From 91db9fab7fb4265ca9d2d97b9c49db49b8961d35 Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Tue, 24 Jun 2025 14:06:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=8E=9F=E5=A7=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Breadcrumb copy.vue | 77 -------------------------------------- src/utils/request.js | 22 ++--------- 2 files changed, 3 insertions(+), 96 deletions(-) delete mode 100644 src/components/Breadcrumb copy.vue diff --git a/src/components/Breadcrumb copy.vue b/src/components/Breadcrumb copy.vue deleted file mode 100644 index 7dea213..0000000 --- a/src/components/Breadcrumb copy.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 1ff2af1..28c3458 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,14 +1,12 @@ // src/utils/request.js import axios from "axios"; -// import store from '@/store' -// let loadingTimer = null + // 创建 axios 实例 const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, // 从环境变量中读取 API 基础地址 timeout: 60000, // 请求超时时间 headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'AUTH': '3c901fa4a19a7ad9d01238890863d499' + 'Content-Type': 'application/x-www-form-urlencoded' }, }); @@ -18,20 +16,11 @@ service.interceptors.request.use( // 在发送请求之前做一些处理,例如添加 token const token = localStorage.getItem("token"); if (token) { - config.headers["AUTH"] = `${token}`; + config.headers["Auth"] = `${token}`; } - // 如果配置里传了 loading: false,则不显示 loading - // if (config.loading !== false) { - // loadingTimer = setTimeout(() => { - // store.dispatch('showLoading') - // }, 300) - // } return config; }, (error) => { - // clearTimeout(loadingTimer) - // // 请求错误时也要关闭 loading - // store.dispatch('hideLoading') // 对请求错误做些什么 return Promise.reject(error); } @@ -43,12 +32,9 @@ service.interceptors.response.use( // 对响应数据做一些处理 const res = response.data; if (!res.status) { - // 如果返回的 status 不是 true,则视为错误 // return Promise.reject(new Error(res.info || "请求失败")); } - // clearTimeout(loadingTimer) - // store.dispatch('hideLoading') return res; }, (error) => { @@ -71,8 +57,6 @@ service.interceptors.response.use( console.error("请求失败", error.message); } } - // clearTimeout(loadingTimer) - // store.dispatch('hideLoading') return Promise.reject(error); } );