فهرست منبع

切换页面伴随症状消失bug

luolei 5 سال پیش
والد
کامیت
99cbe73a8a
1فایلهای تغییر یافته به همراه25 افزوده شده و 20 حذف شده
  1. 25 20
      src/components/Symptom.vue

+ 25 - 20
src/components/Symptom.vue

@@ -378,29 +378,34 @@ export default {
       api.getPush(param).then((res) => {
         const result = res.data;
         if (result.code == 0) {
-          let symp = result.data.symptom||[];
-          let symped = JSON.parse(JSON.stringify(this.chooseSymp));//已选症状
-          let sympStic = JSON.parse(localStorage.getItem('staticSymp'))||[];//首次有无症状
-          let sympAll = sympStic.concat(symp);
-          var obj = {};
-          sympAll = sympAll.reduce(function(item, next) {
-            obj[next.name] ? '' : obj[next.name] = true && item.push(next);
-            return item;
-          }, []);
-          for(let i = 0;i < symped.length;i++){//去掉已选的已选症状
-            for(let j = 0;j < sympAll.length;j++){//去掉
-              if(sympAll[j].name == symped[i].name){
-                sympAll.splice(j,1)
-              }
-            }
-          }
-          this.symp = sympAll.slice(0,12);
-          this.$refs.showHide.style.height = 'auto'
+          this.getSymptomLisCom(result)
+        }else{
+          this.getSymptomLisCom()
         }
-      }).catch(()=>{
-
+      }).catch((err)=>{
+        
       })
     },
+    getSymptomLisCom(result){
+      let symp = (result&&result.data.symptom)||[];
+      let symped = JSON.parse(JSON.stringify(this.chooseSymp));//已选症状
+      let sympStic = JSON.parse(localStorage.getItem('staticSymp'))||[];//首次有无症状
+      let sympAll = sympStic.concat(symp);
+      var obj = {};
+      sympAll = sympAll.reduce(function(item, next) {
+        obj[next.name] ? '' : obj[next.name] = true && item.push(next);
+        return item;
+      }, []);
+      for(let i = 0;i < symped.length;i++){//去掉已选的已选症状
+        for(let j = 0;j < sympAll.length;j++){//去掉
+          if(sympAll[j].name == symped[i].name){
+            sympAll.splice(j,1)
+          }
+        }
+      }
+      this.symp = sympAll.slice(0,12);
+      this.$refs.showHide.style.height = 'auto'
+    },
     deletSymp(item, index) {
       this.delIndex = index;
       this.questId = item.questionId || item.id || item.conceptId;