From b68839128f536a355442c0fdda72c3e66e722794 Mon Sep 17 00:00:00 2001 From: damonyuan <404054358@qq.com> Date: Mon, 18 Nov 2024 14:29:54 +0800 Subject: [PATCH] =?UTF-8?q?debug=20=E5=88=A0=E9=99=A4=20fix=20login?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B2=A1=E6=AD=A3=E7=A1=AE=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniapp/src/pages/login/login.vue | 13 +++++++++---- uniapp/src/pages/user/user.vue | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/uniapp/src/pages/login/login.vue b/uniapp/src/pages/login/login.vue index 8e3eea39..14865787 100644 --- a/uniapp/src/pages/login/login.vue +++ b/uniapp/src/pages/login/login.vue @@ -245,6 +245,7 @@ import wechatOa, { UrlScene } from '@/utils/wechat' // #endif import { onLoad, onShow } from '@dcloudio/uni-app' import { computed, reactive, ref, shallowRef, watch } from 'vue' +import { storeToRefs } from 'pinia' enum LoginWayEnum { ACCOUNT = 1, @@ -258,7 +259,8 @@ isWeixin.value = isWeixinClient() const route = useRoute() const router = useRouter() -const userStore = useUserStore() +const userStore = useUserStore() +const { userInfo, isLogin } = storeToRefs(userStore) const appStore = useAppStore() const showModel = ref(false) const uCodeRef = shallowRef() @@ -329,7 +331,8 @@ const loginFun = async () => { uni.hideLoading() uni.$u.toast(error) } -} +} + const loginHandle = async (data: any) => { const { token, mobile } = data @@ -467,7 +470,6 @@ onLoad(async () => { const data = await oaLogin(options) if (data) { loginData.value = data - loginHandle(loginData.value) } } @@ -479,7 +481,10 @@ onLoad(async () => { wechatOa.setAuthData() } //#endif -}) +}) +if (isLogin.value == true) { + window.location.href = '/mobile/pages/user/user' +}