|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: ch
|
|
|
|
|
* @Date: 2022-05-03 23:04:45
|
|
|
|
|
* @LastEditors: ch
|
|
|
|
|
* @LastEditTime: 2022-05-04 18:32:54
|
|
|
|
|
* @LastEditTime: 2022-05-09 09:40:57
|
|
|
|
|
* @Description: file content
|
|
|
|
|
*/
|
|
|
|
|
let axios = null
|
|
|
|
@ -16,15 +16,20 @@ export default function({app, $axios, req}) {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// export default function ({app, $axios}) {
|
|
|
|
|
$axios.onRequest(()=>{
|
|
|
|
|
// $axios.onRequest(()=>{
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
$axiosTk.onResponse(response => {
|
|
|
|
|
const result = response.data;
|
|
|
|
|
if(response.status === 200){
|
|
|
|
|
if(result.code === 'SUCCESS'){
|
|
|
|
|
return result.data;
|
|
|
|
|
}
|
|
|
|
|
return Promise.reject(result);
|
|
|
|
|
}
|
|
|
|
|
return Promise.reject({message:'请求出错'});
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
$axios.onResponse(res => {
|
|
|
|
|
if (res.status === 200) {
|
|
|
|
|
return res.data;
|
|
|
|
|
} else {
|
|
|
|
|
return Promise.reject(res.data.error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
axios = $axios;
|
|
|
|
|
}
|
|
|
|
|