Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uniapp_scan
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
android
uniapp_scan
Commits
05e3ab25
Commit
05e3ab25
authored
Jun 11, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加权限校验弹框
parent
35777462
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
13 deletions
+99
-13
measurescan.vue
scan/pagesC/measurescan/measurescan.vue
+37
-4
scan.vue
scan/pagesC/scan/scan.vue
+51
-9
utils.js
scan/utils/utils.js
+11
-0
No files found.
scan/pagesC/measurescan/measurescan.vue
View file @
05e3ab25
<
template
>
<
template
>
<view
class=
"body"
>
<view
class=
"body"
>
<camera
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
<view
style=
"position:absolute;width:100%;height:100%;"
>
style=
"position:absolute;width:100%;height:100%;"
>
<camera
v-if=
"showCamera"
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
</camera>
@
initdone=
"initdone"
style=
"width:100%;height:100%;"
>
</camera>
</view>
<image
class=
"icon_center"
mode=
"aspectFit"
src=
"../../static/ic_center.png"
/>
<image
class=
"icon_center"
mode=
"aspectFit"
src=
"../../static/ic_center.png"
/>
...
@@ -36,7 +39,12 @@
...
@@ -36,7 +39,12 @@
}
from
"@/utils/utils.js"
}
from
"@/utils/utils.js"
import
{
import
{
redirectTo
,
openSetting
,
}
from
'@/utils/utils.js'
;
import
{
redirectTo
,
navigateTo
,
navigateTo
,
navigateBack
navigateBack
}
from
'@/utils/fun'
;
}
from
'@/utils/fun'
;
...
@@ -55,6 +63,7 @@
...
@@ -55,6 +63,7 @@
items
:
[],
items
:
[],
showPicker
:
false
,
showPicker
:
false
,
userBean
:
{},
userBean
:
{},
showCamera
:
true
}
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -78,9 +87,15 @@
...
@@ -78,9 +87,15 @@
this
.
userBean
=
data
;
this
.
userBean
=
data
;
}
}
});
});
this
.
showCamera
=
true
},
},
methods
:
{
methods
:
{
takePhoto
()
{
takePhoto
()
{
if
(
!
this
.
showCamera
)
{
this
.
showCamera
=
true
}
if
(
this
.
isMeasureHeight
==
1
&&
!
this
.
isClickTwo
)
{
if
(
this
.
isMeasureHeight
==
1
&&
!
this
.
isClickTwo
)
{
this
.
isClickTwo
=
true
this
.
isClickTwo
=
true
this
.
scanPosition
=
"顶部"
this
.
scanPosition
=
"顶部"
...
@@ -96,6 +111,24 @@
...
@@ -96,6 +111,24 @@
},
},
error
(
e
)
{
error
(
e
)
{
console
.
log
(
e
.
detail
);
console
.
log
(
e
.
detail
);
this
.
showCamera
=
false
this
.
goAuthSetting
()
},
goAuthSetting
()
{
tt
.
showModal
({
title
:
`获取权限失败`
,
content
:
`未授权,请在设置页授权`
,
success
(
res
)
{
if
(
res
.
confirm
)
{
openSetting
()
}
else
if
(
res
.
cancel
)
{
uni
.
showToast
({
title
:
'取消授权'
})
}
},
});
},
},
initdone
({
initdone
({
detail
:
{
detail
:
{
...
...
scan/pagesC/scan/scan.vue
View file @
05e3ab25
<
template
>
<
template
>
<view
class=
"body"
>
<view
class=
"body"
>
<camera
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
<view
style=
"position:relative;width:100%;height:70%;"
>
style=
"position:relative;width:100%;height:70%;"
>
<camera
v-if=
"showCamera"
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
</camera>
@
initdone=
"initdone"
style=
"width:100%;height:100%;"
>
</camera>
</view>
<view
class=
"hint"
v-if=
"current==0"
>
请保持水平清晰
</view>
<view
class=
"hint"
v-if=
"current==0"
>
请保持水平清晰
</view>
<view
class=
"card"
v-if=
"current==1"
@
click=
"showPop"
>
<view
class=
"card"
v-if=
"current==1"
@
click=
"showPop"
>
...
@@ -56,6 +59,10 @@
...
@@ -56,6 +59,10 @@
reLaunch
reLaunch
}
from
'@/utils/fun'
;
}
from
'@/utils/fun'
;
import
{
openSetting
,
}
from
'@/utils/utils.js'
;
const
app
=
getApp
();
const
app
=
getApp
();
export
default
{
export
default
{
...
@@ -89,13 +96,21 @@
...
@@ -89,13 +96,21 @@
},
],
},
],
list
:
[
'身份证正面'
,
'身份证反面'
],
list
:
[
'身份证正面'
,
'身份证反面'
],
cardType
:
ScanTypeBean
.
idcard_front
,
cardType
:
ScanTypeBean
.
idcard_front
,
showCamera
:
true
}
}
},
},
onLoad
(
option
)
{
onLoad
(
option
)
{
this
.
current
=
option
.
type
this
.
current
=
option
.
type
},
},
onShow
()
{
this
.
showCamera
=
true
},
methods
:
{
methods
:
{
takePhoto
()
{
takePhoto
()
{
if
(
!
this
.
showCamera
)
{
this
.
showCamera
=
true
}
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'加载中...'
title
:
'加载中...'
})
})
...
@@ -107,10 +122,10 @@
...
@@ -107,10 +122,10 @@
quality
:
'high'
,
quality
:
'high'
,
success
(
res
)
{
success
(
res
)
{
uni
.
hideLoading
()
uni
.
hideLoading
()
navigateTo
(
`/pagesC/edit/edit`
,
{
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempImagePath
,
uri
:
res
.
tempImagePath
,
type
:
that
.
current
,
type
:
that
.
current
,
cardType
:
that
.
cardType
cardType
:
that
.
cardType
})
})
},
},
fail
(
err
)
{
fail
(
err
)
{
...
@@ -129,14 +144,37 @@
...
@@ -129,14 +144,37 @@
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
navigateTo
(
`/pagesC/edit/edit`
,
{
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempFilePaths
,
uri
:
res
.
tempFilePaths
,
type
:
that
.
current
,
type
:
that
.
current
,
cardType
:
that
.
cardType
cardType
:
that
.
cardType
})
})
},
fail
:
(
res
)
=>
{
setTimeout
(()
=>
{
that
.
goAuthSetting
()
},
500
)
}
}
});
});
},
},
error
(
e
)
{
error
(
e
)
{
console
.
log
(
e
.
detail
);
console
.
log
(
e
.
detail
);
this
.
showCamera
=
false
this
.
goAuthSetting
()
},
goAuthSetting
()
{
tt
.
showModal
({
title
:
`获取权限失败`
,
content
:
`未授权,请在设置页授权`
,
success
(
res
)
{
if
(
res
.
confirm
)
{
openSetting
()
}
else
if
(
res
.
cancel
)
{
uni
.
showToast
({
title
:
'取消授权'
})
}
},
});
},
},
initdone
({
initdone
({
detail
:
{
detail
:
{
...
@@ -151,6 +189,10 @@
...
@@ -151,6 +189,10 @@
},
},
handleChange
(
res
)
{
handleChange
(
res
)
{
this
.
current
=
res
.
value
this
.
current
=
res
.
value
if
(
!
this
.
showCamera
)
{
this
.
showCamera
=
true
}
},
},
showPop
()
{
showPop
()
{
this
.
$refs
.
popup
.
open
(
'bottom'
)
this
.
$refs
.
popup
.
open
(
'bottom'
)
...
@@ -245,7 +287,7 @@
...
@@ -245,7 +287,7 @@
flex-direction
:
column
;
flex-direction
:
column
;
// align-items: center;
// align-items: center;
// justify-content: center;
// justify-content: center;
padding
:
15px
;
padding
:
15px
;
font-size
:
36rpx
;
font-size
:
36rpx
;
background-color
:
#fff
;
background-color
:
#fff
;
}
}
...
...
scan/utils/utils.js
View file @
05e3ab25
...
@@ -334,4 +334,15 @@ export function getSubList(length, list) {
...
@@ -334,4 +334,15 @@ export function getSubList(length, list) {
}
}
}
}
return
subList
return
subList
}
export
function
openSetting
()
{
tt
.
openSetting
({
success
:
res
=>
{
console
.
log
(
'调起设置页面成功'
);
},
fail
:
err
=>
{
console
.
log
(
'调起设置页面失败'
);
}
});
}
}
\ No newline at end of file
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