Przeglądaj źródła

长按功能影响搜索优化

liucf 5 lat temu
rodzic
commit
f8f595cdbd
2 zmienionych plików z 18 dodań i 14 usunięć
  1. 3 2
      src/components/Preview.vue
  2. 15 12
      src/components/Symptom.vue

+ 3 - 2
src/components/Preview.vue

@@ -184,8 +184,9 @@ export default {
             msg += textArr[k].textP + ','
           }
         }
-      }    
-      return trimDots(msg);
+      }
+      // 去掉最后一个逗号
+      return trimDots(msg.substring(0,msg.length-1));
     },
     handleClick(flg){
       this.showDoc = flg

+ 15 - 12
src/components/Symptom.vue

@@ -35,7 +35,7 @@
           v-for="(it,ind) in symp"
           :key="it.conceptId"
           @touchstart.stop.prevent="touchstart(it)"
-          @touchend.stop.prevent="showDetil(it)"
+          @touchend.stop.prevent="touchend(it)"
         >{{it.description || it.name}}</span>
       </div>
       <div
@@ -186,16 +186,7 @@ export default {
         this.$emit('next');
       }
     },
-    showDetil(item,flg) {
-      clearTimeout(this.timer);
-      let endTime = +new Date();
-      if(endTime - this.startTime > 600){
-        this.startTime = "";
-        return
-      }
-      this.startTime = "";
-      this.tmpItem=item
-      this.isSearch=flg||false
+    common(item,flg){
       this.questId = item.questionId || item.id || item.conceptId;
       const id = item.questionId || item.id; //常见症状questionId,推送id,两者均有可能没有
       //将选中的name存到store中的text
@@ -229,7 +220,19 @@ export default {
         this.chooseSymp.push(item);
         this.checkText = this.$store.state.symptom.text;
       }
-
+    },
+    showDetil(item,flg) {//搜索点开的详情
+      this.tmpItem=item
+      this.isSearch=flg||false
+      this.common(item,flg);
+    },
+    touchend(item,flg) {//症状点开详情
+      clearTimeout(this.timer);
+      let endTime = +new Date();
+      if(endTime - this.startTime < 500){//点击事件
+        this.common(item,flg);
+      }
+      this.startTime = "";
     },
     getSympText() {//推送使用医生端信息
       const text = this.$store.state.symptom.text;