加密处理
This commit is contained in:
parent
077c3518b4
commit
170051e46f
|
|
@ -27,9 +27,9 @@ const service = axios.create({
|
||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
const encryptRequest = false
|
const encryptRequest = true
|
||||||
const checkIntegrity = false
|
const checkIntegrity = true
|
||||||
const encryptResponse = false
|
const encryptResponse = true
|
||||||
//入参加密
|
//入参加密
|
||||||
config.headers['encryptRequest'] = systemConfig.requestConfig.encryptRequest && encryptRequest ? 'true' : 'false'
|
config.headers['encryptRequest'] = systemConfig.requestConfig.encryptRequest && encryptRequest ? 'true' : 'false'
|
||||||
// 数据完整性校验
|
// 数据完整性校验
|
||||||
|
|
@ -52,7 +52,7 @@ service.interceptors.request.use(config => {
|
||||||
config.params = {};
|
config.params = {};
|
||||||
config.url = url;
|
config.url = url;
|
||||||
}
|
}
|
||||||
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
|
if (config.method === 'post' || config.method === 'put') {
|
||||||
const requestObj = {
|
const requestObj = {
|
||||||
url: config.url,
|
url: config.url,
|
||||||
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
||||||
|
|
@ -60,6 +60,7 @@ service.interceptors.request.use(config => {
|
||||||
}
|
}
|
||||||
let contentType = config.headers['Content-Type']
|
let contentType = config.headers['Content-Type']
|
||||||
// console.log('🚀 ~ contentType:', contentType, requestObj.data)
|
// console.log('🚀 ~ contentType:', contentType, requestObj.data)
|
||||||
|
console.log('🚀 ~ 要加密:', contentType.includes('application/json'), typeof requestObj.data)
|
||||||
if (contentType.includes('application/json') && typeof requestObj.data !== 'undefined') {
|
if (contentType.includes('application/json') && typeof requestObj.data !== 'undefined') {
|
||||||
// 加密数据
|
// 加密数据
|
||||||
if (systemConfig.requestConfig.encryptRequest && encryptRequest) {
|
if (systemConfig.requestConfig.encryptRequest && encryptRequest) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue