|
|
@ -27,8 +27,6 @@ service.interceptors.response.use( |
|
|
|
if(error.response && error.response.status == 404){ |
|
|
|
if(error.response && error.response.status == 404){ |
|
|
|
router.push('/blank.vue') |
|
|
|
router.push('/blank.vue') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Promise.reject(error.response) |
|
|
|
return Promise.reject(error.response) |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
@ -48,8 +46,6 @@ if(tokens){ |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
token = sessionStorage.getItem('token') |
|
|
|
token = sessionStorage.getItem('token') |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(token) |
|
|
|
|
|
|
|
// let token = sessionStorage.getItem('token')
|
|
|
|
|
|
|
|
export function get(url, params = {}) { |
|
|
|
export function get(url, params = {}) { |
|
|
|
// params.t = new Date().getTime(); //get方法加一个时间参数,解决ie下可能缓存问题.
|
|
|
|
// params.t = new Date().getTime(); //get方法加一个时间参数,解决ie下可能缓存问题.
|
|
|
|
return service({ |
|
|
|
return service({ |
|
|
@ -61,8 +57,6 @@ export function get(url, params = {}) { |
|
|
|
params |
|
|
|
params |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装post请求
|
|
|
|
//封装post请求
|
|
|
|
export function post(url, data = {}) { |
|
|
|
export function post(url, data = {}) { |
|
|
|
//默认配置
|
|
|
|
//默认配置
|
|
|
@ -78,7 +72,6 @@ export function post(url, data = {}) { |
|
|
|
sendObject.data=JSON.stringify(data); |
|
|
|
sendObject.data=JSON.stringify(data); |
|
|
|
return service(sendObject) |
|
|
|
return service(sendObject) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//封装put方法 (resfulAPI常用)
|
|
|
|
//封装put方法 (resfulAPI常用)
|
|
|
|
export function put(url,data = {}){ |
|
|
|
export function put(url,data = {}){ |
|
|
|
return service({ |
|
|
|
return service({ |
|
|
@ -101,7 +94,6 @@ export function deletes(url){ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//不要忘记export
|
|
|
|
//不要忘记export
|
|
|
|
export { |
|
|
|
export { |
|
|
|
service |
|
|
|
service |
|
|
|