From a9b73565264320c05f51a67ebd7faf5abbf16dfc Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Mon, 20 Oct 2025 18:20:18 +0800
Subject: [PATCH] 1
---
src/config/index.js | 4 ++--
src/views/homePage/index.vue | 5 +++--
src/App.vue | 1 -
src/router/index.js | 27 ++++++++++++++-------------
4 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index a3c3a39..f02d456 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -39,7 +39,6 @@
// 登录按钮逻辑,标记为异步函数
const loginButton = async () => {
- // await registerOrLoginUser();
if (typeof window.ethereum !== 'undefined') {
if (!(userStore.userInfo && userStore.userInfo.token)) {
try {
diff --git a/src/config/index.js b/src/config/index.js
index 5afa403..86d4b08 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -35,12 +35,12 @@
// const ENV_DEV = 'zhapi.coinbtcs.com' // dev
// const ENV_DEV = 'openapi.yanshiz.com' // dev
-const ENV_DEV = 'api.cme-coin.com' // dev
+const ENV_DEV = 'cmeapi.durocaspitall.com' // dev
// const ENV_DEV = '192.168.10.12:8222' // dev
// const ENV_PRO = 'qheufhj.site' // app域名
// const ENV_PRO = window.location.hostname // 接口域名跟随 H5zhapi.coinbtcs.com
-const ENV_PRO = 'api.cme-coin.com' // 接口域名跟随 H5zhapi.coinbtcs.com
+const ENV_PRO = 'cmeapi.durocaspitall.com' // 接口域名跟随 H5zhapi.coinbtcs.com
// const ENV_PRO = '192.168.10.12:8222' // 接口域名跟随 H5zhapi.coinbtcs.com
let base_url = ''
diff --git a/src/router/index.js b/src/router/index.js
index ebec230..ece65cc 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1522,20 +1522,21 @@
},
})
router.beforeEach((to, from, next) => {
- 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()
- // }
- } else {
- next()
- }
+ 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()
diff --git a/src/views/homePage/index.vue b/src/views/homePage/index.vue
index dd0bfe3..f9d0b3f 100644
--- a/src/views/homePage/index.vue
+++ b/src/views/homePage/index.vue
@@ -121,8 +121,9 @@
// })
const getcustomer = () => {
_customer().then((data) => {
- customer_service_url.value = data.customer_service_url
- console.log(customer_service_url);
+ if(data.code==0){
+ customer_service_url.value = data.customer_service_url
+ }
}).catch(error => {
console.error('Error fetching data:', error);
});
--
Gitblit v1.9.3