2
李凌
2025-09-03 d69e499d0393c34986e9df73283aba58be266d9a
2
4 files modified
47 ■■■■ changed files
src/App.vue 14 ●●●● patch | view | raw | blame | history
src/config/index.js 2 ●●● patch | view | raw | blame | history
src/router/index.js 30 ●●●● patch | view | raw | blame | history
src/views/ICO/icoRecord.vue 1 ●●●● patch | view | raw | blame | history
src/App.vue
@@ -31,13 +31,13 @@
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 () => {
src/config/index.js
@@ -56,7 +56,7 @@
    ws_url = 'wss://' + ENV_PRO + '/api/websocket'
}
let imgUrl = 'https://dapp.cme-coin.com' // 暂时的 单独的图片地址
let imgUrl = 'https://syimg.yanshiz.com' // 暂时的 单独的图片地址
export const BASE_URL = base_url
export const WS_URL = ws_url
src/router/index.js
@@ -1530,22 +1530,22 @@
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()
            // 账户密码登录逻辑
            // next({
            //   path: '/login',
            // })
        }
    } else {
        next()
    }
    // 钱包登录逻辑
    // if (to.name === 'Login') {
    //     if (userStore.userInfo && userStore.userInfo.token) {
    //         // 通过vuex state获取当前的token是否存在
    //         next()
    //     } else {
    //         // 钱包登录逻辑
    //         loginButton()
    //     }
    // } else {
    //     next()
    // }
    // 普通逻辑
    next()
    
    // if (to.meta.requireAuth) {
    // 判断该路由是否需要登录权限
src/views/ICO/icoRecord.vue
@@ -56,6 +56,7 @@
    let opt = {
        status: active.value
    }
    if(opt.status == '0') delete opt.status
    _icoRecordList(opt).then((res) => {
        console.log(res);
        recordLIst.value = res.records