<template>
	<view class="content">
		<video :src="detail.url"></video>
		<view class="box">
			<view class="title">{{detail.title}}</view>
			<view class="time">{{detail.created_at}}</view>
			<view class="btn" @click="down">下载视频</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {
					
				}
			}
		},
		onLoad(options) {
			this.detail = JSON.parse(decodeURIComponent(options.data))
		},
		methods: {
			down() {
				uni.saveVideoToPhotosAlbum({
					filePath: this.detail.src,
					success: function () {
						console.log('save success');
					},
					fail: function(err) {
						console.log(err,'保存失败');
					}
				});
			},
			
		}
	}
</script>

<style lang="scss">
	.content {
		background: #FFFFFF;
		video {
			width: 100%;
		}
		.box {
			padding: 28rpx;
			.title {
				font-size: 32rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 600;
				color: #222222;
			}
			.time {
				font-size: 24rpx;
				font-family: SFPro, SFPro;
				font-weight: 400;
				color: #222222;
				padding: 20rpx 0 54rpx;
			}
			.btn {
				width: 694rpx;
				height: 84rpx;
				background: rgba(0, 176, 176, .1);
				border-radius: 38rpx;
				font-size: 32rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 500;
				color: #00B0B0;
				line-height: 84rpx;
				text-align: center;
			}
		}
	}
</style>