|
@@ -9,7 +9,7 @@ axios.defaults.withCredentials = true;
|
|
|
* @param {Object} options 详细配置项,使用方法与所有配置项说明如下:
|
|
|
|
|
|
this.API.requestData({
|
|
|
- isMust: true, // 请求是否携带 token ,默认为 true ,可缺省
|
|
|
+ isMust: true, // 请求是否携带 token ,默认为 true ,可缺省
|
|
|
showLoading: false, // 请求是否显示加载中遮罩层,默认 false ,可缺省
|
|
|
method: "GET", // 请求方式,默认为 GET ,可缺省
|
|
|
baseURL: "http://192.168.10.23:8082/", // 请求服务器地址 + 端口,可缺省
|
|
@@ -25,7 +25,7 @@ axios.defaults.withCredentials = true;
|
|
|
});
|
|
|
|
|
|
*/
|
|
|
-export function requestData (options) {
|
|
|
+export function requestData(options) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
|
if (options.showLoading) {
|
|
@@ -49,7 +49,7 @@ export function requestData (options) {
|
|
|
withCredentials: true,
|
|
|
crossDomain: true,
|
|
|
baseURL: options.baseURL || window.__MODE__.baseURL || '/api/',
|
|
|
- timeout: options.timeout || 3000, // 请求超时时间 - 3s
|
|
|
+ timeout: options.timeout || 30000, // 请求超时时间 - 3s
|
|
|
});
|
|
|
|
|
|
// 请求拦截器
|
|
@@ -81,10 +81,8 @@ export function requestData (options) {
|
|
|
msg: (response.data && response.data.msg) || ("请求出错[" + response.data.code + "]")
|
|
|
});
|
|
|
|
|
|
- setTimeout(() => {
|
|
|
- // window.location.reload();
|
|
|
- // window.__STATICVUE__.$router.replace('/login');
|
|
|
- }, 1000);
|
|
|
+ // window.location.reload();
|
|
|
+ // window.__STATICVUE__.$router.replace('/login');
|
|
|
|
|
|
} else if (response.data.code === 200) { // 请求成功 code
|
|
|
|