diff --git a/frontend/pc/src/utils/ajax.js b/frontend/pc/src/utils/ajax.js index f1429fe5..20b7016b 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)}`;