diff --git a/api/wxApi.js b/api/wxApi.js index c94639c..4e0e23f 100644 --- a/api/wxApi.js +++ b/api/wxApi.js @@ -1,9 +1,9 @@ import request from '@/utils/request' // 微信登录授权获取code -export function getCodeUrl(userType) { +export function getCodeUrl(userType, url) { return request({ - 'url': '/wxApi/getCodeUrl?userType=' + userType, + 'url': '/wxApi/getCodeUrl?userType=' + userType + '&url=' + url, 'method': 'get' }) } diff --git a/pages/mine/coupon/my-coupon.vue b/pages/mine/coupon/my-coupon.vue index 2d2c20e..b75e6d6 100644 --- a/pages/mine/coupon/my-coupon.vue +++ b/pages/mine/coupon/my-coupon.vue @@ -24,7 +24,16 @@ ¥{{item.price}} + + 购买 + + + + 购买 + + + @@ -39,7 +48,8 @@ 订单编号:{{item.orderNo}} - {{item.isPay==1?'已支付':'未支付'}} + + {{item.isPay==1?'已支付':'未支付'}} @@ -66,11 +76,29 @@ diff --git a/pages/mine/member/member-card.vue b/pages/mine/member/member-card.vue index e868a3a..45a9721 100644 --- a/pages/mine/member/member-card.vue +++ b/pages/mine/member/member-card.vue @@ -182,37 +182,37 @@ }, onLoad(options) { - //获取url中的search - let search = location.search.slice(1); - let arr = search.split("&"); - let result = {}; - arr.forEach(function(item) { - let itemArr = item.split('='); - result[itemArr[0]] = itemArr[1]; - }) let userTypeTemp = options.userType - this.initData(userTypeTemp); - if (result.code) { - userTypeTemp = result.state - let that = this - getWebAccessTokenAndOpenid(result.code).then(res => { - that.$store.dispatch('GzhLogin', res).then(() => { - that.initData(userTypeTemp); - that.loginSuccess() - }).catch((e) => { - uni.showToast({ - icon: 'error', - duration: 2000, - title: e - }); - }) + //获取url中的search + if (location.search) { + let search = location.search.slice(1); + let arr = search.split("&"); + let result = {}; + arr.forEach(function(item) { + let itemArr = item.split('='); + result[itemArr[0]] = itemArr[1]; }) - } else { - this.toLogin(userTypeTemp) + if (result.code) { + userTypeTemp = result.state + let that = this + getWebAccessTokenAndOpenid(result.code).then(res => { + that.$store.dispatch('GzhLogin', res).then(() => { + that.initData(userTypeTemp); + that.loginSuccess() + }).catch((e) => { + uni.showToast({ + icon: 'error', + duration: 2000, + title: e + }); + }) + }) + } else { + this.toLogin(userTypeTemp) + } } - }, methods: { openVip() { @@ -223,13 +223,6 @@ fail: res => {} }) - }, - - binderror() { - - }, - bindload() { - }, // 登录成功后,处理函数 loginSuccess(result) { @@ -243,17 +236,15 @@ // App端特有的逻辑 console.log('Running on App-Plus'); /*#endif*/ - /*#ifdef H5*/ // 在浏览器端(H5)执行的逻辑 if (!getToken()) { //未登录状态 - getCodeUrl(userType).then(res => { + getCodeUrl(userType, "pages/mine/member/member-card").then(res => { window.location.href = res.codeUrl; }) } /*#endif*/ - /*#ifdef MP-WEIXIN*/ // 微信小程序端执行的逻辑 console.log('Running on WeChat Mini Program'); diff --git a/pages/mine/mine-index.vue b/pages/mine/mine-index.vue index fbfed3d..ce953ee 100644 --- a/pages/mine/mine-index.vue +++ b/pages/mine/mine-index.vue @@ -76,7 +76,7 @@ - 发布通告额度剩余{{userInfo.coupon}}条 + 发布通告额度剩余{{userInfo.coupon||0}}条