Compare commits
No commits in common. 'master' and 'shanliru_branch' have entirely different histories.
master
...
shanliru_b
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Eslint config file
|
|
||||||
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
|
||||||
* Install the Eslint extension before using this feature.
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
es6: true,
|
|
||||||
browser: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
ecmaFeatures: {
|
|
||||||
modules: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2018,
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
wx: true,
|
|
||||||
App: true,
|
|
||||||
Page: true,
|
|
||||||
getCurrentPages: true,
|
|
||||||
getApp: true,
|
|
||||||
Component: true,
|
|
||||||
requirePlugin: true,
|
|
||||||
requireMiniProgram: true,
|
|
||||||
},
|
|
||||||
// extends: 'eslint:recommended',
|
|
||||||
rules: {},
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"cloud": true,
|
|
||||||
"pages": [
|
|
||||||
"pages/index/index",
|
|
||||||
"pages/navigation/index/index",
|
|
||||||
"pages/navigation/index/show_clothes/show_clothes",
|
|
||||||
"pages/navigation/index/add/add",
|
|
||||||
"pages/navigation/index/delete/delete",
|
|
||||||
"pages/navigation/self/self",
|
|
||||||
"pages/navigation/userinform/userinform",
|
|
||||||
"pages/navigation/safety/safety",
|
|
||||||
"pages/navigation/shezhi/shezhi",
|
|
||||||
"pages/navigation/index/recommand/recommand",
|
|
||||||
"pages/navigation/index/add/camera/camera"
|
|
||||||
],
|
|
||||||
"window": {
|
|
||||||
"backgroundTextStyle": "light",
|
|
||||||
"navigationBarBackgroundColor": "#fff",
|
|
||||||
"navigationBarTitleText": "Weixin",
|
|
||||||
"navigationBarTextStyle": "black"
|
|
||||||
},
|
|
||||||
"usingComponents": {
|
|
||||||
"van-button": "pages/miniprogram_npm/@vant/weapp/button/index",
|
|
||||||
"van-tabbar": "pages/miniprogram_npm/@vant/weapp/tabbar/index",
|
|
||||||
"van-tabbar-item": "pages/miniprogram_npm/@vant/weapp/tabbar-item/index",
|
|
||||||
"van-image": "pages/miniprogram_npm/@vant/weapp/image/index",
|
|
||||||
"van-icon": "pages/miniprogram_npm/@vant/weapp/icon/index",
|
|
||||||
"van-divider": "pages/miniprogram_npm/@vant/weapp/divider/index",
|
|
||||||
"van-rate": "pages/miniprogram_npm/@vant/weapp/rate/index",
|
|
||||||
"van-field": "pages/miniprogram_npm/@vant/weapp/field/index",
|
|
||||||
"van-toast": "pages/miniprogram_npm/@vant/weapp/toast/index"
|
|
||||||
},
|
|
||||||
"sitemapLocation": "sitemap.json",
|
|
||||||
"tabBar": {
|
|
||||||
"selectedColor": "#5001",
|
|
||||||
"backgroundColor": "white",
|
|
||||||
"borderStyle": "white",
|
|
||||||
"list": [
|
|
||||||
{
|
|
||||||
"text": "首页",
|
|
||||||
"pagePath": "pages/navigation/index/index",
|
|
||||||
"iconPath": "pages/img/首页.png",
|
|
||||||
"selectedIconPath": "pages/img/首页.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "我的",
|
|
||||||
"pagePath": "pages/navigation/self/self",
|
|
||||||
"iconPath": "pages/img/我的.png",
|
|
||||||
"selectedIconPath": "pages/img/我的.png"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
/**app.wxss**/
|
|
||||||
.container {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 200rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"permissions": {
|
|
||||||
"openapi": [
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
// 云函数入口文件
|
|
||||||
const cloud = require('wx-server-sdk')
|
|
||||||
|
|
||||||
cloud.init() // 使用当前云环境
|
|
||||||
const db=cloud.database()
|
|
||||||
const MAX_LIMIT=100
|
|
||||||
// 云函数入口函数
|
|
||||||
exports.main = async (event, context) => {
|
|
||||||
const wxContext = cloud.getWXContext()
|
|
||||||
//先取出集合记录总数
|
|
||||||
const countResult=await db.collection('cloth').count()
|
|
||||||
const total=countResult.total
|
|
||||||
//计算分几次取
|
|
||||||
const batchTimes = Math.ceil(total / 100)
|
|
||||||
// 承载所有读操作的 promise 的数组
|
|
||||||
const tasks = []
|
|
||||||
for (let i = 0; i < batchTimes; i++) {
|
|
||||||
const promise = db.collection('cloth').skip(i * MAX_LIMIT).limit(MAX_LIMIT).get()
|
|
||||||
tasks.push(promise)
|
|
||||||
}
|
|
||||||
// 等待所有
|
|
||||||
return (await Promise.all(tasks)).reduce((acc, cur) => {
|
|
||||||
return {
|
|
||||||
event,
|
|
||||||
openid: wxContext.OPENID,
|
|
||||||
appid: wxContext.APPID,
|
|
||||||
unionid: wxContext.UNIONID,
|
|
||||||
data: acc.data.concat(cur.data),
|
|
||||||
errMsg: acc.errMsg,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "get",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"wx-server-sdk": "~2.6.3"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"permissions": {
|
|
||||||
"openapi": [
|
|
||||||
"wxacode.get"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
const cloud = require('wx-server-sdk');
|
|
||||||
|
|
||||||
cloud.init({
|
|
||||||
env: cloud.DYNAMIC_CURRENT_ENV
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取小程序二维码云函数入口函数
|
|
||||||
exports.main = async (event, context) => {
|
|
||||||
// 获取小程序二维码的buffer
|
|
||||||
const resp = await cloud.openapi.wxacode.get({
|
|
||||||
path: 'pages/index/index'
|
|
||||||
});
|
|
||||||
const { buffer } = resp;
|
|
||||||
// 将图片上传云存储空间
|
|
||||||
const upload = await cloud.uploadFile({
|
|
||||||
cloudPath: 'code.png',
|
|
||||||
fileContent: buffer
|
|
||||||
});
|
|
||||||
return upload.fileID;
|
|
||||||
};
|
|
@ -1,17 +0,0 @@
|
|||||||
const cloud = require('wx-server-sdk');
|
|
||||||
|
|
||||||
cloud.init({
|
|
||||||
env: cloud.DYNAMIC_CURRENT_ENV
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取openId云函数入口函数
|
|
||||||
exports.main = async (event, context) => {
|
|
||||||
// 获取基础信息
|
|
||||||
const wxContext = cloud.getWXContext();
|
|
||||||
|
|
||||||
return {
|
|
||||||
openid: wxContext.OPENID,
|
|
||||||
appid: wxContext.APPID,
|
|
||||||
unionid: wxContext.UNIONID,
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,25 +0,0 @@
|
|||||||
const getOpenId = require('./getOpenId/index');
|
|
||||||
const getMiniProgramCode = require('./getMiniProgramCode/index');
|
|
||||||
const createCollection = require('./createCollection/index');
|
|
||||||
const selectRecord = require('./selectRecord/index');
|
|
||||||
const updateRecord = require('./updateRecord/index');
|
|
||||||
const sumRecord = require('./sumRecord/index');
|
|
||||||
|
|
||||||
|
|
||||||
// 云函数入口函数
|
|
||||||
exports.main = async (event, context) => {
|
|
||||||
switch (event.type) {
|
|
||||||
case 'getOpenId':
|
|
||||||
return await getOpenId.main(event, context);
|
|
||||||
case 'getMiniProgramCode':
|
|
||||||
return await getMiniProgramCode.main(event, context);
|
|
||||||
case 'createCollection':
|
|
||||||
return await createCollection.main(event, context);
|
|
||||||
case 'selectRecord':
|
|
||||||
return await selectRecord.main(event, context);
|
|
||||||
case 'updateRecord':
|
|
||||||
return await updateRecord.main(event, context);
|
|
||||||
case 'sumRecord':
|
|
||||||
return await sumRecord.main(event, context);
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "quickstartFunctions",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"wx-server-sdk": "~2.4.0"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
const cloud = require('wx-server-sdk');
|
|
||||||
|
|
||||||
cloud.init({
|
|
||||||
env: cloud.DYNAMIC_CURRENT_ENV
|
|
||||||
});
|
|
||||||
const db = cloud.database();
|
|
||||||
|
|
||||||
// 查询数据库集合云函数入口函数
|
|
||||||
exports.main = async (event, context) => {
|
|
||||||
// 返回数据库查询结果
|
|
||||||
return await db.collection('sales').get();
|
|
||||||
};
|
|
@ -1,18 +0,0 @@
|
|||||||
const cloud = require('wx-server-sdk');
|
|
||||||
|
|
||||||
cloud.init({
|
|
||||||
env: cloud.DYNAMIC_CURRENT_ENV
|
|
||||||
});
|
|
||||||
const db = cloud.database();
|
|
||||||
const $ = db.command.aggregate;
|
|
||||||
|
|
||||||
// 聚合记录云函数入口函数
|
|
||||||
exports.main = async (event, context) => {
|
|
||||||
// 返回数据库聚合结果
|
|
||||||
return db.collection('sales').aggregate()
|
|
||||||
.group({
|
|
||||||
_id: '$region',
|
|
||||||
sum: $.sum('$sales')
|
|
||||||
})
|
|
||||||
.end();
|
|
||||||
};
|
|
@ -1,32 +0,0 @@
|
|||||||
const cloud = require('wx-server-sdk');
|
|
||||||
|
|
||||||
cloud.init({
|
|
||||||
env: cloud.DYNAMIC_CURRENT_ENV
|
|
||||||
});
|
|
||||||
const db = cloud.database();
|
|
||||||
|
|
||||||
// 修改数据库信息云函数入口函数
|
|
||||||
exports.main = async (event, context) => {
|
|
||||||
try {
|
|
||||||
// 遍历修改数据库信息
|
|
||||||
for (let i = 0; i < event.data.length; i++) {
|
|
||||||
await db.collection('sales').where({
|
|
||||||
_id: event.data[i]._id
|
|
||||||
})
|
|
||||||
.update({
|
|
||||||
data: {
|
|
||||||
sales: event.data[i].sales
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
success: true,
|
|
||||||
data: event.data
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
errMsg: e
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 172 KiB |
Before Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 252 KiB |
Before Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 170 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 158 KiB |
Before Width: | Height: | Size: 171 KiB |
Before Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 193 KiB |
Before Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 180 KiB |
Before Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 834 KiB |
Before Width: | Height: | Size: 940 KiB |
Before Width: | Height: | Size: 2.4 MiB |
Before Width: | Height: | Size: 693 KiB |
Before Width: | Height: | Size: 389 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 357 KiB |
Before Width: | Height: | Size: 382 KiB |
Before Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 596 KiB |
Before Width: | Height: | Size: 273 KiB |
Before Width: | Height: | Size: 68 KiB |