From 7d34cb17207744cf0d8afaefb262c1919f040181 Mon Sep 17 00:00:00 2001 From: luofann Date: Fri, 10 Nov 2023 10:32:13 +0800 Subject: [PATCH] =?UTF-8?q?upd:=20init=E6=8E=A5=E5=8F=A3=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=AE=BF=E9=97=AEurl=E4=B8=8D=E4=BB=A5/?= =?UTF-8?q?=E7=BB=93=E5=B0=BE=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/pc/src/utils/ajax.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/pc/src/utils/ajax.js b/frontend/pc/src/utils/ajax.js index f1429fe55..20b7016b5 100644 --- a/frontend/pc/src/utils/ajax.js +++ b/frontend/pc/src/utils/ajax.js @@ -66,7 +66,8 @@ bus.$on('processData', (response) => { */ instance.interceptors.request.use( (config) => { - if (config.url === 'init/') { + // 接口请求如果已经配置了以SITE_URL开头,则不需要添加baseURL + if (new RegExp(`^${SITE_URL}`).test(config.url)) { config.baseURL = ''; } // 添加工单查看权限 @@ -82,7 +83,7 @@ instance.interceptors.request.use( instance.interceptors.response.use( (response) => { - if (response.config.url === 'init/') { + if (response.config.url === `${SITE_URL}init/`) { if (response.status === 401) { const { login_url } = response.data; const url = `${login_url.split('c_url=')[0]}c_url=${encodeURIComponent(location.href)}`;