<template>
|
<!-- <div ref="jitsiContainer" style="height: 100vh; width: 100%;"></div>-->
|
<div style="display: flex;height: calc(100vh - 84px);" >
|
<div id="meet" style="width: 65%;height: 100%;"></div>
|
<!-- <el-button @click="Connect">加入</el-button>-->
|
<!-- <div class="table-meet">-->
|
<!-- <el-form :model="queryParam" ref="queryForm" :inline="true">-->
|
<!-- <el-form-item label="用户名:">-->
|
<!-- <el-input v-model="queryParam.userName"></el-input>-->
|
<!-- </el-form-item>-->
|
<!-- <el-form-item>-->
|
<!-- <el-button type="primary" @click="submitForm">查询</el-button>-->
|
<!-- <el-button type="primary" @click="addMeeting">添加至会议</el-button>-->
|
<!-- <el-button type="primary" @click="delMeeting">清空</el-button>-->
|
<!-- </el-form-item>-->
|
<!-- </el-form>-->
|
|
<!-- <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%" @selection-change="handleSelectionChange">-->
|
<!-- <el-table-column-->
|
<!-- type="selection"-->
|
<!-- width="55">-->
|
<!-- </el-table-column>-->
|
<!-- <el-table-column prop="userName" label="用户名"/>-->
|
<!-- <el-table-column prop="realName" label="真实姓名" />-->
|
<!-- <el-table-column prop="userLevel" label="学级" :formatter="levelFormatter"/>-->
|
<!--<!– <el-table-column prop="sex" label="性别" width="60px;" :formatter="sexFormatter"/>–>-->
|
<!-- </el-table>-->
|
<!-- <pagination class="meet-pagin" v-show="total>0" :total="total" :page.sync="queryParam.pageIndex" :limit.sync="queryParam.pageSize"-->
|
<!-- @pagination="search"/>-->
|
<!-- </div>-->
|
</div>
|
|
</template>
|
|
<script>
|
import { JitsiMeet } from "@/utils/jitsi_meet";
|
import $ from 'jquery';
|
import Pagination from '@/components/Pagination/index.vue'
|
import userApi from '@/api/user'
|
import { mapGetters, mapState } from 'vuex'
|
window.$ = $;
|
export default {
|
components: { Pagination },
|
// props: {
|
// domain: {
|
// type: String,
|
// default: '124.222.18.104:8443'
|
// },
|
// options: {
|
// type: Object,
|
// default: () => ({}),
|
// },
|
// },
|
data () {
|
return {
|
multipleSelection:[],
|
userInfo:null,
|
queryParam: {
|
userName: '',
|
role: 1,
|
pageIndex: 1,
|
pageSize: 10
|
},
|
listLoading: true,
|
tableData: [],
|
total: 0,
|
|
jitsiApi: null,
|
userName:'张三',
|
roomName:'李四',
|
meet: {
|
clients: [],
|
},
|
};
|
},
|
async mounted () {
|
// this.search()
|
this.roomName = this.$route.query.roomName
|
await userApi.getCurrentUser().then(re => {
|
this.userInfo = re.response
|
// this.roomName = re.response.userName
|
this.userName = re.response.userName
|
console.log(this.userInfo, this.roomName, this.userName)
|
})
|
|
const domain = '101.35.247.188:8443';
|
const options = {
|
roomName: this.roomName,
|
width: '100%',
|
height: '100%',
|
lang: 'zh_CN',
|
parentNode: document.querySelector('#meet'),
|
userInfo: { displayName: this.userName }
|
};
|
// const connection = new JitsiMeetJS.JitsiConnection('123', null, options);
|
|
const api = new JitsiMeetExternalAPI(domain, options);
|
|
// this.meet = new JitsiMeet(
|
// //这里是服务端的XMPP地址
|
// "https://124.222.18.104:8443/http-bind",
|
// this.name
|
// );
|
api.addEventListeners({
|
participantJoined: handleParticipantJoined,
|
participantLeft: handleParticipantLeft
|
});
|
|
function handleParticipantJoined (event) {
|
console.log(`Participant joined: ${event.id}`);
|
console.log(event)
|
}
|
|
function handleParticipantLeft (event) {
|
console.log(`Participant left: ${event.id}`);
|
console.log(event)
|
}
|
|
// function onConnectionSuccess() {
|
// console.log("onConnectionSuccess", arguments);
|
// }
|
// function onConnectionFailed() {
|
// console.log("onConnectionFailed", arguments);
|
// }
|
// function disconnect() {
|
// console.log("disconnect", arguments);
|
// }
|
//
|
// connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
|
// connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
|
// connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect);
|
//
|
// connection.connect(undefined);
|
|
// this.loadScript(`https://${this.domain}/external_api.js`, () => {
|
// if (!window.JitsiMeetExternalAPI) throw new Error('Jitsi Meet External API not loaded');
|
// this.embedJitsiWidget();
|
// });
|
},
|
beforeDestroy () {
|
// this.Disconnect()
|
this.removeJitsiWidget();
|
|
},
|
computed: {
|
// ...mapGetters('enumItem', [
|
// 'enumFormat'
|
// ]),
|
// ...mapState('enumItem', {
|
// sexEnum: state => state.user.sexEnum,
|
// statusEnum: state => state.user.statusEnum,
|
// statusTag: state => state.user.statusTag,
|
// statusBtn: state => state.user.statusBtn,
|
// levelEnum: state => state.user.levelEnum
|
// })
|
},
|
created () {
|
let _this = this
|
|
|
},
|
methods: {
|
submitForm () {
|
this.queryParam.pageIndex = 1
|
this.search()
|
},
|
handleSelectionChange(val){
|
console.log(val)
|
this.multipleSelection = val;
|
},
|
addMeeting(){
|
//添加会议
|
let obj={}
|
let arr= []
|
this.multipleSelection.forEach(item=>{
|
arr.push(item.id)
|
})
|
obj.roomName=this.roomName
|
obj.stuIds = arr
|
userApi.addMeetin(obj).then(res=>{
|
console.log(res)
|
if (res.code ==1){
|
this.$message.success('添加成功')
|
}
|
})
|
|
},
|
delMeeting(){
|
// 清除会议
|
userApi.delMeetin().then(res=>{
|
console.log(res)
|
if (res.code==1){
|
this.$message.success('清除成功')
|
}
|
|
})
|
|
},
|
// search () {
|
// this.listLoading = true
|
// userApi.getUserPageList(this.queryParam).then(data => {
|
// const re = data.response
|
// this.tableData = re.list
|
// this.total = re.total
|
// this.queryParam.pageIndex = re.pageNum
|
// this.listLoading = false
|
// })
|
// },
|
levelFormatter (row, column, cellValue, index) {
|
return this.enumFormat(this.levelEnum, cellValue)
|
},
|
sexFormatter (row, column, cellValue, index) {
|
return this.enumFormat(this.sexEnum, cellValue)
|
},
|
statusFormatter (status) {
|
return this.enumFormat(this.statusEnum, status)
|
},
|
statusTagFormatter (status) {
|
return this.enumFormat(this.statusTag, status)
|
},
|
statusBtnFormatter (status) {
|
return this.enumFormat(this.statusBtn, status)
|
},
|
Connect() {
|
// 加入名称为xxx的房间(这一步会创建连接与房间对象)
|
this.meet.joinRoom("xxxx");
|
// this.beInRoom = true;
|
},
|
// Disconnect() {
|
// // 离开房间(这一步会断开连接)
|
// this.meet.leveRoom();
|
// // this.beInRoom = false;
|
// },
|
loadScript (src, cb) {
|
const scriptEl = document.createElement('script');
|
scriptEl.src = src;
|
scriptEl.async = 1;
|
document.querySelector('head').appendChild(scriptEl);
|
scriptEl.addEventListener('load', cb);
|
},
|
embedJitsiWidget () {
|
const options = {
|
...this.options,
|
parentNode: this.$refs.jitsiContainer,
|
};
|
this.jitsiApi = new window.JitsiMeetExternalAPI(this.domain, options);
|
},
|
executeCommand (command, ...value) {
|
this.jitsiApi.executeCommand(command, ...value);
|
},
|
addEventListener (event, fn) {
|
this.jitsiApi.on(event, fn);
|
},
|
// Misc
|
removeJitsiWidget () {
|
if (this.jitsiApi) this.jitsiApi.dispose();
|
},
|
}
|
};
|
</script>
|
<style scoped lang="scss">
|
.table-meet{
|
padding: 5px;
|
}
|
.meet-pagin{
|
position: absolute;
|
bottom: 5px;
|
}
|
</style>
|