<template>
	<view class="shipin">
		    <web-view :src="url"></web-view>
	</view>
</template>

<script>
	// import EZUIKit from "../../../../static/ezuikit.js";
	//   var player = null;
	export default {
		data() {
			return {
				urls:'',
				width:'',
			}
		},
		onLoad(options) {
		    this.urls = options.companyOrgId;
	
		//	this.accessToken();
		//	this.width = uni.getSystemInfoSync().screenWidth;
		//  console.log('111111111111111111', uni.getSystemInfoSync().screenWidth)	 
		},
		 onShow() {
		        this.selectVideoValue();
		    },
		
		methods: {
			 selectVideoValue(){		 
				  var postdata ={
				                     'appKey': 'bf1fe258e25b4556af2889b53cf2d835',
				                     'appSecret': 'f814b3ce1653f7f909b6ccc358563fb3'
				                 };			  				  
				 uni.request({
				     url:'https://open.ys7.com/api/lapp/token/get',
				     method: "POST",
				     data: postdata,
				     header: {
				         'content-type': 'application/x-www-form-urlencoded',
				     },
				     success: (res) => {
				       //  console.log('111111111111111111',res.data.data.accessToken)
				 		
				// let that = this;
				 	this.url = "../../../../static/sp.html?url="+ this.urls+"&accessToken="+res.data.data.accessToken;
								 
				     }
				 });
				 
				 
					
				},
		
			
			
			accessToken(){
				
				 var postdata ={
				                    'appKey': 'bf1fe258e25b4556af2889b53cf2d835',
				                    'appSecret': 'f814b3ce1653f7f909b6ccc358563fb3'
				                };
				   console.log('111111111111111111',postdata)
				 
				uni.request({
				    url:'https://open.ys7.com/api/lapp/token/get',
				    method: "POST",
				    data: postdata,
				    header: {
				        'content-type': 'application/x-www-form-urlencoded',
				    },
				    success: (res) => {
				        console.log('111111111111111111',res.data.data.accessToken)
						
						 player = new EZUIKit.EZUIKitPlayer({
						                        id: 'video-container', // 视频容器ID
						                        accessToken: res.data.data.accessToken,
						                        url:this.urls,					                    
						                        template: 'simple',
						                        plugin: ['talk'], // 加载插件，talk-对讲
						                        width:this.width,
						                        height: 250,
						                        autoplay: true,
						                      //  decoderPath: EZUIKit,
						
						                    });
						                    window.player = player;
				
				    }
				});
				
				
				
			}
		},
		//监听页面卸载
				onUnload(){
					
				},
		
	}
</script>

<style>
.shipin{
	width: 750rpx;
	height: 100%;
}
 #video-container{
        width: 750rpx;
        height: 600rpx;
    }
</style>
