From 8d6f7f5141d09233f91b511f878e92652ccdbde1 Mon Sep 17 00:00:00 2001 From: zhaoruhui Date: Tue, 16 Sep 2025 19:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/views/wealth/goldenWheel.vue | 55 ++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/.env.development b/.env.development index 03bfe53..b009372 100644 --- a/.env.development +++ b/.env.development @@ -20,7 +20,7 @@ VITE_APP_IMG_API_BASE_URL = "http://39.101.133.168:8828/hljw/api/aws/upload" VITE_APP_MJ_API_BASE_URL = "http://192.168.9.19:8080/api" #Link测试环境scms库 -VITE_APP_API_SCMS_URL = "http://39.101.133.168:8828/scms" +VITE_APP_API_SCMS_URL = "https://mp.homilychart.com/TestApi/scms" # Whether to open mock VITE_USE_MOCK = true diff --git a/src/views/wealth/goldenWheel.vue b/src/views/wealth/goldenWheel.vue index 19c4b8b..bd1f351 100644 --- a/src/views/wealth/goldenWheel.vue +++ b/src/views/wealth/goldenWheel.vue @@ -298,18 +298,45 @@ export default { return chineseCharCount > 7 || englishCharCount > 15; } }, + // onMounted(){ + // this.getTokenFromURL(); + // this.fetchWheelInfo(); + // }, + mounted() { this.getTokenFromURL(); this.fetchWheelInfo(); - - // 预加载图片 - this.preloadImages(); api.packageFun('JWsetTitle', function () {}, { platform: 5, title: "财富金轮" }) + + // 预加载图片 + this.preloadImages(); + }, methods: { + getTokenFromURL() { + // 首先尝试从URL获取token + const urlParams = new URLSearchParams(window.location.search); + const tokenParam = urlParams.get('token'); + + if (tokenParam) { + // 如果URL中有token,保存到localStorage并设置到组件 + const decodedToken = decodeURIComponent(tokenParam); + localStorage.setItem('fortuneWheelToken', decodedToken); + this.token = decodedToken; + } else { + // 如果URL中没有token,尝试从localStorage获取 + const storedToken = localStorage.getItem('fortuneWheelToken'); + if (storedToken) { + this.token = storedToken; + } else { + console.log('URL和localStorage中都没有找到token'); + // 这里可以添加处理没有token的情况,比如跳转到登录页 + } + } + }, toggleHistory() { this.historyRecordListVisible = !this.historyRecordListVisible this.selected = 1 @@ -391,27 +418,7 @@ async loadHistoryRecord() { }); }, - getTokenFromURL() { - // 首先尝试从URL获取token - const urlParams = new URLSearchParams(window.location.search); - const tokenParam = urlParams.get('token'); - - if (tokenParam) { - // 如果URL中有token,保存到localStorage并设置到组件 - const decodedToken = decodeURIComponent(tokenParam); - localStorage.setItem('fortuneWheelToken', decodedToken); - this.token = decodedToken; - } else { - // 如果URL中没有token,尝试从localStorage获取 - const storedToken = localStorage.getItem('fortuneWheelToken'); - if (storedToken) { - this.token = storedToken; - } else { - console.log('URL和localStorage中都没有找到token'); - // 这里可以添加处理没有token的情况,比如跳转到登录页 - } - } - }, + // 调用API获取财富金轮信息 fetchWheelInfo() {