Explorar o código

Squashed commit of the following:

commit 77b6786373085812110057941296eef709f91dfc
Author: liucf <liucf@zjlantone.com>
Date:   Wed Sep 18 17:07:21 2019 +0800

    时间类型组件

commit 05198f52dee705bd1ebb48b0e3b5afe0d4229457
Author: liucf <liucf@zjlantone.com>
Date:   Thu Sep 12 14:57:22 2019 +0800

    新增时间单位选择组件

commit 08a849b2c172be4b661be7068753415602e68813
Author: liucf <liucf@zjlantone.com>
Date:   Thu Sep 12 10:06:48 2019 +0800

    修改ip

# Conflicts:
#	build/webpack.dev.conf.js
liucf %!s(int64=5) %!d(string=hai) anos
pai
achega
5f10889954

+ 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.107',
+    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",

+ 110 - 0
src/common/PickTime.vue

@@ -0,0 +1,110 @@
+<template>
+  <div class="toast-wrap">
+    <p v-show="val" :class="['tab',{'check':val != '请选择'}]" @click="showPicker">{{val}}</p>
+    <p v-show="val != '请选择'" class="tip">点击可修改</p>
+    <div class="content" v-show="show">
+      <van-picker
+        :columns="columns"
+        :visible-item-count='3'
+      />
+      <div class="confBtn">
+        <div @click="getVal">确认</div>
+      </div>
+    </div>
+  </div>
+</template>
+<script type="text/javascript">
+  import $ from 'jquery';
+  // import {getNum} from '@utils/tools.js';
+  // const num = getNum();
+  const num = [0,1,2,3,4,5,6,7,8,9];
+  const unit = ['分钟', '小时', '天', '周', '月','年'];
+  export default {
+    name:'PickTime',
+    data() {
+      return {
+        columns: [
+          {
+            values:num,
+            className:'column1'
+          },
+          {
+            values:num,
+            className:'column2',
+            defaultIndex: 2
+          },
+          {
+            values:unit,
+            className:'column3'
+          },
+        ],
+        val:this.item.value || '请选择',
+        show:false
+      }
+    },
+    props:['item'],
+    methods: {
+      showPicker(){
+        this.show = true;
+      },
+      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;
+        this.val = val1 + val2 + val3;
+        this.show = false;
+        const newData = Object.assign({},this.item,{value:this.val,valueP:this.val});
+        this.$emit("updata",newData);
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  @import '../less/base.less';
+  .toast-wrap{
+    margin-bottom: .2rem;
+    position: relative;
+    .tab{
+      width:100%;
+      height: .8rem;
+      line-height: .8rem;
+      text-align: center;
+      border:1px solid #E6E6E6;
+      border-radius: .1rem;
+      color:#7C828E;
+    }
+    .content{
+      padding-top: 25px;
+      width: 100%;
+      height: 227px;
+      background: #fff;
+      z-index: 999;
+      position: absolute;
+      top:.88rem;
+      left: 50%;
+      transform: translateX(-50%);
+      box-sizing: border-box;
+      border-radius: .2rem;
+      z-index: 1000;
+      font-size: .3rem;
+      overflow-y: hidden;
+      box-shadow: 0 .12rem .24rem 0 rgba(79,129,255,0.40);
+      .confBtn{
+        height: 44px;
+        line-height: 44px;
+        text-align: center;
+        border-top: 1px solid #ebedf0;
+        margin-top: 25px;
+        div{
+          color: #colors[theme];
+        }
+      }
+    }
+    .check{
+      color: #colors[theme] !important;
+    }
+    .tip{
+      color: #7C828E;
+    }
+  }
+</style>

+ 107 - 0
src/common/Picker.vue

@@ -0,0 +1,107 @@
+<template>
+  <portal to="notification-outlet">
+      <div class="toast-wrap" v-if="show">
+        <div class="content">
+          <van-picker
+            :columns="columns"
+            @cancel="onCancel"
+            @confirm="onConfirm"
+          />
+        </div>
+      <div class="mask" @click="onCancel"></div>
+      </div>
+  </portal> 
+</template>
+<script type="text/javascript">
+  import $ from 'jquery';
+  import {getNum} from '@utils/tools.js';
+  const unit = ['分钟', '小时', '天', '周', '月','年'];
+  const num = getNum();
+  export default {
+    name:'Picker',
+    data() {
+      return {
+        columns: [
+          {
+            values:num,
+            className:'column1'
+          },
+          {
+            values:unit,
+            className:'column2'
+          },
+        ]
+      }
+    },
+    props:['show'],
+    methods: {
+      onConfirm(value, index) {
+        console.log("值:",value,"索引:",index,)
+        $(".btscroll").css({'position':'absolute'})
+        this.$emit("comfirn",value)
+      },
+      onCancel() {
+        console.log('取消');
+        $(".btscroll").css({'position':'absolute'})
+        this.$emit("cancel")
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  @import '../less/base.less';
+  .toast-wrap{
+    .content{
+      width: 6.3rem;
+      height: 4.8rem;
+      background: #fff;
+      z-index: 999;
+      // position: absolute;
+      position: fixed;
+      top:50%;
+      left: 50%;
+      transform: translate(-50%,-50%);
+      // padding: .5rem;
+      box-sizing: border-box;
+      border-radius: .2rem;
+      z-index: 1000;
+      font-size: .3rem;
+      overflow-y: hidden;
+    }
+    // /deep/ .column1 .van-picker-column__item--selected{
+    /deep/ .column1{
+      &:before{
+        // content: '▷';
+        content: '';
+        width:0;
+        height: 0;
+        position: absolute;
+        left: 0.3rem;
+        // top: 2rem;
+        top: 100px;
+        border-left: 10px solid #colors[theme];
+        border-bottom: 10px solid transparent;
+        border-top: 10px solid transparent;
+      }
+    }
+    // /deep/ .column2 .van-picker-column__item--selected{
+    /deep/ .column2{
+      &:after{
+        // content: '◁';
+        content: '';
+        width:0;
+        height: 0;
+        position: absolute;
+        right: 0.3rem;
+        top: 100px;
+        border-right: 10px solid #colors[theme];
+        border-bottom: 10px solid transparent;
+        border-top: 10px solid transparent;
+      }
+    }
+    .mask{
+      .mask;
+      z-index: 999;
+    }
+  }
+</style>

+ 4 - 1
src/components/Detail.vue

@@ -36,6 +36,7 @@
           @updata="updataData($event,item)"
         ></MultiLineInput>
       </template>
+      <PickTime v-if="item.controlType == 9" @updata="updataData" :item="item"/>
     </div>
   </div>
 </template>
@@ -46,6 +47,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 +68,8 @@ import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
       Input,
       ComTextArea,
       MultiLineInput,
-      RadioSelect
+      RadioSelect,
+      PickTime
     },
     methods:{
       updataData(data,item){

+ 12 - 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,11 +141,19 @@
           this.$store.commit('setDetail',{detail:data,ppId:null,moduleType:moduleCP['symp']})
         }
         
+      },
+      hidePic(){
+        this.showPic = false;
+      },
+      comfirnPic(msg){
+        this.showPic = false;
+        console.log(88,msg)
       }
     },
     components:{
       Detail,
-      Toast
+      Toast,
+      Picker
     },
     computed: {
       getStoreItem () {

+ 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;
 
 

+ 11 - 1
src/utils/tools.js

@@ -361,6 +361,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 +393,8 @@ module.exports =  {
   compare,
   dateParser,
   name,
-  isQQ
+  isQQ,
+  getNum
 }