<template>
	<view>
		<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">视频播放</block>
		</cu-custom>
		<iframe :src="pd.VIDEOURL" width="100%" height="380" allowfullscreen allow="autoplay; fullscreen" style="position: relative;border:none"/>
	</view>
</template>

<script>
  import { decryptAes } from "@/common/aesUtil";
	import {
		basePath,
		baseImgPath,
		corpinfoId,
      loginUser
	} from '@/common/tool.js';
	export default {
		data() {
			return {
				noClick: true,
				sTop:0,
				totalHeight:0,
				msg: 'add',
				listLoading: true,
				dialogForm: false,
				dialogImageUrl: '',
				dialogVisible: false,
				pd: [],
				list:[],
				add: true,
				del: true,
				edit: true,
				listQuery: {
					page: 1,
					limit: 10
				},
				movie: {
					'id': 0,
					'title': '视频名称',
					'src': '' //视频地址
				},
				total: 0,
				KEYWORDS: '',
				dates: [],
				dataFlag:'noData',
				varList: [],
				hideUpload: false,
				form: {
					VIDEOMANAGER_ID: '',
					VIDEONAME: '', //
					VIDEOURL: '',
					ISSHOW: ''
				}
			}
		},
		onLoad(e) {
			this.VIDEOMANAGER_ID = e.id;
			this.getData();
		},
		// filters: {
		// 	formatDate(time) {
		// 		time = time * 1
		// 		let date = new Date(time)
		// 		return formatDate(date, 'yyyy-MM-dd hh:mm')
		// 	}
		// },
		methods: {
			getData(path) {
				// uni.showLoading({
				// 	title: '请稍候'
				// })
				uni.request({
					url: basePath + '/app/videomanager/goEdit',
					method: 'POST',
					dataType: 'json',
					header: {
						'Content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						VIDEOMANAGER_ID: this.VIDEOMANAGER_ID
					},
					success: (res) => {
            res.data = decryptAes(res.data);
						console.log(res.data.pd)
						console.log(res.data.pd.VIDEOURL)
						this.pd = res.data.pd
						this.VIDEOURL = res.data.pd.VIDEOURL
						this.listLoading = false
					}
					})
				},

			ChooseImage() {
				var _this = this;
				uni.chooseImage({
					count: 4, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['camera', 'album'], //从相册选择
					success: (res) => {
						if (this.imgList.length != 0) {
							this.imgList = this.imgList.concat(res.tempFilePaths)
						} else {
							this.imgList = res.tempFilePaths
						}
					}
				});
			},
			ViewImage(e) {
				uni.previewImage({
					urls: this.imgList,
					current: e.currentTarget.dataset.url
				});
			},
			DelImg(e) {
				uni.showModal({
					title: '双控平台',
					content: '确定要删除这张图片吗？',
					cancelColor: "#000000",
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.imgList.splice(e.currentTarget.dataset.index, 1)
						}
					}
				})
			},


			changeDate(e) {
				this.RECTIFICATIONTIME = e.detail.value
			},
			radio(e) {
				this.ISQUALIFIED = e
			},
			ViewShowImage(e) {
				let files = [];
				for (var i = 0; i < this.files.length; i++) {
					files.push(baseImgPath + this.files[i].FILEPATH)
				}
				uni.previewImage({
					urls: files,
					current: e.currentTarget.dataset.index
				});
			},
			ViewShowImage2(e) {
				let files = [];
				for (var i = 0; i < this.files2.length; i++) {
					files.push(baseImgPath + this.files2[i].FILEPATH)
				}
				uni.previewImage({
					urls: files,
					current: e.currentTarget.dataset.index
				});
			},
			ViewShowImage3(e) {
				let files = [];
				for (var i = 0; i < this.files3.length; i++) {
					files.push(baseImgPath + this.files3[i].FILEPATH)
				}
				uni.previewImage({
					urls: files,
					current: e.currentTarget.dataset.index
				});
			},
			ViewShowImage4(e) {
				let files = [];
				for (var i = 0; i < this.files4.length; i++) {
					files.push(baseImgPath + this.files4[i].FILEPATH)
				}
				uni.previewImage({
					urls: files,
					current: e.currentTarget.dataset.index
				});
			},
			ViewShowImages(imgs, index) {
				let files = [];
				for (var i = 0; i < imgs.length; i++) {
					files.push(baseImgPath + imgs[i].FILEPATH)
				}
				uni.previewImage({
					urls: files,
					current: index
				});
			},
			goToOpen(e) {
				var url = e;
				plus.runtime.openURL(url, function(res) {
					console.log(res);
				});


				// uni.navigateTo({
				// 	url: '/pages/application/safety-production-account/organization-personnel/web-view?link=' + url
				// });
			},
		}
	}
</script>

<style>

</style>
