mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-25 00:12:53 +08:00
与原生对接身份证
This commit is contained in:
@@ -57,14 +57,16 @@ export default {
|
||||
let that = this
|
||||
if (window.localStorage.getItem('cardScanningType') == '0') {
|
||||
// console.log('11111')
|
||||
EWebBridge.webCallAppInJs('bank_auth', {
|
||||
EWebBridge.webCallAppInJs('bankcard_ocr', {
|
||||
// 1是扫描。0是相册。
|
||||
scan: '1'
|
||||
}).then(data => {
|
||||
if (JSON.parse(data).state == '1') {
|
||||
that.state = JSON.parse(data).state
|
||||
that.bankCard = JSON.parse(data).number
|
||||
that.src = JSON.parse(data).base64
|
||||
console.log(data,'data111111111111')
|
||||
console.log(JSON.parse(data),'JSON.parse(data)')
|
||||
if (JSON.parse(data).imageBase64) {
|
||||
that.state = 1
|
||||
that.bankCard = JSON.parse(data).cardNo
|
||||
that.src = JSON.parse(data).imageBase64
|
||||
|
||||
window.localStorage.setItem('bankCardUrlPath', encodeURI(JSON.parse(data).path).replace(/\+/g, '%2B'))
|
||||
window.localStorage.setItem('bankCard', JSON.parse(data).number)
|
||||
@@ -75,14 +77,14 @@ export default {
|
||||
})
|
||||
} else if (window.localStorage.getItem('cardScanningType') == '1') {
|
||||
// console.log('22222')
|
||||
EWebBridge.webCallAppInJs('bank_auth', {
|
||||
EWebBridge.webCallAppInJs('bankcard_ocr', {
|
||||
// 1是扫描。0是相册。
|
||||
scan: '1'
|
||||
}).then(data => {
|
||||
if (JSON.parse(data).state == '1') {
|
||||
that.state = JSON.parse(data).state
|
||||
that.bankCard = JSON.parse(data).number
|
||||
that.src = JSON.parse(data).base64
|
||||
if (JSON.parse(data).imageBase64) {
|
||||
that.state = 1
|
||||
that.bankCard = JSON.parse(data).cardNo
|
||||
that.src = JSON.parse(data).imageBase64
|
||||
window.localStorage.setItem('bankCardUrlInsuredPath', encodeURI(JSON.parse(data).path).replace(/\+/g, '%2B'))
|
||||
window.localStorage.setItem('bankCardInsured', JSON.parse(data).number)
|
||||
that.isDisabled = false
|
||||
|
||||
@@ -99,35 +99,39 @@ export default {
|
||||
// 点击身份证正面拍照
|
||||
front() {
|
||||
let that = this
|
||||
EWebBridge.webCallAppInJs('id_auth', {
|
||||
EWebBridge.webCallAppInJs('idcard_ocr', {
|
||||
front: '1', //1是正面,0是反面。
|
||||
|
||||
scan: '1' //1是扫描。0是相册。
|
||||
}).then(data => {
|
||||
if (JSON.parse(data).state == '1') {
|
||||
console.log(data,'data111111111111')
|
||||
console.log(JSON.parse(data),'JSON.parse(data)')
|
||||
// if (JSON.parse(data).state == '1') {
|
||||
if (JSON.parse(data).imageBase64) {
|
||||
// console.log(JSON.parse(data).base64)
|
||||
|
||||
if (that.scanFromInsured == 'true') {
|
||||
console.log(JSON.parse(data))
|
||||
that.state = JSON.parse(data).state
|
||||
// that.state = JSON.parse(data).state
|
||||
that.state = 1
|
||||
that.name = JSON.parse(data).name
|
||||
that.idCard = JSON.parse(data).number
|
||||
that.imgfront = JSON.parse(data).base64
|
||||
that.birthYear = JSON.parse(data).birth_year
|
||||
that.birthMonth = JSON.parse(data).birth_month.padStart(2, '0')
|
||||
that.birthDay = JSON.parse(data).birth_day.padStart(2, '0')
|
||||
that.imgfront = JSON.parse(data).imageBase64
|
||||
that.birthYear = JSON.parse(data).birthdayYear
|
||||
that.birthMonth = JSON.parse(data).birthdayMonth.padStart(2, '0')
|
||||
that.birthDay = JSON.parse(data).birthdayDay.padStart(2, '0')
|
||||
that.gender = JSON.parse(data).gender
|
||||
window.localStorage.setItem('imgfrontPath', encodeURI(JSON.parse(data).path).replace(/\+/g, '%2B'))
|
||||
window.localStorage.setItem('imgfrontPath', encodeURI(JSON.parse(data).imagePath).replace(/\+/g, '%2B'))
|
||||
} else {
|
||||
that.state = JSON.parse(data).state
|
||||
// that.state = JSON.parse(data).state
|
||||
that.state = 1
|
||||
that.name = JSON.parse(data).name
|
||||
that.idCard = JSON.parse(data).number
|
||||
that.imgfront = JSON.parse(data).base64
|
||||
that.birthYear = JSON.parse(data).birth_year
|
||||
that.birthMonth = JSON.parse(data).birth_month.padStart(2, '0')
|
||||
that.birthDay = JSON.parse(data).birth_day.padStart(2, '0')
|
||||
that.imgfront = JSON.parse(data).imageBase64
|
||||
that.birthYear = JSON.parse(data).birthdayYear
|
||||
that.birthMonth = JSON.parse(data).birthdayMonth.padStart(2, '0')
|
||||
that.birthDay = JSON.parse(data).birthdayDay.padStart(2, '0')
|
||||
that.gender = JSON.parse(data).gender
|
||||
window.localStorage.setItem('imgfrontInsuredPath', encodeURI(JSON.parse(data).path).replace(/\+/g, '%2B'))
|
||||
window.localStorage.setItem('imgfrontInsuredPath', encodeURI(JSON.parse(data).imagePath).replace(/\+/g, '%2B'))
|
||||
}
|
||||
} else {
|
||||
console.log('')
|
||||
@@ -137,30 +141,34 @@ export default {
|
||||
// 点击身份证背面拍照
|
||||
back() {
|
||||
let that = this
|
||||
EWebBridge.webCallAppInJs('id_auth', {
|
||||
EWebBridge.webCallAppInJs('idcard_ocr', {
|
||||
front: '0', //1是正面,0是反面。
|
||||
scan: '1' //1是扫描。0是相册。
|
||||
}).then(data => {
|
||||
if (that.scanFromInsured == 'true') {
|
||||
if (JSON.parse(data).state == '1') {
|
||||
that.stateBack = JSON.parse(data).state
|
||||
that.imgBack = JSON.parse(data).base64
|
||||
that.startDate = JSON.parse(data).valid_start
|
||||
that.endDate = JSON.parse(data).valid_end
|
||||
if (JSON.parse(data).imageBase64 == '1') {
|
||||
// if (JSON.parse(data).state == '1') {
|
||||
// that.stateBack = JSON.parse(data).state
|
||||
that.stateBack = 1
|
||||
that.imgBack = JSON.parse(data).imagePath
|
||||
that.startDate = JSON.parse(data).validDateStart
|
||||
that.endDate = JSON.parse(data).validDateEnd
|
||||
|
||||
window.localStorage.setItem('imgBackPath', encodeURI(JSON.parse(data).path).replace(/\+/g, '%2B'))
|
||||
} else {
|
||||
console.log('')
|
||||
}
|
||||
} else {
|
||||
if (JSON.parse(data).state == '1') {
|
||||
that.stateBack = JSON.parse(data).state
|
||||
that.imgBack = JSON.parse(data).base64
|
||||
if (JSON.parse(data).imageBase64 == '1') {
|
||||
// if (JSON.parse(data).state == '1') {
|
||||
// that.stateBack = JSON.parse(data).state
|
||||
that.stateBack = 1
|
||||
that.imgBack = JSON.parse(data).imagePath
|
||||
|
||||
window.localStorage.setItem('imgBackInsuredPath', encodeURI(JSON.parse(data).path).replace(/\+/g, '%2B'))
|
||||
|
||||
that.startDate = JSON.parse(data).valid_start
|
||||
that.endDate = JSON.parse(data).valid_end
|
||||
that.startDate = JSON.parse(data).validDateStart
|
||||
that.endDate = JSON.parse(data).validDateEnd
|
||||
} else {
|
||||
console.log('')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user