From 796f802fc5b4fd17fe87a6513ec7e89052d588b0 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 14 Nov 2024 17:05:11 +0800 Subject: [PATCH] fix --- src/setting.js | 7 ++++--- src/utils/api.js | 4 ++-- src/views/review/index.vue | 20 ++++++++++++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/setting.js b/src/setting.js index ab9dacd..020b3fb 100644 --- a/src/setting.js +++ b/src/setting.js @@ -3,9 +3,10 @@ * */ const url = location.host; const isDev = process.env.NODE_ENV === 'development' // 开发环境 -const isPro = url.includes('huorantech.cn') //正式服 +// const isPro = url.includes('huorantech.cn') //正式服 +const isPro = url.includes('47.97.49.1') //正式服 -let jumpPath = `${location.origin}/judgmentPoint/` +let jumpPath = `${location.origin}/panfen/` let sandPath = `http://121.37.12.51/sandbox` // 沙盘地址 let host = `${location.origin}/` if (isDev) { @@ -18,7 +19,7 @@ if (isDev) { host = ips[+localStorage.getItem('ip')] } else if (isPro) { sandPath = `https://izhixinyun.com/sandbox` - jumpPath = 'https://judgment.huorantech.cn/' + // jumpPath = 'https://judgment.huorantech.cn/' } diff --git a/src/utils/api.js b/src/utils/api.js index 5f32b07..4122e5a 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -106,8 +106,8 @@ export default { editProjectDraft: `occupationlab/occupationlab/projectManage/editProjectDraft`, // 修改项目管理 copyProjectManage: `occupationlab/occupationlab/projectManage/copyProjectManage`, // 复制项目管理 // 判分点 - getBcJudgmentPoint: `${jumpApi}judgment/judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取编程类判分点列表(分页) - getLcJudgmentPoint: `${jumpApi}judgment/judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表(分页) + getBcJudgmentPoint: `${host}judgment/judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取编程类判分点列表(分页) + getLcJudgmentPoint: `${host}judgment/judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表(分页) addProjectJudgment: `occupationlab/occupationlab/projectJudgment/addProjectJudgment`, // 添加项目管理、判分点中间表 updateProjectJudgment: `occupationlab/occupationlab/projectJudgment/updateProjectJudgment`, // 判分点中间表批量更新 deleteProjectJudgment: `occupationlab/occupationlab/projectJudgment/deleteProjectJudgment`, // 判分点中间表批量删除 diff --git a/src/views/review/index.vue b/src/views/review/index.vue index 0e7a430..12c7fa2 100644 --- a/src/views/review/index.vue +++ b/src/views/review/index.vue @@ -13,20 +13,32 @@ export default { }; }, mounted () { + const token = sessionStorage.getItem('token') const cache = localStorage.getItem('reviewPath') // 理论考试平台每次跳转都会往localStorage存路径 let url = `${location.origin}/reviewCenter/` if (Setting.isDev) url = `http://192.168.31.125:8099/` if (cache) { - url += `#${cache}${cache.includes('?') ? `&` : '?'}token=${sessionStorage.getItem('token')}&nakadai=1` + url += '#' + this.replaceParam(cache, Date.now()) } else { - url += `#/myReview?token=${sessionStorage.getItem('token')}&nakadai=1` + url += `#/myReview?nakadai=1${Setting.isDev ? `&token=${token}` : ''}&v=${Date.now()}` } - url += `&v=${Date.now()}` - localStorage.setItem('review_token', sessionStorage.getItem('token')) + console.log("🚀 ~ mounted ~ url:", url) + localStorage.setItem('review_token', token) this.url = url }, methods: { + replaceParam (url, newVValue) { + const vParamRegex = /v=[^&]+/g + let newUrl = url.replace(vParamRegex, `v=${newVValue}`) + + const [baseUrl, hash] = newUrl.split('#'); + if (hash) { + newUrl = `${baseUrl}#${hash.replace(vParamRegex, `v=${newVValue}`)}` + } + + return newUrl + } } };