Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/test' into tempMaster

zhouna 5 anni fa
parent
commit
f8e6c9738a

+ 11 - 4
src/common/CheckBox.vue

@@ -17,6 +17,7 @@
           :item="it" 
           ref="inp"
           @handleInp="inpVal($event,index)" 
+          @handleSelec="handleClick(it,index,true)"
           :exclu="exclusion !==999 && it.exclusion !== exclusion" 
           />
     </p>
@@ -46,7 +47,7 @@ import OptionInp from '../common/OptionInp.vue';
       this.resetExc();
     },
     methods:{
-      handleClick(it,index){
+      handleClick(it,index,flag){
         const that = this;
         const list = this.datas;
         let data = list.questionDetailList&&list.questionDetailList.slice(0);
@@ -62,12 +63,18 @@ import OptionInp from '../common/OptionInp.vue';
           this.exclusion = it.exclusion;  
         }
         // 处理选中状态
-        if(data[index].select){
-          data[index].select = 0;
-        }else{
+        if(flag){//输入框反选
           data[index].select = 1;
           this.exclusion = it.exclusion;
+        }else{
+          if(data[index].select){
+            data[index].select = 0;
+          }else{
+            data[index].select = 1;
+            this.exclusion = it.exclusion;
+          }
         }
+        
         // 处理取消-互斥
         const filArr1 = data.filter(it=>it.select==1);
         if(excluArr.length>0){//有互斥

+ 3 - 0
src/common/Label.vue

@@ -76,6 +76,9 @@ import {moduleCP} from '@utils/tools';
           return
         }
         this.showToast = true;
+        // 底部body不可滑动
+        // const prehandler = function(e){e.preventDefault();}
+        // document.body.addEventListener("touchmove",prehandler,false)
       },
       comfirnDel(){
         const temp = this.tempItem;

+ 21 - 10
src/common/OptionInp.vue

@@ -5,8 +5,8 @@
     <div class="inp" @click="preClick">
       <input :type="msg.type=='number'?'tel':'text'" 
               :placeholder="msg.placeholder"
-              :disabled="select!=1"
-              :class="{'exclu':exclu}"
+              
+              :class="[{'exclu':exclu},{'cancel':item.select==0}]"
               v-model="txt"
               @click="handleCli"
               @blur="handleBlur"
@@ -50,6 +50,10 @@ import { getExpStr,scrollToV,isIos} from '@utils/tools';
         e.stopPropagation();
       },
       handleCli(e){
+        // const select = this.item.select;
+        if(!this.select){//聚焦时自动选中该项
+          this.$emit('handleSelec');
+        }
         if(!isIos()){
           scrollToV(e)
         } 
@@ -73,25 +77,32 @@ import { getExpStr,scrollToV,isIos} from '@utils/tools';
     .inp{
       display: inline-block;
       vertical-align: top;
-      position: relative;
-      top:3px;
+      // position: relative;
+      // top:1px;
       input{
         color: #4F50FF;
-        font-size: .3rem;
+        font-size: .28rem;
         border-bottom: 1px solid #DFE0E4 !important;
         border-radius: 0;
         padding-left: .05rem;
       }
     }
-    .check{
+    .check{//选中
       color: #4F50FF;
     }
-    .exclu{
+    .inp .exclu{ //互斥
       color:#e6e7e9 !important;
     }
-    input:disabled, input[disabled]{ 
-      background:#EBEBE4;
-      // -webkit-text-fill-color:#8d9399;
+    .cancel{ //取消
+      color: #bbbbbb !important;
+    }
+    input:disabled, input[disabled]{
+      background:transparent;
+      border-bottom-color: #DEDEDE !important;
+    }
+    // input:disabled,input[disabled]::-webkit-input-placeholder{
+    .exclu::-webkit-input-placeholder{
+      color:#e6e7e9 !important;
     }
   }
 </style>

+ 5 - 1
src/common/Radio.vue

@@ -13,7 +13,7 @@
           :inline="true" 
           :select="it.select==1" 
           /> -->
-      <OptionInp v-else :item="it" @handleInp="inpVal($event,index)" />
+      <OptionInp v-else :item="it" @handleInp="inpVal($event,index)" @handleSelec="handleClick(it,index)"/>
     </p>
   </div>
 </template>
@@ -63,6 +63,10 @@ import OptionInp from '../common/OptionInp.vue';
         this.datas.valueP = temp.valueP;
         this.$emit("updata",this.datas);
       },
+      /*inpSele(index){//输入框反选
+        let detailList = this.datas.questionDetailList;console.log("单选:",index,detailList[index])
+        detailList[index].select = 1;
+      }*/
     },
     watch:{
       item:{

+ 18 - 3
src/common/Toast.vue

@@ -13,6 +13,7 @@
   </div>
 </template>
 <script type="text/javascript">
+import $ from 'jquery';
   export default {
     name:'Toast',
     data(){
@@ -20,15 +21,29 @@
         msg:"是否删除该信息?"
       }
     },
-    props:['message','show'],
+    props:['message','show','labShow'],
+    /*mounted(){
+      $('body').bind("touchmove",function(e){
+        e.preventDefault();
+      })
+    },
+    beforeDestroy(){
+      $('body').bind("touchmove",function(e){
+        e.next();
+      })
+    },*/
     methods:{
       comfirn(){
         this.$emit("comfirn")
+        // const prehandler = function(e){e.preventDefault();}
+        // document.removeEventListener("touchmove",prehandler,false);
       },
       cancel(){
         this.$emit("cancel")
-      },
-    }
+        // const prehandler = function(e){e.preventDefault();}
+        // document.removeEventListener("touchmove",prehandler,false);
+      }
+    },
   }
 </script>
 <style lang="less" scoped>

+ 18 - 3
src/common/UploadImg.vue

@@ -3,7 +3,7 @@
     <div class="box">
       <ul class="upload-imgs">
         <li
-          v-if="imgLen>=6 ? false : true"
+          v-if="imgLen<6"
           class="uploadBox"
           @click="handleUpload"
         >
@@ -37,19 +37,30 @@
   </div>
 </template>
 <script type="text/javascript">
+import {isIos,isWX} from '@utils/tools';
+import $ from 'jquery';
 export default {
   name: 'UploadImg',
   data() {
     return {
       mag: "上传图片",
       imgs: {},
-      imgLen: 0
+      imgLen: 0,
+      flag:true //图片处理完成后才可以再次点击上传
     }
   },
   props: ['item', 'moduleType', 'imgList'],//moduleType-哪个模块下上传的图
   mounted() {
     this.imgs = this.imgList; //回读
+    this.imgLen = Object.keys(this.imgList).length;
     this.$previewRefresh();//预览刷新
+    if(isIos()){
+      $('.upload').removeAttr("capture")
+    }else if(!isWX()){ 
+    // 微信端添加这个属性直接调拍照
+    //安卓手机且非微信端添加相机属性,否则QQ浏览器打不开相机
+      $('.upload').attr("capture","camera")
+    }
   },
   methods: {
     handleUpload() {
@@ -61,7 +72,9 @@ export default {
         alert("请开启权限设置")
       })*/
       const inp = this.$refs.inp;
-      inp.click();
+      if(this.flag){
+        inp.click();
+      } 
     },
     delImg(key) {
       let obj = this.imgs;
@@ -73,6 +86,7 @@ export default {
     },
     addImg() {
       // 上传图片进行压缩,压缩后超过4M则不允许上传
+      this.flag = false;
       let fileTag = this.$refs.inp;
       // let img = this.$refs.img;
       let file = fileTag.files[0];
@@ -106,6 +120,7 @@ export default {
         }
         // that.$refs.inp.value = '';
         fileTag.value = '';
+        that.flag = true
       });
     },
     imgBase64(file, callback) {

+ 1 - 0
src/components/DetailBox.vue

@@ -153,6 +153,7 @@
       height: 100%;
       width:100%;
       overflow-y: auto;
+      // -webkit-overflow-scrolling : touch;//解决滑动卡顿问题
     }
     .foot{
       .footer;

+ 23 - 4
src/components/DiagTreat.vue

@@ -35,6 +35,17 @@
             :item="it"
             :key="it.id"
             @updata="updataData($event,it.id)"/>
+        <!-- 多行输入-->
+        <template
+            v-if="it.controlType == 3"
+            v-for="(part,index) in it.questionDetailList"
+          >
+            <MultiLineInput
+              :msg="part.name"
+              :part="part"
+              @updata="updataData($event,it.id,index)"
+            ></MultiLineInput>
+        </template>
     </div>
     <div class="result" v-if="checkText.length>0">
       <p class="title">{{datas.name}}</p>
@@ -69,6 +80,7 @@
   import {moduleCP,patt,imageUrlPrefix} from '@utils/tools';
   import Radio from '../common/Radio.vue';
   import CheckBox from '../common/CheckBox.vue';
+  import MultiLineInput from '../common/MultiLineInput.vue';
   export default {
     name:'DiagTreat',
     data(){
@@ -123,11 +135,17 @@
         }          
         return msg;
       },
-      updataData(data,id){//输入框存值
+      updataData(data,id,index){//输入框存值
         let list = this.dtoList;
         for(let i in list){
-          if(list[i].id==data.id){
-            list.splice(i,1,data)
+          // if(list[i].id==data.id){
+          if(list[i].id==id){
+            if(list[i].controlType == 3){//多行输入
+              let detailList = list[i].questionDetailList;
+              detailList.splice(index,1,data);
+            }else{
+              list.splice(i,1,data)
+            }
           }
         }
         this.$store.commit('setDatas',{type:moduleCP['diagT'],data:data,pId:data.id,ppId:id});
@@ -141,7 +159,8 @@
       Input,
       ComTextArea,
       Radio,
-      CheckBox
+      CheckBox,
+      MultiLineInput
     },
     /*watch:{
       dtoList:{

+ 13 - 8
src/components/Others.vue

@@ -29,18 +29,17 @@
             :item="it"
             :key="it.id"
             @updata="updataData($event,it.id)"/>
-        <!-- 多行输入 存值和回读事件未处理 -->
-        <!-- <template
+        <!-- 多行输入-->
+        <template
             v-if="it.controlType == 3"
             v-for="(part,index) in it.questionDetailList"
           >
             <MultiLineInput
-              v-if="it.controlType == 3"
               :msg="part.name"
               :part="part"
-              @updata="updataData($event,index,it)"
+              @updata="updataData($event,it.id,index)"
             ></MultiLineInput>
-        </template> -->
+        </template>
     </div>
     <div class="result" v-if="checkText.length>0">
       <p class="title">{{datas.name}}</p>
@@ -120,11 +119,17 @@
         this.labelDetail = {};
         this.ppId = null;
       },
-      updataData(data,id){//输入框存值
+      updataData(data,id,index){//输入框存值
         let list = this.dtoList;
         for(let i in list){
-          if(list[i].id==data.id){
-            list.splice(i,1,data)
+          // if(list[i].id==data.id){
+          if(list[i].id==id){
+            if(list[i].controlType == 3){//多行输入
+              let detailList = list[i].questionDetailList;
+              detailList.splice(index,1,data);
+            }else{
+              list.splice(i,1,data)
+            } 
           }
         }
         

+ 2 - 9
src/components/PathInfo.vue

@@ -101,7 +101,6 @@
       }
     },
     created(){
-      // this.ifWX();
       this.getPathInfo();
       this.getSysConfig();
       this.$store.commit('initAllData');//初始化store数据
@@ -178,7 +177,7 @@
           // this.$router.push({path:'/tab'})
           this.$router.replace({path:'/tab'})
         }else{
-          this.defaultWaring('请先维护症状模块')
+          this.defaultWaring('网络异常请稍后重试')
         }
       },
       defaultWaring(msg){
@@ -188,13 +187,7 @@
           this.submit = false
           clearTimeout(timer)
         }, 2000);
-      },
-      ifWX(){
-        let us = navigator.userAgent.toLowerCase();
-        if(us.indexOf('micromessenger') == -1){
-          console.log("非微信打开")
-        }
-      }
+      }, 
     },
     components:{
       Submit

+ 9 - 8
src/components/Preview.vue

@@ -30,16 +30,16 @@
         <li>
           <h4><i :style="{'background': '#3D69D9'}"></i> 现病史:</h4>
           <p>
-            <span v-for="(item,idx) in symptom.text" :key="item.text+idx">{{item.textP+(idx == symptom.choose.length-1?'。':';')}}</span>
+            <span v-for="(item,idx) in symptom.text" :key="item.text+idx">{{trimDots&&trimDots(item.textP+(idx!=0 && idx == symptom.choose.length-1?'。':';'))}}</span>
           </p>
           <p>
-            <span v-for="(item,idx) in diagnose.text" :key="item.text+idx">{{item.textP+(idx == diagnose.text.length-1?'。':';')}}</span>
+            <span v-for="(item,idx) in diagnose.text" :key="item.text+idx">{{trimDots&&trimDots(item.textP+(idx!=0 && idx == diagnose.text.length-1?'。':';'))}}</span>
           </p>
         </li>
         <li v-if="showLis[moduleCP['other']]==1">
           <h4><i></i> 其他史:</h4>
           <p>
-            <span v-for="(item,idx) in others.text" :key="item.text+idx">{{item.textP+(idx == others.text.length-1?'。':';')}}</span>
+            <span v-for="(item,idx) in others.text" :key="item.text+idx">{{trimDots&&trimDots(item.textP+(idx!=0 && idx == others.text.length-1?'。':';'))}}</span>
           </p>
         </li>
         <li v-if="showLis[moduleCP['suplement']]==1">
@@ -88,16 +88,16 @@
             <li>
               <h4><i :style="{'background': '#3D69D9'}"></i> 现病史:</h4>
               <p>
-                <span v-for="(item,idx) in symptom.text" :key="item.text+idx">{{item.text+(idx == symptom.choose.length-1?'。':';')}}</span>
+                <span v-for="(item,idx) in symptom.text" :key="item.text+idx">{{trimDots&&trimDots(item.text+(idx == symptom.choose.length-1?'。':';'))}}</span>
               </p>
               <p>
-                <span v-for="(item,idx) in diagnose.text" :key="item.text+idx">{{item.text+(idx == diagnose.text.length-1?'。':';')}}</span>
+                <span v-for="(item,idx) in diagnose.text" :key="item.text+idx">{{trimDots&&trimDots(item.text+(idx == diagnose.text.length-1?'。':';'))}}</span>
               </p>
             </li>
             <li v-if="showLis[moduleCP['other']]==1">
               <h4><i></i> 其他史:</h4>
               <p>
-                <span v-for="(item,idx) in others.text" :key="item.text+idx">{{item.text+(idx == others.text.length-1?'。':';')}}</span>
+                <span v-for="(item,idx) in others.text" :key="item.text+idx">{{trimDots&&trimDots(item.text+(idx == others.text.length-1?'。':';'))}}</span>
               </p>
             </li>
             <li v-if="showLis[moduleCP['suplement']]==1">
@@ -120,7 +120,7 @@
 import api from '@utils/api.js';
 import Submit from '../common/Submit';
 import Loading from '../common/Loading';
-import {moduleCP} from '@utils/tools.js'
+import {moduleCP,trimDots} from '@utils/tools.js'
 export default {
   props: ['preName','showLis','loadingShow'],
   data() {
@@ -142,7 +142,8 @@ export default {
       // show:loadingShow,//提交等待的动画loading
       tmpNum:0,
       moduleCP:moduleCP,
-      showDoc:false
+      showDoc:false,
+      trimDots:trimDots
     }
   },
   methods: {

+ 5 - 2
src/components/Symptom.vue

@@ -17,7 +17,7 @@
       </p>
     </div>
     <div class="label">
-      <p class="quest">请问您有哪些不适?<img
+      <p class="quest">{{quesText}}<img
           @click="search(true)"
           class="searchImg"
           src="../images/search.png"
@@ -102,11 +102,13 @@ export default {
       showToast: false,
       searchShow: false,//显示搜索界面
       tmpItem:{},//检索的症状
-      isSearch:false
+      isSearch:false,
+      quesText:"请问您有哪些不适?",
     }
   },
   created() {
     if (this.chooseSymp.length > 0) {
+      this.quesText = "请问您还有其他不适吗?";
       // 推送
       const sympText = this.getSympText();
       this.getPush(sympText);
@@ -154,6 +156,7 @@ export default {
       const id = item.questionId || item.id; //常见症状questionId,推送id,两者均有可能没有
       //将选中的name存到store中的text
       this.$store.commit('setText', { type: moduleCP['symp'], text: item.name,textP: item.name, pId: this.questId });
+      this.quesText = "请问您还有其他不适吗?";
       if (id) {
         const param = {
           "age": this.age,

+ 3 - 0
src/components/TabPage.vue

@@ -67,6 +67,7 @@ import DiagTreat from './DiagTreat.vue';
 import Others from './Others.vue';
 import Preview from './Preview.vue';
 import {moduleConfig,moduleCP} from '../utils/tools.js';
+import $ from 'jquery';
 export default {
   name: 'TabPage',
   data() {
@@ -151,6 +152,7 @@ export default {
           }
         }
       }
+      $('body').scrollTop(0);
     },
     beBack(preview) {
       if(preview === 'preview'){
@@ -171,6 +173,7 @@ export default {
           this.flag = this.modlues[i-1].type
         }
       }
+      $('body').scrollTop(0);
     },
     toggleModule(flg){
       this.moduleShow = flg

+ 12 - 1
src/utils/tools.js

@@ -176,6 +176,16 @@ function isIos(){
   }
 }
 
+// 是否在微信打开
+function isWX(){
+  let us = navigator.userAgent.toLowerCase();
+  if(us.indexOf('micromessenger') == -1){
+    return false;
+  }else{
+    return true;
+  }
+}
+
 // 监听键盘是否弹起
 function fixedKeyboard() {
   var win_h = $(window).height();
@@ -267,7 +277,8 @@ module.exports =  {
   scrollToV,
   isIos,
   trimDots,
-  concatVal
+  concatVal,
+  isWX
 }