Parcourir la source

Merge branch 'btscroll' of http://192.168.2.236:10080/zhouna/preliminary into btscroll

liucf il y a 5 ans
Parent
commit
2d6219be79

+ 1 - 1
src/App.vue

@@ -1,5 +1,5 @@
 <template>
-    <div id="app" onresize="document.activeElement.scrollIntoView(true);">
+    <div id="app">
         <router-view/>
         <portal-target name="notification-outlet"></portal-target>
         <portal-target name="notification-detail"></portal-target>

+ 10 - 2
src/common/CheckBox.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="check-wrap" v-if="item">
     <!-- <img :src="datas.url.replace('{imageUrlPrefix}',imgUrl)" v-if="datas.url"> -->
-    <p v-for="(it,index) in datas.questionDetailList" :key="it.id" class="list" @click="handleClick(it,index)">
+    <p v-for="(it,index) in datas.questionDetailList" :key="it.id" class="list" @click="handleClick(it,index,'',true)">
       <img :src="it.select==1?check:defaultPic">
       <!-- <span :class="{'check':it.select==1}">{{it.name}}</span> -->
       <span v-if="((it.description||it.name).indexOf('${'))==-1" :class="[{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusion !== exclusion}]">{{it.description||it.name}}</span>
@@ -47,13 +47,21 @@ import OptionInp from '../common/OptionInp.vue';
       this.resetExc();
     },
     methods:{
-      handleClick(it,index,flag){
+      handleClick(it,index,flag,flg){
+        if(flg){
+          document.activeElement.blur();      
+          document.activeElement.scrollIntoViewIfNeeded(true);
+          setTimeout(()=>{
+            document.activeElement.scrollIntoViewIfNeeded(true);
+          },300)
+        }
         const that = this;
         const list = this.datas;
         let data = list.questionDetailList&&list.questionDetailList.slice(0);
         // 处理互斥
         const excluArr = data.filter(it=>it.exclusion==1);
         const filArr = data.filter(it=>it.select==1);
+
         if(excluArr.length>0){//有互斥
           if(filArr.length>0){//有选中
             if(it.exclusion !== filArr[0].exclusion){

+ 5 - 2
src/common/ComTextArea.vue

@@ -34,11 +34,14 @@ export default {
   methods:{
     changeVal(){
       this.$emit('changeAreaVal',this.txt)
+      const newData = Object.assign({},this.item,{value:this.txt,valueP:this.txt});
+      this.$emit("updata",newData);
     },
     blur(){
       document.activeElement.scrollIntoViewIfNeeded(true);
-      const newData = Object.assign({},this.item,{value:this.txt,valueP:this.txt});
-      this.$emit("updata",newData);
+      setTimeout(()=>{
+        document.activeElement.scrollIntoViewIfNeeded(true);
+      },300)
     }
   },
   watch:{

+ 9 - 2
src/common/Input.vue

@@ -24,12 +24,19 @@
         if(this.item.controlType==7){//数字键盘
           this.val = e.target.value=e.target.value.replace(/[^\d]/g,'')
         }
-      },
-      blur(){
         document.activeElement.scrollIntoViewIfNeeded(true);
         this.borColor = false;
         const newData = Object.assign({},this.item,{value:this.val,valueP:this.val});
         this.$emit("updata",newData);
+      },
+      blur(){
+        document.activeElement.scrollIntoViewIfNeeded(true);
+        setTimeout(()=>{
+          document.activeElement.scrollIntoViewIfNeeded(true);
+        },300)
+        // this.borColor = false;
+        // const newData = Object.assign({},this.item,{value:this.val,valueP:this.val});
+        // this.$emit("updata",newData);
       }
     },
     watch:{

+ 9 - 2
src/common/Label.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="label-wrap" v-if="item">
-    <p v-for="(it,index) in datas.questionMapping" :key="it.id" :class="['symp',{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusionType !== exclusion}]" @click="handleClick(it,index)">
+    <p v-for="(it,index) in datas.questionMapping" :key="it.id" :class="['symp',{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusionType !== exclusion}]" @click="handleClick(it,index,true)">
       <span>{{it.description||it.name}}</span>
       <!-- <span v-if="it.select==1" @click="deletSymp($event,it,index)"><img src="../images/delete.png" alt=""></span> -->
       <span v-if="it.select==1" @click="deletSymp($event,it,index)"><img src="../images/del.png" alt=""></span>
@@ -40,7 +40,14 @@ import {moduleCP} from '@utils/tools';
       Toast
     },
     methods:{
-      handleClick(it,index){
+      handleClick(it,index,flg){
+        if(flg){
+          document.activeElement.blur();      
+          document.activeElement.scrollIntoViewIfNeeded(true);
+          setTimeout(()=>{
+            document.activeElement.scrollIntoViewIfNeeded(true);
+          },300)
+        }
         const arr = this.datas.questionMapping;
         const excluArr = arr.filter(it=>it.exclusionType==1);
         const filArr = arr.filter(it=>it.select==1);

+ 10 - 4
src/common/MultiLineInput.vue

@@ -67,6 +67,7 @@ export default {
   methods:{
     changeVal(e,num,type){
       let tmpTxt = '',arr=this.tmpArr
+      document.activeElement.scrollIntoViewIfNeeded(true);
       if(type == 'number'){
         e.currentTarget.value=e.currentTarget.value.replace(/[^\d]/g,'')
       }
@@ -75,18 +76,23 @@ export default {
       this.txt = tmpTxt
       this.content = getModelExpStr(this.msg,this.txt)
       // this.$emit('changeMultipVal',e.currentTarget.value,num)
-    },
-    blur(){
-      document.activeElement.scrollIntoViewIfNeeded(true);
-      // 如果该项未选中,则不存值
+      
       const select = this.part.select;
       // if(!select){return}
       const newData = Object.assign({},this.part,{value:this.txt,controlType:3,valueP:this.txt});
       this.$emit("updata",newData);
       this.$emit('handleInp',this.txt);
     },
+    blur(){
+      // 如果该项未选中,则不存值           
+      document.activeElement.scrollIntoViewIfNeeded(true);
+      setTimeout(()=>{
+        document.activeElement.scrollIntoViewIfNeeded(true);
+      },300)
+    },
     handleClick(e){
       // 点击输入框时不选中该项
+      document.activeElement.scrollIntoViewIfNeeded(true);
       e.stopPropagation();
     }
   },

+ 3 - 0
src/common/OptionInp.vue

@@ -44,6 +44,9 @@ import { getExpStr,scrollToV,isIos} from '@utils/tools';
       },
       handleBlur(){
         document.activeElement.scrollIntoViewIfNeeded(true);
+        setTimeout(()=>{
+          document.activeElement.scrollIntoViewIfNeeded(true);
+        },300)
           // 如果该项未选中,则不存值
         // const select = this.item.select;
         // if(!select){return}

+ 7 - 3
src/common/Radio.vue

@@ -40,6 +40,13 @@ import OptionInp from '../common/OptionInp.vue';
     },
     methods:{
       handleClick(it,index,flg){
+        if(flg){
+          document.activeElement.blur();      
+          document.activeElement.scrollIntoViewIfNeeded(true);
+          setTimeout(()=>{
+            document.activeElement.scrollIntoViewIfNeeded(true);
+          },300)
+        }
         const list = this.datas;
         let data = list.questionDetailList&&list.questionDetailList.slice(0); //数组深拷贝?
         for(let i=0;i<data.length; i++){
@@ -51,9 +58,6 @@ import OptionInp from '../common/OptionInp.vue';
         let temp = concatVal(data);
         const newData = Object.assign({},this.datas,{questionDetailList:data,value:temp.value,valueP:temp.valueP})
         this.$emit("updata",newData);
-        if(flg){
-          document.activeElement.blur();
-        }
       },
       inpVal(val,index){//输入框失焦处理  
         // 输入框回读

+ 2 - 3
src/components/AddContent.vue

@@ -78,8 +78,7 @@ export default {
   },
   mounted() {
     this.$nextTick(()=>{
-      let scroll = setScroll(BScroll,true,'.addper')
-      this.scroll = scroll
+      this.scroll = setScroll(BScroll,true,'.addper')
     })
   },
   methods: {
@@ -142,7 +141,7 @@ export default {
   font-size: 0.3rem;
   overflow: hidden;
   .content {
-    padding-right: .3rem;
+    // padding-right: .3rem;
   }
   .btscroll;  
   h3 {

+ 4 - 2
src/components/DetailBox.vue

@@ -62,8 +62,10 @@
         if(hasCheck){
           this.checkF = true;
         }
-        let scroll = setScroll(BScroll,true,'.viewPrew')
-        this.scroll = scroll
+        setTimeout(() => {
+          let scroll = setScroll(BScroll,true,'.viewPrew')
+          this.scroll = scroll
+        }, 400);
         // fixedKeyboard();//给Window绑定事件
       })
     },

+ 4 - 0
src/components/DiagTreat.vue

@@ -105,8 +105,12 @@
     mounted(){
       let scroll = setScroll(BScroll,true,'.treatper')
       this.scroll = scroll
+      scroll.on('scroll', this.onScroll)
     },
     methods:{
+      onScroll(pos) {
+        document.activeElement.scrollIntoViewIfNeeded(true);        
+      },
       commitShowLabel(flg){
         this.scroll = setScroll(BScroll,flg,'.treatper')
       },

+ 5 - 1
src/utils/tools.js

@@ -270,9 +270,13 @@ function concatVal(data){
 function setScroll(scroll,flg,wrapper){
   return new scroll(wrapper?wrapper:'.wrapper',{
       scrollY: flg,
-      click: true
+      click: true,
+      probeType:3,
+      bounceTime:500
   })
 }
+
+
 module.exports =  {
   imageUrlPrefix,
   getUrlArgObject,