Browse Source

优化登录逻辑,改进用户登录流程,调整二维码扫码逻辑并集成状态管理

master
parent
commit
932affebad
  1. 37
      sub/common/waiting.vue

37
sub/common/waiting.vue

@ -8,12 +8,7 @@
:fade="true"
duration="200"
></u--image>
<button
class="login"
@click="login"
>
授权登录
</button>
<button class="login" @click="login">授权登录</button>
</view>
</template>
@ -24,7 +19,7 @@
export default {
data() {
return {
scene: '',
scene: ''
}
},
methods: {
@ -33,30 +28,36 @@
uni
.showModal({
content: '链接失效,请重新扫码',
showCancel: false,
showCancel: false
})
.then(() => {
uni.exitMiniProgram({
success: res => {
console.log(res)
},
}
})
})
} else {
uni.showLoading({
title: '登陆中。。。',
title: '登陆中。。。'
})
uni.login({
success: res => {
console.log('微信code', res.code)
success: async res => {
const data = {
type: 34,
code: res.code,
state: 'default',
userType: 3
}
await this.$store.dispatch('Login', data)
qrLogin({
code: this.scene,
openid: res.code,
openid: getAccessToken()
}).then(res => {
setTimeout(() => {
uni.hideLoading()
uni.switchTab({
url: '/pages/index',
url: '/pages/index'
})
}, 3000)
})
@ -65,17 +66,17 @@
uni.showToast({
title: err,
duration: 2000,
icon: 'none',
icon: 'none'
})
},
}
})
}
},
}
},
onLoad(query) {
// scene 使 decodeURIComponent scene
this.scene = decodeURIComponent(query.scene)
},
}
}
</script>

Loading…
Cancel
Save