feat(ebiz): 优化身份认证影像上传校验逻辑

- 新增 validateRoleImage 方法用于校验角色相关影像是否完整
- 调整注册子任务逻辑,区分本地上传和云端图片校验场景
- 在上传图片时设置 updateImage 标志位以触发列表检测
- 完善受益人信息处理流程,确保 bnfId 正确赋值
- 修复部分条件下未正确返回校验结果的问题
This commit is contained in:
hz
2025-12-01 11:23:26 +08:00
parent 3b6fd6e80e
commit 2e9698b95e

View File

@@ -141,22 +141,40 @@ export default {
}, },
inject: ['nextStepProcesserContainer'], inject: ['nextStepProcesserContainer'],
methods: { methods: {
validateRoleImage(orderDetail) {
if (orderDetail.result !== '0') return false
const { orderDTO } = orderDetail
const { mediaDTOS } = orderDTO
return Array.isArray(mediaDTOS) && mediaDTOS.filter(item => item.subBusinessType === this.role).length === 2
},
registerSubTask() { registerSubTask() {
if (!this.subTask) return if (!this.subTask) return
this.nextStepProcesserContainer.registerPreTask(this.subTask, async () => { this.nextStepProcesserContainer.registerPreTask(this.subTask, async () => {
if (this.list.length <= 2) { const result = getOrderDetail({ orderNo: this.$route.query.orderNo })
setTimeout(() => this.$toast('请补充完整影像信息'), 600)
return false // 如果触发上传图片行为, 就开始进行列表检测
if (this.updateImage) {
if (this.list.length <= 2) {
setTimeout(() => this.$toast('请补充完整影像信息'), 600)
return false
}
} else {
// 如果没有上传图片,对云端图片进行检测
if (!this.validateRoleImage(result)) {
setTimeout(() => this.$toast('请补充完整影像信息'), 600)
return false
}
} }
// 针对 受益人进行特殊的处理, 下一步前的前置处理 // 针对 受益人进行特殊的处理, 下一步前的前置处理
if (this.role === this.user.beneficiary) { if (this.role === this.user.beneficiary) {
const result = getOrderDetail({ orderNo: this.$route.query.orderNo }) if (result.result !== '0') return false
if (result.result !== '0') return
const idNo = this.userInfo['idNo'] const idNo = this.userInfo['idNo']
const beneficiaries = result.orderDTO.insuredDTOs[0].bnfDTOs const beneficiaries = result.orderDTO.insuredDTOs[0].bnfDTOs
if (!Array.isArray(beneficiaries)) return if (!Array.isArray(beneficiaries)) return false
const beneficiary = beneficiaries.find(beneficiary => beneficiary.idNo === idNo) const beneficiary = beneficiaries.find(beneficiary => beneficiary.idNo === idNo)
// 通过 idNo 获取对应的 idNo 受益人, 然后获取 bnfId , 对照片参数补充完整
this.list.forEach(item => { this.list.forEach(item => {
item.subBusinessNo = beneficiary.bnfId item.subBusinessNo = beneficiary.bnfId
}) })
@@ -179,7 +197,8 @@ export default {
}) })
const result = JSON.parse(data) const result = JSON.parse(data)
// 检测图片上传的 single, 跟下一步处理有相关内容
this.updateImage = true
if (result.code === '1') { if (result.code === '1') {
if (isFront) { if (isFront) {
this.handleFrontScanResult(result.content) this.handleFrontScanResult(result.content)