Luolei преди 6 години
родител
ревизия
f5400f3443
променени са 10 файла, в които са добавени 76 реда и са изтрити 190 реда
  1. 0 5
      .babelrc
  2. 1 22
      src/html/disclaimer.html
  3. 0 22
      src/html/drugInfo.html
  4. 4 6
      src/html/index.html
  5. 0 24
      src/html/information.html
  6. 1 22
      src/html/page.html
  7. 1 69
      src/html/scale.html
  8. 3 3
      src/js/indexDom.js
  9. 61 16
      src/js/popup.js
  10. 5 1
      webpack.config.js

+ 0 - 5
.babelrc

@@ -1,5 +0,0 @@
-
-{
-  "presets": ["@babel/preset-env"],
-  "plugins": ["@babel/plugin-transform-runtime"]
-}

+ 1 - 22
src/html/disclaimer.html

@@ -38,28 +38,7 @@
       padding: 0 30px 40px;
     }
   </style>
-  <!-- <script>
-    if (!Function.prototype.bind) {
-      Function.prototype.bind = function (oThis) {
-        if (typeof this !== "function") {
-          throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
-        }
-        var aArgs = Array.prototype.slice.call(arguments, 1),
-          fToBind = this,
-          fNOP = function () {},
-          fBound = function () {
-            return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
-              aArgs.concat(Array.prototype.slice.call(arguments)));
-          };
-        fNOP.prototype = this.prototype;
-        fBound.prototype = new fNOP();
-        return fBound;
-      };
-    }
-  </script> -->
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-shim.min.js"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
 </head>
 
 <body>

+ 0 - 22
src/html/drugInfo.html

@@ -102,7 +102,6 @@
       height: 15px;
       width: 0;
       border-left: 2px solid #ccc;
-      /* background-color: #ccc; */
     }
 
     .anchors .anchor-line:last-child {
@@ -148,28 +147,7 @@
       color: #33475f
     }
   </style>
-  <!-- <script>
-    if (!Function.prototype.bind) {
-      Function.prototype.bind = function (oThis) {
-        if (typeof this !== "function") {
-          throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
-        }
-        var aArgs = Array.prototype.slice.call(arguments, 1),
-          fToBind = this,
-          fNOP = function () {},
-          fBound = function () {
-            return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
-              aArgs.concat(Array.prototype.slice.call(arguments)));
-          };
-        fNOP.prototype = this.prototype;
-        fBound.prototype = new fNOP();
-        return fBound;
-      };
-    }
-  </script> -->
   <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
-  <script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
-  <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-shim.min.js"></script>
 </head>
 
 <body>

Файловите разлики са ограничени, защото са твърде много
+ 4 - 6
src/html/index.html


+ 0 - 24
src/html/information.html

@@ -102,7 +102,6 @@
       height: 15px;
       width: 0;
       border-left: 2px solid #ccc;
-      /* background-color: #ccc; */
     }
 
     .anchors .anchor-line:last-child {
@@ -148,28 +147,7 @@
       color: #000
     }
   </style>
-  <!-- <script>
-    if (!Function.prototype.bind) {
-      Function.prototype.bind = function (oThis) {
-        if (typeof this !== "function") {
-          throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
-        }
-        var aArgs = Array.prototype.slice.call(arguments, 1),
-          fToBind = this,
-          fNOP = function () {},
-          fBound = function () {
-            return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
-              aArgs.concat(Array.prototype.slice.call(arguments)));
-          };
-        fNOP.prototype = this.prototype;
-        fBound.prototype = new fNOP();
-        return fBound;
-      };
-    }
-  </script> -->
     <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-shim.min.js"></script>
 </head>
 
 <body>
@@ -182,8 +160,6 @@
       </div>
     </div>
   </div>
-  <!-- <script src="./js/jquery-1.9.1.min.js"></script>
-<script src="./js/information.js"></script> -->
 </body>
 
 </html>

+ 1 - 22
src/html/page.html

@@ -6,28 +6,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title><%= htmlWebpackPlugin.options.title %></title>
-  <!-- <script>
-    if (!Function.prototype.bind) {
-      Function.prototype.bind = function (oThis) {
-        if (typeof this !== "function") {
-          throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
-        }
-        var aArgs = Array.prototype.slice.call(arguments, 1),
-          fToBind = this,
-          fNOP = function () {},
-          fBound = function () {
-            return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
-              aArgs.concat(Array.prototype.slice.call(arguments)));
-          };
-        fNOP.prototype = this.prototype;
-        fBound.prototype = new fNOP();
-        return fBound;
-      };
-    }
-  </script> -->
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-shim.min.js"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
 </head>
 
 <body>

+ 1 - 69
src/html/scale.html

@@ -118,28 +118,7 @@
       box-sizing: border-box;
     }
   </style>
-  <!-- <script>
-    if (!Function.prototype.bind) {
-      Function.prototype.bind = function (oThis) {
-        if (typeof this !== "function") {
-          throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
-        }
-        var aArgs = Array.prototype.slice.call(arguments, 1),
-          fToBind = this,
-          fNOP = function () {},
-          fBound = function () {
-            return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
-              aArgs.concat(Array.prototype.slice.call(arguments)));
-          };
-        fNOP.prototype = this.prototype;
-        fBound.prototype = new fNOP();
-        return fBound;
-      };
-    }
-  </script> -->
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.2/es6-shim.min.js"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
 </head>
 
 <body>
@@ -148,53 +127,6 @@
     <div class="content"></div>
 
   </div>
-
-  <!-- <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
-  <script type="text/javascript">
-    $(function(){
-      // 从地址栏获取参数,请求量表内容
-      function GetQueryString(name){     
-        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");     
-        var r = window.location.search.substr(1).match(reg);     
-        if(r!=null)return  unescape(r[2]); return null;
-      }
-
-      var scaleInfo;
-      var id = GetQueryString('id') || 40744;
-      var name = GetQueryString('name') || "密西根糖尿病周围神经病评分(MDNS)";
-      var url = "http://192.168.2.236:5050/api/icss/push/pushInner";
-      // 用GetQueryString方法从地址栏获取参数,暂时写死
-      var params = {
-        "age":28,
-        "featureType":'21',
-        "scaleId":id,
-        "scaleName":name,
-        "sex":1,
-        "diag": "肺结核(复诊); ",
-        "lis":[]
-      }
-      if(id){
-        $.ajax({
-          method:'post',
-          url:url,
-          data:JSON.stringify(params),
-          dataType:'json',
-          contentType:'application/json',
-          success:function(res){ 
-            if(res.code==0){
-              scaleInfo = res.data.scale;
-              console.log('量表数据为:',scaleInfo);
-            }
-          },
-          error:function(err){
-            console.log('请求失败:',err);
-          }
-        })
-      }
-
-    })
-      
-  </script> -->
 </body>
 
 </html>

+ 3 - 3
src/js/indexDom.js

@@ -37,7 +37,7 @@ function bqtsFun(data){//病情提示
         for(var v = 0;v < tmpBqDetail.content.result.length;v++){
           deepDetailResultStr+='<p class="result"><span class="calculateName">'+tmpBqDetail.content.result[v].name+':</span><span class="calculateResult"></span></p>'
         }
-        tmpBqDetailStr+='<div class="mayResult">计算公式结果:<span class="mayResultSelect">'+
+        tmpBqDetailStr+='<div class="mayResult">计算公式结果:<span class="mayResultSelect" data-num="'+k+'">'+
         '<span class="makesureResult">请选择</span>'+
         '<span class="sanjiao"></span>'+
         '<div class="popupModal">'+
@@ -63,7 +63,7 @@ function bqtsFun(data){//病情提示
           var deepDetail = tmpBqDetail.content.details[n]
           deepDetailStr+='<li class="radioChecks"><i></i><span>'+deepDetail.detailName+'</span>'+(deepDetail.state == 1?"<a>(智能推荐)</a>":"")+'</li>'
         }
-        tmpBqDetailStr+='<div class="mayResult">可能结果:<span class="mayResultSelect"><span class="makesureResult">请选择</span><i class="sanjiao"></i>'+
+        tmpBqDetailStr+='<div class="mayResult">可能结果:<span class="mayResultSelect" data-num="'+k+'"><span class="makesureResult">请选择</span><i class="sanjiao"></i>'+
           '<div class="popupModal">'+
           '<div class="modalTitle">结果选择<i class="closeModal"></i></div>'+
           '<div class="modalMainOne">'+
@@ -73,7 +73,7 @@ function bqtsFun(data){//病情提示
           '</ul>'+
           '</div>'+
           '<div class="btnWrap clearfix">'+
-          '<button class="sureScore" data-type="3">确定</button>'+
+          '<button class="sureScore" data-type="3" data-num="'+k+'">确定</button>'+
           '</div>'+
           '</div>'+
           '</span></div>'

+ 61 - 16
src/js/popup.js

@@ -1,6 +1,7 @@
 const {post,config} = require('./promise.js');
 
-$(document).on('click',".radioChecks",function(){
+$(".conditionHintTips").on('click',".radioChecks",function(e){
+  e.stopPropagation()
   $(this).attr("data-select","select").children("i").css({
     "background":"url('../images/sex2.png') center center no-repeat"
   })
@@ -10,23 +11,69 @@ $(".conditionHintTips").on('click',".closeModal",function(e){
   e.stopPropagation()
   $(this).parents(".popupModal").css("display","none")
 })
+$(".conditionHintTips").on('click',".popupModal",function(e){
+  e.stopPropagation()
+})
 $(".conditionHintTips").on('click',".mayResultSelect",function(){
   $(".popupModal").css('display',"none")
   $(this).children(".popupModal").css('display',"block")
+  var that = $(this);
+  var numFlg = $(this).attr("data-num")
+  var tmpMoadlData = window.pushMessage[numFlg]
+  for(var i = 0;i<tmpMoadlData.details.length;i++){
+    var tmpPushMsgDetail = tmpMoadlData.details[i]
+    if(tmpPushMsgDetail.type == 2){
+      for(var m = 0;m < tmpPushMsgDetail.content.details.length;m++){
+        var tmpPushMsgDetailContentVal = tmpPushMsgDetail.content.details[m]
+        if(tmpPushMsgDetailContentVal.controlType == 0){
+          var domList = that.find(".caculateLis").children("li")
+          for(var n =0;n < tmpPushMsgDetailContentVal.details.length;n++){
+            if(tmpPushMsgDetailContentVal.details[n].state == 1){
+              domList.eq(n).attr("data-select","select").children("i").css({
+                "background":"url('../images/sex2.png') center center no-repeat"
+              })
+            }else{
+              domList.eq(n).attr("data-select","").children("i").css({
+                "background":"url('../images/sex1.png') center center no-repeat"
+              })
+            }
+          }
+        }
+        if(tmpPushMsgDetailContentVal.controlType == 2){
+          var domLis = that.find("input[type=text]").eq(m)
+          $(domLis).val(tmpPushMsgDetailContentVal.value)
+        }
+      }
+    }
+    if(tmpPushMsgDetail.type == 3){
+      for(var a = 0;a < tmpPushMsgDetail.content.details.length;a++){
+        var tmpPushMsgDetailContentValS = tmpPushMsgDetail.content.details[a]
+        var domList = that.find(".radioChecks")
+        for(var b = 0;b <domList.length;b++){
+          if(that.find(".makesureResult").html() == tmpPushMsgDetailContentValS.detailName){
+            domList.eq(a).attr("data-select","select").children("i").css({
+              "background":"url('../images/sex2.png') center center no-repeat"
+            })
+          }else{
+            domList.eq(a).attr("data-select","").children("i").css({
+              "background":"url('../images/sex1.png') center center no-repeat"
+            })
+          }
+        }
+      }
+    }
+  }
 })
 $(".conditionHintTips").on('click',".sureScore",function(e){
   e.stopPropagation()
-  if($(this).attr("data-type") == 2){
-    var tmpVal = $(this).parents(".mayResultSelect").find(".calculateResult:last").html()
-    tmpVal && $(this).parents(".mayResultSelect").find(".makesureResult").html(tmpVal)
-  }
   if($(this).attr("data-type") == 3){
     var tempVal = $(this).parents(".mayResultSelect").find(".radioChecks[data-select='select'] span").html()
     tempVal && $(this).parents(".mayResultSelect").find(".makesureResult").html(tempVal)
   }
   $(this).parents(".popupModal").css('display',"none")
 })
-$(".conditionHintTips").on('click','.calculate',function(){
+$(".conditionHintTips").on('click','.calculate',function(e){
+  e.stopPropagation()
   var that = $(this)
   var numFlg = that.attr("data-num")
   var tmpMoadlData = window.pushMessage[numFlg]
@@ -39,7 +86,7 @@ $(".conditionHintTips").on('click','.calculate',function(){
       paramsJson = tmpPushMsgDetail;
       for(var m = 0;m < tmpPushMsgDetail.content.details.length;m++){
         var tmpPushMsgDetailContentVal = tmpPushMsgDetail.content.details[m]
-        if(tmpPushMsgDetailContentVal.controlType == 1){
+        if(tmpPushMsgDetailContentVal.controlType == 0){
           var domList = that.parent(".modalMainTwo").find(".caculateLis").children("li")
           for(var n =0;n < domList.length;n++){
             if($(domList[n]).attr("data-select")){
@@ -61,9 +108,9 @@ $(".conditionHintTips").on('click','.calculate',function(){
   }
   for(var s = 0;s < paramsJson.content.details.length;s++){
     if(paramsJson.content.details[s].controlType == 2 && paramsJson.content.details[s].value == ''){
-      that.parent().find(".calculateError").css("display","block")
-      that.parent().find(".calculateResult").html('')
-      return
+      that.parent().find(".calculateError").css("display","block");
+      that.parent().find(".calculateResult").html('');
+      return;
     }
   }
   post(config.calculate,resultParams).then((res)=>{
@@ -76,14 +123,12 @@ $(".conditionHintTips").on('click','.calculate',function(){
         var name = result.result[v].name
         var text = result.result[v].text
         deepDetailResultStr+='<p class="result"><span class="calculateName">'+name+':</span><span class="calculateResult">'+text+'</span></p>'
-        // for(var s = 0;s < tmpName.length;s++){
-        //   console.log(tmpName.eq(s).html().split(":")[0])
-        //   if(tmpName.eq(s).html().split(":")[0] == name){
-        //     tmpName.eq(s).next().html(result.result[v].text)
-        //   }
-        // }
       }
       $('.resultLis').html(deepDetailResultStr)
+      if($(".sureScore").attr("data-type") == 2){
+        var tmpVal = that.parents(".mayResultSelect").find(".calculateResult:last").html()
+        tmpVal && that.parents(".mayResultSelect").find(".makesureResult").html(tmpVal)
+      }
       that.parent().find(".calculateError").css("display","none")
     }else{
       console.log(res)

+ 5 - 1
webpack.config.js

@@ -162,6 +162,10 @@ module.exports = {
           'css-loader',
         ],
       },
+      // {
+      //   test: /\.less$/,
+      //   loader: 'less-loader' // 将 Less 编译为 CSS
+      // },
       {
         test: /\.less$/,
         use: ['style-loader', 'css-loader', 'less-loader']
@@ -180,7 +184,7 @@ module.exports = {
       },
     ]
   },
-  devtool: 'cheap-module-eval-source-map', //开发环境cheap-module-eval-source-map   //生产环境cheap-module-source-map
+  // devtool: 'cheap-module-eval-source-map', //开发环境cheap-module-eval-source-map   //生产环境cheap-module-source-map
   mode: 'development',
   devServer: {
     contentBase: path.join(__dirname, "dist"), //静态文件根目录