From 5adc2d0594f75ed5087f57ea3ab8f32b8a2f33d1 Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Fri, 13 Jun 2025 18:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E9=80=9A=E4=B8=B4=E5=BA=8A=E7=97=85?= =?UTF-8?q?=E4=BE=8B=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.js | 5 ++++- src/router/index.js | 13 ++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/api/user.js b/src/api/user.js index 1e03062..8a2045d 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -44,10 +44,13 @@ const completeCase=(id,data)=>{ const behaviorRecord=(data)=>{ return http.post("/record/user/behavior",data) } - +const loginByWx=(data)=>{ + return http.post("/login/program",data) +} export default { login, + loginByWx, getProjectList, getCaseList, getCaseDetail, diff --git a/src/router/index.js b/src/router/index.js index 8329381..7cef684 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -53,6 +53,7 @@ router.beforeEach(async(to, from, next) => { document.title = '互动病例'; } let source=to.query.source + let tempToken=to.query.token; // 权限验证逻辑 if (source == 3) { if(to.path!=='/result'){ @@ -84,7 +85,17 @@ router.beforeEach(async(to, from, next) => { next(); } - } else { + }else if(tempToken){ + const {data,code}=await api.loginByWx({ + token:tempToken + }) + if(code==200){ + localStorage.setItem('token_gandan',data.token); + localStorage.setItem('userInfo',JSON.stringify(data)); + localStorage.setItem('source',''); + next(); + } + }else { //localStorage.setItem('token_gandan','eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMTg5NDI3NjIyOTg5NzM5MjEyOCIsInBsYXRmb3JtX2lkIjoiMSIsImV4cCI6MTc0NDQyMzU1NCwibmJmIjoxNzQxODMxNTU0LCJpYXQiOjE3NDE4MzE1NTR9.LuU5xpSpTQq6VY7qZJf854qMoNCMVjRj1vi1_Ii8akM'); let token=''; let token_other=localStorage.getItem('token_other');