Ver código fonte

图片修改

1178232204@qq.com 3 anos atrás
pai
commit
3975dc73e4
2 arquivos alterados com 11 adições e 19 exclusões
  1. 0 4
      src/js/cdss.js
  2. 11 15
      src/js/util.js

+ 0 - 4
src/js/cdss.js

@@ -45,10 +45,6 @@ let more = require('./../images/more.png').replace(/^undefined/g, '')
 let up = require('./../images/icon-up.png').replace(/^undefined/g, '')
 let go = require('./../images/g1.png').replace(/^undefined/g, '')
 let down2 = require('./../images/d3.png').replace(/^undefined/g, '')
-let a = require('./../images/toast-1.png').replace(/^undefined/g, '')
-let b = require('./../images/toast-2.png').replace(/^undefined/g, '')
-let c = require('./../images/toast-3.png').replace(/^undefined/g, '')
-let d = require('./../images/toast-4.png').replace(/^undefined/g, '')
 let maydiagnoseList = [], hasdiagnoseList = [];
 let maydiagnoseType = false, hasdiagnoseType = false;
 

+ 11 - 15
src/js/util.js

@@ -70,24 +70,20 @@ function toggleWarnBox(text) {
          * time几毫秒秒后消失,可选,默认2000
          * 用法:$.toast('error','请求出错',3000);
          * ***/
-        "toast": function (type, text, time = 3000, name,i) {
+        "toast": function (type, text, time = 3000, name, i) {
             if ($('#toast:visible').length) {
                 $("#toast").remove()
+            };
+            const toast1 = require('./../images/toast-1.png').replace(/^undefined/g, '');
+            const toast2 = require('./../images/toast-2.png').replace(/^undefined/g, '');
+            const toast3 = require('./../images/toast-3.png').replace(/^undefined/g, '');
+            const toast4 = require('./../images/toast-4.png').replace(/^undefined/g, '');
+            if (type == 'toast1' || type == 'toast2') {
+                $(name).find(".box[data-index=" + i + "] ").find(".moduleCenter").append(`<img id="toast" class="toast" src=${toast1}/>`)
+            } else {
+                $(name).find(".moduleBox ").find(".pushItemBox[data-index=" + i + "] ").append(`<img id="toast" class="toast" src=${toast1}/>`)
             }
-            var typeClass = {
-                toast1: require('./../images/toast-1.png').replace(/^undefined/g, ''),
-                toast2: require('./../images/toast-2.png').replace(/^undefined/g, ''),
-                toast3: require('./../images/toast-3.png').replace(/^undefined/g, ''),
-                toast4: require('./../images/toast-4.png').replace(/^undefined/g, ''),
-              };
-              console.log(type);
-              if(type == 'toast1' || type == 'toast2'){
-                $(name).find(".box[data-index=" + i + "] ").find(".moduleCenter").append(`<img id="toast" class="toast" src=${typeClass[type]}/>`)
-              }else{
-                  console.log(123);
-                $(name).find(".moduleBox ").find(".pushItemBox[data-index=" + i + "] ").append(`<img id="toast" class="toast" src=${typeClass[type]}/>`)
-              }
-            
+
             $("#toast").fadeOut(time, function () {
                 $("#toast").remove()
             });