zsk 2 years ago
parent af1efef3e8
commit b73509c52b

@ -4,6 +4,7 @@ var dateUtil = require("../../utils/dateUtil.js");
var dateTimePicker = require("../../utils/dateTimePicker.js");
Component({
data: {
idCardNum:"",
dateTime: "",
currentTime: dateUtil.formatDateYMD(mydate.toLocaleDateString()),
copyTime: dateUtil.formatDateYMD(mydate.toLocaleDateString()),
@ -227,13 +228,6 @@ Component({
e.detail.value.interviewTimeStr = that.data.currentTime;
}
e.detail.value.jobId = that.data.info.id
console.log('form发生了submit事件携带数据为', e.detail.value)
wx.request({
@ -250,7 +244,8 @@ Component({
})
that.setData({
show: false,
ageIndex:-1
ageIndex:-1,
idCardNum:""
})
wx.showTabBar({
animation: false,
@ -326,7 +321,8 @@ Component({
hideLeft () {
// this.data.show = false
this.setData({
ageIndex: -1
ageIndex: -1,
idCardNum:"",
})
var eventDetail = {
type: this.data.drawerType
@ -356,7 +352,85 @@ Component({
this.setData({
morePeople: !this.data.morePeople
})
}
},
chooseIdCard () {
var that = this;
console.log("ischoise");
wx.chooseMedia({
count: 1,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success (res) {
console.log(res);
// debugger;
that.uploadIdcardImg(res);
},
});
},
uploadIdcardImg (imgPath) {
let that = this;
// tempFilePath可以作为img标签的src属性显示图片
let filePath;
console.log("22222222222222222");
console.log(imgPath);
if (imgPath.tempFiles[0].tempFilePath) {
filePath = imgPath.tempFiles[0].tempFilePath
} else {
filePath = imgPath;
}
console.log(filePath);
wx.showLoading({
title: "识别中...",
});
wx.uploadFile({
// url: app.globalData.ip + '/commons/idCardOcrRecognize',
url: app.globalData.ip + "/commons/idCardOcrRecognizeAndUploadToAliyunOss",
filePath,
name: "uploadFile",
header: app.globalData.headers,
success: function (res) {
console.log("9999999999");
console.log(res);
if(res.statusCode == 413){
wx.showToast({
duration: 2000,
title: "身份证未识别",
icon: "none",
mask: true,
});
return
}
var idcard = JSON.parse(res.data);
console.log(idcard);
if (idcard.status == 200) {
that.setData({
idCardNum:idcard.data.num
});
} else {
wx.showToast({
duration: 2000,
title: "身份证未识别",
icon: "none",
mask: true,
});
}
wx.hideLoading();
},
fail: function (res) {
console.log("99999999998");
console.log(res);
wx.hideLoading()
wx.showToast({
duration: 2000,
title: "身份证未识别",
icon: "none",
mask: true,
});
},
});
},
}
})

@ -61,14 +61,17 @@
</view>
<view class="weui-cell bb1 pb12 pt12" wx:if="{{info.agencyOperation == 1}}">
<view class="weui-cell__hd display-flex aic mb16" style="max-width:90px">
<label class="weui-label c9 f12">
<label class="weui-label c9 f12" bind:tap="uploadCard">
您的身份证号
<text class="cfred">*</text>
</label>
</view>
<view class="weui-cell__bd">
<input class="weui-input f17" type="idcard" maxlength="18" name="idCard" placeholder="请输入您的身份证号" placeholder-class="input__placeholder cccc" />
<view class="weui-cell__bd display-flex">
<input class="weui-input f17 flex-1 mr20" type="idcard" maxlength="18" name="idCard" value="{{idCardNum}}" placeholder="请输入您的身份证号" placeholder-class="input__placeholder cccc" />
<view class="t-icon t-icon-paizhao rightPz" catchtap="chooseIdCard"></view>
</view>
</view>
<view class="weui-cell bb1 pb12 pt12">
<view class="weui-cell__hd display-flex aic mb16" style="max-width:80px">

@ -66,3 +66,9 @@
position: sticky;
bottom: 0;
}
.rightPz{
width: 24px;
height: 24px;
padding: 4px;
box-sizing: border-box;
}
Loading…
Cancel
Save