Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-xcmg-vue-app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xugong
hls-xcmg-vue-app
Commits
c87492dd
Commit
c87492dd
authored
Oct 14, 2019
by
李晓兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'身份证识别结果'
parent
7f3cd95f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
28 deletions
+27
-28
naturePerson.vue
src/pages/userBind/np/naturePerson.vue
+26
-27
hlsUtil.js
src/scripts/hlsUtil.js
+1
-1
No files found.
src/pages/userBind/np/naturePerson.vue
View file @
c87492dd
...
...
@@ -46,29 +46,35 @@
<div
class=
"upload-id-card"
>
<span>
身份证照片上传
</span>
<div
class=
"upload-box"
>
<div
@
click=
"show(
)"
>
<div
v-if=
"!idCardFront"
@
click=
"idCardshow('front'
)"
>
<img
src=
"@/assets/userBind/front.png"
>
<p>
正面
</p>
</div>
<div
@
click=
"show()"
>
<div
v-if=
"idCardFront && !isApproved"
@
click=
"idCardshow('front')"
>
<img
:src=
"idCardFront"
style=
"width: 100%;height: 100%;margin: 0"
>
</div>
<div
v-if=
"!idCardBack"
@
click=
"idCardshow('back')"
>
<img
src=
"@/assets/userBind/back.png"
>
<p>
反面
</p>
</div>
<div
v-if=
"idCardBack && !isApproved"
@
click=
"idCardshow('back')"
>
<img
:src=
"idCardBack"
style=
"width: 100%;height: 100%;margin: 0"
>
</div>
</div>
</div>
<list-item
:item-height=
"44"
class=
"second-part"
>
<item>
<div
slot=
"name"
class=
"required"
>
姓名
</div>
<input
slot=
"content"
:readonly=
"isApproved"
v-model=
"baseInfo.bp_name"
placeholder=
"上传身份证自动填充"
slot=
"content"
v-model=
"baseInfo.bp_name"
readonly
placeholder=
"上传身份证自动填充"
class=
"auto"
>
</item>
<item>
<div
slot=
"name"
class=
"required"
>
身份证号码
</div>
<input
slot=
"content"
:readonly=
"isApproved"
v-model=
"baseInfo.id_card_no"
readonly
placeholder=
"上传身份证自动填充"
class=
"auto"
>
...
...
@@ -77,8 +83,8 @@
<div
slot=
"name"
class=
"required"
>
户籍地址
</div>
<input
slot=
"content"
:readonly=
"isApproved"
v-model=
"baseInfo.address_on_resident_booklit"
readonly
placeholder=
"上传身份证自动填充"
>
</item>
...
...
@@ -262,6 +268,8 @@ export default {
invoice_kind
:
''
,
user_phone
:
window
.
localStorage
.
user_phone
,
},
idCardFront
:
''
,
// 身份证正面图片
idCardBack
:
''
,
// 身份证反面图片
}
},
watch
:
{
...
...
@@ -364,19 +372,6 @@ export default {
window
.
localStorage
.
setItem
(
'bp_name'
,
vm
.
baseInfo
.
bp_name
)
return
res
.
bp_id
}
/* vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.showSuccess('保存成功')
vm.isSave = true
return res.bp_id
window.localStorage.setItem('user_id', res.bp_id)
window.sessionStorage.setItem('user_id', res.bp_id)
window.sessionStorage.setItem('bp_name', vm.baseInfo.bp_name)
window.localStorage.setItem('bp_name', vm.baseInfo.bp_name)
vm.getBankInfo()
}
}) */
},
async
saveWord
()
{
let
vm
=
this
...
...
@@ -431,22 +426,21 @@ export default {
}
})
},
show
(
)
{
idCardshow
(
type
)
{
let
vm
=
this
hlsPopup
.
showActionSheet
({
titleText
:
'请选择照片'
,
buttonArray
:
[
'拍照'
,
'从相册取'
],
callback
:
index
=>
{
if
(
index
===
0
)
{
vm
.
openCamera
()
vm
.
openCamera
(
type
)
}
else
{
vm
.
takePicture
()
vm
.
takePicture
(
type
)
}
},
})
},
openCamera
()
{
alert
(
'相机'
)
openCamera
(
type
)
{
let
vm
=
this
let
cameraoptions
=
{
quality
:
60
,
...
...
@@ -454,6 +448,7 @@ export default {
height
:
1382
,
}
let
success
=
function
(
imgdata
)
{
type
===
'front'
?
vm
.
idCardFront
=
imgdata
:
vm
.
idCardBack
=
imgdata
vm
.
idCardIdentify
(
imgdata
)
}
let
error
=
function
()
{
...
...
@@ -461,8 +456,7 @@ export default {
}
hlsUtil
.
openCamera
(
cameraoptions
,
success
,
error
)
},
takePicture
()
{
alert
(
'相册'
)
takePicture
(
type
)
{
let
vm
=
this
var
cameraoptions
=
{
quality
:
70
,
...
...
@@ -471,6 +465,7 @@ export default {
maxCount
:
1
,
}
let
success
=
function
(
imgUrl
)
{
type
===
'front'
?
vm
.
idCardFront
=
imgUrl
[
0
]
:
vm
.
idCardBack
=
imgUrl
[
0
]
vm
.
idCardIdentify
(
imgUrl
[
0
])
}
let
error
=
function
()
{
...
...
@@ -480,13 +475,17 @@ export default {
},
// 身份证识别
idCardIdentify
(
fileUrl
)
{
alert
(
'fileUrl '
+
fileUrl
)
let
vm
=
this
hlsPopup
.
showLoading
(
'正在识别'
)
let
url
=
process
.
env
.
ocrPath
+
'/baidu/ocr/idCard'
hlsUtil
.
baiduOcr
(
fileUrl
,
url
,
function
(
res
)
{
hlsPopup
.
hideLoading
()
alert
(
'识别结果: '
+
JSON
.
stringify
(
res
))
let
result
=
res
.
result
.
words_result
console
.
log
(
'识别结果: '
+
result
)
console
.
log
(
'姓名: '
+
result
.
姓名
.
words
)
vm
.
baseInfo
.
bp_name
=
result
.
姓名
.
words
vm
.
baseInfo
.
id_card_no
=
result
.
公民身份号码
.
words
vm
.
baseInfo
.
address_on_resident_booklit
=
result
.
住址
.
words
})
},
successCall
()
{
...
...
src/scripts/hlsUtil.js
View file @
c87492dd
...
...
@@ -279,7 +279,7 @@ export default {
saveToPhotoAlbum
:
window
.
localStorage
.
savePhoto
||
false
,
correctOrientation
:
true
,
}
$cordovaCamera
.
getPicture
(
options
).
then
(
onSuccess
,
onFail
);
navigator
.
camera
.
getPicture
(
onSuccess
,
onFail
,
options
)
}
else
{
window
.
hlsPopup
.
showLongCenter
(
'参数有误!'
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment