li.shaoyi 3 年之前
父節點
當前提交
3a1af31a49
共有 3 個文件被更改,包括 7 次插入13 次删除
  1. 1 1
      src/common/methods/request/resultInfo.ts
  2. 1 12
      src/common/setup/form/validateAction.ts
  3. 5 0
      src/utils/eventBus/index.ts

+ 1 - 1
src/common/methods/request/resultInfo.ts

@@ -46,7 +46,7 @@ export function commonResultInfo(fn: Promise<any>, sign: ResultInfo, loading: Re
  * @returns
  */
 export async function requestResultLoadingAndInfo(fn: any, param: any, loading: Ref<boolean>, messageInfo: [string, string] = ['成功', '失败'], isDefaultMsg = false) {
-    console.log('请求接口参数: ', param);
+    console.log('Proto请求参数: ', param);
     const [sucInfo, errInfo] = messageInfo
     loading.value = true;
     return new Promise((resolve, reject) => {

+ 1 - 12
src/common/setup/form/validateAction.ts

@@ -12,18 +12,7 @@ export function validateAction<T>(formRef: Ref<any>, formState: UnwrapRef<T>): P
         .validate()
         .then(() => {
             const param = toRaw(formState);
-            console.log('请求参数:', param);
-            if (timer) {
-                // 节流 2秒
-                const now = new Date().getTime()
-                if (now - timer > 2 * 1000) {
-                    timer = new Date().getTime()
-                    return param
-                }
-            } else {
-                timer = new Date().getTime()
-                return param
-            }
+            return param;
         })
         .catch((error: ValidateErrorEntity<T>) => {
             console.error('表单验证错误:', error);

+ 5 - 0
src/utils/eventBus/index.ts

@@ -70,4 +70,9 @@ export default new (class Bus {
             delete this.subscribe[enentType];
         }
     }
+
+    // 清空所有订阅
+    $clear() {
+        this.subscribe = {};
+    }
 })();