wyq 4 tahun lalu
induk
melakukan
cc65172786
3 mengubah file dengan 43 tambahan dan 35 penghapusan
  1. 33 28
      src/css/staticInfo.less
  2. 1 1
      src/js/promise.js
  3. 9 6
      src/js/staticInfo.js

+ 33 - 28
src/css/staticInfo.less

@@ -239,6 +239,8 @@
     background-color: #F5F6F7;
     background: url('../images/icon_current.png');
     background-repeat: no-repeat;
+    background-position-x: center;
+    background-position-y: center;
   }
   .disCopy {
     -webkit-touch-callout: none;
@@ -394,21 +396,20 @@
   }
 }
 .scalebot{
-  display: flex;
-  align-items: center;
-  justify-content: flex-end;
   margin-bottom: 44px;
+  text-align: right;
+  overflow: hidden;
   .but{
     width: 94px;
     height: 34px;
     background: #FFFFFF;
     border-radius: 8px;
-    
     border: 1px solid #2A9BD5;
     font-size: 16px;
     font-weight: 400;
     color: #2A9BD5;
     margin-right: 9px;
+    float: right;
   }
   .score{
     font-size: 16px;
@@ -416,12 +417,13 @@
     color: #333333;
     margin-right: 30px;
     display: none;
+    float: right;
+    line-height: 34px;
   }
 }
 .result{
   background: #EDFAFF;
   border-radius: 10px;
-  
   font-size: 14px;
   font-weight: 500;
   color: #333333;
@@ -429,47 +431,50 @@
   margin: 0 75px;
   text-align: center;
   .result_box{
-    display: flex;
-    justify-content: center;
     padding:25px 56px;
-    .hel{
-      width: 21px;
-      height: 21px;
-      background: #2C96E5;
-      border-radius: 50%;
-      
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      color: #fff;
-      margin-right: 9px;
-      font-size: 12px;
+    overflow: hidden;
+    position: relative;
+    .result_left{
+      display: inline-block;
+      position: absolute;
+      .hel{
+        background: #2C96E5;
+        border-radius: 50%;
+        color: #fff;
+        margin-right: 9px;
+        font-size: 12px;
+        vertical-align: middle;
+      }
+    }
+    .result_title{
+      max-width: 85%;
+      display: inline-block;
+      margin-left: 65px;
     }
   }
   
 }
-.result_title{
-  max-width: 85%;
-}
+
 .foot{
   margin-bottom: 20px;
   margin-top: 40px;
   display: none;
+  overflow: hidden;
   .foot_box{
-    display: flex;
-    justify-content: center;
+    width: 300px;
+    margin: auto;
     .printing{
-      display: flex;
-      align-items: center;
+      float: left;
       width: 94px;
       height: 32px;
       background: #FFFFFF;
       border-radius: 4px;
-      
       border: 1px solid #333333;
       cursor: pointer;
+      line-height: 32px;
       & img{
         margin: 0 12px 0 14px;
+        vertical-align: middle;
       }
     }
     .printing:hover{
@@ -482,7 +487,7 @@
       height: 32px;
       background: #FFFFFF;
       border-radius: 4px;
-      
+      float: left;
       border: 1px solid #333333;
       text-align: center;
       line-height: 32px;

+ 1 - 1
src/js/promise.js

@@ -348,7 +348,7 @@ const Toast = function (msg, duration,type) {
     m.innerHTML = `<img class="warn" style="width:32px;margin-right:14px" src=${success} />` + msg;
   }
   
-  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;";
+  m.style.cssText = "width:300px;margin-left:-150px;display:flex;vertical-align:middle;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 () {

+ 9 - 6
src/js/staticInfo.js

@@ -102,6 +102,7 @@ function renderContent(list, contentWrapClassName) {
     var divHeight = 0;
     for (var i = 0; i < list.length; i++) {
       divHeight = divHeight + parseInt($('#' + contentWrapClassName + i).css('height')) + parseInt($('#' + contentWrapClassName + i).parent().next().css('height')) + 20
+      
       if (divHeight > scrollTop) {
         var anchor = 2 * i;
         $(`.${contentWrapClassName} .anchors ul`).children().eq(anchor).addClass('active').siblings().removeClass('active');
@@ -163,7 +164,7 @@ function renderContentscale(list, contentWrapClassName, name) {
             }
             str += its.content
             if (item.resultType == 1) {
-              str += '<span class="num">' + '(' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + ')' + '</span>'
+              str += '<span class="num">' + its.score + '</span>'
             }
             str += '</label>'
             str += `${its.match == 1 ? `<img class="recommend" src=${recommend} />` : ``}</div>`
@@ -188,7 +189,7 @@ function renderContentscale(list, contentWrapClassName, name) {
   str = '<div class="scalebot">'
   str += '<button class="but">结果</button><p class="score"></p>'
   str += '</div>'
-  str += `<div class="result"><div class="result_box"><img src=${hel} class="hel"/><span>结果:</span><p id="result_title" class="result_title"></p><textarea id="inputs"></textarea></div></div>`
+  str += `<div class="result"><div class="result_box"><div class="result_left"><img src=${hel} class="hel"/><span>结果:</span></div><p id="result_title" class="result_title"></p><textarea id="inputs"></textarea></div></div>`
   str += `<div class="foot"><div class="foot_box"><div class="printing"><img src=${printing} class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
   $(`.${contentWrapClassName} .infos .infos-box`).append(str);
   // str = `<div class="foot"><div class="foot_box"><div class="printing"><img src=${printing} class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
@@ -213,6 +214,7 @@ function renderContentscale(list, contentWrapClassName, name) {
   getResult(pushInfo, textType)
   copy(name)
   getprinting()
+  
 }
 
 function getprinting() {
@@ -289,15 +291,15 @@ function copy(name) {
   $(".copy").click(function () {
     var texts = document.getElementById("result_title").innerText;
     if (texts == '') {
-      Toast('结果为空,无法复制', 500000000000, 'warn')
+      Toast('结果为空,无法复制', 500, 'warn')
       return
     }
     var inputs = document.getElementById("inputs");
-    inputs.value = name + '结果为' + texts; // 修改文本框的内容(赋值内容)
+    inputs.value = name + '结果为' + texts; // 修改文本框的内容(赋值内容)
     console.log(inputs.value)
     inputs.select(); // 选中文本
     document.execCommand("copy"); // 执行浏览器复制命令
-    Toast('复制成功', 50000000000, 'success')
+    Toast('复制成功', 500, 'success')
     setTimeout(() => {
       window.close()
     }, 500)
@@ -392,6 +394,7 @@ function getResult(pushInfo, textType) {
         $(".hel").attr({
           "title": proposal
         });
+        
         $(".result_title").html(result);
         if ($.inArray(13, textType) > 0) {
           $(".score").html('总分:' + num + '分');
@@ -402,7 +405,7 @@ function getResult(pushInfo, textType) {
         $(".foot").css('display', 'block')
       }
     } else {
-      Toast('温馨提示:必填选项不能为空~', 500000000000000, 'warn')
+      Toast('温馨提示:必填选项不能为空~', 500, 'warn')
     }
   })
   $(".printing").hover(