From c68a2ea1af385ffefc66f985a4eb418b8ef2b2f6 Mon Sep 17 00:00:00 2001 From: lixg Date: Tue, 7 Mar 2023 22:23:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:returnUrl=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request.js | 2 +- src/router/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/request.js b/src/api/request.js index a792cce..20c92f2 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -100,7 +100,7 @@ export async function request(_url, params) { console.log('window.location.', window, router) if (response.code === 1000) { delCookie() - (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') + (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 + encodeURI(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/router/index.js b/src/router/index.js index 6b2adf1..ee107cb 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 16:43:57 + * @LastEditTime: 2023-03-07 21:52:35 * @FilePath: /stu_h5/src/router/index.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -28,7 +28,7 @@ router.beforeEach((to, from, next) => { if (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") { 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 + window.location.href = window.location.protocol + import.meta.env.VITE_BASE_LOGIN_URL + encodeURI(window.location.protocol + import.meta.env.VITE_BOE_BASE_URL + import.meta.env.VITE_BASE + to.fullPath) } } next()