Browse Source

toast图片替换

wyq 4 năm trước cách đây
mục cha
commit
a3df14cd8a
5 tập tin đã thay đổi với 15 bổ sung19 xóa
  1. 0 1
      src/css/staticInfo.less
  2. BIN
      src/images/icon-warning.png
  3. 2 3
      src/js/promise.js
  4. 10 12
      src/js/staticInfo.js
  5. 3 3
      src/js/staticInfoOut.js

+ 0 - 1
src/css/staticInfo.less

@@ -390,7 +390,6 @@
   align-items: center;
   justify-content: flex-end;
   margin-bottom: 44px;
-  
   .but{
     width: 94px;
     height: 34px;

BIN
src/images/icon-warning.png


+ 2 - 3
src/js/promise.js

@@ -342,14 +342,13 @@ const titleConfigH = {
 const Toast = function (msg, duration,type) {
   duration = isNaN(duration) ? 3000 : duration;
   var m = document.createElement('div');
-  console.log(type)
   if(type == 'warn'){
     m.innerHTML = `<img class="warn" style="margin-right:14px" src=${warn} />` + msg;
   }else if(type == 'success'){
-    m.innerHTML = `<img class="warn" style="margin-right:14px" src=${success} />` + msg;
+    m.innerHTML = `<img class="warn" style="width:32px;margin-right:14px" src=${success} />` + msg;
   }
   
-  m.style.cssText = "display:flex;align-items:center;max-width:60%;min-width: 150px;padding:10px 14px;height: 30px;color: #fff;line-height: 30px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: #333;font-size: 16px;";
+  m.style.cssText = "display:flex;align-items:center;padding:25px 14px;height: 30px;color: #fff;line-height: 30px;text-align: center;border-radius: 8px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: #333;font-size: 16px;";
   $('.warn').css('margin-top','10px')
   document.body.appendChild(m);
   setTimeout(function () {

+ 10 - 12
src/js/staticInfo.js

@@ -15,8 +15,7 @@ const {
   config,
   getUrlArgObject,
   openNewWin,
-  Toast,
-  Toasts
+  Toast
 } = require('./promise.js');
 const $ = require("jquery");
 require("./jquery-migrate");
@@ -248,7 +247,6 @@ function getcheck() {
       $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
       if (isclick) {
         getchecks()
-        console.log(11)
         $(".score").html('');
         $(".result_title").html('');
         $(".result").css('display', 'none')
@@ -288,7 +286,7 @@ function copy(name) {
   $(".copy").click(function () {
     var texts = document.getElementById("result_title").innerText;
     if (texts == '') {
-      Toast('结果为空,无法复制', 500)
+      Toast('结果为空,无法复制', 500, 'warn')
       return
     }
     var inputs = document.getElementById("inputs");
@@ -296,10 +294,10 @@ function copy(name) {
     console.log(inputs.value)
     inputs.select(); // 选中文本
     document.execCommand("copy"); // 执行浏览器复制命令
-    Toast('复制成功', 500)
-    setTimeout(() => {
-      window.close()
-    }, 500)
+    Toast('复制成功', 500000000, 'success')
+    // setTimeout(() => {
+    //   window.close()
+    // }, 500)
 
   })
 
@@ -328,6 +326,7 @@ function getResult(pushInfo, textType) {
     let result
     let key = false
     let proposal = ''
+    isclick = true
     $(".contentList").each(function (i) {
       if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
         $(this).find(".item-title").addClass('chColor');
@@ -341,7 +340,6 @@ function getResult(pushInfo, textType) {
       }
     });
     if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
-      isclick = true
       $('input[type="radio"]:checked').each(function () {
         if (!isNaN($(this).val())) {
           num += parseFloat($(this).val())
@@ -359,7 +357,6 @@ function getResult(pushInfo, textType) {
       });
       
       if (multarr.join("、")){
-        console.log(1)
         arr.push(multname + multarr.join("、"))
       }
       console.log(arr)
@@ -367,16 +364,17 @@ function getResult(pushInfo, textType) {
       if (pushInfo.length > 0) {
         for (var i = 0; i < pushInfo.length; i++) {
           if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min) {
+            console.log(pushInfo[i])
             if (tmp) {
               result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
               proposal = pushInfo[i].pushInfo
-              
             } else {
               result = pushInfo[i].result + '(' + num + '分' + ')'
               proposal = pushInfo[i].pushInfo
             }
           } else {
             if (tmp) {
+              console.log(123)
               result = tmp
             }
           }
@@ -406,7 +404,7 @@ function getResult(pushInfo, textType) {
         $(".foot").css('display', 'block')
       }
     } else {
-      Toasts('温馨提示:必填选项不能为空~')
+      Toast('温馨提示:必填选项不能为空~', 50000000, 'warn')
     }
   })
   $(".printing").hover(

+ 3 - 3
src/js/staticInfoOut.js

@@ -347,7 +347,7 @@ function copy(name) {
   $(".copy").click(function () {
     var texts = document.getElementById("result_title").innerText;
     if (texts == '') {
-      Toast('结果为空,无法复制', 500)
+      Toast('结果为空,无法复制', 500, 'warn')
       return
     }
     var inputs = document.getElementById("inputs");
@@ -355,7 +355,7 @@ function copy(name) {
     console.log(inputs.value)
     inputs.select(); // 选中文本
     document.execCommand("copy"); // 执行浏览器复制命令
-    Toast('复制成功', 500)
+    Toast('复制成功', 500, 'success')
     setTimeout(() => {
       window.close()
     }, 500)
@@ -465,7 +465,7 @@ function getResult(pushInfo, textType) {
         $(".foot").css('display', 'block')
       }
     } else {
-      Toasts('温馨提示:必填选项不能为空~')
+      Toasts('温馨提示:必填选项不能为空~', 500, 'warn')
     }
   })
   $(".printing").hover(