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-wrapper'+(errormsg?' error':'')">
<view class="left">
@ -11,12 +11,12 @@
</view>
</view>
<view class="errmsg" v-if="errormsg">*{{errormsg}}</view>
</view>
</template>
<script>
export default {
name: "inputBox",
</view>
</template>
<script>
export default {
name: "inputBox",
props: {
value: {
type: String,
@ -29,10 +29,10 @@ export default {
label: {
type: String,
default: ""
},
holder: {
type: String,
default: ''
},
holder: {
type: String,
default: ''
},
rule: {
type: String,
@ -42,14 +42,14 @@ export default {
type: Boolean,
default: true
}
},
data() {
},
data() {
return {
errormsg:'',
cssUrl:this.cssUrl
}
},
methods: {
cssUrl:this.cssUrl
}
},
methods: {
handleBlur(e) {
var value = e.detail.value
var res = this.check(value);
@ -85,12 +85,36 @@ export default {
this.errormsg = this.label+'格式不正确'
return false
}
if(this.rule == 'idcard' && !this.validateChineseIDCard(noEmptyVal)){
this.errormsg = this.label+'格式不正确'
return false
}
this.errormsg = ''
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>
<style lang="scss" scoped>
@ -134,7 +158,7 @@ export default {
textarea{
width: 100%;
height: 45rpx;
}
}
}
}
.errmsg{
@ -150,4 +174,4 @@ export default {
height: 20rpx;
}
}
</style>
</style>

12
components/preBookList.vue

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

25
pages/index/index.vue

@ -25,7 +25,6 @@
<view class="con">
<!-- <view class="con over2 over4"> -->
{{doctorInfo.doctor_info.doctor_detail}}
北京中医药大学硕士研究生中国针灸学会会员中国中医药信息学会专科专病诊疗分会理事学会专科专病诊疗分会理事擅长针药并用治疗内科疾病
</view>
</view>
@ -40,7 +39,10 @@
</text>
<img :src="cssUrl+'index_comback.svg'" v-if="item.hospital_pos" @click="toLocation(item)">
</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 }}
</view>
</view>
@ -255,15 +257,24 @@
let indexofNum = workDatKeyArr.indexOf(item.depart_id);
if(indexofNum > -1){
let departCurItem = workDateValArr[indexofNum];
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('、')
let flag = Array.isArray(departCurItem)
if(flag){
item.visit_time = data.workdate_desc[item.depart_id]
item.plan =0
}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
})
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="title PfScMedium">就诊人信息</view>
<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>
</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