Forráskód Böngészése

静态信息多条数据

zhangxc 5 éve
szülő
commit
f49423e403

+ 23 - 3
src/css/indexHorizontal.less

@@ -259,14 +259,18 @@
     overflow: hidden;
 }
 .tipsInfoBox {
-    margin: 10px 0 0 80px;
-    line-height: 30px;
+    margin: 10px 0 0 0px;
+    line-height: 20px;
     height: 180px;
     overflow-y: auto;
     img {
         display: none;
     }
 }
+.diagName {
+    height: 30px;
+    line-height: 30px;
+}
 .drugTreatmentInfoItemBox {
     .ellipse;
     height: 30px;
@@ -375,4 +379,20 @@ color: @grayColor;
     cursor: pointer;
     position: relative;
     margin: 10px 0 0 0;
-}
+}
+.tipsInfoItem{
+    position: relative;
+    // max-height: 60px;
+    overflow: hidden;
+}
+.hasMore:after{
+    content: "..."; 
+    position: absolute; 
+    bottom: 0; 
+    right: 0; 
+    padding-left: 20px;
+    background: -webkit-linear-gradient(left, transparent, #fff 55%);
+    background: -moz-linear-gradient(left, transparent, #fff 55%);
+    background: -o-linear-gradient(left, transparent, #fff 55%);
+    background: linear-gradient(to right, transparent, #fff 55%);
+}

+ 5 - 3
src/js/index.js

@@ -72,7 +72,9 @@ function getTreatment() {
 }
 
 function getTipsInfo() {
-  return post(config.information,{name:getUrlArgObject('tipsName'),type:getUrlArgObject('tipsType'), position: 1})
+  let tipsInfoList =  JSON.parse(getUrlArgObject('tipsInfoList')) || []
+  return post(config.informationMore, {conceptIntorduces:tipsInfoList})
+  // return post(config.information,{name:getUrlArgObject('tipsName'),type:getUrlArgObject('tipsType'), position: 1})
 }
 
 
@@ -83,7 +85,7 @@ function getPageInfo() {
     const configArr = res1&&res1.data&&res1.data.data || []
     const pushInfo = res2&&res2.data || {}
     const treatInfo = res3&&res3.data || {}
-    const tipsInfo = res4&&res4.data || {}
+    const tipsInfo = res4&&res4.data || []
     const confArr = transConf(configArr)
     pushResult = pushInfo.data || {};
     treatResult = treatInfo.data || {}
@@ -160,7 +162,7 @@ function getPageInfo() {
 function moreInfo() {
   $('.moreInfo').click(function(){
     const name = $(this).attr('data-name')
-    const type = getUrlArgObject('tipsType')
+    const type = $(this).attr('data-type')
     openNewWin(`information.html?type=${type}&position=0&name=${name}`)
   })
 }

+ 6 - 5
src/js/indexHorizontal.js

@@ -88,7 +88,9 @@ function getTreatment() {
 
 
 function getTipsInfo() {
-  return post(config.information,{name:getUrlArgObject('tipsName'),type:getUrlArgObject('tipsType'), position: 1})
+  let tipsInfoList =  JSON.parse(getUrlArgObject('tipsInfoList')) || []
+  return post(config.informationMore, {conceptIntorduces:tipsInfoList})
+  // return post(config.information,{name:getUrlArgObject('tipsName'),type:getUrlArgObject('tipsType'), position: 1})
 }
 
 function getPageInfo() {
@@ -96,7 +98,7 @@ function getPageInfo() {
     const configArr = res1&&res1.data&&res1.data.data || []
     const pushInfo = res2.data || {}
     const treatInfo = res3.data || {}
-    const tipsInfo = res4.data || {}
+    const tipsInfo = res4.data || []
     const confArr = transConf(configArr)
     pushResult = pushInfo.data || {};
     treatResult = treatInfo.data || {}
@@ -187,7 +189,6 @@ function getPageInfo() {
       })
     
     }
-    console.log(tipsNum,showTab)
     if(tipsNum > 1) {
       bindTab();
     }else if(tipsNum == 0){
@@ -200,7 +201,7 @@ function getPageInfo() {
     function moreInfo() {
       $('.moreInfo').click(function(){
         const name = $(this).attr('data-name')
-        const type = getUrlArgObject('tipsType')
+        const type = $(this).attr('data-type')
         openNewWin(`information.html?type=${type}&position=0&name=${name}`)
       })
     }
@@ -240,4 +241,4 @@ $(function(){
     localStorage.setItem('versionTime-v',ver.replace("=new",""));
     openNewWin("version.html");
   });
-});
+ })

+ 29 - 14
src/js/indexHorizontalDom.js

@@ -225,46 +225,61 @@ function renderTreatDrug(className,title,data, parentNode) {
 }
 
 function renderTipsInfo(icon, className,title,data) {
-  
     $('.infoTabBox').append(`<span class="infoTab tipsTab" data-box="${className}">${title}</span>`)
     let str
-    if(!data.name) {
+    if(data.length === 0) {
         str = `<div class="informationBox tipsInfoWrapper ${className} clearfix">
             <p class="diagName recommendNull">暂无数据</p>
             <div class="tipsInfoBox clearfix ${className + 'box'}"></div>
         </div>`
     } else {
         str = `<div class="informationBox tipsInfoWrapper ${className} clearfix">
-                    <p class="diagName">${data.name} <span class="moreInfo" data-name="${data.name}">详情</span></p>
-                    <p class="tipsTitle">诊断依据:</p>
-                    <div class="tipsInfoBox clearfix ${className + 'box'}"></div>
+                    <div class="tipsInfoBox clearfix ${className + 'box'}">
+                    </div>
                 </div>`
     }
     
     $('.infomationBox').append(str)
-    if(data.name) {
-        renderTipsInfoText('','诊断依据',data.details,className + 'box')
+    for(let i = 0; i < data.length; i++) {
+        renderTipsInfoText('','诊断依据',data[i],className + 'box')
     }
+    // if(data.name) {
+    //     renderTipsInfoText('','诊断依据',data.details,className + 'box')
+    // }
+    if(data.length > 1) {
+        $('.tipsInfoItem').each(function(i, obj){
+            var lineHeight = parseInt($(this).css("line-height"));
+            var height = parseInt($(this).height());
+            if((height / lineHeight) >3 ){
+                $(this).addClass("hasMore")
+                $(this).css("height","60px");    
+            }else{
+                $(this).removeClass("hasMore");
+            }
+        });
+    }
+   
 }
 
 
 function renderTipsInfoText(className,title,data, parentNode) {
-    let childrenNodeBoxStr = ``
-    if(data.length === 0) {
+    let childrenNodeBoxStr = `<p class="diagName">${data.name} <span class="moreInfo"  data-name="${data.name}" data-type="${data.type}">详情</span></p>`
+    if(data.details.length === 0) {
         childrenNodeBoxStr += `<p class="recommendNull">暂无数据</p>
-                                
                             `
     } else {
-        for(let i = 0; i < data.length; i++) {
-            childrenNodeBoxStr += `<p>${data[i].title}</p>
-                                    ${data[i].content.replace(/{imageUrlPrefix}/g, imageUrlPrefix)}
+        for(let i = 0; i < data.details.length; i++) {
+            childrenNodeBoxStr += `<div class="tipsInfoItem">
+                                        <p class="tipsInfoItemTitle">${data.details[i].title}</p>
+                                        ${data.details[i].content.replace(/{imageUrlPrefix}/g, imageUrlPrefix)}
+                                   </div>
                                 `
         }
     }
    
     $('.' + parentNode).append(childrenNodeBoxStr)
   
-    
+   
 }
 
 function renderRecommendConditTips(icon, className,title,data) {

+ 7 - 5
src/js/indexVertDom.js

@@ -66,8 +66,11 @@ function renderTipsInfo(className,title, data) {
                     <div class="recommendInfoBox clearfix ${className + 'box'}"></div>
                 </div>`
     $('.recommendWrap').append(str)
-    if(data.name) {
-        renderTipsInfoMsg('tipsInfo', data.name, data.details, className+'box')
+    if(data.length > 0) {
+        for(let i = 0; i < data.length; i++) {
+            renderTipsInfoMsg('tipsInfo'+i, data[i], data[i].details, className+'box')
+
+        }
     } else {
         // renderTipsInfoMsg('tipsInfo', data.name, data.details, className+'box')
         $('.' + className+'box').append('<p class="TipsInfoNull">暂无数据</p>')
@@ -98,10 +101,10 @@ function renderScaleInfo(className,title, data) {
     })
 }
 
-function renderTipsInfoMsg(className,title,data, parentNode) {
+function renderTipsInfoMsg(className,item,data, parentNode) {
     const childrenNodeBoxStr = `
         <div class = "treatItemBox ${className + 'box'}">
-            <p class="treatItemTitle">${title} <span class="moreInfo" data-name="${title}">详情</span></p>
+            <p class="treatItemTitle">${item.name} <span class="moreInfo" data-name="${item.name}" data-type="${item.type}"}>详情</span></p>
             <p class="${className + 'Info'} clearfix"></p>
         </div>
     `
@@ -117,7 +120,6 @@ function renderTipsInfoMsg(className,title,data, parentNode) {
                         `
         }
     }
-    
     $('.' + className+'Info').html(dataStr)
 }
 

+ 1 - 0
src/js/promise.js

@@ -35,6 +35,7 @@ const config = {
   calculate: '/api/data/calc/calculate',
   disclaimer: '/api/data/disclaimerInformation/getDisclaimerInformations',
   information: '/api/data/conceptDetail/getConceptDetail',
+  informationMore: '/api/data/conceptDetail/getConceptDetails',
   pushScale: '/api/data/push/pushScale',
   pushTreatment: '/api/data/push/pushTreatment',
   getSysSetInfoDatas: '/api/data/sysSet/getSysSetInfoDatas',

+ 5 - 1
src/page.js

@@ -20,5 +20,9 @@ var lis = [
   // {name:"血电解质3项",detailName:"钠(Na)",uniqueName:"血电解质3项--钠(Na)",source:"0",maxValue:145,minValue:"",time:"2019-08-30 15:31:49",units:"mmol/L",value:"120",otherValue:""},
   // {name:"尿常规11联",detailName:"尿蛋白(PRO-U)",uniqueName:"尿常规11联--尿蛋白(PRO)",source:"0",maxValue:1,minValue:"",time:"2019-08-30 15:31:49",units:"",value:"300",otherValue:""}
 ]
+var tipsInfo = [
+  {name:"血常规",type:12,position:"1"},
+  {name:"尿常规",type:12,position:"1"},
+  {name:"糖尿病",type:7,position:"1"}]
 
-$(".iframeContainer").attr("src",'indexHorizontal.html?age=22&lisJson='+JSON.stringify(lis)+'&diagJson=糖尿病&pastJson=无心脏病&otherJson=无高血压&pacsJson=腹部B超:无异常, 报告日期:2019-05-07&sex=男&symptomJson=恶心呕吐腰痛&vitalJson=血压左上肢13/12mmHg')
+$(".iframeContainer").attr("src",'indexHorizontal.html?age=22&lisJson='+JSON.stringify(lis)+'&diagJson=糖尿病&tipsInfo='+JSON.stringify(tipsInfo)+'&pastJson=无心脏病&otherJson=无高血压&pacsJson=腹部B超:无异常, 报告日期:2019-05-07&sex=男&symptomJson=恶心呕吐腰痛&vitalJson=血压左上肢13/12mmHg')

+ 1 - 1
webpack.config.js

@@ -4,7 +4,7 @@ const CleanWebpackPlugin = require('clean-webpack-plugin') // 清空打包目录
 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
 const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
 const webpack = require('webpack');
-const proxyHost = "http://192.168.2.241:5050";
+const proxyHost = "http://192.168.2.236:5050";
 module.exports = {
   entry: {
     index: path.resolve(__dirname, 'src/js', 'index.js'),