Commit f00f03a8 authored by Jennie Shi's avatar Jennie Shi

新增人脸识别插件

parent 573997d7
......@@ -109,7 +109,7 @@
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<engine name="ios" spec="~4.5.5" />
<plugin name="IdCardPlugin" spec="/Users/jeshi/Documents/徐工/IdCardPlugin-测试S" />
<engine name="android" spec="~6.2.0" />
<plugin name="IdCardPlugin" spec="/Users/jeshi/Documents/徐工/card-plugin-test/IdCardPlugin" />
<engine name="android" spec="^6.2.0" />
<engine name="ios" spec="^4.5.5" />
</widget>
......@@ -11,5 +11,5 @@ module.exports = {
ocrPath:'"http://www.xcmgfs.com:8087/r/api"',
fileUploadSvcPath:'"http://www.xcmgfs.com:8087/r/api/app/fileUploadSvc?sysName=XCMG_PROD&apiName="',
appId: '"com.xcmg.app"',
currentVersion: '"0.2.2"'
currentVersion: '"0.2.3"'
}
......@@ -11,5 +11,5 @@ module.exports = {
ocrPath:'"http://180.104.121.66:8088/r/api"',
fileUploadSvcPath:'"http://180.104.121.66:8088/r/api/app/fileUploadSvc?sysName=XCMG_UAT&apiName="',
appId: '"com.xcmg.app.dev"',
currentVersion: '"2.7.7"'
currentVersion: '"2.8.1"'
}
......@@ -167,7 +167,7 @@
"dev": true
},
"IdCardPlugin": {
"version": "file:../IdCardPlugin-测试S"
"version": "file:../card-plugin-test/IdCardPlugin"
},
"abbrev": {
"version": "1.1.1",
......
......@@ -20,6 +20,8 @@
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
......@@ -27,10 +29,11 @@
</config-file>
<!-- arr引用 -->
<resource-file src="src/android/lib/qsign_facesdk_xg_dev_1.0.0.aar" target="libs/qsign_facesdk_xg_dev_1.0.0.aar" />
<resource-file src="src/android/lib/jsgzsdk.aar" target="libs/jsgzsdk.aar" />
<framework src="src/android/lib/idCard.gradle" custom="true" type="gradleReference" />
<source-file src="src/android/java/IdCardIdentifyPlugin.java" target-dir="src/com/xg/idcard/" />
<source-file src="src/android/lib/com.xcmg.app.dev-license.qsign-android" target-dir="assets/" />
<source-file src="src/android/lib/com.xcmg.app-license.qsign-android" target-dir="assets/" />
</platform>
</plugin>
......@@ -3,35 +3,10 @@
调用方式:
```
cordova.plugins.IdCardPlugin.idCardIdentify({"idNum":"123213213123123123123213","idName":"张三","timeout":10000}, function (success) {alert(success);
}, function (reason) {
alert("Failed: " + reason);
});
```
字段:
idNum : 身份证号码
idName: 用户名称
timeout:检测超时时间
返回值介绍:
1.实名认证
cordova.plugins.IdCardPlugin.idCardIdentify({"idNum":"身份证号码","idName":"姓名","phoneNum":"手机号"}, function (success) {}, function (reason) {});
​ 检测成功返回值:
​ {"code":1,"message":"检测成功"}
​ 检测失败返回值:
​ 1.{"code":0,"message":"参数错误"}
​ 2.{"code":0,"message":"idNum 或者 idName 为空"}
​ 3.{"code":0,"message":"检测失败"}
​ 4.{"code":0,"message":"未授予相机权限"}
2.人脸对比 成功回调返回人脸照片路径
cordova.plugins.IdCardPlugin.faceContrast({"idNum":"身份证号码","idName":"姓名"}, function (success) {}, function (reason) {});
```
IyDl5pQS3o3fFUQeXbstDxTvBS/uVKYWHDf549PcITq+WrHoe4ubjzoizlu5olJs2qHqvqAW4N+tnywSWMbzhMRiQKpx2SGHy7c+egnXWl5VCA3LRVMjRPsx+XE1bUHbL9RzjSUq/BN9WVz2HEryxSmRf+YD+QAKuc2e01Ei7c8=
\ No newline at end of file
OoC6eFPZ052U9SUIKADVkMowQX8QUK6xZdzz3R8W/15nMXisPRHSccLFlLalaf5n0pYf+/A087BXOcLDOfDqlWr0d68z0S+hNbmjvovgd4Og0sJodxnBHailPIGbjJPiqPByiAzke+Z6qxN3fB3bpA1ViXilJKXBwg5/bgJPxuE=
\ No newline at end of file
......@@ -6,8 +6,18 @@ repositories{
}
dependencies {
compile(name:"qsign_facesdk_xg_dev_1.0.0",ext: 'aar')
compile('com.lzy.net:okgo:3.0.4')
compile(name:"jsgzsdk",ext: 'aar')
implementation 'com.android.support:appcompat-v7:28.+'
//必须添加如下依赖!!!
implementation 'com.android.support:recyclerview-v7:28.+'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.alibaba:fastjson:1.2.31'
implementation 'com.lzy.net:okgo:3.0.4'
implementation ('com.github.bumptech.glide:glide:4.8.0'){
exclude group:"com.android.support"
}
implementation "com.android.support:exifinterface:28.+"
implementation 'com.otaliastudios:cameraview:1.5.0'
}
android {
......@@ -16,7 +26,18 @@ android {
exclude 'META-INF/LICENSE'
}
aaptOptions {
noCompress "dat"
aaptOptions {
noCompress "dat"
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
\ No newline at end of file
......@@ -3,3 +3,7 @@ var exec = require('cordova/exec');
exports.idCardIdentify = function (arg0, success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'IdCardIdentify', [arg0]);
};
exports.faceContrast = function (arg0, success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'faceContrast', [arg0]);
};
\ No newline at end of file
......@@ -72,7 +72,7 @@
"PACKAGE_NAME": "com.xcmg.app.dev"
},
"IdCardPlugin": {
"PACKAGE_NAME": "com.xcmg.app"
"PACKAGE_NAME": "com.xcmg.app.dev"
}
},
"dependent_plugins": {
......
......@@ -583,7 +583,6 @@ export default {
url: res.info.data.url,
},
})
cordova.InAppBrowser.open(res.info.data.url, '_blank', 'location=yes')
} else {
vm.hlsPopup.showLongCenter(res.info.msg)
}
......@@ -618,11 +617,16 @@ export default {
hlsPopup.hideLoading()
if (res.result === 'S') {
let data = res.lists[0]
cordova.plugins.IdCardPlugin.idCardIdentify({'idNum': data.id_card_no, 'idName': data.bp_name, 'timeout': 10000}, function (suc) {
cordova.plugins.IdCardPlugin.faceContrast({'idNum': data.id_card_no, 'idName': data.bp_name}, function (suc) {
// cordova.plugins.IdCardPlugin.faceContrast({'idNum': '341181199602016223', 'idName': '史蒙蒙'}, function (suc) {
let success = JSON.parse(suc)
console.log('success === ' + success)
if (success.code === 1) {
let filePath = JSON.stringify(success.message, '\\', null)
filePath = filePath.replace('\"', '')
console.log('filePath ==== ' + filePath)
// 回调成功上传图片
// vm.uploadImg(success.image)
vm.uploadImg(filePath)
vm.goElectronicSign()
}
}, function (reason) {
......@@ -696,7 +700,7 @@ export default {
if (list[j].filePath === res.response.filePath) {
list[j].attachment_id = res.response.attachment_id
vm.faceListUpload.push(list[j])
// alert('faceListUpload' + JSON.stringify(vm.faceListUpload))
console.log('faceListUpload' + JSON.stringify(vm.faceListUpload))
break
}
}
......
......@@ -164,7 +164,7 @@ export default {
}
},
async access () {
// cordova.plugins.IdCardPlugin.idCardIdentify({'idNum': '341181199602016223', 'idName': '史蒙蒙', 'phoneNum': '15751862158', environment: 'DEV'}, function (success) {
// cordova.plugins.IdCardPlugin.idCardIdentify({'idNum': '341181199602016223', 'idName': '史蒙蒙', 'phoneNum': '15751862159'}, function (success) {
// alert(success)
// }, function (reason) {
// alert('Failed: ' + reason)
......
This diff is collapsed.
......@@ -128,6 +128,7 @@ export default {
return {
backImg: null,
showModalValue: false,
bp_identity: window.localStorage.bp_identity,
bankList: [],
isClear: false,
certification_status: '',
......@@ -151,7 +152,7 @@ export default {
beforeRouteEnter (to, from, next) {
next(vm => {
vm.getBankInfo()
// vm.getNpCertificationUrl()
vm.checkElectonic()
})
},
methods: {
......@@ -185,89 +186,103 @@ export default {
}
vm.hlsPopup.showLoading('请稍候')
let res = await vm.$post(url, param)
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.hideLoading()
vm.certification_status = res.info.certification_status
return true
} else {
vm.hlsPopup.hideLoading()
this.hlsPopup.showLongCenter(res.message)
vm.hlsPopup.showLongCenter(res.message)
}
},
// 提交
async putData () {
let vm = this
let bp_id = window.localStorage.getItem('bp_id')
let isCheck = await vm.checkElectonic()
let urlTemp = await vm.getNpCertificationUrl()
if (urlTemp) {
this.hlsPopup.showConfirm({
title: '提示',
content: '您确认提交吗?',
onConfirm: data => {
if (data) {
let url = process.env.basePath + 'bp_bind_submit'
let param = {
master: {
bp_id: bp_id,
company_id: '2145',
bp_class: 'NP',
bp_type: window.localStorage.getItem('bp_type'),
business_num: window.localStorage.getItem('business_num'),
},
}
vm.hlsPopup.showLoading('请稍候')
if (isCheck) {
vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.showSuccess('提交成功')
if (vm.certification_status === 'Y') {
vm.$router.push({
name: 'MyInfo',
})
} else if (vm.certification_status === 'N') {
// vm.$router.push({
// name: 'Certification',
// params: {
// authUrl: vm.authUrl,
// },
// })
const u = navigator.userAgent
const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
if (isiOS) {
cordova.InAppBrowser.open(vm.authUrl, '_blank', 'location=yes')
console.log('ios')
} else {
vm.$router.push({
name: 'Certification',
params: {
authUrl: vm.authUrl,
// 个人或授权人
vm.hlsPopup.showConfirm({
title: '提示',
content: '您确认提交吗?',
onConfirm: d => {
if (d) {
if (vm.bp_identity === 'NP_NO' || vm.bp_identity === 'ORG_L_NO' || vm.bp_identity === 'ORG_AUTH_NO') {
vm.hlsPopup.showConfirm({
title: '提示',
content: '当前用户尚未认证,是否需要验证',
onConfirm: c => {
if (c) {
// 只有自然人需要认证
let url = process.env.basePath + 'bp_query'
let param = {
bp_id: window.localStorage.bp_id,
}
hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then((result) => {
hlsPopup.hideLoading()
if (result.result === 'S') {
let data = result.lists[0]
cordova.plugins.IdCardPlugin.idCardIdentify(
{
idNum: data.id_card_no,
idName: data.bp_name,
phoneNum: window.localStorage.user_phone,
},
})
console.log('android')
function (suc) {
let success = JSON.parse(suc)
if (success.code === 1) {
vm.getNpCertificationUrl()
}
},
function (reason) {
let error = JSON.parse(reason)
vm.hlsPopup.showLongCenter('认证失败: ' + error.message)
}
)
} else {
vm.hlsPopup.showLongCenter(result.message)
}
} else {
vm.$router.push({
name: 'MyInfo',
})
}
} else if (res.result === 'P') {
vm.hlsPopup.showLongCenter(res.message)
vm.$router.push({
name: 'MyInfo',
})
} else {
vm.hlsPopup.showLongCenter(res.message)
// 不校验的也直接提交
vm.submitBind()
}
})
}
},
})
} else {
// 已认证过的用户直接提交
vm.submitBind()
}
},
})
} else {
this.hlsPopup.showLongCenter('电子签认证出错')
}
},
})
},
async submitBind () {
let vm = this
let url = $config.basePath + 'bp_bind_submit'
let param = {
master: {
bp_id: window.localStorage.bp_id,
bp_class: 'ORG',
bp_type: window.localStorage.getItem('bp_type'),
business_num: window.localStorage.getItem('business_num'),
},
}
vm.hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.showSuccess('提交成功')
vm.$router.push({
name: 'MyInfo',
})
} else if (res.result === 'P') {
vm.hlsPopup.showLongCenter(res.message)
vm.$router.push({
name: 'MyInfo',
})
} else {
vm.hlsPopup.showLongCenter(res.message)
}
})
},
// 获取个人认证url
async getNpCertificationUrl () {
let vm = this
let url = $config.basePath + 'auth_user_sign'
......@@ -277,15 +292,16 @@ export default {
hlsPopup.showLoading('请稍候')
let res = await vm.$post(url, param)
hlsPopup.hideLoading()
if ((res.info.code === 0) && (res.info.data.authUrl)) {
vm.authUrl = res.info.data.authUrl
return vm.authUrl
} else if ((res.info.code === 0) && (res.info.data.openId)) {
vm.authUrl = res.info.data.openId
return vm.authUrl
if (res.info.code === 0 && res.info.data.authUrl) {
hlsPopup.showLongCenter('绑定失败!')
} else if (res.info.code === 0 && res.info.data.openId) {
hlsPopup.showLongCenter('绑定成功!')
vm.submitBind()
vm.$router.push({
name: 'MyInfo',
})
} else {
hlsPopup.showError(res.info.msg)
return ''
hlsPopup.showLongCenter(res.info.msg)
}
},
addBankInfo () {
......
<!--
* @Description: In User Settings Edit
* @Author: your name
* @Date: 2019-09-24 21:29:35
* @LastEditTime : 2019-12-24 16:25:09
* @LastEditors : Please set LastEditors
-->
<template>
<h-view id="bankInfo" class="public-style">
<h-header :proportion="[5,1,1]" class="bar-custom">
......@@ -129,6 +122,7 @@ export default {
isApproved: false,
backImg: null,
getBankList: [],
bp_identity: window.localStorage.bp_identity,
bank_lists: {
bank_account_num: '', // 卡号
bank_account_name: '', // 账户姓名
......@@ -160,11 +154,6 @@ export default {
vm.certification_status = ''
vm.getBankInfo()
vm.electQuery()
/* if (window.localStorage.bp_identity === 'ORG_NO') {
vm.getOrgCertificationUrl() // 获取企业认证url
} else {
vm.getNpCertificationUrl()
} */
}
})
},
......@@ -304,83 +293,92 @@ export default {
// 提交
async handSubmit () {
let vm = this
// if (window.localStorage.bp_identity === 'ORG_NO') {
// var urlTemp = await vm.getOrgCertificationUrl() // 获取企业认证url
// } else {
var urlTemp = await vm.getNpCertificationUrl()
// }
this.hlsPopup.showConfirm({
// 个人或授权人
vm.hlsPopup.showConfirm({
title: '提示',
content: '您确认提交吗?',
onConfirm: data => {
if (data) {
let url = $config.basePath + 'bp_bind_submit'
let param = {
master: {
bp_id: this.$route.params.bp_id,
company_id: '2145',
bp_class: 'ORG',
bp_type: window.localStorage.getItem('bp_type'),
business_num: window.localStorage.getItem('business_num'),
},
}
let vm = this
vm.hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.showSuccess('提交成功')
if (urlTemp) {
if (vm.certification_status === 'Y') {
vm.$router.push({
name: 'MyInfo',
})
} else {
if (vm.authUrl) {
// vm.$router.push({
// name: 'Certification',
// params: {
// authUrl: vm.authUrl,
// },
// })
const u = navigator.userAgent
const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
if (isiOS) {
cordova.InAppBrowser.open(vm.authUrl, '_blank', 'location=yes')
console.log('ios')
} else {
vm.$router.push({
name: 'Certification',
params: {
authUrl: vm.authUrl,
onConfirm: d => {
if (d) {
if (vm.bp_identity === 'NP_NO' || vm.bp_identity === 'ORG_L_NO' || vm.bp_identity === 'ORG_AUTH_NO') {
vm.hlsPopup.showConfirm({
title: '提示',
content: '当前用户尚未认证,是否需要验证',
onConfirm: c => {
if (c) {
// 只有自然人需要认证
let url = process.env.basePath + 'bp_query'
let param = {
bp_id: window.localStorage.bp_id,
}
hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then((result) => {
hlsPopup.hideLoading()
if (result.result === 'S') {
let data = result.lists[0]
cordova.plugins.IdCardPlugin.idCardIdentify(
{
idNum: data.id_card_no,
idName: data.bp_name,
phoneNum: window.localStorage.user_phone,
},
function (suc) {
let success = JSON.parse(suc)
if (success.code === 1) {
vm.getNpCertificationUrl()
}
},
})
console.log('android')
function (reason) {
let error = JSON.parse(reason)
vm.hlsPopup.showLongCenter('认证失败: ' + error.message)
}
)
} else {
vm.hlsPopup.showLongCenter(result.message)
}
} else {
vm.$router.push({
name: 'MyInfo',
})
}
})
} else {
// 不校验的也直接提交
vm.submitBind()
}
} else {
vm.$router.push({
name: 'MyInfo',
})
}
} else if (res.result === 'P') {
vm.hlsPopup.showLongCenter(res.message)
vm.$router.push({
name: 'MyInfo',
})
} else {
vm.hlsPopup.showLongCenter(res.message)
}
})
},
})
} else {
// 已认证过的用户直接提交
vm.submitBind()
}
}
},
})
},
async submitBind () {
let vm = this
let url = $config.basePath + 'bp_bind_submit'
let param = {
master: {
bp_id: window.localStorage.bp_id,
bp_class: 'ORG',
bp_type: window.localStorage.getItem('bp_type'),
business_num: window.localStorage.getItem('business_num'),
},
}
vm.hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.showSuccess('提交成功')
vm.$router.push({
name: 'MyInfo',
})
} else if (res.result === 'P') {
vm.hlsPopup.showLongCenter(res.message)
vm.$router.push({
name: 'MyInfo',
})
} else {
vm.hlsPopup.showLongCenter(res.message)
}
})
},
// 获取个人认证url
async getNpCertificationUrl () {
let vm = this
......@@ -391,41 +389,18 @@ export default {
hlsPopup.showLoading('请稍候')
let res = await vm.$post(url, param)
hlsPopup.hideLoading()
if ((res.info.code === 0) && (res.info.data.authUrl)) {
vm.authUrl = res.info.data.authUrl
return vm.authUrl
} else if ((res.info.code === 0) && (res.info.data.openId)) {
// vm.authUrl = res.info.data.openId
// return vm.authUrl
return false
if (res.info.code === 0 && res.info.data.authUrl) {
hlsPopup.showLongCenter('绑定失败!')
} else if (res.info.code === 0 && res.info.data.openId) {
hlsPopup.showLongCenter('绑定成功!')
vm.submitBind()
vm.$router.push({
name: 'MyInfo',
})
} else {
// hlsPopup.showError(res.info.msg)
// vm.errorMsg = res.info.msg
return ''
hlsPopup.showLongCenter(res.info.msg)
}
},
// 获取企业认证url
// async getOrgCertificationUrl () {
// let vm = this
// let url = $config.basePath + 'auth_company_sign'
// let param = {
// phone: window.localStorage.user_phone,
// }
// hlsPopup.showLoading('请稍候')
// let res = await vm.$post(url, param)
// hlsPopup.hideLoading()
// if ((res.info.code === 0) && (res.info.data.authUrl)) {
// vm.authUrl = res.info.data.authUrl
// return vm.authUrl
// } else if((res.info.code === 0) && (res.info.data.openId)){
// vm.authUrl = res.info.data.openId
// return vm.authUrl
// } else {
// hlsPopup.showError(res.info.msg)
// return ''
// //vm.errorMsg = res.info.msg
// }
// },
// ocr识别入口
ocrShow (ocrType, type) {
let vm = this
......
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><script type=text/javascript src=./static/vuePlatform.js></script><script type=text/javascript src=./static/prototype.js></script><script type=text/javascript src=./cordova.js></script><script type=text/javascript src="http://api.map.baidu.com/api?v=2.0&ak=Eoo0EtfjYCdAy7r8D19gZ0vMojdZpHqU"></script><title>徐工金服</title><link href=./static/css/app.512826ac6a88930aaaea4e530d0361b7.css rel=stylesheet></head><body><div id=app-box></div><script type=text/javascript src=./static/js/manifest.6a178e8d77c32e3c385d.js></script><script type=text/javascript src=./static/js/vendor.0a4e11017ea45af58444.js></script><script type=text/javascript src=./static/js/app.e85af0954e9c1691cb2c.js></script></body></html>
\ No newline at end of file
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