Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-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 5982d020
authored
Dec 29, 2022
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
视频详情,下载
1 parent
6991d0e1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
13 deletions
packagesList/pages/videoDetal/videoDetal.js
packagesList/pages/videoDetal/videoDetal.json
packagesList/pages/videoDetal/videoDetal.wxml
packagesList/pages/videoDetal/videoDetal.js
View file @
5982d02
...
@@ -18,7 +18,8 @@ Page({
...
@@ -18,7 +18,8 @@ Page({
videoUrl
:
''
,
videoUrl
:
''
,
isShare
:
false
,
//是否是被分享出去
isShare
:
false
,
//是否是被分享出去
},
},
videoObj
:
{}
videoObj
:
{},
showAuth
:
false
},
},
/**
/**
...
@@ -98,19 +99,35 @@ Page({
...
@@ -98,19 +99,35 @@ Page({
},
},
// 下载视频
// 下载视频
downVideo() {
downVideo() {
const _this = this
let { videoObj } = this.data
let { videoObj } = this.data
let url = videoObj.videoUrl
let url = videoObj.videoUrl
wx.$api.showToast('正在下载视频...')
wx.getSetting({
wx.downloadFile({
success: (res)=> {
url: url,
if(res.authSetting['scope.writePhotosAlbum']===false){
success(res) {
_this.setData({
if (res.statusCode === 200) {
showAuth: true
wx.saveVideoToPhotosAlbum({
})
filePath: res.tempFilePath,
}else{
wx.$api.showToast('正在下载视频...')
wx.downloadFile({
url: url,
success(res) {
success(res) {
setTimeout(() => {
if (res.statusCode === 200) {
wx.$api.showToast('下载成功!')
wx.saveVideoToPhotosAlbum({
}, 2000)
filePath: res.tempFilePath,
success(res) {
setTimeout(() => {
wx.$api.showToast('下载成功!')
}, 2000)
},
fail({ errMsg }) {
_this.setData({
showAuth: errMsg == "saveVideoToPhotosAlbum:fail auth deny",
})
}
})
}
}
}
})
})
}
}
...
...
packagesList/pages/videoDetal/videoDetal.json
View file @
5982d02
{
{
"usingComponents"
:
{
"usingComponents"
:
{
"gl-video-detail"
:
"glsx-applet-component/video-detail/index"
,
"gl-video-detail"
:
"glsx-applet-component/video-detail/index"
,
"apply-button"
:
"../../../pages/viewVideo/components/apply-button/index"
"apply-button"
:
"../../../pages/viewVideo/components/apply-button/index"
,
"authorize"
:
"../../../components/Authorize/Authorize"
}
}
}
}
\ No newline at end of file
\ No newline at end of file
packagesList/pages/videoDetal/videoDetal.wxml
View file @
5982d02
...
@@ -2,4 +2,7 @@
...
@@ -2,4 +2,7 @@
<gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail>
<gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 -->
<!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
\ No newline at end of file
\ No newline at end of file
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
<block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
\ No newline at end of file
\ No newline at end of file
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