fix: 授权登录逻辑调整

master
xjs 2026-01-21 10:20:41 +08:00
parent 0c2339522f
commit 22f4c1f298
2 changed files with 19 additions and 3 deletions

View File

@ -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>

View File

@ -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>