Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-middle-front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-middle-front
Commits
7b722871
Commit
7b722871
authored
Sep 05, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置 test
parent
ae900c2d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
18 deletions
+10
-18
.env.testelopment
+1
-1
src/utils/request.js
+2
-10
vite.config.js
+7
-7
No files found.
.env.testelopment
View file @
7b722871
...
...
@@ -5,4 +5,4 @@ VITE_APP_TITLE = 银盾中台系统
VITE_APP_ENV = 'testelopment'
# 若依管理系统/开发环境
VITE_APP_BASE_API =
'http://139.224.145.34:9002'
VITE_APP_BASE_API =
/api
src/utils/request.js
View file @
7b722871
...
...
@@ -13,20 +13,12 @@ export let isRelogin = { show: false }
axios
.
defaults
.
headers
[
'Content-Type'
]
=
'application/json;charset=utf-8'
//
使用相对路径 /api,而不是完整URL
//
创建axios实例
const
service
=
axios
.
create
({
baseURL
:
'/api'
,
// 使用相对路径
baseURL
:
import
.
meta
.
env
.
VITE_APP_BASE_API
||
'/api'
,
// 使用环境变量
timeout
:
10000
})
// 创建axios实例
// const service = axios.create({
// // axios中请求配置有baseURL选项,表示请求URL公共部分
// baseURL: import.meta.env.VITE_APP_BASE_API,
// // 超时
// timeout: 10000
// })
// request拦截器
service
.
interceptors
.
request
.
use
(
config
=>
{
...
...
vite.config.js
View file @
7b722871
...
...
@@ -46,15 +46,15 @@ export default defineConfig(({ mode, command }) => {
host
:
true
,
open
:
true
,
proxy
:
{
//
https://cn.vitejs.dev/config/#server-proxy
'/
dev-
api'
:
{
target
:
baseUrl
,
//
开发环境代理配置,与生产环境保持一致
'/api'
:
{
target
:
'http://139.224.145.34:9002'
,
// 直接使用后端地址
changeOrigin
:
true
,
rewrite
:
(
p
)
=>
p
.
replace
(
/^
\/
dev-
api/
,
''
)
rewrite
:
(
p
)
=>
p
.
replace
(
/^
\/
api/
,
''
)
},
// springdoc proxy
'^/v3/api-docs/(.*)'
:
{
target
:
baseUrl
,
// springdoc proxy
'^/v3/api-docs/(.*)'
:
{
target
:
'http://139.224.145.34:9002'
,
changeOrigin
:
true
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment