Prechádzať zdrojové kódy

feat: 网络请求进行中不黑屏

任一存 4 rokov pred
rodič
commit
1765f1266a
1 zmenil súbory, kde vykonal 0 pridanie a 23 odobranie
  1. 0 23
      src/utils/request.js

+ 0 - 23
src/utils/request.js

@@ -13,7 +13,6 @@ import { base64ToBlob } from "./file";
 import { checkLogin } from "@/api";
 import { LoginDetector } from "@/utils/starter";
 import { $alert, $loginTips } from "@/components/shared/message";
-import { $waiting } from "@/components/shared/loading";
 
 let vue = new Vue();
 
@@ -187,20 +186,6 @@ $.ajaxSetup({
   },
   success: function() {},
   complete: function(data) {
-    // Post类型请求无论成功或失败都关闭等待提示
-    if (
-      this.type === "POST" &&
-      this.url.indexOf("manage/fodder/upload") == -1
-    ) {
-      let isLongpolling = "";
-      try {
-        isLongpolling = JSON.parse(this.data).islongpolling;
-      } catch (error) {
-        error;
-      }
-      http.__loading && !isLongpolling && $waiting.hide();
-    }
-
     http.__loading = true;
   },
 });
@@ -346,10 +331,6 @@ export const http = {
    * @param {Function?} fail 失败回调
    */
   post(url, data = {}, done, fail) {
-    if (url.indexOf("isLogin") == -1) {
-      http.__loading && $waiting.show();
-    }
-
     return this.__request($.post(url, data), "post", url, data, done, fail);
   },
   /**
@@ -360,7 +341,6 @@ export const http = {
    * @param {Function?} fail 失败回调
    */
   postJson(url, data = {}, done, fail) {
-    http.__loading && !data.islongpolling && $waiting.show();
     return this.__request(
       $.ajax({
         type: "POST",
@@ -412,9 +392,6 @@ export const http = {
         fail
       );
     } else {
-      if (url.indexOf("manage/fodder/upload") == -1) {
-        http.__loading && $waiting.show();
-      }
       return this.__request(
         $.ajax({
           type: "POST",