|
@ -5,6 +5,9 @@ import axios from "axios"; |
|
|
const service = axios.create({ |
|
|
const service = axios.create({ |
|
|
baseURL: process.env.VUE_APP_BASE_API, // 从环境变量中读取 API 基础地址
|
|
|
baseURL: process.env.VUE_APP_BASE_API, // 从环境变量中读取 API 基础地址
|
|
|
timeout: 10000, // 请求超时时间
|
|
|
timeout: 10000, // 请求超时时间
|
|
|
|
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded' |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 请求拦截器
|
|
|
// 请求拦截器
|
|
@ -74,9 +77,6 @@ const request = (method, url, data = {}, config = {}) => { |
|
|
method: "get", |
|
|
method: "get", |
|
|
url, |
|
|
url, |
|
|
params: data, |
|
|
params: data, |
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded' |
|
|
|
|
|
}, |
|
|
|
|
|
...config, |
|
|
...config, |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
@ -85,9 +85,6 @@ const request = (method, url, data = {}, config = {}) => { |
|
|
method: lowerCaseMethod, |
|
|
method: lowerCaseMethod, |
|
|
url, |
|
|
url, |
|
|
data, |
|
|
data, |
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded' |
|
|
|
|
|
}, |
|
|
|
|
|
...config, |
|
|
...config, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|