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

'身份证识别'

parent c208f02a
......@@ -7,9 +7,10 @@ module.exports = merge(prodEnv, {
CONFIG_ENV: JSON.stringify(process.env.CONFIG_ENV),
debug: true,
isMobilePlatform: false,
loginPath: '"http://hlsapp.hand-china.com/core/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=app&password=" ',
basePath: '"http://hlsapp.hand-china.com/core/r/api?sysName=XCMG_DEV&apiName="',
rootPath: '"http://hlsapp.hand-china.com/core/r/api"',
loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ',
basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="',
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/"',
appId: '"com.hls.easy.car"',
currentVersion: '"0.0.1"'
......
......@@ -4,9 +4,9 @@ module.exports = {
CONFIG_ENV: JSON.stringify(process.env.CONFIG_ENV),
debug: false,
isMobilePlatform: true,
loginPath: '"http://hlsapp.hand-china.com/core/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=app&password=appadmin" ',
basePath: '"http://hlsapp.hand-china.com/core/r/api?sysName=XCMG_DEV&apiName="',
rootPath: '"http://hlsapp.hand-china.com/core/r/api"',
loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=" ',
basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="',
rootPath: '"http://180.104.121.66:8088/r/api/interface"',
file_url: '"http://hlsapp.hand-china.com/file/"',
appId: '"com.hls.easy.car"',
currentVersion: '"0.0.1"'
......
......@@ -87,7 +87,7 @@ export default {
} else if (!vm.password || vm.password === undefined) {
vm.hlsPopup.showLongCenter('请输入密码')
} else {
let url = process.env.loginPath + 'appadmin'
let url = process.env.loginPath + 'admin'
let param = {}
vm.hlsPopup.showLoading('请稍等')
vm.$post(url, param).then(function (res) {
......
......@@ -50,7 +50,7 @@
<img src="@/assets/userBind/front.png" >
<p>正面</p>
</div>
<div>
<div @click="show()">
<img src="@/assets/userBind/back.png" >
<p>反面</p>
</div>
......@@ -446,60 +446,49 @@ export default {
})
},
openCamera () {
alert('相机')
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 = {
quality: 100,
quality: 60,
width: 1843,
height: 1382,
}
let success = function (imgdata) {
obj.picture = imgdata
obj.filePath = imgdata
vm.upload_list.push(obj)
vm.idCardIdentify(imgdata)
}
let error = function () {
console.log('出现错误')
hlsPopup.showLongCenter(error)
}
hlsUtil.openCamera(cameraoptions, success, error)
},
takePicture () {
alert('相册')
let vm = this
let cameraoptions = {
quality: 100,
var cameraoptions = {
quality: 70,
width: 1843,
height: 1382,
maxCount: 1,
}
let success = function (imgUrl) {
// for (let i = 0; i < imgUrl.length; i++) {
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)
vm.idCardIdentify(imgUrl[0])
}
// }
let error = function () {
console.log('出现错误')
hlsPopup.showLongCenter(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 () {
this.hideModal()
this.getBankInfo()
......
......@@ -279,7 +279,7 @@ export default {
saveToPhotoAlbum: window.localStorage.savePhoto || false,
correctOrientation: true,
}
navigator.camera.getPicture(onSuccess, onFail, options)
$cordovaCamera.getPicture(onSuccess, onFail, options)
} else {
window.hlsPopup.showLongCenter('参数有误!')
}
......@@ -436,6 +436,39 @@ export default {
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 输入的数字
......
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