Commit fb7f082b by luyt

fix;添加视频下载

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