Commit fb7f082b by luyt

fix;添加视频下载

1 parent a54a5b91
...@@ -53,6 +53,7 @@ Component({ ...@@ -53,6 +53,7 @@ Component({
}, },
lifetimes: { lifetimes: {
ready: function () { ready: function () {
console.log('window',window)
if(!this.data.outshowVideo){ if(!this.data.outshowVideo){
this.setData({ this.setData({
...@@ -148,14 +149,26 @@ Component({ ...@@ -148,14 +149,26 @@ Component({
}, },
// 视频下载 // 视频下载
downVideo(e){ downVideo(e){
let {src} = e.currentTarget.dataset let {url} = e.target.dataset
console.log('src: ', src); console.log(url)
wx.saveVideoToPhotosAlbum({ wx.$api.showToast('正在下载视频...')
filePath: src, wx.downloadFile({
url:url,
success (res) { success (res) {
console.log('视频下载',res) // console.log(res,111)
if (res.statusCode === 200) {
wx.saveVideoToPhotosAlbum({
filePath: res.tempFilePath,
success (res) {
setTimeout(() =>{
wx.$api.showToast('下载成功!')
},2000)
}
})
}
} }
}) })
}, },
saleTextChange(e) {}, saleTextChange(e) {},
changeTab(e) { changeTab(e) {
...@@ -170,9 +183,11 @@ wx.saveVideoToPhotosAlbum({ ...@@ -170,9 +183,11 @@ wx.saveVideoToPhotosAlbum({
}); });
}, },
scrolltoupper(event) { scrolltoupper(event) {
console.log(event.detail.scrollHeight,event.detail.scrollTop)
const idx = this.data.heightArr.findIndex( const idx = this.data.heightArr.findIndex(
(item) => item > event.detail.scrollTop (item) => item > event.detail.scrollHeight
); );
console.log('idx',idx)
this.setData({ this.setData({
curTabIdx: idx, curTabIdx: idx,
}); });
......
...@@ -144,8 +144,8 @@ ...@@ -144,8 +144,8 @@
} }
.project-img { .project-img {
height: 1600rpx; // height: 1600rpx;
white-space: nowrap; // white-space: nowrap;
.img-item { .img-item {
position: relative; position: relative;
} }
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
} }
.stickyTab { .stickyTab {
position: sticky; position: sticky;
z-index: 1; z-index: 2;
background-color: #f5f7fb; background-color: #f5f7fb;
} }
// .out-tab{ // .out-tab{
...@@ -326,6 +326,7 @@ ...@@ -326,6 +326,7 @@
font-size: 0; font-size: 0;
} }
.video-item { .video-item {
position: relative;
width: calc(50% - 12rpx); width: calc(50% - 12rpx);
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
...@@ -334,6 +335,14 @@ ...@@ -334,6 +335,14 @@
height: 590rpx; height: 590rpx;
// border: 1rpx dashed #AFB0B2; // border: 1rpx dashed #AFB0B2;
} }
.video-item .download{
position: absolute;
top:0;
right: 2px;
font-size: 26rpx;
color: #666;
z-index: 1;
}
.video-item:nth-child(even) { .video-item:nth-child(even) {
margin-left: 22rpx; margin-left: 22rpx;
} }
......
...@@ -25,9 +25,6 @@ ...@@ -25,9 +25,6 @@
<image class="icon" src="{{IMGURL}}share.png" /> <image class="icon" src="{{IMGURL}}share.png" />
<text>分享</text> <text>分享</text>
</view> </view>
<!-- <view class="" bindtap="downVideo" data-src="https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/video/360_AR.mp4?v=" hover-class="none" hover-stop-propagation="false">
视频下载
</view> -->
</view> </view>
</view> </view>
</view> </view>
...@@ -86,6 +83,7 @@ ...@@ -86,6 +83,7 @@
<view class="video-list"> <view class="video-list">
<block wx:for="{{senceData[actNum].videoList}}" wx:key="i"> <block wx:for="{{senceData[actNum].videoList}}" wx:key="i">
<view class="video-item"> <view class="video-item">
<view class="download" bindtap="downVideo" data-url="{{videoBaseUrl}}video/{{item.videoUrl}}.mp4?v={{img_version}}">视频下载</view>
<video poster="{{videoBaseUrl}}video/{{item.posterUrl}}.png?v={{img_version}}" title="{{item.name}}" src="{{videoBaseUrl}}video/{{item.videoUrl}}.mp4?v={{img_version}}" /> <video poster="{{videoBaseUrl}}video/{{item.posterUrl}}.png?v={{img_version}}" title="{{item.name}}" src="{{videoBaseUrl}}video/{{item.videoUrl}}.mp4?v={{img_version}}" />
<view class="video-text">{{item.name}}</view> <view class="video-text">{{item.name}}</view>
</view> </view>
......
...@@ -317,11 +317,11 @@ Page({ ...@@ -317,11 +317,11 @@ Page({
break break
case 'protectMembrane': case 'protectMembrane':
// 漆面保护膜 // 漆面保护膜
profit = (flow * 0.05 * 3000 * 12).toFixed(0) profit = (sales * 0.05 * 3000 * 12).toFixed(0)
break break
case 'colorMembrane': case 'colorMembrane':
// 改色膜 // 改色膜
profit = (flow * 0.05 * 5000 * 12).toFixed(0) profit = (sales * 0.05 * 5000 * 12).toFixed(0)
break break
case 'digitBeauty': case 'digitBeauty':
// 数字化美容 // 数字化美容
......
...@@ -10,7 +10,7 @@ page { ...@@ -10,7 +10,7 @@ page {
width: 100%; width: 100%;
background-size: 100% 100%; background-size: 100% 100%;
margin-bottom: 32rpx; margin-bottom: 32rpx;
z-index: 1; z-index: 2;
.header { .header {
position: absolute; position: absolute;
left: 0; left: 0;
...@@ -330,7 +330,7 @@ page { ...@@ -330,7 +330,7 @@ page {
width: 60px; width: 60px;
height: 60px; height: 60px;
border-radius: 50%; border-radius: 50%;
z-index: 1; z-index: 2;
} }
.output-value { .output-value {
position: fixed; position: fixed;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!