| | |
| | | <el-row :gutter="5"> |
| | | <el-col :span="12"> |
| | | <el-input placeholder="搜索学员" size="small" clearable @input="getStudentList" @clear="getStudentList" |
| | | v-model="searchForm.keyword" /> |
| | | v-model="searchForm.keyword"/> |
| | | </el-col> |
| | | <el-col :span="2"> |
| | | <el-button type="primary" size="small" @click="getStudentList">搜索</el-button> |
| | |
| | | |
| | | <script> |
| | | import { getStudentList } from '@/api/meet' |
| | | |
| | | export default { |
| | | data() { |
| | | data () { |
| | | return { |
| | | ws: null, |
| | | jitsiApi: null, |
| | |
| | | showStudentList: [] |
| | | } |
| | | }, |
| | | beforeDestroy() { |
| | | beforeDestroy () { |
| | | if (this.ws) { |
| | | this.ws.close(); |
| | | this.ws.close() |
| | | } |
| | | }, |
| | | methods: { |
| | | muteEveryone() { |
| | | this.jitsiApi.executeCommand('muteEveryone', 'audio'); |
| | | muteEveryone () { |
| | | this.jitsiApi.executeCommand('muteEveryone', 'audio') |
| | | }, |
| | | videoEveryone() { |
| | | this.jitsiApi.executeCommand('muteEveryone', 'video'); |
| | | videoEveryone () { |
| | | this.jitsiApi.executeCommand('muteEveryone', 'video') |
| | | }, |
| | | handleCommand(command) { |
| | | handleCommand (command) { |
| | | this.sendMessage(JSON.stringify(command)) |
| | | }, |
| | | initWebSocket() { |
| | | this.ws = new WebSocket('ws://127.0.0.1:8000/websocket/' + 1); |
| | | let ws = this.ws; |
| | | initWebSocket () { |
| | | this.ws = new WebSocket('ws://127.0.0.1:8000/websocket/' + 1) |
| | | let ws = this.ws |
| | | ws.onopen = () => { |
| | | console.log('WebSocket 连接成功'); |
| | | console.log('WebSocket 连接成功') |
| | | // 发送心跳数据 |
| | | ws.send('ping'); |
| | | }; |
| | | ws.send('ping') |
| | | } |
| | | ws.onmessage = (event) => { |
| | | console.log('收到服务器消息:', event.data); |
| | | console.log('收到服务器消息:', event.data) |
| | | // 处理服务器发来的消息 |
| | | }; |
| | | } |
| | | ws.onerror = (error) => { |
| | | console.error('WebSocket 连接出错:', error); |
| | | }; |
| | | console.error('WebSocket 连接出错:', error) |
| | | } |
| | | ws.onclose = () => { |
| | | console.log('WebSocket 连接已关闭'); |
| | | console.log('WebSocket 连接已关闭') |
| | | // 可以在这里尝试重新连接 |
| | | }; |
| | | } |
| | | |
| | | // 组件销毁时断开 WebSocket 连接 |
| | | this.$once('hook:beforeDestroy', () => { |
| | | ws.close(); |
| | | }); |
| | | ws.close() |
| | | }) |
| | | }, |
| | | sendMessage(message) { |
| | | sendMessage (message) { |
| | | if (this.ws.readyState === WebSocket.OPEN) { |
| | | this.ws.send(message); |
| | | this.ws.send(message) |
| | | } else { |
| | | console.error('WebSocket 连接未打开'); |
| | | console.error('WebSocket 连接未打开') |
| | | } |
| | | }, |
| | | hiddenStudent() { |
| | | hiddenStudent () { |
| | | this.showStudent = !this.showStudent |
| | | }, |
| | | changeJitsiWindowSize(width, height) { |
| | | changeJitsiWindowSize (width, height) { |
| | | this.jitsiApi.resizeLargeVideo(width, height) |
| | | }, |
| | | getShowText() { |
| | | getShowText () { |
| | | if (this.showStudent) { |
| | | return '隐藏' |
| | | } else { |
| | | return '显示' |
| | | } |
| | | }, |
| | | getStatus(status) { |
| | | getStatus (status) { |
| | | if (status === 1) { |
| | | return '在线' |
| | | } else if (status === 0) { |
| | | return '离线' |
| | | } |
| | | }, |
| | | handleTabChange(tab) { |
| | | handleTabChange (tab) { |
| | | let status = parseInt(tab.name) |
| | | this.showStudentList = this.studentList.filter(student => { |
| | | return student.onlineStatus === status |
| | | }) |
| | | }, |
| | | getStudentList() { |
| | | getStudentList () { |
| | | let params = { |
| | | keyword: this.searchForm.keyword |
| | | } |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | getRoomInfo() { |
| | | getRoomInfo () { |
| | | this.jitsiApi.getRoomsInfo().then(rooms => { |
| | | rooms.rooms.forEach(room => { |
| | | // 房间的id是一个子域名,且@符前的会议名称是经过URL编码的 |
| | |
| | | }) |
| | | } |
| | | }, |
| | | mounted() { |
| | | mounted () { |
| | | this.height = window.innerHeight |
| | | this.meetId = this.$route.query.meetId |
| | | this.getStudentList() |
| | |
| | | 'camera', |
| | | // 聊天 |
| | | 'chat', |
| | | // 'closedcaptions', |
| | | // 共享 |
| | | 'desktop', |
| | | 'download', |
| | | // 'embedmeeting', |
| | | // 'etherpad', |
| | | // 'feedback', |
| | | // 'filmstrip', |
| | | 'fullscreen', |
| | | 'hangup', |
| | | // 'help', |
| | |
| | | 'livestreaming', |
| | | 'microphone', |
| | | 'noisesuppression', |
| | | // 'participants-pane', |
| | | // 'profile', |
| | | // 'raisehand', |
| | | 'recording', |
| | | // 'security', |
| | | 'select-background', |
| | | 'settings', |
| | | 'shareaudio', |
| | |
| | | 'stats', |
| | | 'tileview', |
| | | 'toggle-camera', |
| | | // 'videoquality', |
| | | 'whiteboard' |
| | | 'whiteboard', |
| | | |
| | | // 'closedcaptions', |
| | | // 'embedmeeting', |
| | | // 'etherpad', |
| | | // 'feedback', |
| | | // 'filmstrip', |
| | | 'participants-pane', |
| | | // 'profile', |
| | | 'raisehand', |
| | | // 'security', |
| | | 'videoquality', |
| | | ], |
| | | whiteboard: { |
| | | enabled: true |
| | |
| | | }, 2500) |
| | | |
| | | // 初始化 |
| | | this.initWebSocket(); |
| | | this.initWebSocket() |
| | | }, |
| | | beforeDestroy() { |
| | | beforeDestroy () { |
| | | // 清除定时器,避免内存泄漏 |
| | | if (this.intervalId) { |
| | | clearInterval(this.intervalId) |