diff --git a/App.vue b/App.vue index a446578..eb8fa79 100644 --- a/App.vue +++ b/App.vue @@ -2,6 +2,10 @@ export default { onLaunch: function() { console.log('App Launch'); + const userInfo = uni.getStorageSync('userInfo'); + if(userInfo){ + this.globalData.userInfo = userInfo + } }, onShow: function() { console.log('App Show'); @@ -11,15 +15,56 @@ export default { }, globalData: { api: { - home: 'https://88d58ce0-c72d-4ad5-9ad5-5196f032ef71.bspapp.com/http/api/home', - openid: 'https://88d58ce0-c72d-4ad5-9ad5-5196f032ef71.bspapp.com/http/api/openid', + home: 'https://728da630-a10b-4780-b26e-30aa5aec7ee7.bspapp.com/http/api/home', + openid: 'https://728da630-a10b-4780-b26e-30aa5aec7ee7.bspapp.com/http/api/openid', }, - subscribe: 'https://88d58ce0-c72d-4ad5-9ad5-5196f032ef71.bspapp.com/http/subscribe', + subscribe: 'https://728da630-a10b-4780-b26e-30aa5aec7ee7.bspapp.com/http/subscribe', openid: '', + userInfo: '', }, - - - + methods: { + shareConfig(){ + var messages = [{ + title: '美团饿了么大额红包,每日可领!', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png', + },{ + title: '吃了这么多年外卖,你知道这个秘密吗?', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + },{ + title: '这样点外卖,一年省下一个亿', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + },{ + title: '点外卖前先领券,吃霸王餐', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + },{ + title: '美团饿了么内部优惠券,手慢无', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + },{ + title: '点外卖不用优惠券,你就out了', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + },{ + title: '外卖不为人知的秘密,点这解密', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + },{ + title: '震惊!小伙点外卖竟然花了1分钱', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + },{ + title: '从这点外卖,你也可以吃霸王餐', + path: '/pages/index/index', + imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png' + }]; + return messages[Math.floor(Math.random()*messages.length)]; + } + } }; diff --git a/cloudfunctions-aliyun/db_init.json b/cloudfunctions-aliyun/db_init.json index db71261..8437918 100644 --- a/cloudfunctions-aliyun/db_init.json +++ b/cloudfunctions-aliyun/db_init.json @@ -88,15 +88,37 @@ } ] }, - "tab": { - "schema": { - "bsonType": "object", - "permission": { - ".create": false, - ".delete": false, - ".read": true, - ".update": false - } - } - } + "tab": { // 集合(表名) + "data": [ // 数据 + { + "icon": "/static/all.png", + "text": "全部", + "tabId": 0 + }, + { + "icon": "/static/ele.png", + "text": "饿了么", + "tabId": 1 + }, + { + "icon": "/static/meituan.png", + "text": "美团", + "tabId": 2 + }, + { + "icon": "/static/jd.png", + "text": "京东", + "tabId": 3 + } + ], + "schema": { + "bsonType": "object", + "permission": { + ".read": true, + ".create": false, + ".update": false, + ".delete": false + } + } + } } \ No newline at end of file diff --git a/pages.json b/pages.json index d3e374a..8eddcef 100644 --- a/pages.json +++ b/pages.json @@ -1,7 +1,32 @@ { "pages": [{ "path": "pages/index/index" + }, { + "path": "pages/user/user", + "style": { + "navigationBarTitleText": "我的", + "enablePullDownRefresh": false + } + }], + "tabBar": { + "backgroundColor": "#F7F7FA", + "color": "#707070", + "selectedColor": "#ffad00", + "list": [{ + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "/static/tabbar/home.png", + "selectedIconPath": "/static/tabbar/home_fill.png" + }, + { + "pagePath": "pages/user/user", + "text": "我的", + "iconPath": "/static/tabbar/user.png", + "selectedIconPath": "/static/tabbar/user_fill.png" + } + ] + }, "globalStyle": { "navigationBarTextStyle": "white", "navigationBarTitleText": "外卖专享优惠", diff --git a/pages/index/index.vue b/pages/index/index.vue index fd15a97..b902c21 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -50,35 +50,7 @@ export default { this.changeTab(this.current) }, onShareAppMessage(res) { - var messages = [{ - title: '美团饿了么大额红包,每日可领!', - path: '/pages/index/index' - },{ - title: '吃了这么多年外卖,你知道这个秘密吗?', - path: '/pages/index/index' - },{ - title: '这样点外卖,一年省下一个亿', - path: '/pages/index/index' - },{ - title: '点外卖前先领券,吃霸王餐', - path: '/pages/index/index' - },{ - title: '美团饿了么内部优惠券,手慢无', - path: '/pages/index/index' - },{ - title: '点外卖不用优惠券,你就out了', - path: '/pages/index/index' - },{ - title: '外卖不为人知的秘密,点这解密', - path: '/pages/index/index' - },{ - title: '震惊!小伙点外卖竟然花了1分钱', - path: '/pages/index/index' - },{ - title: '从这点外卖,你也可以吃霸王餐', - path: '/pages/index/index' - }]; - return messages[Math.floor(Math.random()*messages.length)]; + return getApp().shareConfig() }, methods: { onSubscribe() { @@ -105,13 +77,13 @@ export default { openid: openid, }; console.log(data) - uni.showLoading({ - title: '订阅中...', - }); - setTimeout(function () { - uni.hideLoading(); - }, 5000); - // 调用微信 API 申请发送订阅消息 + // uni.showLoading({ + // title: '订阅中...', + // }); + // setTimeout(function () { + // uni.hideLoading(); + // }, 2000); + // 调用微信 API 申请发送订阅消息 wx.requestSubscribeMessage({ // 传入订阅消息的模板id,模板 id 可在小程序管理后台申请 tmplIds: [lessonTmplId], diff --git a/pages/user/user.vue b/pages/user/user.vue new file mode 100644 index 0000000..e277947 --- /dev/null +++ b/pages/user/user.vue @@ -0,0 +1,188 @@ + + + + + diff --git a/static/right_h.png b/static/right_h.png new file mode 100644 index 0000000..7822caa Binary files /dev/null and b/static/right_h.png differ diff --git a/static/tabbar/fuli.png b/static/tabbar/fuli.png new file mode 100644 index 0000000..d6d4fc6 Binary files /dev/null and b/static/tabbar/fuli.png differ diff --git a/static/tabbar/fuli_fill.png b/static/tabbar/fuli_fill.png new file mode 100644 index 0000000..008044b Binary files /dev/null and b/static/tabbar/fuli_fill.png differ diff --git a/static/tabbar/home.png b/static/tabbar/home.png new file mode 100644 index 0000000..9c57e29 Binary files /dev/null and b/static/tabbar/home.png differ diff --git a/static/tabbar/home_fill.png b/static/tabbar/home_fill.png new file mode 100644 index 0000000..a5ffd4d Binary files /dev/null and b/static/tabbar/home_fill.png differ diff --git a/static/tabbar/user.png b/static/tabbar/user.png new file mode 100644 index 0000000..d2af75f Binary files /dev/null and b/static/tabbar/user.png differ diff --git a/static/tabbar/user_fill.png b/static/tabbar/user_fill.png new file mode 100644 index 0000000..074ba68 Binary files /dev/null and b/static/tabbar/user_fill.png differ diff --git a/static/user_hezuo.png b/static/user_hezuo.png new file mode 100644 index 0000000..6ff5375 Binary files /dev/null and b/static/user_hezuo.png differ diff --git a/static/user_kefu.png b/static/user_kefu.png new file mode 100644 index 0000000..ca4937e Binary files /dev/null and b/static/user_kefu.png differ diff --git a/static/user_share.png b/static/user_share.png new file mode 100644 index 0000000..a898848 Binary files /dev/null and b/static/user_share.png differ