zhouna 3 rokov pred
rodič
commit
4142b21222
1 zmenil súbory, kde vykonal 9 pridanie a 8 odobranie
  1. 9 8
      src/js/modal.js

+ 9 - 8
src/js/modal.js

@@ -7,9 +7,6 @@ const jQuery = require('jquery');
     let warn = require("../images/warn.png")
     let loadingImg = require("../images/loading.gif")
     $.alerModal = function (options) {
-      if($('.alertModal:visible').length){  //如果该弹窗已存在,则不再显示多个
-          return;
-      }
         var dft = {
             sureBtn: true,
             quiteBtn: false,
@@ -27,6 +24,13 @@ const jQuery = require('jquery');
             callback: null
         };
         var ops = $.extend(dft, options || {});
+        var popDom = $('.alertModal:visible');
+        if(ops.isFather){
+		  ops.fatherWrapper.find('.alertModal:visible');
+		}
+		if(popDom.length){  //如果该弹窗已存在,则不再显示多个
+		  return;
+		}
         var html = `
             <div class="alertModal">
                 <div class="modalBg"></div>
@@ -100,14 +104,11 @@ const jQuery = require('jquery');
             }, ops.time);
         }
         if (ops.callback && typeof ops.callback === 'function') {
-            $(document).on('click', ".alertModal .titlemodal img,.alertModal .quite", function () {
-                ops.callback();
-            })
-             $(document).on('click', ".alertModal .titlemodal img,.alertModal .gobackbtn ", function () {
+            $(parent.document||document).on('click', ".alertModal .titlemodal img,.alertModal .quite,.alertModal .gobackbtn", function () {
                 ops.callback();
             })
         } else {
-            $(document).on('click', ".alertModal .titlemodal img,.alertModal .quite", function () {
+            $(parent.document||document).on('click', ".alertModal .titlemodal img,.alertModal .quite,.alertModal .gobackbtn", function () {
                 box.remove();
             })
         }