Browse Source

修改身份证号校验、增加空列表状态

master
zq 9 months ago
parent
commit
6cb298f737
  1. 70
      components/inputBox.vue
  2. 12
      components/preBookList.vue
  3. 25
      pages/index/index.vue
  4. 2
      pages/modify_visitor/modify_visitor.vue
  5. 1
      static/images/frontend/list_empty.svg

70
components/inputBox.vue

@ -1,4 +1,4 @@
<template> <template>
<view class="input-com"> <view class="input-com">
<view :class="'input-wrapper'+(errormsg?' error':'')"> <view :class="'input-wrapper'+(errormsg?' error':'')">
<view class="left"> <view class="left">
@ -11,12 +11,12 @@
</view> </view>
</view> </view>
<view class="errmsg" v-if="errormsg">*{{errormsg}}</view> <view class="errmsg" v-if="errormsg">*{{errormsg}}</view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: "inputBox", name: "inputBox",
props: { props: {
value: { value: {
type: String, type: String,
@ -29,10 +29,10 @@ export default {
label: { label: {
type: String, type: String,
default: "" default: ""
}, },
holder: { holder: {
type: String, type: String,
default: '' default: ''
}, },
rule: { rule: {
type: String, type: String,
@ -42,14 +42,14 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
} }
}, },
data() { data() {
return { return {
errormsg:'', errormsg:'',
cssUrl:this.cssUrl cssUrl:this.cssUrl
} }
}, },
methods: { methods: {
handleBlur(e) { handleBlur(e) {
var value = e.detail.value var value = e.detail.value
var res = this.check(value); var res = this.check(value);
@ -85,12 +85,36 @@ export default {
this.errormsg = this.label+'格式不正确' this.errormsg = this.label+'格式不正确'
return false return false
} }
if(this.rule == 'idcard' && !this.validateChineseIDCard(noEmptyVal)){
this.errormsg = this.label+'格式不正确'
return false
}
this.errormsg = '' this.errormsg = ''
return true return true
} },
} validateChineseIDCard(idCard) {
}; const pattern = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/;
if (!pattern.test(idCard)) {
return false;
}
const modWeight = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
const modCheckDigit = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
const idArray = idCard.split('');
let sum = 0;
for (let i = 0; i < 17; i++) {
sum += parseInt(idArray[i]) * modWeight[i];
}
const mod = sum % 11;
const checkDigit = modCheckDigit[mod];
return idArray[17] === checkDigit.toString();
}
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -134,7 +158,7 @@ export default {
textarea{ textarea{
width: 100%; width: 100%;
height: 45rpx; height: 45rpx;
} }
} }
} }
.errmsg{ .errmsg{
@ -150,4 +174,4 @@ export default {
height: 20rpx; height: 20rpx;
} }
} }
</style> </style>

12
components/preBookList.vue

@ -1,6 +1,6 @@
<template> <template>
<view class="prebook-list-com"> <view class="prebook-list-com">
<view class="list btPadding" v-if="dataList.length>0"> <view class="list btPadding" v-if="dataList.length>0">
<view :class="'item '+item" v-for="(item, key) in dataList" @click="toBookDetail(item)"> <view :class="'item '+item" v-for="(item, key) in dataList" @click="toBookDetail(item)">
<view class="left"> <view class="left">
<view class="title PfScMedium"><text v-if="item.name">{{item.name}}</text><text v-else></text></view> <view class="title PfScMedium"><text v-if="item.name">{{item.name}}</text><text v-else></text></view>
@ -16,6 +16,7 @@
</view> </view>
</view> </view>
</view> </view>
<img class="emptyImg" v-else :src="cssUrl + 'list_empty.svg'" alt="">
</view> </view>
</template> </template>
<script> <script>
@ -56,6 +57,7 @@ export default {
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
background: #FFFFFF;
.list{ .list{
width: 100%; width: 100%;
height: auto; height: auto;
@ -174,6 +176,12 @@ export default {
} }
} }
} }
.emptyImg{
width: 440rpx;
opacity: .6;
margin-left: 50%;
transform: translateX(-50%);
}
} }
</style> </style>

25
pages/index/index.vue

@ -25,7 +25,6 @@
<view class="con"> <view class="con">
<!-- <view class="con over2 over4"> --> <!-- <view class="con over2 over4"> -->
{{doctorInfo.doctor_info.doctor_detail}} {{doctorInfo.doctor_info.doctor_detail}}
北京中医药大学硕士研究生中国针灸学会会员中国中医药信息学会专科专病诊疗分会理事学会专科专病诊疗分会理事擅长针药并用治疗内科疾病
</view> </view>
</view> </view>
@ -40,7 +39,10 @@
</text> </text>
<img :src="cssUrl+'index_comback.svg'" v-if="item.hospital_pos" @click="toLocation(item)"> <img :src="cssUrl+'index_comback.svg'" v-if="item.hospital_pos" @click="toLocation(item)">
</view> </view>
<view class="date over2 over4"> <view class="date over2 over4" v-if="item.plan==0">
停诊
</view>
<view class="date over2 over4" v-else>
出诊{{ item.visit_time }} 出诊{{ item.visit_time }}
</view> </view>
</view> </view>
@ -255,15 +257,24 @@
let indexofNum = workDatKeyArr.indexOf(item.depart_id); let indexofNum = workDatKeyArr.indexOf(item.depart_id);
if(indexofNum > -1){ if(indexofNum > -1){
let departCurItem = workDateValArr[indexofNum]; let departCurItem = workDateValArr[indexofNum];
for(let key in departCurItem){ let flag = Array.isArray(departCurItem)
let dateItem = departCurItem[key]; if(flag){
if(Number(dateItem.plan) === 0)continue item.visit_time = data.workdate_desc[item.depart_id]
timeList.push(dateItem.week_desc+this.workPlan[dateItem.plan]) item.plan =0
item.visit_time = timeList.join('、') }else{
for(let key in departCurItem){
let dateItem = departCurItem[key];
if(Number(dateItem.plan) === 0)continue
timeList.push(dateItem.week_desc+this.workPlan[dateItem.plan])
item.visit_time = timeList.join('、')
}
} }
} }
return item return item
}) })
console.log(this.hospital_departs,'this.hospital_departs');
// }else{
// } // }
}); });
}, },

2
pages/modify_visitor/modify_visitor.vue

@ -3,7 +3,7 @@
<view class="block"> <view class="block">
<view class="title PfScMedium">就诊人信息</view> <view class="title PfScMedium">就诊人信息</view>
<input-box class="inputcom-wrapper" v-model="name" holder="就诊人姓名" label="姓名" @blurEvent="nameBlurEvent"></input-box> <input-box class="inputcom-wrapper" v-model="name" holder="就诊人姓名" label="姓名" @blurEvent="nameBlurEvent"></input-box>
<input-box class="inputcom-wrapper" v-model="idcard" holder="请输入身份证后4位" label="身份证尾号" @blurEvent="idCardBlurEvent" rule="idcardext"></input-box> <input-box class="inputcom-wrapper" v-model="idcard" holder="请输入身份证号" label="身份证号" @blurEvent="idCardBlurEvent" rule="idcard"></input-box>
<input-box class="inputcom-wrapper" v-model="phone" holder="请输入就诊人手机号" label="常用手机号" @blurEvent="phoneBlurEvent" rule="phone"></input-box> <input-box class="inputcom-wrapper" v-model="phone" holder="请输入就诊人手机号" label="常用手机号" @blurEvent="phoneBlurEvent" rule="phone"></input-box>
</view> </view>

1
static/images/frontend/list_empty.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

Loading…
Cancel
Save