Commit 5e842947 authored by linwenqing's avatar linwenqing

Revert "fix:身份证识别"

This reverts commit a3797fd9.
parent f0919a31
...@@ -10,7 +10,6 @@ const UNI_APP = { ...@@ -10,7 +10,6 @@ const UNI_APP = {
}, },
qn_base_url: 'https://qn-static.banshouhui.com/self-support/', qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'http://deudn.c.pp.cc/', qn_asset_url: 'http://deudn.c.pp.cc/',
uc_img_url_pre: 'http://deudn.c.pp.cc/',
argoDebugMode: 1 argoDebugMode: 1
} }
module.exports = UNI_APP; module.exports = UNI_APP;
...@@ -9,7 +9,6 @@ const UNI_APP = { ...@@ -9,7 +9,6 @@ const UNI_APP = {
}, },
qn_base_url: 'https://qn-static.banshouhui.com/self-support/', qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'https://qn-static.banshouhui.com', qn_asset_url: 'https://qn-static.banshouhui.com',
uc_img_url_pre: 'https://img2.banshouhui.com/',
argoDebugMode: 0 argoDebugMode: 0
} }
......
...@@ -9,7 +9,6 @@ const UNI_APP = { ...@@ -9,7 +9,6 @@ const UNI_APP = {
}, },
qn_base_url: 'https://qn-static.banshouhui.com/self-support/', qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'https://qn-static.banshouhui.com', qn_asset_url: 'https://qn-static.banshouhui.com',
uc_img_url_pre: 'https://img2.banshouhui.com/',
argoDebugMode: 1 argoDebugMode: 1
} }
module.exports = UNI_APP; module.exports = UNI_APP;
...@@ -89,9 +89,6 @@ ...@@ -89,9 +89,6 @@
import Settle from '@/components/settle/index.vue' import Settle from '@/components/settle/index.vue'
import base from '@/components/upload/index'; import base from '@/components/upload/index';
const app = getApp() const app = getApp()
const globalUrl = process.uniEnv || {};
const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl;
const uc_img_url_pre = globalUrl.uc_img_url_pre;
export default { export default {
mixins:[base], mixins:[base],
components: { components: {
...@@ -187,13 +184,11 @@ export default { ...@@ -187,13 +184,11 @@ export default {
], ],
submitSuccess: false, submitSuccess: false,
saving: false, saving: false,
wxToken: "",
} }
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('入驻证件信息上传页') getApp().trackPage('入驻证件信息上传页')
this.initSettledInfo() this.initSettledInfo()
this.getWxToken()
}, },
updated() { updated() {
// 该方法性能消耗大目前不使用 // 该方法性能消耗大目前不使用
...@@ -264,20 +259,6 @@ export default { ...@@ -264,20 +259,6 @@ export default {
}, },
methods: { methods: {
async getWxToken() {
let that = this;
wx.request({
url: ucenterApiUrl + "/v1/settled/wx-token",
method: 'GET',
header: {
'Authorization': that.vuex_token
},
success(res) {
that.wxToken = res.data.access_token;
console.log(that.wxToken);
}
})
},
// 初始化入驻信息 // 初始化入驻信息
async initSettledInfo() { async initSettledInfo() {
let self = this let self = this
...@@ -399,53 +380,44 @@ export default { ...@@ -399,53 +380,44 @@ export default {
uni.showLoading({ uni.showLoading({
title: '识别中' title: '识别中'
}) })
let request = {
let url = { front: this.$u.api.checkSettleIDCardFront,
front: this.fileInfo.id_card_front, back: this.$u.api.checkSettleIDCardBack,
back: this.fileInfo.id_card_back, };
}; let url = {
let that = this; front: this.fileInfo.id_card_front,
// 文字识别 back: this.fileInfo.id_card_back,
let access_token = this.wxToken; };
let img_pre = uc_img_url_pre;
let img_url = img_pre + url[type] //"tmp/X8XIAJvSt7jp29a97371a466eecab48e7a7c35d92861.jpg"; const params = {
console.log(access_token); ["id_card_" + type]: url[type],
console.log(img_url); id: this.fileInfo.id || 0,
img_url = encodeURI(img_url); }
let post_url = 'https://api.weixin.qq.com/cv/ocr/idcard?type=MODE&img_url='+img_url+'&access_token=' + access_token;
//url识别图片 const res = await request[type](params);
wx.request({ if (res.code !== 200) {
url: post_url, if (type === "front") {
header: { this.fileInfo.id_card_name = "";
'Content-Type': 'application/x-www-form-urlencoded' this.fileInfo.id_card_number = "";
}, this.frontErrorMsg = res.message || "识别失败,请重新上传"
method: 'POST', } else {
success(res) { this.fileInfo.id_card_back_check = false;
uni.hideLoading() this.backErrorMsg = res.message || "识别失败,请重新上传"
let info = res.data; }
if(info.errcode != 0){ return
if (type === "front") { }
that.fileInfo.id_card_name = ""; uni.hideLoading()
that.fileInfo.id_card_number = ""; if (type === "front") {
that.frontErrorMsg = res.message || "识别失败,请重新上传" this.fileInfo.id_card_name =
} else { res.data.id_card_name || "";
that.fileInfo.id_card_back_check = false; this.fileInfo.id_card_number =
that.backErrorMsg = res.message || "识别失败,请重新上传" res.data.id_card_number || "";
} this.frontErrorMsg = (!this.fileInfo.id_card_name || !this.fileInfo.id_card_number) ? "识别失败,请重新上传" : ''
return } else {
} else if (type === "front") { this.fileInfo.id_card_expire = res.data.id_card_expire || "";
that.fileInfo.id_card_name = this.fileInfo.id_card_back_check = true;
info.name || ""; this.backErrorMsg = !this.fileInfo.id_card_expire ? "识别失败,请重新上传" : ''
that.fileInfo.id_card_number = }
info.id || "";
that.frontErrorMsg = (!that.fileInfo.id_card_name || !that.fileInfo.id_card_number) ? "识别失败,请重新上传" : ''
} else {
that.fileInfo.id_card_expire = info.valid_date || "";
that.fileInfo.id_card_back_check = true;
that.backErrorMsg = !that.fileInfo.id_card_expire ? "识别失败,请重新上传" : ''
}
}
})
}, },
checkFileInfo() { checkFileInfo() {
let formFlag = true; let formFlag = true;
......
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