浏览代码

Merge branch 'test' into btscroll

luolei 5 年之前
父节点
当前提交
f3b0a5af43

+ 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

@@ -77,6 +77,9 @@ import {moduleCP} from '@utils/tools';
         }
         this.showToast = true;
         this.$emit("commitShowLabel",false)
+        // 底部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"
@@ -51,6 +51,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)
         } 
@@ -74,25 +78,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:{

+ 14 - 1
src/common/Toast.vue

@@ -16,6 +16,7 @@
 </template>
 <script type="text/javascript">
 
+import $ from 'jquery';
   export default {
     name:'Toast',
     data(){
@@ -23,10 +24,22 @@
         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")

+ 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) {

+ 56 - 38
src/components/DiagTreat.vue

@@ -7,44 +7,54 @@
           class="label">
         <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
         <img class="questionImg" :src="it.url.replace('{imageUrlPrefix}',imgUrl)" v-if="it.url">
-          <Label v-if="it.controlType==0" 
-                :item="it" 
-                :indx="i" 
-                :ppId="it.id"
-                :moduleType="datas.type"
-                dom=".treatper"
-                @commitShowLabel="commitShowLabel"
-                @setDetail="setDetail"/>
-          <!-- 上传图片 -->
-          <UploadImg v-if="it.controlType==4" 
+        <Label v-if="it.controlType==0" 
               :item="it" 
+              :indx="i" 
+              :ppId="it.id"
               :moduleType="datas.type"
-              :imgList="imgs"
-              />
-          <!-- 输入框 -->
-          <Input v-if="it.controlType==6 || it.controlType==7"
-              :item="it"
-              :key="it.id"
-              @updata="updataData($event,it.id)"/>
-          <!-- 文本域 -->
-          <ComTextArea v-if="it.controlType == 5"
-              :item="it"
-              @updata="updataData($event,it.id)"/>
-          <Radio v-if="it.controlType==1" 
-              :item="it"
-              :key="it.id"
-              @updata="updataData($event,it.id)"/>
-          <CheckBox v-if="it.controlType==2" 
-              :item="it"
-              :key="it.id"
-              @updata="updataData($event,it.id)"/>
-      </div>
-      <div class="result" v-if="checkText.length>0">
-        <p class="title">{{datas.name}}</p>
-        <!-- <p v-for="(v,i) in checkText">{{v.text}}</p> -->
-        <p>{{getText()}}</p>
+              dom=".treatper"
+              @commitShowLabel="commitShowLabel"
+              @setDetail="setDetail"/>
+        <!-- 上传图片 -->
+        <UploadImg v-if="it.controlType==4" 
+            :item="it" 
+            :moduleType="datas.type"
+            :imgList="imgs"/>
+        <!-- 输入框 -->
+        <Input v-if="it.controlType==6 || it.controlType==7"
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
+        <!-- 文本域 -->
+        <ComTextArea v-if="it.controlType == 5"
+            :item="it"
+            @updata="updataData($event,it.id)"/>
+        <Radio v-if="it.controlType==1" 
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
+        <CheckBox v-if="it.controlType==2" 
+            :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>
+    <div class="result" v-if="checkText.length>0">
+      <p class="title">{{datas.name}}</p>
+      <!-- <p v-for="(v,i) in checkText">{{v.text}}</p> -->
+      <p>{{getText()}}</p>
+    </div>
 
     <div class="foot" v-if="modluesLen==2">
       <span class="back" @click="beBack">{{'返回'+ preName}}</span>
@@ -74,6 +84,7 @@
   import Radio from '../common/Radio.vue';
   import CheckBox from '../common/CheckBox.vue';
   import BScroll from 'better-scroll';
+  import MultiLineInput from '../common/MultiLineInput.vue';
   export default {
     name:'DiagTreat',
     data(){
@@ -138,11 +149,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});
@@ -156,7 +173,8 @@
       Input,
       ComTextArea,
       Radio,
-      CheckBox
+      CheckBox,
+      MultiLineInput
     },
     /*watch:{
       dtoList:{

+ 64 - 43
src/components/Others.vue

@@ -5,49 +5,64 @@
           v-if="dtoList"
           :key="it.id"
           class="label">
-          <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
-          <img class="questionImg" :src="it.url.replace('{imageUrlPrefix}',imgUrl)" v-if="it.url">
-          <!-- <Label v-if="it.controlType==0" -->
-          <Label v-if="it.controlType==0"
-                :item="it"
-                :ppId="it.id" 
-                :moduleType="datas.type" 
-                @setDetail="setDetail"/>
-          <!-- 输入框 -->
-          <Input v-if="it.controlType==6 || it.controlType==7"
+        <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
+        <img class="questionImg" :src="it.url.replace('{imageUrlPrefix}',imgUrl)" v-if="it.url">
+        <!-- <Label v-if="it.controlType==0" -->
+        <Label v-if="it.controlType==0"
               :item="it"
-              :key="it.id"
-              @updata="updataData($event,it.id)"/>
-          <!-- 文本域 -->
-          <ComTextArea v-if="it.controlType == 5"
-              :item="it"
-              @updata="updataData($event,it.id)"/>
-          <Radio v-if="it.controlType==1" 
-              :item="it"
-              :key="it.id"
-              @updata="updataData($event,it.id)"/>
-          <CheckBox v-if="it.controlType==2" 
-              :item="it"
-              :key="it.id"
-              @updata="updataData($event,it.id)"/>
-          <!-- 多行输入 存值和回读事件未处理 -->
-          <!-- <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)"
-              ></MultiLineInput>
-          </template> -->
-      </div>
-      <div class="result" v-if="checkText.length>0">
-        <p class="title">{{datas.name}}</p>
-        <p>{{getText()}}</p>
+              :ppId="it.id" 
+              :moduleType="datas.type" 
+              @setDetail="setDetail"/>
+        <!-- 输入框 -->
+        <Input v-if="it.controlType==6 || it.controlType==7"
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
+        <!-- 文本域 -->
+        <ComTextArea v-if="it.controlType == 5"
+            :item="it"
+            @updata="updataData($event,it.id)"/>
+        <Radio v-if="it.controlType==1" 
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
+        <CheckBox v-if="it.controlType==2" 
+            :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>
+    <div class="result" v-if="checkText.length>0">
+      <p class="title">{{datas.name}}</p>
+      <p>{{getText()}}</p>
+    </div>
+    <div class="foot" v-if="modluesLen==3&&!nextName||modluesLen==2">
+      <span class="back" @click="beBack">{{'返回'+ preName}}</span>
+      <span class="next" @click="toNext">{{'预览并提交病历'}}</span>
+    </div>
+    <div class="foot" v-else>
+      <span class="back" @click="beBack">{{'返回'+ preName}}</span>
+      <span class="next" @click="toNext">{{'进入'+ nextName}}</span>
+    </div>
+    <div class="detail" v-if="show">
+      <DetailBox @close="closeDetal" 
+              :data="labelDetail" 
+              :moduleType="datas.type"
+              :ppId="ppId"
+              v-if="labelDetail.questionMapping&&labelDetail.questionMapping.length>0"
+              @pComplete="complete"/>
+    </div>
     
       <div class="foot" v-if="modluesLen==3&&!nextName||modluesLen==2">
         <span class="back" @click="beBack">{{'返回'+ preName}}</span>
@@ -133,11 +148,17 @@
         this.ppId = null;
         this.scroll = setScroll(BScroll,true,'.otherper')
       },
-      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

+ 6 - 5
src/components/Preview.vue

@@ -33,16 +33,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.text+(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.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.textP+(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">
@@ -125,8 +125,8 @@
 import api from '@utils/api.js';
 import Submit from '../common/Submit';
 import Loading from '../common/Loading';
-import {moduleCP,setScroll} from '@utils/tools.js'
 import BScroll from 'better-scroll';
+import {moduleCP,trimDots,setScroll} from '@utils/tools.js'
 export default {
   props: ['preName','showLis','loadingShow'],
   data() {
@@ -148,7 +148,8 @@ export default {
       // show:loadingShow,//提交等待的动画loading
       tmpNum:0,
       moduleCP:moduleCP,
-      showDoc:false
+      showDoc:false,
+      trimDots:trimDots
     }
   },
   mounted() {

+ 5 - 2
src/components/Symptom.vue

@@ -106,11 +106,13 @@ export default {
       searchShow: false,//显示搜索界面
       tmpItem:{},//检索的症状
       isSearch:false,
-      scroll:null
+      scroll:null,
+      quesText:"请问您有哪些不适?",
     }
   },
   created() {
     if (this.chooseSymp.length > 0) {
+      this.quesText = "请问您还有其他不适吗?";
       // 推送
       const sympText = this.getSympText();
       this.getPush(sympText);
@@ -162,6 +164,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,
@@ -276,7 +279,7 @@ export default {
       const origin = this.$store.state.symptom.origin;
       const read = this.$store.state.symptom.datas;
       const data = read[(item.questionId||item.id)] || origin[(item.questionId||item.id)];
-      if (data.questionMapping && data.questionMapping.length > 0) {
+      if (data&&data.questionMapping && data.questionMapping.length > 0) {
         this.labelDetail = data;
         this.show = true;
         // this.scroll = setScroll(BScroll,true,'.symper')        

+ 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

+ 1 - 1
src/less/index.less

@@ -99,4 +99,4 @@ html{
     .main .mainBtm .Recommend .btn {
       padding: 0 10px !important;
     }
-} */ 
+} */ 

+ 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();
@@ -278,7 +288,8 @@ module.exports =  {
   isIos,
   trimDots,
   concatVal,
-  setScroll
+  setScroll,
+  isWX
 }