From a7ea20968f76e1a6a0e0db574a1b5ff8bfd18935 Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Wed, 10 Sep 2025 15:18:19 +0800
Subject: [PATCH] 暂存
---
src/App.vue | 14 +++---
src/router/index.js | 52 +++++++++++++-------------
2 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 77c8cf9..4fcc67d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -29,13 +29,13 @@
setStorage('usercode', usercode);
}
const userStore = useUserStore();
-onMounted(() => {
- if (window.ethereum !== undefined || window.web3 !== undefined || window.injectedWeb3 !== undefined) {
- loginButton(); // 如果支持 Web3,调用登录函数
- } else {
- window.location.href = 'https://trustwallet.com/download'; // 否则重定向
- }
-});
+// onMounted(() => {
+// if (window.ethereum !== undefined || window.web3 !== undefined || window.injectedWeb3 !== undefined) {
+// loginButton(); // 如果支持 Web3,调用登录函数
+// } else {
+// window.location.href = 'https://trustwallet.com/download'; // 否则重定向
+// }
+// });
// 登录按钮逻辑,标记为异步函数
const loginButton = async () => {
diff --git a/src/router/index.js b/src/router/index.js
index 0dd884a..d039f7c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1500,36 +1500,36 @@
},
})
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()
- }
+ // 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) {
// 判断该路由是否需要登录权限
-
+ next()
})
// 登录按钮逻辑,标记为异步函数
--
Gitblit v1.9.3