<!-- 直播视频组件，用于邀请其他人与视频，by wuyang -->
<template>
	<div class="roomVideo">
		<ul class="list">
			<el-checkbox-group v-model="info.noticeUserIdList" class="checkList" @change="changeBu">
				<el-checkbox :label="item.userId" v-for="item in lvshiList" :key="item">{{item.userName}}</el-checkbox>
			</el-checkbox-group>
			<!-- <li v-for="item in lvshiList">{{item.userName}}</li> -->
			<el-button @click="yaoqing" slot="reference" class="ends">邀请</el-button>
		</ul>
	</div>
</template>

<script>
	import {
		getApi,
		postApi,
		getMessage
	} from "../../api/commonApi";
	export default {
		data() {
			return {
				url: '',
				visebe: false,
				lvshiList: [],
				checkList: [],
				info: {
					content: '',
					type: '1',
					createUser: localStorage.getItem('userId'),
					noticeUserIdList: []
				}
			};
		},
		props: ['add'],
		created() {

			this.getLawyerlist()
		},
		watch: {
			add() {
				// this.getList()
			}
		},
		mounted() {

		},
		methods: {
			getList() {
				let that = this;
				var iWidth = 1200; //弹出窗口的宽度;
				var iHeight = 800; //弹出窗口的高度;
				var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置;
				var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置;
				let newWin = window.open("about:blank","win_name", "height=" + iHeight + ", width=" + iWidth + ", top=" + iTop + ", left=" +
					iLeft);
				getApi('/system/fileinfo/roomUrl', {},
					function(data) {
						// window.open(data.url, "win_name", "height=" + iHeight + ", width=" + iWidth + ", top=" + iTop + ", left=" +iLeft)
						newWin.location.href = data.url
						that.url = data.url
					},
					function(data) {
						getMessage(data.msg, 'error')
					});
			},
			changeBu(val) {
				this.info.noticeUserIdList = val
			},
			yaoqing() {
				let that = this;
				var iWidth = 1200; //弹出窗口的宽度;
				var iHeight = 800; //弹出窗口的高度;
				var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置;
				var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置;
				let newWin = window.open("about:blank","win_name", "height=" + iHeight + ", width=" + iWidth + ", top=" + iTop + ", left=" +
					iLeft);
				getApi('/system/fileinfo/roomUrl', {},
					function(data) {
						// window.open(data.url, "win_name", "height=" + iHeight + ", width=" + iWidth + ", top=" + iTop + ", left=" +iLeft)
						newWin.location.href = data.url
						that.url = data.url
					that.$nextTick(function() {
								that.info.content = data.url
								postApi('/system/noticeInfo/generate', that.info,
									function(data) {
										getMessage('邀请成功', 'success')
										that.info.noticeUserIdList = []
										that.$emit('isClose', true)
									},
									function(data) {
										getMessage(data.msg, 'error')
										that.info.noticeUserIdList = []
										that.visebe = false
									});
							})
					},
					function(data) {
						getMessage(data.msg, 'error')
					});

			},
			//律师列表
			getLawyerlist() {
				let that = this;
				getApi("caseInfo/caseParty/list", {
					type: '3',
					status: '1', //本所
					companyId: localStorage.getItem('companyId'),
					// 					keyword: that.chooseName,
					// 					name: that.lvshiname
				}, function(data) {
					that.lvshiList = data.list
				}, function(data) {});

			},
		}
	}
</script>

<style scoped="scoped">
	@import 'roomVideo.css';
</style>
