Browse Source

Merge remote-tracking branch 'origin/new'

zhouna 5 years atrás
parent
commit
503bcf8356

+ 4 - 1
.babelrc

@@ -8,5 +8,8 @@
     }],
     "stage-2"
   ],
-  "plugins": ["transform-vue-jsx", "transform-runtime"]
+  "plugins": [
+    "transform-vue-jsx", 
+    "transform-runtime"
+  ]
 }

+ 1 - 1
build/webpack.dev.conf.js

@@ -34,7 +34,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
     compress: true,
     // host: HOST || config.dev.host,
     // host: '192.168.3.6',
-    host: '192.168.1.104',
+    host: '192.168.1.108',
     port: PORT || config.dev.port,
     open: config.dev.autoOpenBrowser,
     overlay: config.dev.errorOverlay

+ 2 - 2
config/index.js

@@ -4,8 +4,8 @@
 
 const path = require('path')
 // const proxy_path = 'http://192.168.2.236:80';
-// const proxy_path = 'http://192.168.2.236:5050';
-const proxy_path = 'http://192.168.2.241:5050';
+const proxy_path = 'http://192.168.2.236:5050';
+// const proxy_path = 'http://192.168.2.241:5050';
 
 module.exports = {
   dev: {

+ 1 - 0
package.json

@@ -19,6 +19,7 @@
     "less-loader": "^4.1.0",
     "lib-flexible": "^0.3.2",
     "portal-vue": "^2.1.6",
+    "vant": "^2.2.0",
     "vue": "^2.5.2",
     "vue-photo-preview": "^1.1.3",
     "vue-router": "^3.0.1",

+ 1 - 0
src/common/ComTextArea.vue

@@ -78,6 +78,7 @@ export default {
       -webkit-appearance: none;
       padding: .16rem /* 16/100 */ .3rem /* 30/100 */;
       margin-bottom: .3rem;
+      background-color: transparent;
     }
   }
 </style>

+ 3 - 2
src/common/Input.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="inp-wrap">
-    <input :type="item.controlType==6?'text':'tel'" 
+    <input :type="item.controlType==6?'text':'number'" 
           :maxlength="item.controlType==6?'':10"
           :class="{'change':borColor}" 
           v-model="val" 
@@ -26,7 +26,7 @@
       changeVal(e){
         this.borColor = true;
         if(this.item.controlType==7){//数字键盘
-          this.val = e.target.value=e.target.value.replace(/[^\d]/g,'')
+          this.val = e.target.value=e.target.value.replace(/^\.$/,'')
         }
         // document.activeElement.scrollIntoViewIfNeeded(true);
         this.borColor = false;
@@ -75,6 +75,7 @@
       outline-color: invert;
       padding-left: 0.1rem;
       box-sizing: border-box;
+      // background: #fff;
       background: transparent;
     }
     .change{

+ 3 - 3
src/common/MultiLineInput.vue

@@ -6,7 +6,7 @@
           <template v-for="(item,idx) in content.iptLis">
             <input v-if="content.iptLis.length>1" 
               class="contentVal" 
-              :type="content.type=='number'?'tel':'text'" 
+              :type="content.type=='number'?'number':'text'" 
               :style="{'width':1/content.iptLis.length*100-3+'%'}" 
               :key="item.placeholder+idx" 
               v-model="item.value"
@@ -17,7 +17,7 @@
               :maxlength="content.type=='number'?10:''"
               @click="handleClick">
             <input v-show="content.iptLis.length==1" class="contentVal" 
-              :type="content.type=='number'?'tel':'text'" 
+              :type="content.type=='number'?'number':'text'" 
               :placeholder="content.placeholder" 
               v-model="item.value"
               @input="changeVal($event,idx,content.type)" 
@@ -74,7 +74,7 @@ export default {
       let tmpTxt = '',arr=this.tmpArr
       document.activeElement.scrollIntoViewIfNeeded(true);
       if(type == 'number'){
-        e.currentTarget.value=e.currentTarget.value.replace(/[^\d]/g,'')
+        e.currentTarget.value = e.currentTarget.value.replace(/^\.$/,'')
       }
       arr[num]=e.currentTarget.value
       tmpTxt=arr.join('/')

+ 4 - 3
src/common/OptionInp.vue

@@ -3,7 +3,7 @@
   <div :class="['inpbox',{'check':item.select},{'exclu':exclu}]">
     <span class="prefix" v-if="msg.prefix">{{msg.prefix}}</span>
     <!-- <div class="inp" @click="preClick"> -->
-      <input :type="msg.type=='number'?'tel':'text'" 
+      <input :type="msg.type=='number'?'number':'text'" 
               :placeholder="msg.placeholder"
               :style="{'width':!msg.prefix&&!msg.suffix?'90%':'33%'}"
               :disabled="exclu"
@@ -27,7 +27,7 @@ import $ from 'jquery';
       return{
         msg:{},
         txt:this.item.value || '',
-        select:0,
+        select:0
       }
     },
     props:['item','exclu'],
@@ -39,7 +39,7 @@ import $ from 'jquery';
     methods:{
       changeVal(e){
         if(this.msg.type=='number'){//数字键盘
-          this.txt = e.target.value=e.target.value.replace(/[^\d]/g,'')
+          this.txt = e.target.value=e.target.value.replace(/^\.$/,'')
         }
         
         const newData = Object.assign({},this.part,{value:this.txt});
@@ -109,6 +109,7 @@ import $ from 'jquery';
       border-bottom: 1px solid #DFE0E4 !important;
       border-radius: 0;
       padding-left: .05rem;
+      background-color: transparent;
       height: 0.38rem;
       line-height: 0.38rem;
     }

+ 84 - 0
src/common/PickTime.vue

@@ -0,0 +1,84 @@
+<!-- 时间类型控件 -->
+<template>
+  <div class="toast-wrap">
+    <p v-show="val" :class="['ptab',{'check':val != '请选择'}]" @click="showPicker">{{val}}</p>
+    <p v-show="val != '请选择'" class="tip">点击可修改</p>
+    <Picker ref="picker" :show="showTime" @comfirn="getTimeVal" @cancel="close" :picIndex="picIndex"/>
+  </div> 
+</template>
+<script type="text/javascript">
+  import $ from 'jquery';
+  import Picker from './Picker.vue';
+  export default {
+    name:'PickTime',
+    data() {
+      return {
+        val:this.item.value || '请选择',
+        showTime:false,
+        picIndex:this.item.pickIndex||[]
+      }
+    },
+    props:['item'],
+    methods: {
+      showPicker(){
+        this.showTime = true;
+        $(".btscroll").css({'position':'fixed'})
+        $(".foot").css({'position':'fixed'})
+      },
+      getTimeVal(value,index){//确定
+        // 首位为0则去掉
+        if(value.charAt(0) == 0){
+          this.val = value.substr(1);
+        }else{
+          this.val = value;
+        }
+        this.showTime = false;
+        const newData = Object.assign({},this.item,{value:this.val,valueP:this.val,pickIndex:index});
+        this.$emit("updata",newData);
+        $(".btscroll").css({'position':'absolute'})
+      },
+      close(){//点击蒙层关闭
+        this.showTime = false;
+        $(".btscroll").css({'position':'absolute'})
+      }
+    },
+    components:{
+      Picker
+    },
+    watch:{
+      item:{
+        handler(newVal,oldVal){
+          this.val = newVal.value|| '请选择';
+          if(!newVal.value){//没有值时复原时间组件中的index
+            this.$refs.picker.resetIndex();
+          }
+        },
+        deep:true
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  @import '../less/base.less';
+  .toast-wrap{
+    margin-bottom: .2rem;
+    position: relative;
+    z-index: 116;
+    .ptab{
+      width:100%;
+      height: .8rem;
+      line-height: .8rem;
+      text-align: center;
+      border:1px solid #E6E6E6;
+      border-radius: .1rem;
+      color:#7C828E;
+    }
+    .check{
+      color: #colors[theme] !important;
+    }
+    .tip{
+      color: #7C828E;
+      font-size: .24rem;
+    }
+  }
+</style>

+ 136 - 0
src/common/Picker.vue

@@ -0,0 +1,136 @@
+<!-- 时间选择弹窗 -->
+<template>
+  <portal to="notification-outlet">
+      <div class="toast-wrap" v-if="show">
+        <div class="content">
+          <van-picker
+            :columns="columns"
+            :visible-item-count='3'
+            @change="handlechange"
+          />
+          <div class="confBtn">
+            <p class="tip" v-show="showTip">请选择正确的时间</p>
+            <div @click="getVal">确认</div>
+          </div>
+        </div>
+      <div class="mask" @click="onCancel"></div>
+      </div>
+  </portal> 
+</template>
+<script type="text/javascript">
+  import $ from 'jquery';
+  const num = [0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9];
+  const unit = ['分钟', '小时', '天', '周', '月','年','分钟', '小时', '天', '周', '月','年'];
+  export default {
+    name:'Picker',
+    data() {
+      return {
+        columns: [
+          {
+            values:num,
+            className:'column1',
+            defaultIndex: 10
+          },
+          {
+            values:num,
+            className:'column2',
+            defaultIndex: 11
+          },
+          {
+            values:unit,
+            className:'column3',
+            defaultIndex: 6
+          },
+        ],
+        showTip:false,
+        columIndx:[]
+      }
+    },
+    props:['show','picIndex'],
+    created(){//记录位置
+      this.columns[0].defaultIndex = this.columIndx[0] = this.picIndex[0] || 10;
+      this.columns[1].defaultIndex = this.columIndx[1] = this.picIndex[1] || 11;
+      this.columns[2].defaultIndex = this.columIndx[2] = this.picIndex[2] || 6;
+    },
+    methods: {
+      getVal() {
+        const val1 = $(".column1 ul .van-picker-column__item--selected")[0].innerText;
+        const val2 = $(".column2 ul .van-picker-column__item--selected")[0].innerText;
+        const val3 = $(".column3 ul .van-picker-column__item--selected")[0].innerText;
+        // 如果选两个0,则提示
+        if(val1 == 0 && val2 == 0){
+          this.showTip = true;
+          return
+        }
+        const value = val1 + val2 + val3;
+        this.$emit("comfirn",value,this.columIndx)
+        this.columns[0].defaultIndex = this.columIndx[0] || 10;
+        this.columns[1].defaultIndex = this.columIndx[1] || 11;
+        this.columns[2].defaultIndex = this.columIndx[2] || 6;
+      },
+      onCancel() {
+        this.$emit("cancel")
+        this.showTip = false;
+      },
+      handlechange(picker, value, colum){//关掉提示
+        this.showTip = false;
+        if(colum == 2){
+          this.columIndx[colum] = unit.lastIndexOf(value[colum]);
+        }else{
+          this.columIndx[colum] = num.lastIndexOf(value[colum]);
+        }
+      },
+      resetIndex(){//清除时复原默认index
+        this.columns[0].defaultIndex = 10;
+        this.columns[1].defaultIndex = 11;
+        this.columns[2].defaultIndex = 6;
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  @import '../less/base.less';
+  .toast-wrap{
+    .content{
+      padding-top: 25px;
+      width: 6.3rem;
+      // height: 4.8rem;
+      height: 227px;
+      background: #fff;
+      z-index: 999;
+      position: fixed;
+      top:50%;
+      left: 50%;
+      transform: translate(-50%,-50%);
+      box-sizing: border-box;
+      border-radius: .2rem;
+      z-index: 1000;
+      font-size: .3rem;
+      overflow-y: hidden;
+      .confBtn{
+        height: 44px;
+        line-height: 44px;
+        text-align: center;
+        border-top: 1px solid #ebedf0;
+        margin-top: 25px;
+        position: relative;
+        .tip{
+          position: absolute;
+          top:-22px;
+          font-size: .24rem;
+          color: red;
+          line-height: 20px;
+          width:100%;
+          text-align: center;
+        }
+        div{
+          color: #colors[theme];
+        }
+      }
+    }
+    .mask{
+      .mask;
+      z-index: 999;
+    }
+  }
+</style>

+ 10 - 3
src/components/AddContent.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="symp-wrap addper btscroll">
+  <div class="addc-wrap addper btscroll">
     <div class="content">
         <div class="choose">
         <ul class="addPart">
@@ -35,6 +35,11 @@
                 @updata="updataData($event,index,item)"
               ></MultiLineInput>
             </template>
+            <!-- 时间控件 -->
+            <PickTime v-if="item.controlType==9"
+              :item="item"
+              :key="item.id"
+              @updata="updataData($event,idx,item)"/>
           </li>
         </ul>
         <div class="result" v-if="allStr">
@@ -62,6 +67,7 @@ import Radio from '../common/Radio.vue';
 import CheckBox from '../common/CheckBox.vue';
 import {imageUrlPrefix,getAllStr,setScroll} from '@utils/tools.js';
 import BScroll from 'better-scroll';
+import PickTime from '../common/PickTime.vue';
 export default {
   name: 'AddContent',
   props: ['allMoudles','preName'],
@@ -137,7 +143,8 @@ export default {
     MultiLineInput,
     Input,
     Radio,
-    CheckBox
+    CheckBox,
+    PickTime
   }
 }
 </script>
@@ -146,7 +153,7 @@ export default {
 .questionImg {
   width: 100%;
 }
-.symp-wrap {
+.addc-wrap {
   font-size: 0.3rem;
   overflow: hidden;
   .content {

+ 0 - 2
src/components/Department.vue

@@ -61,9 +61,7 @@
                     recordId:msg.recordId,
                     time:(new Date(time.replace(/\-/g, "/"))).getTime()
                 }
-
                 localStorage.setItem('loginParam',JSON.stringify(params))//保存登陆信息,扫码进入徐删除该参数
-
                 this.$router.push({
                     path:'/home',
                     query:params

+ 12 - 1
src/components/Detail.vue

@@ -36,6 +36,9 @@
           @updata="updataData($event,item)"
         ></MultiLineInput>
       </template>
+      <PickTime v-if="item.controlType == 9" 
+              @updata="updataData"
+              :item="item"/>
     </div>
   </div>
 </template>
@@ -46,6 +49,7 @@ import Input from '../common/Input.vue';
 import ComTextArea from '../common/ComTextArea.vue';
 import RadioSelect from '../common/RadioSelect.vue';
 import MultiLineInput from '../common/MultiLineInput.vue';
+import PickTime from '../common/PickTime.vue';
 import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
 // 将获取到的数据源转换成私有数据,处理选择事件。点击完成后统一存到store中,便于回读
   export default {
@@ -66,7 +70,8 @@ import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
       Input,
       ComTextArea,
       MultiLineInput,
-      RadioSelect
+      RadioSelect,
+      PickTime
     },
     methods:{
       updataData(data,item){
@@ -176,6 +181,12 @@ import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
         const datas = JSON.parse(JSON.stringify(this.checkDatas.questionMapping))
         let reqFlag = false;//必填项标识
         for(let i in datas){
+          // 时间控件需要清除缓存的index
+          if(datas[i].controlType ==9){
+            if(datas[i].pickIndex){
+              datas[i].pickIndex = [];
+            } 
+          }
           datas[i].value = "";
           datas[i].valueP = "";
           if(datas[i].required==1){

+ 4 - 2
src/components/DetailBox.vue

@@ -33,6 +33,7 @@
 <script type="text/javascript">
   import Detail from './Detail.vue';
   import Toast from '../common/Toast.vue';
+  import Picker from '../common/Picker.vue';
   import {fixedKeyboard,setScroll,moduleCP} from '@utils/tools.js';
   import BScroll from 'better-scroll';
   import $ from 'jquery';
@@ -50,7 +51,8 @@
         tips:"(请完成病情预问诊可让医生提前了解病情)",
         checkF:false, //详情页有无已选项标识
         show:detailShow,
-        reqFinish:false
+        reqFinish:false,
+        showPic:false
       }
     },
     mounted(){
@@ -139,7 +141,7 @@
           this.$store.commit('setDetail',{detail:data,ppId:null,moduleType:moduleCP['symp']})
         }
         
-      }
+      },
     },
     components:{
       Detail,

+ 8 - 1
src/components/DiagTreat.vue

@@ -45,6 +45,11 @@
               @updata="updataData($event,it.id,i,index)"
             ></MultiLineInput>
         </template>
+        <!-- 时间控件 -->
+        <PickTime v-if="it.controlType==9"
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id,i)"/>
       </div>
       <div class="result" v-if="getText()">
         <p class="title">{{datas.name}}</p>
@@ -73,6 +78,7 @@
   import CheckBox from '../common/CheckBox.vue';
   import BScroll from 'better-scroll';
   import MultiLineInput from '../common/MultiLineInput.vue';
+  import PickTime from '../common/PickTime.vue';
   export default {
     name:'DiagTreat',
     data(){
@@ -168,7 +174,8 @@
       ComTextArea,
       Radio,
       CheckBox,
-      MultiLineInput
+      MultiLineInput,
+      PickTime
     },
     computed:{
       getItem(){

+ 8 - 1
src/components/Others.vue

@@ -40,6 +40,11 @@
               @updata="updataData($event,it.id,i,index)"
             ></MultiLineInput>
         </template>
+        <!-- 时间控件 -->
+        <PickTime v-if="it.controlType==9"
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id,i)"/>
       </div>
       <div class="result" v-if="getText()">
         <p class="title">{{datas.name}}</p>
@@ -68,6 +73,7 @@
   import CheckBox from '../common/CheckBox.vue';
   import MultiLineInput from '../common/MultiLineInput.vue';
   import BScroll from 'better-scroll';
+  import PickTime from '../common/PickTime.vue';
   export default {
     name:'Others',
     data(){
@@ -164,7 +170,8 @@
       ComTextArea,
       Radio,
       CheckBox,
-      MultiLineInput
+      MultiLineInput,
+      PickTime
     },
     computed:{
       getItem(){

+ 4 - 0
src/main.js

@@ -6,8 +6,12 @@ import preview from 'vue-photo-preview';
 import 'vue-photo-preview/dist/skin.css';
 import PortalVue from 'portal-vue';
 import './utils/getfile.js';
+// import {Picker} from 'vant';
+import Picker from 'vant/lib/picker';
+import 'vant/lib/picker/style';
 Vue.use(PortalVue);
 Vue.use(preview);
+Vue.use(Picker);
 Vue.config.productionTip = false;
 
 

+ 12 - 1
src/utils/tools.js

@@ -318,6 +318,7 @@ function setScroll(scroll,flg,wrapper){
   return new scroll(wrapper?wrapper:'.wrapper',{
       scrollY: flg,
       click: true,
+      tap: true,
       probeType:3,
       // bounceTime:800,
       momentumLimitTime:300,//只有在屏幕上快速滑动的时间小于 momentumLimitTime,才能开启 momentum 动画。
@@ -361,6 +362,15 @@ function dateParser(timestamp,link = '-'){
   return result;
 }
 
+// 获取01-99
+const getNum = () => {
+  let num = [];
+  for(let i = 1; i < 100; i++){
+    num.push(i.toString().padStart(2,'0'));
+  }
+  return num;
+}
+
 module.exports =  {
   imageUrlPrefix,
   getUrlArgObject,
@@ -384,7 +394,8 @@ module.exports =  {
   compare,
   dateParser,
   name,
-  isQQ
+  isQQ,
+  getNum
 }