|
|
|
@ -21,9 +21,9 @@ service.interceptors.request.use( |
|
|
|
|
// do something before request is sent
|
|
|
|
|
// 对post请求进行加密
|
|
|
|
|
if (config.data && config.method === 'post') { |
|
|
|
|
console.log('原始数据 -> ', JSON.stringify(config.data)) |
|
|
|
|
let sourceBody = JSON.stringify(config.data) |
|
|
|
|
config.data = aes.encrypt(JSON.stringify(config.data)) |
|
|
|
|
console.log('加密为 -> ', config.data) |
|
|
|
|
console.log('加密请求参数 ', sourceBody, ' -> ', config.data) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (store.getters.token) { |
|
|
|
@ -55,7 +55,7 @@ service.interceptors.response.use( |
|
|
|
|
*/ |
|
|
|
|
response => { |
|
|
|
|
const res = response.data |
|
|
|
|
console.log('response -> ', response) |
|
|
|
|
console.log('服务器响应 -> ', res) |
|
|
|
|
// if the custom code is not 0, it is judged as an error.
|
|
|
|
|
if (res.code !== 0) { |
|
|
|
|
Message({ |
|
|
|
|