Commit 58a867bc authored by 李晓兵's avatar 李晓兵

'身份证识别'

parent c208f02a
...@@ -7,9 +7,10 @@ module.exports = merge(prodEnv, { ...@@ -7,9 +7,10 @@ module.exports = merge(prodEnv, {
CONFIG_ENV: JSON.stringify(process.env.CONFIG_ENV), CONFIG_ENV: JSON.stringify(process.env.CONFIG_ENV),
debug: true, debug: true,
isMobilePlatform: false, isMobilePlatform: false,
loginPath: '"http://hlsapp.hand-china.com/core/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=app&password=" ', loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ',
basePath: '"http://hlsapp.hand-china.com/core/r/api?sysName=XCMG_DEV&apiName="', basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="',
rootPath: '"http://hlsapp.hand-china.com/core/r/api"', rootPath: '"http://180.104.121.66:8088/r/api/interface"',
ocrPath:'"http://180.104.121.66:8088/r/api"',
file_url: '"http://hlsapp.hand-china.com/file/"', file_url: '"http://hlsapp.hand-china.com/file/"',
appId: '"com.hls.easy.car"', appId: '"com.hls.easy.car"',
currentVersion: '"0.0.1"' currentVersion: '"0.0.1"'
......
...@@ -4,9 +4,9 @@ module.exports = { ...@@ -4,9 +4,9 @@ module.exports = {
CONFIG_ENV: JSON.stringify(process.env.CONFIG_ENV), CONFIG_ENV: JSON.stringify(process.env.CONFIG_ENV),
debug: false, debug: false,
isMobilePlatform: true, isMobilePlatform: true,
loginPath: '"http://hlsapp.hand-china.com/core/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=app&password=appadmin" ', loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ',
basePath: '"http://hlsapp.hand-china.com/core/r/api?sysName=XCMG_DEV&apiName="', basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="',
rootPath: '"http://hlsapp.hand-china.com/core/r/api"', rootPath: '"http://180.104.121.66:8088/r/api/interface"',
file_url: '"http://hlsapp.hand-china.com/file/"', file_url: '"http://hlsapp.hand-china.com/file/"',
appId: '"com.hls.easy.car"', appId: '"com.hls.easy.car"',
currentVersion: '"0.0.1"' currentVersion: '"0.0.1"'
......
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
} else if (!vm.password || vm.password === undefined) { } else if (!vm.password || vm.password === undefined) {
vm.hlsPopup.showLongCenter('请输入密码') vm.hlsPopup.showLongCenter('请输入密码')
} else { } else {
let url = process.env.loginPath + 'appadmin' let url = process.env.loginPath + 'admin'
let param = {} let param = {}
vm.hlsPopup.showLoading('请稍等') vm.hlsPopup.showLoading('请稍等')
vm.$post(url, param).then(function (res) { vm.$post(url, param).then(function (res) {
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<img src="@/assets/userBind/front.png" > <img src="@/assets/userBind/front.png" >
<p>正面</p> <p>正面</p>
</div> </div>
<div> <div @click="show()">
<img src="@/assets/userBind/back.png" > <img src="@/assets/userBind/back.png" >
<p>反面</p> <p>反面</p>
</div> </div>
...@@ -446,60 +446,49 @@ export default { ...@@ -446,60 +446,49 @@ export default {
}) })
}, },
openCamera () { openCamera () {
alert('相机')
let vm = this let vm = this
let obj = {
// 'table_pk_value': check_id,
table_name: 'PRJ_CDD_ITEM_CHECK',
// 'check_id': check_id,
picture: '',
filePath: '',
attachment_id: '',
timestamp: new Date().getTime(),
}
let cameraoptions = { let cameraoptions = {
quality: 100, quality: 60,
width: 1843,
height: 1382,
} }
let success = function (imgdata) { let success = function (imgdata) {
obj.picture = imgdata vm.idCardIdentify(imgdata)
obj.filePath = imgdata
vm.upload_list.push(obj)
} }
let error = function () { let error = function () {
console.log('出现错误') hlsPopup.showLongCenter(error)
} }
hlsUtil.openCamera(cameraoptions, success, error) hlsUtil.openCamera(cameraoptions, success, error)
}, },
takePicture () { takePicture () {
alert('相册')
let vm = this let vm = this
let cameraoptions = { var cameraoptions = {
quality: 100, quality: 70,
width: 1843,
height: 1382,
maxCount: 1,
} }
let success = function (imgUrl) { let success = function (imgUrl) {
// for (let i = 0; i < imgUrl.length; i++) { vm.idCardIdentify(imgUrl[0])
let obj = {
// 'table_pk_value': check_id,
table_name: 'PRJ_CDD_ITEM_CHECK',
// 'check_id': check_id,
picture: '',
filePath: '',
attachment_id: '',
timestamp: new Date().getTime(),
sequence: '',
}
obj.picture = imgUrl
obj.filePath = imgUrl
// obj.picture = imgUrl[i]
// obj.filePath = imgUrl[i]
// obj.sequence = i + 1
// push到上传列表中 通知前台数据发生改变
vm.upload_list.push(obj)
} }
// }
let error = function () { let error = function () {
console.log('出现错误') hlsPopup.showLongCenter(error)
} }
vm.hlsUtil.takePicture(cameraoptions, success, error) vm.hlsUtil.takePicture(cameraoptions, success, error)
}, },
// 身份证识别
idCardIdentify (fileUrl) {
alert('fileUrl '+ fileUrl)
let vm = this
hlsPopup.showLoading('正在识别')
let url = process.env.rootPath + '/baidu/ocr/idCard'
hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading()
alert('识别结果: '+ JSON.stringify(res))
})
},
successCall () { successCall () {
this.hideModal() this.hideModal()
this.getBankInfo() this.getBankInfo()
......
...@@ -279,7 +279,7 @@ export default { ...@@ -279,7 +279,7 @@ export default {
saveToPhotoAlbum: window.localStorage.savePhoto || false, saveToPhotoAlbum: window.localStorage.savePhoto || false,
correctOrientation: true, correctOrientation: true,
} }
navigator.camera.getPicture(onSuccess, onFail, options) $cordovaCamera.getPicture(onSuccess, onFail, options)
} else { } else {
window.hlsPopup.showLongCenter('参数有误!') window.hlsPopup.showLongCenter('参数有误!')
} }
...@@ -436,6 +436,39 @@ export default { ...@@ -436,6 +436,39 @@ export default {
ft.upload(path, url, uploadSuccess, error, options) ft.upload(path, url, uploadSuccess, error, options)
}, },
/**
* 百度OCR识别
* @param file
* @param url
* @param success
*/
baiduOcr: function (fileUrl, postUrl, success) {
if (!fileUrl) {
return
}
let path = fileUrl
let name = fileUrl.substr(fileUrl.lastIndexOf('/') + 1)
let url = encodeURI(postUrl)
let options = new FileUploadOptions() // eslint-disable-line
options.headers = {
'Authorization': 'Bearer ' + window.localStorage.access_token,
}
options.fileKey = 'file'
options.fileName = name
options.mimeType = 'multipart/form-date'
let ft = new FileTransfer() // eslint-disable-line
function uploadSuccess (message) {
let res = JSON.parse(message.response)
success(res)
}
function error (e) {
this.hlsPopup.showLongCenter('识别失败')
}
ft.upload(path, url, uploadSuccess, error, options)
},
/** /**
* *
* @param x 输入的数字 * @param x 输入的数字
......
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