Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 76eac997
authored
Oct 26, 2022
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
设置权限判断
1 parent
471ba7b1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
3 deletions
pages/checkProduct/checkProduct.js
pages/tab/discovery/components/product/product.js
pages/checkProduct/checkProduct.js
View file @
76eac99
...
@@ -201,16 +201,43 @@ Page({
...
@@ -201,16 +201,43 @@ Page({
download
()
{
download
()
{
wx
.
showModal
({
wx
.
showModal
({
content
:
'确认下载海报?'
,
content
:
'确认下载海报?'
,
success
:
(
res
)
=>
{
success
:
async
(
res
)
=>
{
console
.
log
(
res
)
if
(
res
.
confirm
){
if
(
res
.
confirm
){
let
hasAuth
=
await
this
.
toSetting
()
if
(
hasAuth
){
this
.
createImg
()
this
.
createImg
()
}
}
}
},
},
fail
:
(
res
)
=>
{},
fail
:
(
res
)
=>
{},
complete
:
(
res
)
=>
{},
complete
:
(
res
)
=>
{},
})
})
},
},
toSetting
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
openSetting
({
success
:(
resp
)
=>
{
if
(
resp
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
showToast
({
title
:
"下载海报前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
}
}
})
}
}
})
})
},
//模态框关闭
//模态框关闭
modelClose
()
{
modelClose
()
{
// this.setData({
// this.setData({
...
...
pages/tab/discovery/components/product/product.js
View file @
76eac99
...
@@ -124,7 +124,9 @@ Component({
...
@@ -124,7 +124,9 @@ Component({
curTabIdx
:
idx
curTabIdx
:
idx
})
})
},
},
downVideo
(
e
)
{
async
downVideo
(
e
)
{
let
hasAuth
=
await
this
.
toSetting
()
if
(
hasAuth
){
let
{
url
}
=
e
.
target
.
dataset
let
{
url
}
=
e
.
target
.
dataset
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
downloadFile
({
wx
.
downloadFile
({
...
@@ -141,6 +143,32 @@ Component({
...
@@ -141,6 +143,32 @@ Component({
}
}
}
}
})
})
}
},
toSetting
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
openSetting
({
success
:(
resp
)
=>
{
if
(
resp
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
showToast
({
title
:
"下载视频前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
}
}
})
}
}
})
})
},
},
getImgHeight
(){
getImgHeight
(){
let
query
=
wx
.
createSelectorQuery
().
in
(
this
)
let
query
=
wx
.
createSelectorQuery
().
in
(
this
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment