Browse Source

接口添加字段

wyq 4 years ago
parent
commit
1fea01efd7
4 changed files with 22 additions and 18 deletions
  1. 2 2
      src/js/cdss.js
  2. 1 1
      src/js/promise.js
  3. 18 13
      src/js/staticInfo.js
  4. 1 2
      src/js/staticInfoOut.js

+ 2 - 2
src/js/cdss.js

@@ -179,12 +179,12 @@ function moreInfo() {
   $('.infoImg').off("click").click(function(){
     const name = $(this).parent().attr('data-name')
     const type = $(this).parent().attr('data-type')
-    openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
+    openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&mrId=${encodeURIComponent(mrId)}`)
   })
   $('.pushItemName').off("click").click(function () {
     const name = $(this).parent().attr('data-name')
     const type = $(this).parent().attr('data-type')
-    openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&page=1`)
+    openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&page=1&mrId=${encodeURIComponent(mrId)}`)
   })
 }
 

+ 1 - 1
src/js/promise.js

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

+ 18 - 13
src/js/staticInfo.js

@@ -31,7 +31,8 @@ function getInfomation() {
     "type": getUrlArgObject('type'),
     "name": getUrlArgObject('name'),
     "position": getUrlArgObject('position'),
-    "contentTypes": [1, 2, 3]
+    "contentTypes": [1, 2, 3],
+    "mrId": getUrlArgObject('mrId')
   };
   showName = param.name
   $(".tabBox .title").html(showName);
@@ -113,15 +114,18 @@ function renderContent(list, contentWrapClassName) {
 
 function renderContentscale(list, contentWrapClassName, name) {
   var pushInfo = []
-  anchors = '<li><i></i><a href="#' + contentWrapClassName +
-    '">' + name + '</a></li><li class="anchor-line"></li>';
+  // anchors = '<li><i></i><a href="#' + contentWrapClassName +
+  //   '">' + name + '</a></li><li class="anchor-line"></li>';
   str = '<p class="scaletitle">' + name + '</p>'
   $(`.${contentWrapClassName} .infos .infos-box`).append(str);
-  $(`.${contentWrapClassName} .anchors ul`).append(anchors);
+  // $(`.${contentWrapClassName} .anchors ul`).append(anchors);
   for (var i = 0; i < list[0].detailList.length; i++) {
     var item = list[0].detailList[i];
-    console.log(item)
+    
     if (item.textType == 11) {
+      anchors = '<li><i></i><a href="#' + contentWrapClassName + i +
+        '">' + item.content + '</a></li><li class="anchor-line"></li>';
+      
       item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
       str = '<div class="infoBox scaleBox" data-id="' + item.id + '"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
         '">'
@@ -129,15 +133,16 @@ function renderContentscale(list, contentWrapClassName, name) {
       str += '</h2></div>'
       str = `<div class="infoWrapper">${str}</div>`
       $(`.${contentWrapClassName} .infos .infos-box`).append(str);
+      $(`.${contentWrapClassName} .anchors ul`).append(anchors);
       for (var j = 0; j < item.subList.length; j++) {
         var items = item.subList[j];
         for (var k = 0; k < items.detailList.length; k++) {
           var it = items.detailList[k];
           it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
           str = '<div class="contentList" data-id="' + it.parentId + '"><div class="item-list">';
-          if (it.selectType == 1) {
+          if (it.selectType == 2) {
             str += '<p class="item-title">' + it.content + '</p>'
-          } else if (it.selectType == 2) {
+          } else if (it.selectType == 1) {
             str += '<p class="item-titles">' + it.content + '</p>'
           }
 
@@ -149,13 +154,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 == 1 && item.resultType == 1) {
-              str += '<label><input class="radio_type" type="checkbox" name="scale' + its.parentId + '" value="' + its.score + '"/>'
+              str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + its.score + '"/>'
             } else if (it.selectType == 2 && item.resultType == 1) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.score + '" />'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.score + '" />'
             } else if (it.selectType == 1 && item.resultType == 2) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + its.result + '"/>'
-            } else if (it.selectType == 2 && item.resultType == 2) {
               str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + its.result + '"/>'
+            } else if (it.selectType == 2 && item.resultType == 2) {
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + its.result + '"/>'
             }
             str += its.content
             if (item.resultType == 1) {
@@ -309,7 +314,7 @@ function getResult(pushInfo) {
         for (var i = 0; i < pushInfo.length; i++) {
           if (pushInfo[i].content.max >= num >= pushInfo[i].content.min) {
             if (tmp) {
-              result = pushInfo[i].result + ',' + tmp
+              result = pushInfo[i].result + ';' + tmp
             } else {
               result = pushInfo[i].result
             }
@@ -331,7 +336,7 @@ function getResult(pushInfo) {
       $(".result").css('display', 'block')
       $(".foot").css('display', 'block')
     } else {
-      Toast('温馨提示:必填选项不能为空~', 500)
+      Toast('温馨提示:必填选项不能为空~', 500000)
     }
   })
 

+ 1 - 2
src/js/staticInfoOut.js

@@ -360,14 +360,13 @@ function getResult(pushInfo) {
         for (var i = 0; i < pushInfo.length; i++) {
           if (pushInfo[i].content.max >= num >= pushInfo[i].content.min) {
             if (tmp) {
-              result = pushInfo[i].result + ',' + tmp
+              result = pushInfo[i].result + ';' + tmp
             } else {
               result = pushInfo[i].result
             }
           }
         }
       } else {
-        console.log(11)
         result = tmp
       }