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
>
<view
class=
"body"
>
<camera
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
style=
"position:absolute;width:100%;height:100%;"
>
</camera>
<view
style=
"position:absolute;width:100%;height:100%;"
>
<camera
v-if=
"showCamera"
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
style=
"width:100%;height:100%;"
>
</camera>
</view>
<image
class=
"icon_center"
mode=
"aspectFit"
src=
"../../static/ic_center.png"
/>
...
...
@@ -36,7 +39,12 @@
}
from
"@/utils/utils.js"
import
{
redirectTo
,
openSetting
,
}
from
'@/utils/utils.js'
;
import
{
redirectTo
,
navigateTo
,
navigateBack
}
from
'@/utils/fun'
;
...
...
@@ -55,6 +63,7 @@
items
:
[],
showPicker
:
false
,
userBean
:
{},
showCamera
:
true
}
},
onLoad
(
options
)
{
...
...
@@ -78,9 +87,15 @@
this
.
userBean
=
data
;
}
});
this
.
showCamera
=
true
},
methods
:
{
takePhoto
()
{
if
(
!
this
.
showCamera
)
{
this
.
showCamera
=
true
}
if
(
this
.
isMeasureHeight
==
1
&&
!
this
.
isClickTwo
)
{
this
.
isClickTwo
=
true
this
.
scanPosition
=
"顶部"
...
...
@@ -96,6 +111,24 @@
},
error
(
e
)
{
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
({
detail
:
{
...
...
scan/pagesC/scan/scan.vue
View file @
05e3ab25
<
template
>
<view
class=
"body"
>
<camera
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
style=
"position:relative;width:100%;height:70%;"
>
</camera>
<view
style=
"position:relative;width:100%;height:70%;"
>
<camera
v-if=
"showCamera"
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
style=
"width:100%;height:100%;"
>
</camera>
</view>
<view
class=
"hint"
v-if=
"current==0"
>
请保持水平清晰
</view>
<view
class=
"card"
v-if=
"current==1"
@
click=
"showPop"
>
...
...
@@ -56,6 +59,10 @@
reLaunch
}
from
'@/utils/fun'
;
import
{
openSetting
,
}
from
'@/utils/utils.js'
;
const
app
=
getApp
();
export
default
{
...
...
@@ -89,13 +96,21 @@
},
],
list
:
[
'身份证正面'
,
'身份证反面'
],
cardType
:
ScanTypeBean
.
idcard_front
,
showCamera
:
true
}
},
onLoad
(
option
)
{
this
.
current
=
option
.
type
},
onShow
()
{
this
.
showCamera
=
true
},
methods
:
{
takePhoto
()
{
if
(
!
this
.
showCamera
)
{
this
.
showCamera
=
true
}
uni
.
showLoading
({
title
:
'加载中...'
})
...
...
@@ -107,10 +122,10 @@
quality
:
'high'
,
success
(
res
)
{
uni
.
hideLoading
()
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempImagePath
,
type
:
that
.
current
,
cardType
:
that
.
cardType
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempImagePath
,
type
:
that
.
current
,
cardType
:
that
.
cardType
})
},
fail
(
err
)
{
...
...
@@ -129,14 +144,37 @@
success
:
(
res
)
=>
{
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempFilePaths
,
type
:
that
.
current
,
type
:
that
.
current
,
cardType
:
that
.
cardType
})
},
fail
:
(
res
)
=>
{
setTimeout
(()
=>
{
that
.
goAuthSetting
()
},
500
)
}
});
},
error
(
e
)
{
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
({
detail
:
{
...
...
@@ -151,6 +189,10 @@
},
handleChange
(
res
)
{
this
.
current
=
res
.
value
if
(
!
this
.
showCamera
)
{
this
.
showCamera
=
true
}
},
showPop
()
{
this
.
$refs
.
popup
.
open
(
'bottom'
)
...
...
@@ -245,7 +287,7 @@
flex-direction
:
column
;
// align-items: center;
// justify-content: center;
padding
:
15px
;
padding
:
15px
;
font-size
:
36rpx
;
background-color
:
#fff
;
}
...
...
scan/utils/utils.js
View file @
05e3ab25
...
...
@@ -334,4 +334,15 @@ export function getSubList(length, list) {
}
}
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