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