fix: 授权登录逻辑调整
parent
0c2339522f
commit
22f4c1f298
|
|
@ -81,6 +81,8 @@ const show = ref(false)
|
||||||
const checked = ref([]) // 是否同意条款
|
const checked = ref([]) // 是否同意条款
|
||||||
const getPhoneInfo = ref(null)
|
const getPhoneInfo = ref(null)
|
||||||
|
|
||||||
|
const scene = ref('')
|
||||||
|
|
||||||
const getPhoneNumber = async (e: any) => {
|
const getPhoneNumber = async (e: any) => {
|
||||||
if (e.detail.errMsg == 'getPhoneNumber:ok') {
|
if (e.detail.errMsg == 'getPhoneNumber:ok') {
|
||||||
const detail = e.detail
|
const detail = e.detail
|
||||||
|
|
@ -189,6 +191,8 @@ const getUserInfo = async (_code: string) => {
|
||||||
// 个人信息初始化
|
// 个人信息初始化
|
||||||
if (infoData.userExtend && !infoData.userExtend.init) {
|
if (infoData.userExtend && !infoData.userExtend.init) {
|
||||||
uni.navigateTo({ url: '/login-sub/inviteCode' })
|
uni.navigateTo({ url: '/login-sub/inviteCode' })
|
||||||
|
} else if (scene.value !== '') {
|
||||||
|
uni.navigateTo({ url: `/pages/index/index?scene=${scene.value}` })
|
||||||
} else {
|
} else {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/home/index/index',
|
url: '/pages/home/index/index',
|
||||||
|
|
@ -205,6 +209,11 @@ const getUserInfo = async (_code: string) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
// 如果是授权登录页面回来,则要回去授权页面
|
||||||
|
scene.value = options.scene || ''
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,14 @@ import { useUserStore } from '@/store/user'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
let scene = ''
|
let scene = ref('')
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
uni.switchTab({ url: '/pages/home/index/index' })
|
uni.switchTab({ url: '/pages/home/index/index' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleAuthPage = () => {
|
const handleAuthPage = () => {
|
||||||
authQrCode({
|
authQrCode({
|
||||||
userCode: scene,
|
userCode: scene.value,
|
||||||
messageType: 2,
|
messageType: 2,
|
||||||
weChat: { openId: userStore.userInfo.openid, sessionKey: '', unionId: '' },
|
weChat: { openId: userStore.userInfo.openid, sessionKey: '', unionId: '' },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
|
|
@ -63,6 +63,13 @@ const handleAuthPage = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
scene = options.scene || ''
|
scene.value = options.scene || ''
|
||||||
|
console.log('用户是否登录了', userStore.isLoginFlag)
|
||||||
|
|
||||||
|
if (!userStore.isLoginFlag) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/login-sub/index?scene=${scene.value}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue