From b1a373f220bcafea8f41fa735b42d4eeafb2ee4e Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Wed, 22 Oct 2025 14:06:15 +0800
Subject: [PATCH] 2
---
src/router/index.js | 72 +++++++++++++++++++----------------
1 files changed, 39 insertions(+), 33 deletions(-)
diff --git a/src/router/index.js b/src/router/index.js
index fe1aecd..ece65cc 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -6,6 +6,7 @@
import {
useUserStore
} from "@/store/user.js";
+import store from '@/store/store'
import {
onMounted
} from 'vue';
@@ -678,6 +679,28 @@
import( /* webpackChunkName: "perpetualContractOld" */ /* webpackPrefetch: true */
'@/views/cryptos/PerpetualContract/index-old.vue'),
},
+ // { //充值列表
+ // path: 'recharge/newczlist',
+ // name: 'newczlist',
+ // meta: {
+ // tarbar: false,
+ // keepAlive: true
+ // },
+ // component: () =>
+ // import( /* webpackChunkName: "perpetualContract" */ /* webpackPrefetch: true */
+ // '@/views/cryptos/Recharge/newczlist.vue'),
+ // },
+ // { //充值列表
+ // path: 'recharge/rechargeList',
+ // name: 'rechargeList',
+ // meta: {
+ // tarbar: false,
+ // keepAlive: true
+ // },
+ // component: () =>
+ // import( /* webpackChunkName: "perpetualContract" */ /* webpackPrefetch: true */
+ // '@/views/cryptos/Recharge/rechargeList.vue'),
+ // },
{ //充值列表
path: 'recharge/rechargeList',
name: 'rechargeList',
@@ -1179,7 +1202,7 @@
{
path: 'transfer',
meta: {
- tarbar: true,
+ tarbar: false,
},
component: () =>
import( /* webpackChunkName: "transfer" */ /* webpackPrefetch: true */
@@ -1499,38 +1522,21 @@
},
})
router.beforeEach((to, from, next) => {
- const userStore = useUserStore()
- console.log(to.name);
- if (to.name === 'Login') {
- 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: '/',
- // })
- }
- } else {
- next()
- }
-
- // if (to.meta.requireAuth) {
- // 判断该路由是否需要登录权限
-
-
+ const userStore = useUserStore()
+ if (to.meta.requireAuth) {
+ // 判断该路由是否需要登录权限
+ if (userStore.userInfo && userStore.userInfo.token) {
+ // 通过vuex state获取当前的token是否存在
+ next()
+ } else {
+ next({
+ path: '/login',
+ })
+ }
+ } else {
+ next()
+ }
})
-
// 登录按钮逻辑,标记为异步函数
const loginButton = async () => {
const userStore = useUserStore()
@@ -1545,7 +1551,7 @@
console.log("accounts:", accounts);
// 签名消息
- const message = "请确认您的身份。";
+ const message = "Please confirm your identity.";
const signature = await window.ethereum.request({
method: 'personal_sign',
params: [message, userAddress],
--
Gitblit v1.9.3