| | |
| | | <el-tab-pane label="在线学员" name="1"></el-tab-pane> |
| | | <el-tab-pane label="离线学员" name="0"></el-tab-pane> |
| | | </el-tabs> |
| | | <el-row :gutter="20" v-for="student in showStudentList" :key="student.id" class="student-row"> |
| | | <el-col :span="18"> |
| | | <div> |
| | | {{ student.realName }} |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <div :class="{online: student.onlineStatus === 1, outline: student.onlineStatus === 0}"> |
| | | {{ getStatus(student.onlineStatus) }} |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="showStudentList" style="width: 100%"> |
| | | <el-table-column prop="realName" label="学员姓名"></el-table-column> |
| | | <el-table-column prop="id" label="操作" width="80px;"> |
| | | <template slot-scope="scope"> |
| | | <el-dropdown trigger="click" @command="handleCommand"> |
| | | <i class="el-icon-more-outline" id="more"></i> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <el-dropdown-item :command="{ command: 'openCamera', id: scope.row.id }">打开/关闭摄像头</el-dropdown-item> |
| | | <el-dropdown-item :command="{ command: 'mute', id: scope.row.id }">静音/取消静音</el-dropdown-item> |
| | | <el-dropdown-item :command="{ command: 'kickOut', id: scope.row.id }">踢出</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="onlineStatus" label="状态" width="80px;"> |
| | | <template slot-scope="scope"> |
| | | <div :class="{ online: scope.row.onlineStatus === 1, outline: scope.row.onlineStatus === 0 }"> |
| | | {{ getStatus(scope.row.onlineStatus) }} |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-button class="link-left" type="primary" size="small" @click="muteEveryone">全体静音</el-button> |
| | | <el-button class="link-left" type="primary" size="small" @click="videoEveryone">全体关闭摄像头</el-button> |
| | | </el-row> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | <script> |
| | | import { getStudentList } from '@/api/meet' |
| | | import Cookies from 'js-cookie' |
| | | |
| | | export default { |
| | | data () { |
| | | return { |
| | | ws: null, |
| | | jitsiApi: null, |
| | | width: 0, |
| | | height: 0, |
| | |
| | | showStudentList: [] |
| | | } |
| | | }, |
| | | beforeDestroy () { |
| | | if (this.ws) { |
| | | this.ws.close() |
| | | } |
| | | }, |
| | | methods: { |
| | | muteEveryone () { |
| | | this.jitsiApi.executeCommand('muteEveryone', 'audio') |
| | | const h = this.$createElement; |
| | | |
| | | this.$notify({ |
| | | title: '提示', |
| | | message: h('i', { style: 'color: teal'}, '已全体禁音') |
| | | }); |
| | | }, |
| | | videoEveryone () { |
| | | this.jitsiApi.executeCommand('muteEveryone', 'video') |
| | | const h = this.$createElement; |
| | | |
| | | this.$notify({ |
| | | title: '提示', |
| | | message: h('i', { style: 'color: teal'}, '已关闭全体视频') |
| | | }); |
| | | }, |
| | | handleCommand (command) { |
| | | this.sendMessage(JSON.stringify(command)) |
| | | }, |
| | | initWebSocket () { |
| | | this.ws = new WebSocket('wss://www.kgmeet.com:18080/websocket/' + JSON.parse(Cookies.get('adminUserInfo')).id) |
| | | let ws = this.ws |
| | | ws.onopen = () => { |
| | | console.log('WebSocket 连接成功') |
| | | // 发送心跳数据 |
| | | ws.send('ping') |
| | | } |
| | | ws.onmessage = (event) => { |
| | | console.log('收到服务器消息:', event.data) |
| | | // 处理服务器发来的消息 |
| | | } |
| | | ws.onerror = (error) => { |
| | | console.error('WebSocket 连接出错:', error) |
| | | } |
| | | ws.onclose = () => { |
| | | console.log('WebSocket 连接已关闭') |
| | | // 可以在这里尝试重新连接 |
| | | } |
| | | |
| | | // 组件销毁时断开 WebSocket 连接 |
| | | this.$once('hook:beforeDestroy', () => { |
| | | ws.close() |
| | | }) |
| | | }, |
| | | sendMessage (message) { |
| | | if (this.ws.readyState === WebSocket.OPEN) { |
| | | this.ws.send(message) |
| | | } else { |
| | | console.error('WebSocket 连接未打开') |
| | | } |
| | | }, |
| | | hiddenStudent () { |
| | | this.showStudent = !this.showStudent |
| | | }, |
| | |
| | | '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 |
| | |
| | | this.jitsiApi.addListener('readyToClose', () => { |
| | | window.close() |
| | | }) |
| | | // 初始化 |
| | | this.initWebSocket() |
| | | // 每三秒更学员在线状态 |
| | | this.intervalId = setInterval(() => { |
| | | this.getRoomInfo() |
| | | // 发送心跳数据 |
| | | this.ws.send('ping') |
| | | }, 2500) |
| | | |
| | | }, |
| | | beforeDestroy () { |
| | | // 清除定时器,避免内存泄漏 |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | /deep/ thead { |
| | | display: none; |
| | | } |
| | | |
| | | #more:hover { |
| | | cursor: pointer; |
| | | } |
| | | |
| | | #meet { |
| | | height: 100%; |
| | | } |