update naming style

This commit is contained in:
weiweiw 2024-08-26 13:05:39 +08:00
parent 20797914db
commit 312c9ebaec
1 changed files with 20 additions and 12 deletions

View File

@ -52,19 +52,27 @@ service.interceptors.request.use(config => {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义 token config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义 token
} }
// 处理 GET 请求 // // 处理 GET 请求
// if (config.method === 'get' && config.params) {
// let params = tansParams(config.params).slice(0, -1)
// // 数据完整性校验
// if (CONFIG.dataSettings.integrityCheck && checkIntegrity) {
// config.headers['Params-Hash'] = hashWithSM3AndSalt(params)
// }
// // 加密参数
// if (CONFIG.dataSettings.encryptRequest && encryptRequest) {
// params = encryptCBC(params)
// }
// config.url = `${config.url}?${params}`
// config.params = {}
// }
// get请求映射params参数
if (config.method === 'get' && config.params) { if (config.method === 'get' && config.params) {
let params = tansParams(config.params).slice(0, -1) let url = config.url + '?' + tansParams(config.params);
// 数据完整性校验 url = url.slice(0, -1);
if (CONFIG.dataSettings.integrityCheck && checkIntegrity) { config.params = {};
config.headers['Params-Hash'] = hashWithSM3AndSalt(params) config.url = url;
}
// 加密参数
if (CONFIG.dataSettings.encryptRequest && encryptRequest) {
params = encryptCBC(params)
}
config.url = `${config.url}?${params}`
config.params = {}
} }
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {