From 869d01cd9bee3bce4f024465a4ba29549f9bb03f Mon Sep 17 00:00:00 2001 From: sws <1141121512@qq.com> Date: Tue, 27 Aug 2024 18:24:07 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=95=86=E5=93=81=E9=A3=8E=E6=A0=BC=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=9B=BE=E7=89=87=E5=9C=86=E8=A7=92=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20sws=202024-08-27?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.ts | 4 ++-- src/utils/request.ts | 3 ++- temp_pro.d.ts | 0 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 temp_pro.d.ts diff --git a/src/utils/index.ts b/src/utils/index.ts index 1e9fa4e5..cfe94a5c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -326,8 +326,8 @@ export const tabs_style = (color: string, style: string | number | boolean | und */ export const online_url = async () => { if (import.meta.env.VITE_APP_BASE_API == '/dev-api') { - let temp_value = await import('../../temp.d'); - return temp_value.default.temp_attachment_host + '/static/app/tabbar/'; + let temp_data = await import(import.meta.env.VITE_APP_BASE_API == '/dev-api' ? '../../temp.d' : '../../temp_pro.d'); + return temp_data.default.temp_attachment_host + '/static/app/tabbar/'; } else { return (await get_cookie('temp_attachment_host')) + '/static/app/tabbar/'; } diff --git a/src/utils/request.ts b/src/utils/request.ts index 24095b1b..635ba735 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -9,13 +9,14 @@ const service = axios.create({ timeout: 50000, headers: { 'Content-Type': 'application/json;charset=utf-8' }, }); +/** @ts-ignore */ // 请求拦截器 service.interceptors.request.use( async (config: InternalAxiosRequestConfig) => { // 如果是本地则使用静态tonken如果是线上则使用cookie的token const cookie = get_cookie('admin_info'); if (import.meta.env.VITE_APP_BASE_API == '/dev-api') { - let temp_data = await import('../../temp.d'); + let temp_data = await import(import.meta.env.VITE_APP_BASE_API == '/dev-api' ? '../../temp.d' : '../../temp_pro.d'); config.url = config.url + '?token=' + temp_data.default.temp_token; } else { if (cookie) { diff --git a/temp_pro.d.ts b/temp_pro.d.ts new file mode 100644 index 00000000..e69de29b