From 73528efff04d36bdc7771cc067aad1c8ef2b1ec5 Mon Sep 17 00:00:00 2001 From: lixg Date: Tue, 7 Mar 2023 15:53:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 +++- .env.prod | 3 ++- .env.release | 3 ++- src/api/request.js | 3 ++- src/components/ReturnHead.vue | 3 ++- src/router/index.js | 4 ++-- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.env b/.env index 42ea51e..f30153d 100644 --- a/.env +++ b/.env @@ -29,4 +29,6 @@ VITE_FILE_PATH=/upload/ #h5的基本url -VITE_BOE_HOME=//u-pre.boe.com/mobile/pages/index/index \ No newline at end of file +VITE_BOE_HOME=//u-pre.boe.com/mobile/pages/index/index +# 学习任务页 +VITE_BOE_STUDY=https://u-pre.boe.com/mobile/pages/study/index \ No newline at end of file diff --git a/.env.prod b/.env.prod index 80dbce5..036b4e4 100644 --- a/.env.prod +++ b/.env.prod @@ -18,4 +18,5 @@ VITE_BOE_BASE_URL=//u.boe.com VITE_IMG=/manageApi #h5的基本url -VITE_BOE_HOME=//u.boe.com/mobile/pages/index/index \ No newline at end of file +VITE_BOE_HOME=//u.boe.com/mobile/pages/index/index +VITE_BOE_STUDY=https://u.boe.com/mobile/pages/study/index \ No newline at end of file diff --git a/.env.release b/.env.release index a05c31f..d89cb62 100644 --- a/.env.release +++ b/.env.release @@ -15,4 +15,5 @@ VITE_BOE_BASE_URL=//u.boe.com VITE_IMG=/manageApi-release #h5的基本url -VITE_BOE_HOME=//u.boe.com/mobile-release/pages/index/index \ No newline at end of file +VITE_BOE_HOME=//u.boe.com/mobile-release/pages/index/index +VITE_BOE_STUDY=https://u.boe.com/mobile-release/pages/study/index \ No newline at end of file diff --git a/src/api/request.js b/src/api/request.js index 93fee43..85f175f 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -97,8 +97,9 @@ export async function request(_url, params) { ...method !== 'get' ? { data: JSON.stringify(body) } : {} }).then(resp => resp.data).then(response => { if (response.code !== 200 && response.code !== 0) { + console.log('window.location.', window, router) if (response.code === 1000) { - (import.meta.env.MODE === 'development' || import.meta.env.MODE === 'test') ? router.push({ path: '/login' }) : window.open(window.location.protocol + import.meta.env.VITE_BASE_LOGIN_URL, '_top') + (import.meta.env.MODE === 'development' || import.meta.env.MODE === 'test') ? router.push({ path: '/login', query: { returnUrl: router.currentRoute.value.fullPath } }) : window.open(window.location.protocol + import.meta.env.VITE_BASE_LOGIN_URL + window.location.protocol + import.meta.env.VITE_BOE_BASE_URL + import.meta.env.VITE_BASE + router.currentRoute.value.fullPath, '_top') } if (response.code === 2001) { router.push({ path: '/FaceTeachSignUp', query: { courseId: router.currentRoute.value.query.courseId, type: 3 } }) diff --git a/src/components/ReturnHead.vue b/src/components/ReturnHead.vue index 27fa44d..2f16173 100644 --- a/src/components/ReturnHead.vue +++ b/src/components/ReturnHead.vue @@ -2,7 +2,7 @@ * @Author: lixg lixg@dongwu-inc.com * @Date: 2023-01-16 17:26:39 * @LastEditors: lixg lixg@dongwu-inc.com - * @LastEditTime: 2023-02-22 19:32:18 + * @LastEditTime: 2023-03-07 15:17:43 * @FilePath: /stu_h5/src/components/ReturnHead.vue * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE --> @@ -89,6 +89,7 @@ export default { const router = useRouter(); const returnclick = () => { router.back(); + // VITE_BOE_STUDY }; const publishClick = () => { if (props.postAdd) { diff --git a/src/router/index.js b/src/router/index.js index 5957ede..292580a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,7 @@ * @Author: lixg lixg@dongwu-inc.com * @Date: 2023-02-08 09:50:10 * @LastEditors: lixg lixg@dongwu-inc.com - * @LastEditTime: 2023-03-07 12:53:34 + * @LastEditTime: 2023-03-07 15:48:30 * @FilePath: /stu_h5/src/router/index.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -26,7 +26,7 @@ router.beforeEach((to, from, next) => { console.log('toooooooo', to) if (!getCookie('token')) { if (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") { - to.path.includes('/login') ? next() : next({ path: '/login', query: { returnUrl: import.meta.env.VITE_BASE + to.fullPath } }) + to.path.includes('/login') ? next() : next({ path: '/login', query: { returnUrl: to.fullPath } }) } else { window.location.href = window.location.protocol + import.meta.env.VITE_BASE_LOGIN_URL + window.location.protocol + import.meta.env.VITE_BOE_BASE_URL + import.meta.env.VITE_BASE + to.fullPath }