mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-12 13:46:43 +08:00
[NEW]【更换人脸识别厂商】增加微信端获取腾讯人脸识别相关接口
This commit is contained in:
@@ -77,6 +77,7 @@ export function uploadImg(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
/*
|
||||
// 人脸识别
|
||||
export function recognition(data) {
|
||||
return request({
|
||||
@@ -85,8 +86,26 @@ export function recognition(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
//获取腾讯人脸识别URL接口
|
||||
export function getRecognitionUrl(data) {
|
||||
return request({
|
||||
url: getUrl('/customer/tencent/getRecognitionUrl', 1),
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//获取腾讯人脸识别结果接口
|
||||
export function getRecognitionResult(data) {
|
||||
return request({
|
||||
url: getUrl('/customer/tencent/getRecognitionResult', 1),
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 139.9.27.13:7002/updown/uploadImage
|
||||
// 核保接口
|
||||
export function underWrite(data) {
|
||||
return request({
|
||||
@@ -194,4 +213,3 @@ export function getPayState(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { Uploader, button } from 'vant'
|
||||
import { uploadImg, recognition } from '@/api/ebiz/sale/sale'
|
||||
import { uploadImg, getRecognitionUrl, getRecognitionResult } from '@/api/ebiz/sale/sale'
|
||||
export default {
|
||||
name: 'UploadImageFile',
|
||||
props: {
|
||||
@@ -36,7 +36,11 @@ export default {
|
||||
file: '',
|
||||
imgName: '',
|
||||
fileListIdFront: [],
|
||||
isSuccess: false
|
||||
isSuccess: false,
|
||||
bizToken: '',
|
||||
requestId: '',
|
||||
recognizeResult: '', //人脸识别结果
|
||||
recognizeMessage: '' //人脸识别失败原因
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -93,6 +97,7 @@ export default {
|
||||
let formdata = new FormData()
|
||||
formdata.append('imgPath', that.file)
|
||||
},
|
||||
/*
|
||||
recognition(val, num) {
|
||||
let data = {}
|
||||
num++
|
||||
@@ -116,6 +121,48 @@ export default {
|
||||
this.$emit('sendimage', this.isSuccess)
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
async recognition(val, num) {
|
||||
num++
|
||||
await this.getRecognitionUrl(val, num)
|
||||
if (this.requestId && this.bizToken) {
|
||||
await this.getRecognitionResult(this.requestId, this.bizToken)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$emit('sendimage', this.isSuccess)
|
||||
},
|
||||
|
||||
getRecognitionUrl(val, num) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let data = {}
|
||||
data = { realName: this.realName, idno: this.idno, redirectUrl: '' }
|
||||
getRecognitionUrl(data).then(res => {
|
||||
console.log('getRecognitionUrl', res)
|
||||
if (res.result == '0') {
|
||||
this.requestId = res.content.requestId
|
||||
this.bizToken = res.content.bizToken
|
||||
} else {
|
||||
this.$toast(res.resultMessage)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getRecognitionResult(requestId, bizToken) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getRecognitionResult({ requestId, bizToken }).then(res => {
|
||||
console.log('getRecognitionResult', res)
|
||||
if (res.result == '0') {
|
||||
this.recognizeResult = res.content.result
|
||||
this.recognizeMessage = res.content.result == '1' ? res.content.resultMessage : ''
|
||||
this.isSuccess = true
|
||||
} else {
|
||||
this.$toast(res.resultMessage)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user