Browse Source

修改结果类型判断方法

wyq 3 years atrás
parent
commit
c1152c765e
3 changed files with 33 additions and 26 deletions
  1. 1 0
      src/css/informationOut.less
  2. 9 12
      src/js/informationOut.js
  3. 23 14
      src/js/staticInfo.js

+ 1 - 0
src/css/informationOut.less

@@ -228,6 +228,7 @@ div,li,span,i,p,h1,h2,h3,h4,h5,pre{
   background-repeat: no-repeat;
   background-position-x: center;
   background-position-y: center;
+  background-size: 18px 9px;
 }
   .disCopy {
     -webkit-touch-callout: none;

+ 9 - 12
src/js/informationOut.js

@@ -109,9 +109,7 @@ function showInfo(data,type) {
   //   "borderBottom": "4px solid  #E9E9E9",
   //   "padding": "0px 60px 50px 0px"
   // });
-  if(type == 1){
-    renderTab(detailList, scale)
-  }
+  renderTab(detailList, scale)
   staticKnowList&&renderContent(staticKnowList,'staticKnowledge')
   noticeInfo&&renderContent(noticeInfo,'notice')
   clinicalPathwayInfo&&renderContent(clinicalPathwayInfo,'clinicalPathway')
@@ -158,6 +156,7 @@ function renderContent(list, contentWrapClassName) {
     } else {
       str += item.title
     }
+    console.log(item)
     str += '</h2></div>' +
       '<div class="contentWrapper"><pre>' + item.content + '</pre><div></div>';
     str = `<div class="infoWrapper">${str}</div>`
@@ -520,6 +519,7 @@ function addLinkClickEvent(contentWrapClassName) {
 }
 
 function renderTab(detailList, scale) {
+  $(".tabList").html('')
   if (detailList['静态知识']) {
     $(".tabList").append(`<span class="tab" data-module="staticKnowledge" data-title="` + showName + `">静态知识</span>`)
   }
@@ -531,7 +531,7 @@ function renderTab(detailList, scale) {
     $(".tabList").append(`<span class="tab" data-module="notice" data-title="` + noticeName + `">注意事项</span>`)
     //$(".tabBox .title").html(noticeName);
   }
-  if (scale || getUrlArgObject('gauge') == 'gauge' || getUrlArgObject('type') == 8) {
+  if (!!scale && getUrlArgObject('type') == 8) {
     $(".tabList").append(`<span class="tab" data-module="scale" data-title="` + showName + `">评估内容</span>`)
     //$(".tabBox .title").html(noticeName);
   }
@@ -543,25 +543,22 @@ function renderTab(detailList, scale) {
     $(".tabList .tab").eq(0).addClass("activeTab")
     defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
   }
-  if (!scale || detailList['静态知识'] == undefined) {
-    $(".tabList .tab").eq(0).removeClass("activeTab")
-  }
   $(`.${defaultModuleName}`).css("display", "block")
   bindTabClick()
 }
 function bindTabClick(){
   $(".tabList .tab").on("click", function(){
     const moduleName = $(this).attr("data-module")
-    //const display = $(`.${moduleName}`).css("display")
+    const display = $(`.${moduleName}`).css("display")
       selectedTab=$('.tabList .tab').index(this);
-      $(".titleCont .title").html($(this).attr('data-title'));
-    //if(display == "none"){
+      // $(".titleCont .title").html($(this).attr('data-title'));
+    if(display == "none"){
       $(".activeTab").removeClass("activeTab")
       $(this).addClass("activeTab")
       $(".container").css("display","none")
       $(`.${moduleName}`).css("display","block")
       $(`.${moduleName} .infos`).scrollTop(0)
-    //}
+    }
   })
   $("#openWin").on("click", function () {
     const type = getUrlArgObject('type');
@@ -582,7 +579,7 @@ function adjustHeight() {
 function adjustWidth() {
   var wt = window.innerWidth || document.documentElement.clientWidth;
   $(".titleH2").width(wt - 0.2 * wt - 33 - 200 - 17 - 40 - 15 + 'px')
-  $(".content .infos").width(wt - 243 + 'px');
+  $(".content .infos").width(wt - 155 - 33 - 17 - 40 - 15 + 'px');
 }
 $(window).on('resize', function(){
   adjustHeight()

+ 23 - 14
src/js/staticInfo.js

@@ -153,13 +153,13 @@ function renderContentscale(list, contentWrapClassName, name) {
             its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
             str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
             if (it.selectType == 21 && item.resultType == 1) {
-              str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '"/>'
+              str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 22 && item.resultType == 1) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '"/>'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 21 && item.resultType == 2) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '"/>'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 22 && item.resultType == 2) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '"/>'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
             }
             str += its.content
             if (item.resultType == 1) {
@@ -373,7 +373,7 @@ function getResult(pushInfo, textType) {
     });
     if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
       $('input[type="radio"]:checked').each(function () {
-        if (!isNaN($(this).val())) {
+        if ($(this).attr("resultType") == 1) {
           num += parseFloat($(this).val())
         } else {
           arr.push($(this).attr("data_obj"))
@@ -381,23 +381,34 @@ function getResult(pushInfo, textType) {
         }
       });
       $('input[type="checkbox"]:checkbox:checked').each(function () {
-        if (!isNaN($(this).val())) {
+        if ($(this).attr("resultType") == 1) {
           num += parseFloat($(this).val())
         } else {
+          console.log($(this).attr("data_obj"))
           arr.push($(this).attr("data_obj"))
           proposals.push($(this).attr("proposal"))
-        }
+        } 
       });
+      console.log(arr)
       tmp = arr.join(";");
+      
       if (pushInfo.length > 0) {
         for (var i = 0; i < pushInfo.length; i++) {
           if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && !tmp) {
             result = pushInfo[i].result + '(' + num + '分' + ')'
-            proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
+            if (proposals.join(";")){
+              proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
+            }else{
+              proposal = pushInfo[i].pushInfo
+            }
             break
           } else if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && tmp) {
             result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
-            proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
+            if (proposals.join(";")) {
+              proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
+            } else {
+              proposal = pushInfo[i].pushInfo
+            }
             break
           } else {
             result = tmp
@@ -467,7 +478,8 @@ function renderTab(detailList, scale) {
     $(".tabList").append(`<span class="tab" data-module="notice" data-title="` + noticeName + `">注意事项</span>`)
     //$(".tabBox .title").html(noticeName);
   }
-  if (scale || getUrlArgObject('gauge') == 'gauge' || getUrlArgObject('type') == 8) {
+  if (!!scale && getUrlArgObject('type') == 8) {
+    console.log(1)
     $(".tabList").append(`<span class="tab" data-module="scale" data-title="` + showName + `">评估内容</span>`)
     //$(".tabBox .title").html(noticeName);
   }
@@ -479,9 +491,6 @@ function renderTab(detailList, scale) {
     $(".tabList .tab").eq(0).addClass("activeTab")
     defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
   }
-  if (!scale || detailList['静态知识'] == undefined){
-    $(".tabList .tab").eq(0).removeClass("activeTab")
-  }
   $(`.${defaultModuleName}`).css("display", "block")
   bindTabClick()
 }
@@ -515,7 +524,7 @@ function adjustHeight() {
 function adjustWidth() {
   var wt = window.innerWidth || document.documentElement.clientWidth;
   $(".titleH2").width(wt - 0.2 * wt - 33 - 200 - 17 - 40 - 15 + 'px')
-  $(".content .infos").width(wt - 243 + 'px');
+  $(".content .infos").width(wt - 210 - 33 - 17 - 40 - 15 + 'px');
 }
 $(window).on('resize', function () {
   adjustHeight()