| | |
| | | config.url = url; |
| | | } |
| | | |
| | | if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { |
| | | if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put' || config.method === 'get')) { |
| | | const requestObj = { |
| | | url: config.url, |
| | | data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, |
| | |
| | | const s_url = sessionObj.url; // 请求地址 |
| | | const s_data = sessionObj.data; // 请求数据 |
| | | const s_time = sessionObj.time; // 请求时间 |
| | | const interval = 600000; // 间隔时间(ms),小于此时间视为重复提交 |
| | | const interval = 500; // 间隔时间(ms),小于此时间视为重复提交 |
| | | if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { |
| | | const message = '数据正在处理,请勿重复提交'; |
| | | console.warn(`[${s_url}]: ` + message); |
| | |
| | | } |
| | | } |
| | | // 当开启参数加密 |
| | | if (isEncrypt && (config.method === 'post' || config.method === 'put')) { |
| | | if (isEncrypt && (config.method === 'post' || config.method === 'put' || config.method === 'get')) { |
| | | // 生成一个 AES 密钥 |
| | | const aesKey = generateAesKey(); |
| | | config.headers['encrypt-key'] = encrypt(encryptBase64(aesKey)); |
| | |
| | | ElNotification.error({ title: msg }); |
| | | return Promise.reject('error'); |
| | | } else { |
| | | |
| | | return Promise.resolve(res.data); |
| | | } |
| | | }, |
| | | (error: any) => { |