zhangxc před 5 roky
rodič
revize
a9c581c09e
2 změnil soubory, kde provedl 23 přidání a 30 odebrání
  1. 6 23
      src/js/index.js
  2. 17 7
      src/js/indexHorizontal.js

+ 6 - 23
src/js/index.js

@@ -136,26 +136,9 @@ function getPushInfo() {
 function getTreatment() {
   return  post(config.pushTreatment,Object.assign({featureType: '8'},msg)).then((res)=>{
           var data = res.data
+          if(data.code == 0){
           window.treatInfo = data
-          // if(data.code == 0){
-          //   var result = data.data;
-          //   renderTreat('treatRecommend','治疗方案',result)
-          //   // var num = 0;
-          //   // if(result.commonTreatment && result.commonTreatment.content){
-          //   //   ++num
-          //   //   ybzlFun(result.commonTreatment.content)//一般治疗
-          //   // }
-          //   // if(result.treatment && result.treatment.length>0){
-          //   //   ++num
-          //   //   cyywFun(result.treatment)//常用药物
-          //   // }
-          //   // if(num == 0){
-          //   //   $(".conditionHintZhiliaoNull").css("display","block")
-          //   // }
-          // } else {
-          //   renderTreat('treatRecommend','治疗方案',{})
-          // }
-
+          }
   })
   
 }
@@ -163,7 +146,7 @@ function getTreatment() {
 function getTipsInfo() {
   post(config.information,{name:getUrlArgObject('tipsName'),type:getUrlArgObject('tipsType'), position: 1}).then((res)=>{
     var data = res.data
-    if(data) {
+    if(data.code == 0) {
         window.tipsInfo = data
     }
     
@@ -179,17 +162,17 @@ function getTipsInfo() {
 function getPageInfo() {
 
   Promise.all([getConf(),getPushInfo(),getTreatment(),getTipsInfo()]).then(([res1, res2, res3, res4]) =>{
-    if(pushInfo.code == 0) {
+    if(pushInfo&&pushInfo.code == 0) {
       pushResult = pushInfo.data;
     } else {
       pushResult = {};
     }
-    if(treatInfo.code == 0) {
+    if(treatInfo&&treatInfo.code == 0) {
       treatResult = treatInfo.data
     } else {
       treatResult = {}
     }
-    if(tipsInfo.code &&tipsInfo.code == 0) {
+    if(tipsInfo&&tipsInfo.code == 0) {
       tipsResult = tipsInfo.data
     } else {
       tipsResult = {}

+ 17 - 7
src/js/indexHorizontal.js

@@ -85,6 +85,8 @@ function getConf() {
           let confArr = transConf(data.data)
           window.confArr = confArr;
       }
+  }).catch(function (err) {
+    console.log(err);
   })
 }
 
@@ -154,15 +156,17 @@ function getPushInfo() {
     
       
     // }
+  }).catch(function (err) {
+    console.log(err);
   })
 }
 
 function getTreatment() {
   post(config.pushTreatment,Object.assign({featureType: '8'},msg)).then((res)=>{
     var data = res.data
-    if(data) {
-      window.tipsInfo = data
-    }
+    if(data.code == 0){
+      window.treatInfo = data
+      }
     // if(data.code == 0){
     //   var result = data.data;
     //   renderTreat(treatImg, 'treatRecommend','治疗方案',result)
@@ -190,27 +194,33 @@ function getTreatment() {
 function getTipsInfo() {
   post(config.information,{name:getUrlArgObject('tipsName'),type:getUrlArgObject('tipsType'), position: 1}).then((res)=>{
     var data = res.data
-    window.tipsInfo = data
+    if(data.code == 0) {
+      window.tipsInfo = data
+  }
+  }).catch(function (err) {
+    console.log(err);
   })
 }
 
 function getPageInfo() {
   Promise.all([getConf(),getPushInfo(),getTreatment(),getTipsInfo()]).then(([res1, res2, res3,res4]) =>{
-    if(pushInfo.code == 0) {
+    if(pushInfo&&pushInfo.code == 0) {
       pushResult = pushInfo.data;
     } else {
       pushResult = {};
     }
-    if(treatInfo.code == 0) {
+    if(treatInfo&&treatInfo.code == 0) {
       treatResult = treatInfo.data
     } else {
       treatResult = {}
     }
-    if(tipsInfo.code && tipsInfo.code == 0) {
+    if(tipsInfo&&tipsInfo.code == 0) {
       tipsResult = tipsInfo.data
     } else {
       tipsResult = {}
     }
+
+   
     const diagPossible =  pushResult.dis&&pushResult.dis['可能诊断'] || []//可能
     const diagDoubt = pushResult.dis&&pushResult.dis['疑似诊断'] || [] // 疑似
     const diagDeter = pushResult.dis&&pushResult.dis['确诊'] || []//确诊