From a464d256a25fda9d0fbcba0ec1fd90a705b9314c Mon Sep 17 00:00:00 2001 From: "34701892@qq.com" <34701892@qq.com> Date: Thu, 6 Nov 2025 20:46:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtoken=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E9=80=BB=E8=BE=91=E5=B9=B6=E4=BF=AE=E6=AD=A3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复路由token验证逻辑,增加加载状态和错误处理 修正sendToken接口路径错误 --- src/api/index.ts | 2 +- src/pages/realtimeInfo/pc/rank.vue | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index e3dfe05..bb8e713 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -74,5 +74,5 @@ export const editTopNews = (data: any) => { // 编辑精选接口 export const sendToken = (data: any) => { - return Request.post("/common/forward/financiald", data); + return Request.post("/common/forward/financial", data); }; diff --git a/src/pages/realtimeInfo/pc/rank.vue b/src/pages/realtimeInfo/pc/rank.vue index 5bca493..d422a0a 100644 --- a/src/pages/realtimeInfo/pc/rank.vue +++ b/src/pages/realtimeInfo/pc/rank.vue @@ -129,17 +129,31 @@ function currentChange(page) { onMounted(async (e) => { console.log("🚀 ~ route.query:", route.query) - if (route.query?.token) { + if (route.query?.token && !Session.get("token")) { + uni.showLoading({ + title: '加载中', + mask: true + }) sendToken({ token: route.query.token, + }).then((res) => { + uni.hideLoading() + if (res.code == 200) { + Session.set("token", res.data.token); + Session.set("userPhone", res.data.phone); + + window.location.reload(); + } }) + } else { + if (!Session.get("token")) { + LoginShow.value = true; + } } getNewsList(); - if (!Session.get("token")) { - LoginShow.value = true; - } + }); const LoginShow = ref(false);