diff --git a/App.vue b/App.vue index 7811e02..3dfe00d 100644 --- a/App.vue +++ b/App.vue @@ -19,6 +19,12 @@ // 获取用户信息 getUserInfo(){ this.globalData.wxlogin = this.wxlogin; + // 检查用户是否点击的退出登录按钮 + // let quit_login_state = uni.getStorageSync('quit_login_state'); + // if(quit_login_state){ + // return; + // } + // 去缓存判断有无用户信息 let userinfo = uni.getStorageSync('userinfo'); if(userinfo && userinfo.id){ return; diff --git a/common/api.js b/common/api.js index f35cd83..0256022 100644 --- a/common/api.js +++ b/common/api.js @@ -46,6 +46,8 @@ export const API_ARTICLE_QA = '/api/article/qa'; // 常见问题列表 export const API_WXLOGIN = '/api/wxlogin'; // 用户登录 export const API_WECHAT_SETPHONE = '/api/wechat/setPhone'; // 用户授权手机号提交 export const API_WECHAT_SETPROFILE = '/api/wechat/setProfile'; // 用户授权微信信息提交(返回用户信息) +export const API_WXLOGIN_VIEW = '/api/wxlogin/view'; // 获取登录页协议 +export const API_ARTICLE_DETAIL = '/api/article/detail'; // 协议文章详情 /* 商户相关 */ export const API_CONFIRM_CODE = '/api/confirm/code'; // 扫码核销 \ No newline at end of file diff --git a/pages/agreement/agreement.vue b/pages/agreement/agreement.vue index c3ebb6d..3d54344 100644 --- a/pages/agreement/agreement.vue +++ b/pages/agreement/agreement.vue @@ -1,7 +1,7 @@ @@ -9,11 +9,20 @@ export default { data() { return { - + article_id: 0, + detail: {} } }, + onLoad(options){ + this.article_id = options.id; + this.getData(); + }, methods: { - + getData(){ + this.$http(this.API.API_ARTICLE_DETAIL, {article_id: this.article_id}).then(res => { + this.detail = res.data; + }) + } } } diff --git a/pages/center/index.vue b/pages/center/index.vue index f81e527..6821507 100644 --- a/pages/center/index.vue +++ b/pages/center/index.vue @@ -4,8 +4,8 @@ - - {{ info.nickname }} + + {{ info.nickname }} {{ item }} @@ -21,7 +21,7 @@ 我的收藏 - + @@ -30,7 +30,7 @@ 联系客服 - + @@ -39,7 +39,7 @@ 意见反馈 - + @@ -49,19 +49,18 @@ 常见问题 - + - - + @@ -75,7 +74,7 @@ 商家订单 - + @@ -84,7 +83,7 @@ 卡券核销 - + @@ -123,11 +122,17 @@ } }, onLoad() { - this.verifyUserInfo(); this.getData(); }, + onShow(){ + this.verifyUserInfo(); + }, methods: { verifyUserInfo(){ + // let quit_login_state = uni.getStorageSync('quit_login_state'); + // if(quit_login_state){ + // return; + // } let userInfo = uni.getStorageSync('userinfo') || {}; if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){ this.$url('/pages/login/index?type=userinfo'); @@ -158,6 +163,21 @@ } } }) + }, + // 退出登录 + quitLogin(){ + uni.showModal({ + title: '温馨提示', + content: '您确定退出当前登录状态吗?', + success: result => { + console.log(result); + if(result.confirm){ + uni.setStorageSync('quit_login_state', true); + uni.removeStorageSync('userinfo'); + this.$msg('退出成功', {icon: 'success'}); + } + } + }) } } } @@ -212,8 +232,8 @@ box-sizing: border-box; position: relative; .icon-img{ - width: 42rpx; - height: 42rpx; + width: 50rpx; + height: 50rpx; } .feedback-btn{ position: absolute; diff --git a/pages/goodsDetail/index.vue b/pages/goodsDetail/index.vue index e32c7df..31ece93 100644 --- a/pages/goodsDetail/index.vue +++ b/pages/goodsDetail/index.vue @@ -58,7 +58,7 @@ - + 首页 @@ -75,9 +75,10 @@ @@ -154,7 +155,7 @@ let goods = this.goods_detail; let title = goods.name; let imageUrl = goods.share_cover || goods.cover; - let path = '/pages/route/index'; + let path = '/pages/route/index?route=goods_detail&id='+ goods.id; return { title, @@ -277,18 +278,20 @@ padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); .icon-item{ - padding: 0 14rpx; margin-right: 16rpx; background-color: transparent; margin: 0; line-height: initial; font-size: 28rpx; font-weight: inherit; + margin-right: 10rpx; + padding: 0; + width: 88rpx; &:first-child{ padding-left: 0; } .icon-img{ - height: 44rpx; + height: 50rpx; width: 50rpx; } } diff --git a/pages/index/index.vue b/pages/index/index.vue index f2c4ae8..0e51b6a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -158,7 +158,7 @@ onShareAppMessage(){ return { title: '分享小程序', - path: '/pages/route/index' + path: '/pages/route/index?route=home' } } } diff --git a/pages/login/index.vue b/pages/login/index.vue index 2649f3d..956d101 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -23,16 +23,16 @@ - + - - 请认真阅读并同意 - 《{{ agreement.title }}》 - ,在小程序下单购买即表示您已默认同意 - 《{{ agreement.title }}》 - 的所有条款。 + + 请认真阅读并同意 + 《{{ agreement.title }}》 + ,在小程序下单购买即表示您已默认同意 + 《{{ agreement.title }}》 + 的所有条款。 @@ -166,4 +166,7 @@ width: 100%; height: 190rpx; } + .display-inline-block{ + display: inline-block; + } diff --git a/pages/order/index.vue b/pages/order/index.vue index 7647b34..5ae5279 100644 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -106,10 +106,20 @@ } }, onLoad(e) { - this.assetsType = e.type + this.assetsType = e.type; this.getUserOrder() }, + onShow(){ + this.verifyUserInfo(); + }, methods: { + // 检查当前用户登录状态 + verifyUserInfo(){ + let userInfo = uni.getStorageSync('userinfo') || {}; + if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){ + this.$url('/pages/login/index?type=userinfo'); + } + }, // 切换tab change(index) { this.current = index; diff --git a/pages/route/index.vue b/pages/route/index.vue index 841c95f..fea224b 100644 --- a/pages/route/index.vue +++ b/pages/route/index.vue @@ -6,7 +6,35 @@ /* 路由分发页面仅供跳转页面 */ export default { onLoad(options){ - this.$url('/pages/index/index', {type: 'switch'}); + this.routeToPage(options); + }, + methods: { + // 路由分发 + routeToPage(options){ + if(options.route == 'goods_detail'){ + options.page_url = '/pages/goodsDetail/index'; + this.joinPagePath(options); + }else if(options.route == 'home'){ + options.page_url = '/pages/index/index'; + this.joinPagePath(options); + } + }, + // 拼接地址,并相应跳转 + joinPagePath(par){ + let path = par.page_url; + let flag = true; // 标志,用于判断拼接次数,?只能出现一次 + for(let i in par){ + if(i != 'route' && i != 'page_url'){ // 跳过route和page_url + if(flag){ + path += '?'+ i +'='+ par[i]; + flag = false; + }else{ + path += '&'+ i +'='+ par[i]; + } + } + } + this.$url(path, {type: 'redirect'}); + } } } diff --git a/static/center/home.png b/static/center/home.png new file mode 100644 index 0000000..96dfb2a Binary files /dev/null and b/static/center/home.png differ diff --git a/static/center/share.png b/static/center/share.png new file mode 100644 index 0000000..84a1bc9 Binary files /dev/null and b/static/center/share.png differ diff --git a/static/tabbar/center-selected.png b/static/tabbar/center-selected.png deleted file mode 100644 index 2dd1645..0000000 Binary files a/static/tabbar/center-selected.png and /dev/null differ diff --git a/static/tabbar/center.png b/static/tabbar/center.png deleted file mode 100644 index a09652e..0000000 Binary files a/static/tabbar/center.png and /dev/null differ diff --git a/static/tabbar/home-active.png b/static/tabbar/home-active.png index 20d374f..6ca1989 100644 Binary files a/static/tabbar/home-active.png and b/static/tabbar/home-active.png differ diff --git a/static/tabbar/home.png b/static/tabbar/home.png index 3f7f029..18735f9 100644 Binary files a/static/tabbar/home.png and b/static/tabbar/home.png differ diff --git a/static/tabbar/index-selected.png b/static/tabbar/index-selected.png deleted file mode 100644 index c472a9b..0000000 Binary files a/static/tabbar/index-selected.png and /dev/null differ diff --git a/static/tabbar/index.png b/static/tabbar/index.png deleted file mode 100644 index be67af7..0000000 Binary files a/static/tabbar/index.png and /dev/null differ diff --git a/static/tabbar/my-active.png b/static/tabbar/my-active.png index 845e73f..3a40fa9 100644 Binary files a/static/tabbar/my-active.png and b/static/tabbar/my-active.png differ diff --git a/static/tabbar/my.png b/static/tabbar/my.png index 17632e3..14e2741 100644 Binary files a/static/tabbar/my.png and b/static/tabbar/my.png differ diff --git a/static/tabbar/order-active.png b/static/tabbar/order-active.png index 93274b3..9f1842f 100644 Binary files a/static/tabbar/order-active.png and b/static/tabbar/order-active.png differ diff --git a/static/tabbar/order.png b/static/tabbar/order.png index f4d3655..f497a76 100644 Binary files a/static/tabbar/order.png and b/static/tabbar/order.png differ