From 7907f9a7d414404effff61df799945c23573b25a Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Thu, 23 Oct 2025 15:19:12 +0800
Subject: [PATCH] 1

---
 src/router/index.js |   69 ++++++++++++++++++----------------
 1 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index 043e2de..ece65cc 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -679,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',
@@ -1500,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()
@@ -1546,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