mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-24 19:32:53 +08:00
ocr入参调整
This commit is contained in:
@@ -56,40 +56,44 @@ export default {
|
||||
click() {
|
||||
let that = this
|
||||
if (window.localStorage.getItem('cardScanningType') == '0') {
|
||||
// console.log('11111')
|
||||
EWebBridge.webCallAppInJs('bankcard_ocr', {
|
||||
// 1是扫描。0是相册。
|
||||
scan: '1'
|
||||
}).then(data => {
|
||||
console.log(data,'data111111111111')
|
||||
EWebBridge.webCallAppInJs('bankcard_ocr').then(data => {
|
||||
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)
|
||||
that.isDisabled = false
|
||||
let result = JSON.parse(data)
|
||||
if(result.code == 1){
|
||||
let bankCardInfo = result.content
|
||||
if (bankCardInfo.imageBase64) {
|
||||
that.state = 1
|
||||
that.bankCard = bankCardInfo.cardNo
|
||||
that.src = bankCardInfo.imageBase64
|
||||
window.localStorage.setItem('bankCardUrlPath', encodeURI(bankCardInfo.imagePath).replace(/\+/g, '%2B'))
|
||||
window.localStorage.setItem('bankCard', bankCardInfo.cardNo)
|
||||
that.isDisabled = false
|
||||
} else {
|
||||
console.log('')
|
||||
}
|
||||
} else {
|
||||
console.log('')
|
||||
//识别失败
|
||||
this.$toast(result.message)
|
||||
}
|
||||
})
|
||||
} else if (window.localStorage.getItem('cardScanningType') == '1') {
|
||||
// console.log('22222')
|
||||
EWebBridge.webCallAppInJs('bankcard_ocr', {
|
||||
// 1是扫描。0是相册。
|
||||
scan: '1'
|
||||
}).then(data => {
|
||||
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
|
||||
EWebBridge.webCallAppInJs('bankcard_ocr').then(data => {
|
||||
let result = JSON.parse(data)
|
||||
if(result.code == 1){
|
||||
let bankCardInfo = result.content
|
||||
if (bankCardInfo.imageBase64) {
|
||||
that.state = 1
|
||||
that.bankCard = bankCardInfo.cardNo
|
||||
that.src = bankCardInfo.imageBase64
|
||||
window.localStorage.setItem('bankCardUrlInsuredPath', encodeURI(bankCardInfo.imagePath).replace(/\+/g, '%2B'))
|
||||
window.localStorage.setItem('bankCardInsured', bankCardInfo.cardNo)
|
||||
that.isDisabled = false
|
||||
} else {
|
||||
console.log('')
|
||||
}
|
||||
} else {
|
||||
console.log('')
|
||||
//识别失败
|
||||
this.$toast(result.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -100,41 +100,46 @@ export default {
|
||||
front() {
|
||||
let that = this
|
||||
EWebBridge.webCallAppInJs('idcard_ocr', {
|
||||
front: '1', //1是正面,0是反面。
|
||||
|
||||
scan: '1' //1是扫描。0是相册。
|
||||
front: '1' //1是正面,0是反面。
|
||||
// scan: '1' //1是扫描。0是相册。
|
||||
}).then(data => {
|
||||
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 = 1
|
||||
that.name = JSON.parse(data).name
|
||||
that.idCard = JSON.parse(data).number
|
||||
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).imagePath).replace(/\+/g, '%2B'))
|
||||
console.log(JSON.parse(data),'JSON.parse(data)')
|
||||
let result = JSON.parse(data)
|
||||
// if (idCardInfo.state == '1') {
|
||||
if(result.code == 1){
|
||||
let idCardInfo = result.content
|
||||
if (idCardInfo.imageBase64) {
|
||||
// console.log(idCardInfo.base64)
|
||||
if (that.scanFromInsured == 'true') {
|
||||
console.log(idCardInfo)
|
||||
// that.state = idCardInfo.state
|
||||
that.state = 1
|
||||
that.name = idCardInfo.name
|
||||
that.idCard = idCardInfo.number
|
||||
that.imgfront = idCardInfo.imageBase64
|
||||
that.birthYear = idCardInfo.birthdayYear
|
||||
that.birthMonth = idCardInfo.birthdayMonth.padStart(2, '0')
|
||||
that.birthDay = idCardInfo.birthdayDay.padStart(2, '0')
|
||||
that.gender = idCardInfo.gender
|
||||
window.localStorage.setItem('imgfrontPath', encodeURI(idCardInfo.imagePath).replace(/\+/g, '%2B'))
|
||||
} else {
|
||||
// that.state = idCardInfo.state
|
||||
that.state = 1
|
||||
that.name = idCardInfo.name
|
||||
that.idCard = idCardInfo.number
|
||||
that.imgfront = idCardInfo.imageBase64
|
||||
that.birthYear = idCardInfo.birthdayYear
|
||||
that.birthMonth = idCardInfo.birthdayMonth.padStart(2, '0')
|
||||
that.birthDay = idCardInfo.birthdayDay.padStart(2, '0')
|
||||
that.gender = idCardInfo.gender
|
||||
window.localStorage.setItem('imgfrontInsuredPath', encodeURI(idCardInfo.imagePath).replace(/\+/g, '%2B'))
|
||||
}
|
||||
} else {
|
||||
// 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).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).imagePath).replace(/\+/g, '%2B'))
|
||||
console.log('')
|
||||
}
|
||||
} else {
|
||||
console.log('')
|
||||
//识别失败
|
||||
this.$toast(result.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -142,36 +147,41 @@ export default {
|
||||
back() {
|
||||
let that = this
|
||||
EWebBridge.webCallAppInJs('idcard_ocr', {
|
||||
front: '0', //1是正面,0是反面。
|
||||
scan: '1' //1是扫描。0是相册。
|
||||
front: '0' //1是正面,0是反面。
|
||||
// scan: '1' //1是扫描。0是相册。
|
||||
}).then(data => {
|
||||
if (that.scanFromInsured == 'true') {
|
||||
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'))
|
||||
console.log(JSON.parse(data),'JSON.parse(data)')
|
||||
let result = JSON.parse(data)
|
||||
if(result.code == 1){
|
||||
let idCardInfo = result.content
|
||||
if (that.scanFromInsured == 'true') {
|
||||
if (idCardInfo.imageBase64) {
|
||||
// if (idCardInfo.state == '1') {
|
||||
// that.stateBack = idCardInfo.state
|
||||
that.stateBack = 1
|
||||
that.imgBack = idCardInfo.imagePath
|
||||
that.startDate = idCardInfo.validDateStart
|
||||
that.endDate = idCardInfo.validDateEnd
|
||||
window.localStorage.setItem('imgBackPath', encodeURI(idCardInfo.imagePath).replace(/\+/g, '%2B'))
|
||||
} else {
|
||||
console.log('')
|
||||
}
|
||||
} else {
|
||||
console.log('')
|
||||
if (idCardInfo.imageBase64) {
|
||||
// if (idCardInfo.state == '1') {
|
||||
// that.stateBack = idCardInfo.state
|
||||
that.stateBack = 1
|
||||
that.imgBack = idCardInfo.imagePath
|
||||
window.localStorage.setItem('imgBackInsuredPath', encodeURI(idCardInfo.imagePath).replace(/\+/g, '%2B'))
|
||||
that.startDate = idCardInfo.validDateStart
|
||||
that.endDate = idCardInfo.validDateEnd
|
||||
} else {
|
||||
console.log('')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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).validDateStart
|
||||
that.endDate = JSON.parse(data).validDateEnd
|
||||
} else {
|
||||
console.log('')
|
||||
}
|
||||
//识别失败
|
||||
this.$toast(result.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user