Explorar el Código

fix(登录): 添加已登录检查避免重复登录

当用户已登录时直接返回上一页,不再执行登录操作
同时启用路由拦截器的调试日志
feige996 hace 8 meses
padre
commit
23ddd5e2e1
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      src/pages/login/login.vue

+ 4 - 0
src/pages/login/login.vue

@@ -27,6 +27,10 @@ onLoad((options) => {
 const userStore = useUserStore()
 const tokenStore = useTokenStore()
 function doLogin() {
+  if (tokenStore.hasLogin) {
+    uni.navigateBack()
+    return
+  }
   userStore.setUserInfo({
     userId: 123456,
     username: 'abc123456',