|
|
|
@ -23,7 +23,7 @@ service.interceptors.request.use( |
|
|
|
|
if (config.data && config.method === 'post') { |
|
|
|
|
let sourceBody = JSON.stringify(config.data) |
|
|
|
|
config.data = aes.encrypt(JSON.stringify(config.data)) |
|
|
|
|
console.log('加密请求参数 ', sourceBody, ' -> ', config.data) |
|
|
|
|
// console.log('加密请求参数 ', sourceBody, ' -> ', config.data)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (store.getters.token) { |
|
|
|
@ -54,8 +54,14 @@ service.interceptors.response.use( |
|
|
|
|
* You can also judge the status by HTTP Status Code |
|
|
|
|
*/ |
|
|
|
|
response => { |
|
|
|
|
const res = response.data |
|
|
|
|
console.log('服务器响应 -> ', res) |
|
|
|
|
// console.log(response)
|
|
|
|
|
// console.log(JSON.stringify(response.headers))
|
|
|
|
|
const source = response.data |
|
|
|
|
if (response.headers['encrypt'] != null) { |
|
|
|
|
response.data = aes.decrypt(response.data) |
|
|
|
|
} |
|
|
|
|
// console.log(`响应数据解密: ${source} -> ${response.data}`)
|
|
|
|
|
const res = JSON.parse(response.data) |
|
|
|
|
// if the custom code is not 0, it is judged as an error.
|
|
|
|
|
if (res.code !== 0) { |
|
|
|
|
Message({ |
|
|
|
|