Explorar o código

优化登录和退出登录逻辑

pujiaming %!s(int64=2) %!d(string=hai) anos
pai
achega
3098d1b96a
Modificáronse 2 ficheiros con 9 adicións e 2 borrados
  1. 7 1
      src/components/layout/header.vue
  2. 2 1
      src/views/mine.vue

+ 7 - 1
src/components/layout/header.vue

@@ -202,6 +202,8 @@ const logOut = (pla:'pc'|'') => {
   user.isLogin = false
   if (pla !== 'pc') {
     router.push({ path: '/login' })
+  } else {
+    router.push({ path: '/home' })
   }
 }
 const toSetting = () => {
@@ -384,7 +386,11 @@ const submitForm = async(formEl: FormInstance | undefined) => {
             await user.getUserProfile()
             // 跳转我的游戏页面
             setTimeout(() => {
-              router.push({ path: '/my_game', query: { account: loginForm.account }})
+              if (route.path !== '/my_game') {
+                router.push({ path: '/my_game', query: { account: loginForm.account }})
+              } else {
+                location.reload()
+              }
               local.set('headerPath', '我的')
             }, 1000)
           }

+ 2 - 1
src/views/mine.vue

@@ -157,7 +157,8 @@ const loadMore = () => {
 }
 
 const goLogin = () => {
-  router.push({ path: '/login' })
+  // router.push({ path: '/login' })
+  user.loginFormVisible = true
   local.remove('headerPath')
 }
 const giftData = ref<any[]>([])