dever 6 年之前
父节点
当前提交
f9e5d8950c
共有 1 个文件被更改,包括 19 次插入18 次删除
  1. 19 18
      assets/lib/layui/upload.js

+ 19 - 18
assets/lib/layui/upload.js

@@ -7,22 +7,23 @@ var showUploadType = 1;
 var showUploadCall = false;
 var showUploadThis = false;
 var showUploadIndex = false;
-var xhrOnProgress=function(fun) {
-	xhrOnProgress.onprogress = fun; //绑定监听
- //使用闭包实现监听绑
-	return function() {
-	//通过$.ajaxSettings.xhr();获得XMLHttpRequest对象
-		var xhr = $.ajaxSettings.xhr();
-		 //判断监听函数是否为函数
-		  if (typeof xhrOnProgress.onprogress !== 'function')
-		       return xhr;
-		   //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
-		    if (xhrOnProgress.onprogress && xhr.upload) {
-		          xhr.upload.onprogress = xhrOnProgress.onprogress;
-		    }
-		    return xhr;
-	}
-}
+//创建监听函数
+ var xhrOnProgress=function(fun) {
+    xhrOnProgress.onprogress = fun; //绑定监听
+     //使用闭包实现监听绑
+    return function() {
+        //通过$.ajaxSettings.xhr();获得XMLHttpRequest对象
+        var xhr = $.ajaxSettings.xhr();
+         //判断监听函数是否为函数
+          if (typeof xhrOnProgress.onprogress !== 'function')
+               return xhr;
+           //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
+            if (xhrOnProgress.onprogress && xhr.upload) {
+                  xhr.upload.onprogress = xhrOnProgress.onprogress;
+            }
+            return xhr;
+     }
+ }
 
 function showUpload(i,e,key,url,assets)
 {
@@ -157,12 +158,12 @@ function loadUpload(i,e,key,url,assets)
 			}
 			,choose: function(obj){
 				element.progress(id + '_progress', '0%')
-				//layer.load();
+				layer.load();
 			}
 			,done: function(data) {
 				element.progress(id + '_progress', '0%')
 				$('#' + id + '_progress').hide();
-				//layer.closeAll('loading');
+				layer.closeAll('loading');
 				if (data.status == 1) {
 					loadUploadSet(e,value,data);
 				} else {