Commit c4a3b37a authored by Mac's avatar Mac

保存视频

parent 2ad80a63
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
"navigationBarTitleText": "WeChat", "navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
}, },
"style": "v2",
"sitemapLocation": "sitemap.json", "sitemapLocation": "sitemap.json",
"tabBar": { "tabBar": {
"selectedColor": "#d4237a", "selectedColor": "#d4237a",
......
...@@ -714,6 +714,41 @@ Page({ ...@@ -714,6 +714,41 @@ Page({
result = Nyear + "-" + Nmonth + "-" + Ndate result = Nyear + "-" + Nmonth + "-" + Ndate
} }
return result; return result;
} },
down_sp:function(){
let VideoAddress = this.data.videoList[this.data.current].VideoAddress
wx.downloadFile({
url: VideoAddress, //仅为示例,并非真实的资源
success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
wx.playVoice({
filePath: res.tempFilePath
})
}
wx.saveVideoToPhotosAlbum({
filePath: res.tempFilePath,
success:
function (data) {
wx.showModal({
title: '下载成功',
content: '视频以保存至您的手机',
confirmText:'确定',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
})
}
})
},
}) })
\ No newline at end of file
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
<text class="btnBoxText">{{item.CommentNum}}</text> <text class="btnBoxText">{{item.CommentNum}}</text>
</view> </view>
<view class='btnTx'> <button class='btnTx' bindtap="down_sp">
<image style="width:69rpx;height:62rpx" src='../../images/index/fx.png'></image> <image style="width:69rpx;height:62rpx" src='../../images/index/fx.png'></image>
</view> </button>
<view class='btnTx' style="margin-top:20rpx"> <view class='btnTx' style="margin-top:20rpx">
<image style="width:69rpx;height:62rpx;marginTop:20rpx" src='../../images/index/sp.png'></image> <image style="width:69rpx;height:62rpx;marginTop:20rpx" src='../../images/index/sp.png'></image>
</view> </view>
......
...@@ -337,3 +337,6 @@ slider{ ...@@ -337,3 +337,6 @@ slider{
color: #111111; color: #111111;
padding-left:20rpx padding-left:20rpx
} }
button::after{
border: none
}
...@@ -688,5 +688,41 @@ Page({ ...@@ -688,5 +688,41 @@ Page({
} }
return result; return result;
} }
,
down_sp: function () {
let VideoAddress = this.data.videoList[this.data.current].VideoAddress
wx.downloadFile({
url: VideoAddress, //仅为示例,并非真实的资源
success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
wx.playVoice({
filePath: res.tempFilePath
})
}
wx.saveVideoToPhotosAlbum({
filePath: res.tempFilePath,
success:
function (data) {
wx.showModal({
title: '下载成功',
content: '视频以保存至您的手机',
confirmText: '确定',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
})
}
})
},
}) })
\ No newline at end of file
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
<text class="btnBoxText">{{item.CommentNum}}</text> <text class="btnBoxText">{{item.CommentNum}}</text>
</view> </view>
<view class='btnTx'> <button class='btnTx' bindtap="down_sp">
<image style="width:69rpx;height:62rpx" src='../../../images/index/fx.png'></image> <image style="width:69rpx;height:62rpx" src='../../../images/index/fx.png'></image>
</view> </button>
<view class='btnTx' style="margin-top:20rpx"> <view class='btnTx' style="margin-top:20rpx">
<image style="width:69rpx;height:62rpx;marginTop:20rpx" src='../../../images/index/sp.png'></image> <image style="width:69rpx;height:62rpx;marginTop:20rpx" src='../../../images/index/sp.png'></image>
</view> </view>
......
...@@ -347,4 +347,7 @@ slider{ ...@@ -347,4 +347,7 @@ slider{
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
} }
\ No newline at end of file button::after{
border: none
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment