diff --git a/pages/login/login.vue b/pages/login/login.vue index 6f296b1..41043c1 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -12,24 +12,14 @@ } }, onLoad(option) { - console.log(option,this.$store.state.user,this.$store.state.user.toPath) if(!option.code) { this.gotoPath('/pages/index/index') }else { this.Post({code: option.code},'/api/wechat/oauth_callback').then(res => { - console.log(this.$store.state.user.toPath) return; if(res.code == 1) { this.$store.commit('changeUserInfo', res.data) - if (this.$store.state.user.toPath.includes('user/user') || this.$store.state.user.toPath.includes('daoyou/index')) { - console.log(111,this.$store.state.user.toPath) - uni.switchTab({ - url: this.$store.state.user.toPath - }) - } else { - console.log(222) - uni.navigateBack({}) - } + window.location.href = option.state } }) } diff --git a/pages/user/user.vue b/pages/user/user.vue index f65018b..f3e5bc6 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -94,7 +94,7 @@ this.userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {} if(!this.userInfo.teken) { - // this.$store.commit('changeLoginPath') + this.$store.commit('changeLoginPath') } // this.Post({}, '/api/Merchants/get_login_details').then(res => { // this.userInfo = res.data diff --git a/store/modules/user.js b/store/modules/user.js index ca5bb57..e9007d6 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -44,7 +44,8 @@ export default { // 登录 const appid = 'wxaf37fcd750cb3329' const redirect_uri = encodeURIComponent('https://tourist.sz-trip.com/pages/login/login') - const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect`; + const state_url = 'https://tourist.sz-trip.com' + state.toPath + const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state_url}&connect_redirect=1#wechat_redirect`; window.location.href = url // uni.navigateTo({ // url: '/pages/login/login' diff --git a/unpackage/dist/build/web/index.html b/unpackage/dist/build/web/index.html index 3eab2ec..88aaaa5 100644 --- a/unpackage/dist/build/web/index.html +++ b/unpackage/dist/build/web/index.html @@ -1,2 +1,2 @@