Commit 765a3b41 authored by linwenqing's avatar linwenqing

refactor:身份证识别修改

parent 492d6bea
......@@ -79,7 +79,8 @@ export default {
data() {
return {
student: {},
token: '',
qiToken: '',
vToken: null,
}
},
computed: {
......@@ -118,7 +119,11 @@ export default {
},
onLoad() {
this.student = getApp().globalData.student
this.token = getApp().globalData.qiNiuToken
this.qiToken = getApp().globalData.qiNiuToken
this.vToken = this.vuex_token
},
onUnload() {
uni.hideLoading()
},
methods: {
submit() {
......@@ -148,19 +153,24 @@ export default {
})
},
getFront() {
let that = this
//身份证正面图片识别
upload.getPhoto(2, this.token).then((res) => {
upload.getPhoto(2, this.qiToken).then((res) => {
this.student.identityFrontPath = res.key
uni.showLoading({
title: '识别中,请稍后',
})
this.$u.api
.getCertifyInfoByType('front', {
url: process.uniEnv.qn_asset_url + res.key,
})
.then((res) => {
console.log('识别结果', res)
uni.hideLoading()
this.student.name = res.name
this.student.identityNumber = res.number
})
.catch((data) => {
uni.hideLoading()
this.student.name = ''
this.student.identityNumber = ''
this.$u.toast('识别身份证信息错误')
......@@ -169,17 +179,22 @@ export default {
},
getBack() {
//身份证反面图片识别
upload.getPhoto(2, this.token).then((res) => {
upload.getPhoto(2, this.qiToken).then((res) => {
this.student.identityBackPath = res.key
uni.showLoading({
title: '识别中,请稍后',
})
this.$u.api
.getCertifyInfoByType('back', {
url: process.uniEnv.qn_asset_url + res.key,
})
.then((res) => {
uni.hideLoading()
console.log('识别结果', res)
this.student.certificateValidityDate = res.expire
})
.catch((data) => {
uni.hideLoading()
this.student.certificateValidityDate = ''
this.$u.toast('识别身份证信息错误')
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment