<view class="content">
<view class="discriminate">
<view class="radio"></view>
<view class="sfz"><text>身份证智能识别填写</text></view>
</view>
<view class="discriminatesingtitle">
<text>点击自动识别身份证信息</text>
</view>
<view class="pybottomitem" style="margin-top:30rpx">
<view> <text class="required">*</text><text class="pybottomitemtitle">身份证号</text></view>
<view class="pybottomiteminput" style="width: 56%;">
<input type="idcard" bindblur="rqpCard" maxlength="18" value="{{personalCard}}" name="personalCard" placeholder="请输入身份证号" />
</view>
<view class="pb center" bindtap="chooseImage" style="height: 55rpx;background-image: url('{{app.host.file.info}}/pb.png')"></view>
</view>
<view class="{{isshow?'':'isnum'}}" style="margin-left: 30%;margin-top: 10rpx;color: #FF0000;"><text>请输入正确格式的身份证号码</text></view>
<view class="pybottomitem">
<view> <text class="required">*</text><text class="pybottomitemtitle">姓名</text></view>
<view class="pybottomiteminput">
<input type="text" value="{{username}}" name="name" placeholder="请输入姓名" />
</view>
</view>
<!-- <view class="{{personalCard?'':'isnum'}}" style="margin-left: 30%;margin-top: 10rpx;color: #FF0000;"><text>请输入正确格式的身份证号码</text></view> -->
<view class="pybottomitem">
<view> <text class="required">*</text><text class="pybottomitemtitle">性别</text></view>
<view class="pybottomiteminput">
<radio-group name="gender" bindchange="handleChange">
<radio wx:for="{{gender}}" value="{{item.value}}" checked="{{item.checked ? true : false}}">{{item.text}}</radio>
</radio-group>
</view>
</view>
<view class="pybottomitem">
<view> <text class="required">*</text><text class="pybottomitemtitle">民族</text></view>
<picker bindchange="shoppick" range="{{nationdata}}" range-key="name">
<view class="picker ">
<!-- <text class='icon .icon-youjiantou placeholder-style' style="float: right;"></text> -->
<van-icon name="arrow" size="32rpx" color="#888888" />
<input placeholder="请选择民族" disabled="true" class="textomit" style="float: left;font-weight: 400;font-family: PingFang SC;" value="{{nationtitle}}" />
<input type="text" style="display: none;" name="nationID" value="{{nationvalue}}" />
</view>
</picker>
</view>
<view class="pybottomitem">
<view> <text class="required">*</text><text class="pybottomitemtitle">出生日期</text></view>
<picker mode="date" value="{{date}}" start="1555-01-01" end="2099-01-01" bindchange="birthdayChange">
<view class="picker ">
<van-icon name="arrow" size="32rpx" color="#888888" />
<input placeholder="请选择出生日期" disabled="true" value="{{date}}" class="textomit" style="float: left;font-weight: 400;font-family: PingFang SC;" />
<input type="text" style="display: none;" name="birthday" value="{{date}}" />
</view>
</picker>
</view>
<view class="pybottomitem" style="border-bottom: 0px;">
<view> <text class="required">*</text><text class="pybottomitemtitle">家庭地址</text></view>
<picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
<view class="picker ">
<van-icon name="arrow" size="32rpx" color="#888888" />
<input placeholder="请选择家庭地址" disabled="true" value="{{region[0]}}{{region[1]}}{{region[2]}}" class="textomit" style="float: left;font-weight: 400;font-family: PingFang SC;" />
<input type="text" style="display: none;" name="familyAddress" value="{{region[0]}}{{region[1]}}{{region[2]}}" />
</view>
</picker>
</view>
<view class="pybottomitem" style="height: 20rpx;">
<view> <text class="pybottomitemtitle"></text></view>
<view class="pybottomiteminput" style="margin-top: -30rpx;">
<input type="text" value="{{adddress}}" name="adddress" placeholder="请输入详细地址" />
</view>
</view>
</view>
@import '/lib/iconfont/iconfont.wxss';
.topbg {
width: 100%;
height: 520rpx;
/* background: linear-gradient(180deg, #2E6EFF 56.99999999999999%, #F6F6F6 100%); */
overflow: hidden;
align-items: center;
justify-content: center;
/*图片路径*/
background-size: 100% 100%;
/*图片显示大小*/
background-repeat: no-repeat;
/*是否重复多个*/
background-position: center;
}
.center {
display: flex;
align-items: center;
justify-content: center;
/*图片路径*/
background-size: 100% 100%;
/*图片显示大小*/
background-repeat: no-repeat;
/*是否重复多个*/
background-position: center;
}
.toptitle {
margin: auto;
margin-top: 49rpx;
height: 47rpx;
font-size: 48rpx;
font-family: DingTalk JinBuTi;
font-weight: 400;
color: #FFFFFF;
line-height: 47rpx;
text-shadow: 0rpx 4rpx 6rpx rgba(0, 31, 96, 0.5);
text-align: center;
}
.topsingletitle {
margin: auto;
margin-top: 40rpx;
height: 32rpx;
font-size: 32rpx;
font-family: PingFang SC;
color: #FFEC48;
line-height: 32rpx;
text-shadow: 0rpx 4rpx 6rpx rgba(0, 31, 96, 0.2);
text-align: center;
}
.content {
margin: auto;
margin-top: -300rpx;
width: 690rpx;
background: #FFFFFF;
border-radius: 10rpx;
overflow: hidden;
padding-bottom: 40rpx;
}
.contenttwo {
margin: auto;
margin-top: 50rpx;
width: 690rpx;
background: #FFFFFF;
border-radius: 10rpx;
overflow: hidden;
padding-bottom: 40rpx;
}
.discriminate {
margin-top: 40rpx;
margin-left: 30rpx;
display: flex;
}
.radio {
width: 10rpx;
height: 30rpx;
background: #3D8FFF;
border-radius: 5rpx;
}
.sfz {
margin-left: 10rpx;
width: 100%;
height: 31rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
line-height: 30rpx;
}
.discriminatesingtitle {
margin-left: 30rpx;
margin-top: 20rpx;
width: 100%;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: #888888;
line-height: 40rpx;
}
.upload {
margin-top: 30rpx;
margin-left: 30rpx;
display: flex;
}
.uploadsfz {
width: 300rpx;
height: 200rpx;
background: #F6F8FC;
position: relative
}
.uploadhk {
margin-left: 25rpx;
width: 300rpx;
height: 200rpx;
background: #F6F8FC;
position: relative
}
.a {
width: 18rpx;
height: 18rpx;
position: absolute;
top: 0;
left: 0;
border-left: 2px solid #9CA7BC;
border-top: 2px solid #9CA7BC;
}
.b {
width: 18rpx;
height: 18rpx;
position: absolute;
top: 0;
right: 0;
border-right: 2px solid #9CA7BC;
border-top: 2px solid #9CA7BC;
}
.c {
width: 18rpx;
height: 18rpx;
position: absolute;
bottom: 0;
left: 0;
border-bottom: 2px solid #9CA7BC;
border-left: 2px solid #9CA7BC;
}
.d {
width: 18rpx;
height: 18rpx;
position: absolute;
bottom: 0;
right: 0;
border-right: 2px solid #9CA7BC;
border-bottom: 2px solid #9CA7BC;
}
.pybottomitem {
margin-left: 30rpx;
width: 88%;
padding: 23rpx 0;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #eeeeee;
}
.pybottomitemtitle {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
line-height: 40rpx;
}
.required {
color: #fc5744;
}
.pybottomiteminput {
width: 71%;
text-align: left;
}
.pb{
width: 55rpx;
}
radio {
padding-left: 30rpx;
width: 118rpx;
height: 28rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
color: #555555;
line-height: 40rpx;
}
radio:nth-child(1) {
padding-left: 10rpx;
}
radio .wx-radio-input.wx-radio-input-checked {
border-color: #0097FF !important;
background: #0097FF !important;
}
.radiotwo {
width: 10rpx;
height: 30rpx;
background: #16D1B0;
border-radius: 5rpx;
}
.switch {
display: flex;
align-items: center;
justify-content: flex-end;
width: 100px;
height: 54rpx;
border-radius: 54rpx;
background: #f7f7fb;
}
.switchNums {
width: 100rpx;
height: 54rpx;
line-height: 54rpx;
border-radius: 54rpx;
text-align: center;
color: #C1C1C1;
font-size: 28rpx;
font-weight: bold;
}
.currentNum {
background: #3D8FFF;
color: #ffffff;
}
.bottom {
width: 100%;
margin-top: 25rpx;
height: 112rpx;
background: #FFFFFF;
padding-top: 25rpx;
}
.subbtn {
width: 96% !important;
height: 80rpx;
font-size: 30rpx;
line-height: 76rpx;
background-color: #0097FF;
color: #FFFFFF;
text-align: center;
border-bottom: 10px;
font-weight: 400px !important;
letter-spacing: 10rpx;
margin: auto;
}
.isnum {
display: none;
}
.textomit {
width: 400rpx !important;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
.icon {
width: 30rpx !important;
}
// 获取应用实例
const app = getApp()
Page({
data: {
app: app,
gender: [{text: "男", value: 155}, {text: "女", value: 156}], //性别
nationdata: [{value: 1, name: "汉"}, {value: 2, name: "壮"}, {value: 3, name: "满"}, {value: 4, name: "回"}], //民族
isnum: false, //手机号格式,
ismobilePhone: false,
},
onLoad() {
var that = this;
},
onShow() {
},
// 上传身份证图片
chooseImage() {
const that = this;
wx.chooseMedia({
sourceType: ['album', 'camera'], //图片和视频选择的来源
//sizeType: ['original', 'compressed'], //是否压缩所选文件
count: 1,
mediaType: ['image'],
success(res) {
wx.getFileSystemManager().readFile({
filePath: res.tempFiles[0].tempFilePath, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success: res => { //成功的回调
}
});
},
fail: function (err) { //请求失败
if (err.errMsg == "chooseMedia:fail cancel") {
wx.showToast({
title: "取消上传",
icon: "none",
duration: 1000
});
} else {
wx.showToast({
title: "图片上传失败",
icon: "none",
duration: 1000
});
}
}
})
},
//上传户口本图片
chooseImagehkb() {
const that = this;
wx.chooseMedia({
sourceType: ['album', 'camera'], //图片和视频选择的来源
//sizeType: ['original', 'compressed'], //是否压缩所选文件
count: 1,
mediaType: ['image'],
success(res) {
that.setData({
hkbimageList: res.tempFiles,
imgList: [],
ishavefile: true,
isshowhkb: false
})
},
fail: function (err) { //请求失败
if (err.errMsg == "chooseMedia:fail cancel") {
wx.showToast({
title: "取消上传",
icon: "none",
duration: 1000
});
} else {
wx.showToast({
title: "图片上传失败",
icon: "none",
duration: 1000
});
}
}
})
},
//民族
shoppick: function (e) {
this.setData({
nationtitle: this.data.nationdata[e.detail.value].name,
nationvalue: this.data.nationdata[e.detail.value].value
});
},
//出生日期
birthdayChange: function (e) {
this.setData({
date: e.detail.value
})
},
//家庭住址
bindRegionChange: function (e) {
this.setData({
region: e.detail.value
})
},
//电话号码验证
rqnum: function (e) {
var num = e.detail.value
if (num.length != 11) {
this.setData({
isnum: true
})
} else {
this.setData({
isnum: false
})
}
},
//
rqmobilePhone: function (e) {
var num = e.detail.value
if (num.length != 11) {
this.setData({
ismobilePhone: true
})
} else {
this.setData({
ismobilePhone: false
})
}
},
// 提交方法
submit() {
}
})
![](https://img-blog.csdnimg.cn/direct/04964712eca04d0784e9abf0dc9ec96c.png)