1
jhzh
2025-10-20 26a0b98faf6f883c7b1ad6e72c6031a9dc2306d7
src/router/index.js
@@ -1525,33 +1525,15 @@
   const userStore = useUserStore()
   console.log(to.name);
   if (to.name === 'Login' || to.name == 'Register') {
      if (userStore.userInfo && userStore.userInfo.token) {
         // 通过vuex state获取当前的token是否存在
         next()
      } else {
         // loginButton().then(() => {
         //    console.log('钱包授权成功');
         //    next(); // 授权成功后允许跳转
         // }).catch(() => {
         //    console.error('钱包授权失败');
         //    next(false); // 授权失败,阻止跳转
         // });
         loginButton()
         // next({
         //   path: '/login',
         // })
         // next({
         //   path: '/',
         // })
      }
      // if (userStore.userInfo && userStore.userInfo.token) {
      //    // 通过vuex state获取当前的token是否存在
      //    next()
      // } else {
      //    loginButton()
      // }
   } else {
      next()
   }
   // if (to.meta.requireAuth) {
   // 判断该路由是否需要登录权限
})
// 登录按钮逻辑,标记为异步函数