| | |
| | | /* //POST传参序列化(添加请求拦截器) */ |
| | | Axios.interceptors.request.use( |
| | | (config) => { |
| | | // 若是有做鉴权token , 就给头部带上token |
| | | // let token = util.cookies.get("token"); |
| | | // if (token != undefined) { |
| | | // config.headers.Authorization = "Bearer " + token; |
| | | // } |
| | | |
| | | // // 若是有做鉴权token , 就给头部带上token |
| | | // // let token = util.cookies.get("token"); |
| | | // // if (token != undefined) { |
| | | // // config.headers.Authorization = "Bearer " + token; |
| | | // // } |
| | | let token = document.cookie.replace( |
| | | /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, |
| | | "$1", |
| | | ); |
| | | if (token) { |
| | | config.headers.Authorization = "Bearer " + token; |
| | | } |
| | | return config |
| | | }, |
| | | (error) => { |
| | |
| | | /* //对响应数据做些事 */ |
| | | if (res.data.code === 200) { |
| | | return res.data ? res.data : {} |
| | | } else if (res.data.code === 700001 || res.data.code === 700005) { |
| | | console.log("客户名称重复") |
| | | return res |
| | | } else { |
| | | Message({ |
| | | message: res.data.msg, |