浏览代码

上传文件数量限制10个

laiguoran 5 年之前
父节点
当前提交
39196211f2
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      app/public/js/global.js

+ 5 - 0
app/public/js/global.js

@@ -223,6 +223,11 @@ const postDataCompress = function (url, data, successCallback, errorCallBack, ht
  */
  */
 const postDataWithFile = function (url, formData, successCallback, errorCallBack, showWaiting = true) {
 const postDataWithFile = function (url, formData, successCallback, errorCallBack, showWaiting = true) {
     if (showWaiting) showWaitingView();
     if (showWaiting) showWaitingView();
+    if (formData.getAll('file[]').length > 10) {
+        toastr.error('文件数量不能多于10个');
+        if (showWaiting) closeWaitingView();
+        return
+    }
     $.ajax({
     $.ajax({
         type:"POST",
         type:"POST",
         url: url,
         url: url,