Compare commits
91 Commits
sunjiahong
...
master
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 549 KiB |
After Width: | Height: | Size: 243 KiB |
After Width: | Height: | Size: 130 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 237 KiB |
After Width: | Height: | Size: 401 KiB |
After Width: | Height: | Size: 745 KiB |
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 361 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 482 KiB |
After Width: | Height: | Size: 202 KiB |
After Width: | Height: | Size: 409 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 246 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 576 KiB |
After Width: | Height: | Size: 202 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 20 KiB |
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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: {},
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/login/login",
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/fourm/fourm",
|
||||||
|
"pages/submit/submit",
|
||||||
|
"pages/cart/cart",
|
||||||
|
"pages/usercenter/usercenter",
|
||||||
|
"pages/detail/detail",
|
||||||
|
"pages/searchShow/searchShow",
|
||||||
|
"pages/change/change",
|
||||||
|
"pages/answer/answer",
|
||||||
|
"pages/paying/paying",
|
||||||
|
"pages/orderlist/orderlist",
|
||||||
|
"pages/address/address",
|
||||||
|
"pages/turning/turning",
|
||||||
|
"pages/addAddress/addAddress",
|
||||||
|
"pages/myorder/myorder",
|
||||||
|
"pages/orderdetail/orderdetail",
|
||||||
|
"pages/searchfood/searchfood",
|
||||||
|
"pages/select1/select1",
|
||||||
|
"pages/select2/select2"
|
||||||
|
|
||||||
|
],
|
||||||
|
"tabBar": {
|
||||||
|
"custom": false,
|
||||||
|
|
||||||
|
"backgroundColor": "#ffffff",
|
||||||
|
"borderStyle": "black",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/index/index",
|
||||||
|
"text": "首页",
|
||||||
|
"iconPath": "/images/home.png",
|
||||||
|
"selectedIconPath": "/images/home-active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/fourm/fourm",
|
||||||
|
"text": "论坛",
|
||||||
|
"iconPath": "/images/message.png",
|
||||||
|
"selectedIconPath": "/images/message-active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/cart/cart",
|
||||||
|
"text": "购物车",
|
||||||
|
"iconPath": "/images/message.png",
|
||||||
|
"selectedIconPath": "/images/message-active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/usercenter/usercenter",
|
||||||
|
"text": "我的",
|
||||||
|
"iconPath": "/images/message.png",
|
||||||
|
"selectedIconPath": "/images/message-active.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
},
|
||||||
|
"window": {
|
||||||
|
"backgroundColor": "#F6F6F6",
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
|
"navigationBarBackgroundColor": "#F6F6F6",
|
||||||
|
"navigationBarTitleText": "节时不节食",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"enablePullDownRefresh": true
|
||||||
|
},
|
||||||
|
"networkTimeout": {
|
||||||
|
"request": 10000,
|
||||||
|
"downloadFile": 10000
|
||||||
|
},
|
||||||
|
"debug": true,
|
||||||
|
"sitemapLocation": "sitemap.json",
|
||||||
|
"style": "v2"
|
||||||
|
}
|
@ -0,0 +1,160 @@
|
|||||||
|
/**app.wxss**/
|
||||||
|
.container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 200rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus{
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
button::after{
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
page {
|
||||||
|
background: #f6f6f6;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**app.wxss**/
|
||||||
|
/* .container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
/*padding: 200rpx 0;*/
|
||||||
|
/* box-sizing: border-box;
|
||||||
|
background: #F0F4F3;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.container.withtab{
|
||||||
|
margin: 105rpx 0 0 0;
|
||||||
|
/*top: 105rpx;*/
|
||||||
|
}
|
||||||
|
.flex-wrp{
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.flex-tab{
|
||||||
|
flex-flow: row nowrap;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
.flex-item{
|
||||||
|
flex-grow: 1;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.top-tab{
|
||||||
|
width: 750rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
background: #298DE5;
|
||||||
|
color: #8CCEFD;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
box-shadow: 0 2px 2px #bebebe;
|
||||||
|
margin: 0 0 8rpx 0;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
.toptab.active{
|
||||||
|
color: #ffffff;
|
||||||
|
border-bottom: solid 2px #ffffff;
|
||||||
|
}
|
||||||
|
.container{
|
||||||
|
padding: 0;
|
||||||
|
font-size: 14rpx;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.container .feed-item{
|
||||||
|
width: 690rpx;
|
||||||
|
padding: 30rpx 30rpx 20rpx;
|
||||||
|
margin: 7rpx 0 6rpx 0;
|
||||||
|
background: #ffffff;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
box-shadow: 0 2px 5px #eeeeee;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-source{
|
||||||
|
width: 690rpx;
|
||||||
|
left: 0;
|
||||||
|
height: 50rpx;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-source .avatar{
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-source a{
|
||||||
|
display: inline-block;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-source .avatar image{
|
||||||
|
/*position: absolute;*/
|
||||||
|
display: inline-block;
|
||||||
|
width: 45rpx;
|
||||||
|
height: 45rpx;
|
||||||
|
border-radius: 45rpx;
|
||||||
|
top: 10rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-source text{
|
||||||
|
/*position: absolute;*/
|
||||||
|
display: inline-block;
|
||||||
|
height: 40rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 0 0 0 15rpx;
|
||||||
|
color: #a0acac;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-source .item-more{
|
||||||
|
display: inline-block;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 45rpx;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-content{
|
||||||
|
padding: 10rpx 0 0 0;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-content .question text{
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 600px;
|
||||||
|
line-height: 40rpx;
|
||||||
|
word-spacing: 5rpx;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-content .answer-body{
|
||||||
|
padding: 10rpx 0 0 0;
|
||||||
|
/*height: 10rpx;*/
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 28rpx;
|
||||||
|
color: #5b5b5b;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-content .answer-actions{
|
||||||
|
width: 690rpx;
|
||||||
|
padding: 10rpx 0 0;
|
||||||
|
color: #a0acac;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-content .answer-actions view{
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
padding: 0 10rpx 0 0;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
.container .feed-item .feed-content .answer-actions .dot ::after{
|
||||||
|
content: "•";
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"openapi": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
// 云函数入口文件
|
||||||
|
const cloud = require('wx-server-sdk')
|
||||||
|
|
||||||
|
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
|
||||||
|
|
||||||
|
// 云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
const wxContext = cloud.getWXContext()
|
||||||
|
|
||||||
|
return {
|
||||||
|
event,
|
||||||
|
openid: wxContext.OPENID,
|
||||||
|
appid: wxContext.APPID,
|
||||||
|
unionid: wxContext.UNIONID,
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"openapi": [
|
||||||
|
"wxacode.get"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
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;
|
||||||
|
};
|
@ -0,0 +1,17 @@
|
|||||||
|
const cloud = require('wx-server-sdk');
|
||||||
|
|
||||||
|
cloud.init({
|
||||||
|
env: "cloud1-8g5wmepxce8a3b8a"
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取openId云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
// 获取基础信息
|
||||||
|
const wxContext = cloud.getWXContext();
|
||||||
|
|
||||||
|
return {
|
||||||
|
openid: wxContext.OPENID,
|
||||||
|
appid: wxContext.APPID,
|
||||||
|
unionid: wxContext.UNIONID,
|
||||||
|
};
|
||||||
|
};
|
@ -0,0 +1,25 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
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();
|
||||||
|
};
|
@ -0,0 +1,18 @@
|
|||||||
|
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();
|
||||||
|
};
|
@ -0,0 +1,32 @@
|
|||||||
|
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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,6 @@
|
|||||||
|
const envList = [{"envId":"cloud1-8g5wmepxce8a3b8a","alias":"cloud1"}]
|
||||||
|
const isMac = false
|
||||||
|
module.exports = {
|
||||||
|
envList,
|
||||||
|
isMac
|
||||||
|
}
|
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 526 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 715 B |