diff --git a/components/bottom-drawer/index.js b/components/bottom-drawer/index.js index d5d0da1..a3e5000 100644 --- a/components/bottom-drawer/index.js +++ b/components/bottom-drawer/index.js @@ -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, + }); + }, + }); + }, } }) \ No newline at end of file diff --git a/components/bottom-drawer/index.wxml b/components/bottom-drawer/index.wxml index 1a6d6e4..cfee7ff 100644 --- a/components/bottom-drawer/index.wxml +++ b/components/bottom-drawer/index.wxml @@ -61,14 +61,17 @@ - - - + + + + + diff --git a/components/bottom-drawer/index.wxss b/components/bottom-drawer/index.wxss index 63154ba..9bfc71b 100644 --- a/components/bottom-drawer/index.wxss +++ b/components/bottom-drawer/index.wxss @@ -65,4 +65,10 @@ .sticky{ position: sticky; bottom: 0; +} +.rightPz{ + width: 24px; + height: 24px; + padding: 4px; + box-sizing: border-box; } \ No newline at end of file