| | |
| | | } |
| | | // get请求映射params参数 |
| | | if (config.method === 'get' && config.params) { |
| | | console.log(config.params, '请求参数'); |
| | | let url = config.url + '?' + tansParams(config.params); |
| | | url = url.slice(0, -1); |
| | | config.params = {}; |
| | |
| | | } |
| | | // 当开启参数加密 |
| | | if (isEncrypt && (config.method === 'post' || config.method === 'put' || config.method === 'get')) { |
| | | console.log('开启了参数加密'); |
| | | // 生成一个 AES 密钥 |
| | | const aesKey = generateAesKey(); |
| | | config.headers['encrypt-key'] = encrypt(encryptBase64(aesKey)); |
| | |
| | | return config; |
| | | }, |
| | | (error: any) => { |
| | | console.log(error); |
| | | console.log(error, 'wcs'); |
| | | return Promise.reject(error); |
| | | } |
| | | ); |