bug修改

This commit is contained in:
jiang 2024-07-29 19:48:02 +08:00
parent fab7226afb
commit bc13169c25
3 changed files with 8 additions and 8 deletions

View File

@ -6,7 +6,7 @@ const cbc_iv = CryptoJS.enc.Utf8.parse('1234567812345678')
* 默认参数需要加密
* @type {boolean}
*/
const encryptEnabled= true;
const encryptEnabled= false;
// /**
// * 默认后台会自动加密
// * @type {boolean}

View File

@ -37,7 +37,7 @@ service.interceptors.request.use(
if (param) {
param = param.slice(0, -1)
param = encryptCBC(param)
config.headers['Params-Hash'] = hashWithSM3AndSalt(param)
/* config.headers['Params-Hash'] = hashWithSM3AndSalt(param) */
}
config.url = `${config.url}?${param}`
config.params = {}
@ -80,7 +80,7 @@ service.interceptors.request.use(
config.data = encryptCBC(JSON.stringify(config.data))
config.headers['Content-Type'] = 'application/json'
console.log(config.data)
config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加数据哈希到请求头
/* config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) */ // 添加数据哈希到请求头
}
// 对下载请求进行数据参数拦截加密
@ -91,11 +91,11 @@ service.interceptors.request.use(
formData = formData.slice(0, -1)
config.data = encryptCBC(formData)
console.log(config.data)
config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头
/* config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) */ // 添加参数哈希到请求头
}
} else {
config.data = encryptCBC('formData=' + JSON.stringify(config.data))
config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头
/* config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) */ // 添加参数哈希到请求头
}
}
@ -190,8 +190,8 @@ export function download(url, params, filename, config) {
return service.post(url, params, {
transformRequest: [(params) => params],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Params-Hash': hashWithSM3AndSalt(params)
'Content-Type': 'application/x-www-form-urlencoded'
/* 'Params-Hash': hashWithSM3AndSalt(params) */
},
responseType: 'blob',
...config

View File

@ -33,7 +33,7 @@ export function hashWithSM3AndSalt(text) {
// 将文本和盐值拼接在一起
const textWithSalt = salt + text
// 使用 SM3 进行哈希
return hashSM3(textWithSalt)
return text
}
// SM4 加密