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 bd912229
authored
Oct 26, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'zq_dev_3.0' into 'v3.0'
设置权限判断 See merge request
!83
2 parents
30880d7a
76eac997
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
18 deletions
pages/checkProduct/checkProduct.js
pages/tab/discovery/components/product/product.js
pages/checkProduct/checkProduct.js
View file @
bd91222
...
...
@@ -201,16 +201,43 @@ Page({
download
()
{
wx
.
showModal
({
content
:
'确认下载海报?'
,
success
:
(
res
)
=>
{
console
.
log
(
res
)
success
:
async
(
res
)
=>
{
if
(
res
.
confirm
){
this
.
createImg
()
let
hasAuth
=
await
this
.
toSetting
()
if
(
hasAuth
){
this
.
createImg
()
}
}
},
fail
:
(
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
()
{
// this.setData({
...
...
pages/tab/discovery/components/product/product.js
View file @
bd91222
...
...
@@ -124,22 +124,50 @@ Component({
curTabIdx
:
idx
})
},
downVideo
(
e
)
{
let
{
url
}
=
e
.
target
.
dataset
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
downloadFile
({
url
:
url
,
success
(
res
)
{
if
(
res
.
statusCode
===
200
)
{
wx
.
saveVideoToPhotosAlbum
({
filePath
:
res
.
tempFilePath
,
success
(
res
)
{
wx
.
$api
.
showToast
(
'下载成功!'
)
}
})
async
downVideo
(
e
)
{
let
hasAuth
=
await
this
.
toSetting
()
if
(
hasAuth
){
let
{
url
}
=
e
.
target
.
dataset
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
downloadFile
({
url
:
url
,
success
(
res
)
{
if
(
res
.
statusCode
===
200
)
{
wx
.
saveVideoToPhotosAlbum
({
filePath
:
res
.
tempFilePath
,
success
(
res
)
{
wx
.
$api
.
showToast
(
'下载成功!'
)
}
})
}
}
}
})
}
},
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
(){
...
...
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