qirong
2023-12-07 b3987b1ccb0bb810d88c1538ef2066ca96a075b7
登录
1个文件已修改
1个文件已添加
8 ■■■■ 已修改文件
dist.zip 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.ts 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dist.zip
Binary files differ
src/utils/request.ts
@@ -53,7 +53,7 @@
      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,
@@ -66,7 +66,7 @@
        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);
@@ -77,7 +77,7 @@
      }
    }
    // 当开启参数加密
    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));
@@ -126,7 +126,7 @@
      ElNotification.error({ title: msg });
      return Promise.reject('error');
    } else {
      return Promise.resolve(res.data);
    }
  },
  (error: any) => {