From 752b1ae951119bdd5b5544285a249c68b63dfc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Tue, 22 Jul 2025 15:12:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E6=B5=8F=E8=A7=88=E5=99=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96token=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/zhongchouApi.js | 14 ++++++++++---- vite.config.js | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/api/zhongchouApi.js b/src/api/zhongchouApi.js index b618c8f..e5ff8d4 100644 --- a/src/api/zhongchouApi.js +++ b/src/api/zhongchouApi.js @@ -5,15 +5,21 @@ const APIurl = import.meta.env.VITE_APP_API_BASE_URL; export function addRecordAPI(data) { return request({ - url: `Api/api/funding/addRecord`, + url: `${APIurl}/api/funding/addRecord`, method: 'post', - data: data + data: data, + headers: { + token: localStorage.getItem('localToken') + }, }) } // 新增:获取活动信息接口 export function getActivity1API() { return request({ - url: `Api/api/funding/getActivity`, - method: 'post' + url: `${APIurl}/api/funding/getActivity`, + method: 'post', + headers: { + token: localStorage.getItem('localToken') + }, }) } \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 94c13b8..c051bd6 100644 --- a/vite.config.js +++ b/vite.config.js @@ -11,6 +11,11 @@ export default defineConfig({ plugins: [ vue(), ], + resolve: { + alias: { + '@': path.resolve(process.cwd(), 'src') + } + }, server: { proxy: { '/Api': { @@ -22,3 +27,22 @@ export default defineConfig({ } } }) +// export default defineConfig({ +// plugins: [vue()], +// resolve: { +// alias: { +// '@': path.resolve(process.cwd(), 'src') +// } +// }, +// server: { +// proxy: { +// '/Api': { +// target: 'https://dbqb.nfdxy.net/devLotApi', // 后端基础地址 +// changeOrigin: true, +// rewrite: (path) => path.replace(/^\/Api/, ''), // 移除 /api 前缀 +// // 或者更精确的重写(根据后端路径调整): +// // rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'), +// }, +// }, +// }, +// })