Browse Source

Merge branch 'syf-scale1220' into test

1178232204@qq.com 3 năm trước cách đây
mục cha
commit
b9dee1fd52
4 tập tin đã thay đổi với 27 bổ sung9 xóa
  1. 8 4
      src/App.vue
  2. 2 0
      src/components/ChooseScale.vue
  3. 11 5
      src/components/ScaleDetail.vue
  4. 6 0
      src/store.js

+ 8 - 4
src/App.vue

@@ -2,11 +2,9 @@
   <div>
     <p class="pc-enter" v-if="!isMobile && !isScaleShow">请在手机端访问</p>
     <div v-else id="app">
-      <keep-alive>
-        <router-view v-if="$route.meta.keepAlive"></router-view>
+      <keep-alive :include="keepAlive">
+        <router-view ></router-view>
       </keep-alive>
-      <router-view v-if="!$route.meta.keepAlive">
-      </router-view>
       <!-- <router-view/> -->
       <portal-target name="notification-outlet"></portal-target>
       <portal-target name="notification-detail"></portal-target>
@@ -17,6 +15,7 @@
   </div>
 </template>
 <script>
+import { mapState } from "vuex";
 export default {
   name: "App",
   data: () => {
@@ -27,6 +26,11 @@ export default {
       isScaleShow: false,
     };
   },
+  computed: {
+    ...mapState({
+      keepAlive: (state) => state.keepAlive,
+    }),
+  },
   watch: {
     $route(to, from) {
       console.log(to, from);

+ 2 - 0
src/components/ChooseScale.vue

@@ -51,6 +51,8 @@ export default {
       if(this.isChange == -1){
         return
       }
+      const arr = ['ScaleDetail']
+      this.$store.commit("setkeepAlive", arr);
       this.$router.push({ path: "/scaleDetail",query: JSON.parse(localStorage.getItem('loginParam')) });
     }
   },

+ 11 - 5
src/components/ScaleDetail.vue

@@ -38,6 +38,7 @@ import { data } from "@utils/data.js";
 import Toast from "../common/Toast.vue";
 import { mapState } from "vuex";
 export default {
+  name: 'ScaleDetail',
   data() {
     return {
       list: [],
@@ -73,11 +74,15 @@ export default {
       return score;
     },
     getresult() {
-      if (this.score < 20) {
+      let score = 0;
+      for (let i in this.list.list) {
+        score += parseInt(this.list.list[i].checked);
+      }
+      if (score < 20) {
         return "未达到目标在过去4周内,哮喘可能没有得到控制。可以制订一个哮喘管理计划,帮助改善哮喘控制。";
-      } else if (this.score < 25 && this.score > 19) {
+      } else if (score < 25 && score > 19) {
         return "接近目标在过去4周内,哮喘已得到良好控制,但还没有完全控制。";
-      } else if (this.score >= 25) {
+      } else if (score > 24) {
         return "在过去4周内,哮喘已得到完全控制。没有哮喘症状,生活也不受哮喘所限制。";
       }
     },
@@ -109,12 +114,13 @@ export default {
           const scaleList = [
             {
               dataJson: JSON.stringify(this.list.list),
-              result: this.getresult(),
-              scaleName: this.list.title,
               score: this.getscore(),
+              scaleName: this.list.title,
+              result: this.getresult(),
             },
           ];
           this.$store.commit("saveScaleInfo", scaleList);
+          console.log(this.istrue);
           if (this.istrue) {
             this.$router.push({
               path: "/preview",

+ 6 - 0
src/store.js

@@ -15,6 +15,7 @@ const store = new Vuex.Store({
     scroll:{
       x:0,y:0
     },
+    keepAlive:[],//缓存
     symptom:{ //症状情况
       choose:[],
       origin:{},
@@ -134,6 +135,8 @@ const store = new Vuex.Store({
       }
       state.addBuriedSomeList=[]//买点数据
       state.scaleInfo =null//量表信息
+      state.istrue = false
+      state.keepAlive = []
     },
     setDetail(state,param){//明细
       const detail = param.detail;
@@ -153,6 +156,9 @@ const store = new Vuex.Store({
         }
       }
     },
+    setkeepAlive(state,flg){
+      state.keepAlive = flg;
+    },
     setSearchShow(state,flg){//搜索显示与否
       state.searchShow = flg;
     },