From 201569b10a64c00f23188cf35efb437bdde2faa5 Mon Sep 17 00:00:00 2001 From: pengda <1111@qq.com> Date: Mon, 4 Aug 2025 15:49:43 +0800 Subject: [PATCH] =?UTF-8?q?host=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 ++- .env.production | 3 ++- src/main.js | 2 -- src/utils/loginRefresh.js | 4 +--- src/utils/request.js | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.env.development b/.env.development index 707c24f..3c1eb00 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,2 @@ -VUE_APP_BASE_API=http://agentnew.pengda.checkcopy.com/api \ No newline at end of file +VUE_APP_BASE_API=http://agentnew.pengda.checkcopy.com/api +VUE_APP_HOST=//agentnew.pengda.checkcopy.com \ No newline at end of file diff --git a/.env.production b/.env.production index 496a0ca..1148fc4 100644 --- a/.env.production +++ b/.env.production @@ -1 +1,2 @@ -VUE_APP_BASE_API=http://admin.kuailelunwen.com/api \ No newline at end of file +VUE_APP_BASE_API=//admin.kuailelunwen.com/api +VUE_APP_HOST=//admin.kuailelunwen.com \ No newline at end of file diff --git a/src/main.js b/src/main.js index afa234b..7e8af37 100755 --- a/src/main.js +++ b/src/main.js @@ -24,8 +24,6 @@ Vue.prototype.$copy = modernCopyToClipboard; Vue.prototype.$loadingFn = LoadingService; Vue.config.productionTip = false; // 请求 -import { host } from '@/config/host'; -Vue.prototype.$host = host Vue.prototype.$http = request; Vue.prototype.$token = '' Vue.use(ElementUI); diff --git a/src/utils/loginRefresh.js b/src/utils/loginRefresh.js index af167e8..7efd475 100644 --- a/src/utils/loginRefresh.js +++ b/src/utils/loginRefresh.js @@ -1,5 +1,3 @@ -import { host } from '@/config/host'; - let isRefreshing = false let refreshSubscribers = [] @@ -42,7 +40,7 @@ export async function handleTokenRefresh(originalRequest, instance) { isRefreshing = false refreshSubscribers = [] localStorage.removeItem('token') - window.location.href = host; + window.location.href = process.env.VUE_APP_BASE_API; return Promise.reject(err) } } diff --git a/src/utils/request.js b/src/utils/request.js index 706c15c..03b4c2d 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,7 +1,6 @@ // src/utils/request.js import axios from "axios"; import { handleTokenRefresh } from '@/utils/loginRefresh'; -import { host } from '@/config/host'; // 创建 axios 实例 const service = axios.create({ @@ -53,7 +52,7 @@ service.interceptors.response.use( switch (error.response.status) { case 401: // 未授权,跳转到登录页 - window.location.href = host; + window.location.href = process.env.VUE_APP_HOST; break; case 402: // token失效