Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
lizhenhua 2024-07-22 14:08:04 +08:00
commit 783af74cd1
2 changed files with 12 additions and 9 deletions

View File

@ -6,12 +6,12 @@ const cbc_iv = CryptoJS.enc.Utf8.parse('1234567812345678')
* 默认参数需要加密
* @type {boolean}
*/
const encryptEnabled=true;
/**
* 默认后台会自动加密
* @type {boolean}
*/
const decryptEnabled=true;
const encryptEnabled= true;
// /**
// * 默认后台会自动加密
// * @type {boolean}
// */
// const decryptEnabled=true;
/**
* 加密
* @param word
@ -35,9 +35,9 @@ export const encryptCBC = function(word) {
* @returns {*}
*/
export const decryptCBC = function(word) {
if(!decryptEnabled){
return word;
}
// if(!decryptEnabled){
// return word;
// }
const encrypted = CryptoJS.AES.decrypt(word, cbc_key, {
iv: cbc_iv,
mode: CryptoJS.mode.CBC,

View File

@ -115,6 +115,9 @@ service.interceptors.response.use(res => {
const resultData=decryptCBC(res.data.data);
res.data=JSON.parse(resultData);
}
else if(typeof res.data.code=='undefined'){
res.data= res.data.data
}
// 未设置状态码则默认成功状态
const code = res.data.code || 200;
// 获取错误信息