<template>
	<view class="videoLive">
	  <web-view v-if='src' :src="src"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token:'',
				id:'',
				src:'',
				userid:'',
				deviceId:'',
				cameraSerialNumber :'',
				cameraChannelNumber:'',
			}
		},
		onLoad(options) {
			if(options){
				this.cameraSerialNumber = options.cameraSerialNumber;
				this.cameraChannelNumber = options.cameraChannelNumber
			}
			let that = this
			uni.getStorage({
				key: 'token',
				success: function(res) {
					// console.log('res',res);
					that.token = res.data;
					uni.getStorage({
						key:'userid',
						success:function(res){
							that.userid = res.data
							// that.src = `https://portal.lihe-control.com/#/irrigateSet?id=${that.id}&token=${that.token}&userid=${that.userid}&deviceId=${that.deviceId}`
							that.src = `https://portal.lihe-control.com/#/videoLive?cameraSerialNumber=${that.cameraSerialNumber}&token=${that.token}&userid=${that.userid}&cameraChannelNumber=${that.cameraChannelNumber}`
							console.log(that.src,11);
						}
					})
				},
				fail:function(err){
					uni.navigateTo({
						url:'/pages/timeVideo/timeVideo'
					});
					uni.showToast({
						title: "跳转失败!",
						icon: 'fail',
					})
				}
			})
		},
		methods: {
			
		}
	}
</script>

<style>
.videoLive{
	width: 100%;
	min-height: 100vh;
	background-color: #F5F6FA;
	}
</style>
