浏览代码

loading遮罩调整

maixinrong 5 年之前
父节点
当前提交
972a94467c
共有 1 个文件被更改,包括 80 次插入43 次删除
  1. 80 43
      app/public/js/global.js

+ 80 - 43
app/public/js/global.js

@@ -227,7 +227,7 @@ const postDataWithFile = function (url, formData, successCallback, errorCallBack
         type:"POST",
         url: url,
         data: formData,
-        dataType: 'json',
+        dataType: 'json', 
         cache: false,
         // 告诉jQuery不要去设置Content-Type请求头
         contentType: false,
@@ -300,51 +300,88 @@ function closeWaitingView() {
         if(msgDiv != null){
             document.body.removeChild(msgDiv);
         }
-    }, Math.max(beginWaitingTime - time + 1000, 0));
+    }, Math.max(beginWaitingTime - time + 500, 0));
 }
 //显示等待窗口
 function showWaitingView() {
-    bShowWaiting = true;
-    setTimeout(function () {
-        if (!bShowWaiting) return;
-        beginWaitingTime = parseInt(new Date());
-        var msgw = 300; //提示窗口的宽度
-        var msgh = 100; //提示窗口的高度
-
-        var sWidth, sHeight;
-        sWidth = document.body.clientWidth;
-        sHeight = document.body.clientHeight;
-
-        //背景遮罩层div
-        var bgObj = document.createElement("div");
-        bgObj.setAttribute('id', 'bgDiv');
-        bgObj.style.zIndex = '9998';
-        bgObj.style.position = "absolute";
-        bgObj.style.top = "0px";
-        bgObj.style.background = "#888";
-        bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
-        bgObj.style.opacity = "0.6";
-        bgObj.style.left = "0px";
-        bgObj.style.width = sWidth + "px";
-        bgObj.style.height = sHeight + "px";
-        document.body.appendChild(bgObj);
-
-        //信息提示层div
-        var msgObj = document.createElement("div");
-        msgObj.style.zIndex = '9999';
-        msgObj.setAttribute("id", "msgDiv");
-        msgObj.setAttribute("align", "center");
-        msgObj.style.position = "absolute";
-        msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
-        msgObj.style.width = msgw + "px";
-        msgObj.style.height = msgh + "px";
-        msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
-        msgObj.style.left = (sWidth - msgw) / 2 + "px";
-        document.body.appendChild(msgObj);
-
-        //中间等待图标
-        document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
-    }, 1000);
+    // bShowWaiting = true;
+    // setTimeout(function () {
+    //     if (!bShowWaiting) return;
+    //     beginWaitingTime = parseInt(new Date());
+    //     var msgw = 300; //提示窗口的宽度
+    //     var msgh = 100; //提示窗口的高度
+    //
+    //     var sWidth, sHeight;
+    //     sWidth = document.body.clientWidth;
+    //     sHeight = document.body.clientHeight;
+    //
+    //     //背景遮罩层div
+    //     var bgObj = document.createElement("div");
+    //     bgObj.setAttribute('id', 'bgDiv');
+    //     bgObj.style.zIndex = '9998';
+    //     bgObj.style.position = "absolute";
+    //     bgObj.style.top = "0px";
+    //     bgObj.style.background = "#888";
+    //     bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
+    //     bgObj.style.opacity = "0.6";
+    //     bgObj.style.left = "0px";
+    //     bgObj.style.width = sWidth + "px";
+    //     bgObj.style.height = sHeight + "px";
+    //     document.body.appendChild(bgObj);
+    //
+    //     //信息提示层div
+    //     var msgObj = document.createElement("div");
+    //     msgObj.style.zIndex = '9999';
+    //     msgObj.setAttribute("id", "msgDiv");
+    //     msgObj.setAttribute("align", "center");
+    //     msgObj.style.position = "absolute";
+    //     msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
+    //     msgObj.style.width = msgw + "px";
+    //     msgObj.style.height = msgh + "px";
+    //     msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
+    //     msgObj.style.left = (sWidth - msgw) / 2 + "px";
+    //     document.body.appendChild(msgObj);
+    //
+    //     //中间等待图标
+    //     document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
+    // }, 1000);
+    beginWaitingTime = parseInt(new Date());
+    var msgw = 300; //提示窗口的宽度
+    var msgh = 100; //提示窗口的高度
+
+    var sWidth, sHeight;
+    sWidth = document.body.clientWidth;
+    sHeight = document.body.clientHeight;
+
+    //背景遮罩层div
+    var bgObj = document.createElement("div");
+    bgObj.setAttribute('id', 'bgDiv');
+    bgObj.style.zIndex = '9998';
+    bgObj.style.position = "absolute";
+    bgObj.style.top = "0px";
+    // bgObj.style.background = "#888";
+    bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
+    bgObj.style.opacity = "0.6";
+    bgObj.style.left = "0px";
+    bgObj.style.width = sWidth + "px";
+    bgObj.style.height = sHeight + "px";
+    document.body.appendChild(bgObj);
+
+    //信息提示层div
+    var msgObj = document.createElement("div");
+    msgObj.style.zIndex = '9999';
+    msgObj.setAttribute("id", "msgDiv");
+    msgObj.setAttribute("align", "center");
+    msgObj.style.position = "absolute";
+    msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
+    msgObj.style.width = msgw + "px";
+    msgObj.style.height = msgh + "px";
+    msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
+    msgObj.style.left = (sWidth - msgw) / 2 + "px";
+    document.body.appendChild(msgObj);
+
+    //中间等待图标
+    document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
 }
 
 let progressInterval;