fuliqi
2024-07-16 c4d0466cec9c334d9f0e74fe44576364a019aed3
src/views/meet/index.vue
@@ -1,33 +1,35 @@
<template>
  <div>
    <div style="display: flex; flex-direction: row">
      <div id="meet" ref="meet"/>
      <div style="padding: 5px">
        <el-row :gutter="5">
          <el-col :span="22">
            <el-input placeholder="搜索" size="small" clearable @input="getStudentList" @clear="getStudentList" v-model="searchForm.keyword"/>
          </el-col>
          <el-col :span="2">
            <el-button type="primary" size="small" @click="getStudentList">搜索</el-button>
          </el-col>
        </el-row>
        <el-row>
    <div style="display: flex; flex-direction: row;">
      <div id="meet" ref="meet" style="flex-grow: 1;">
      </div>
      <div style="padding-top: 5px; padding-left: 5px;right: 15px">
        <el-button type="success" size="small" @click="hiddenStudent" >{{getShowText()}}</el-button>
        <el-row v-show="showStudent">
          <el-row :gutter="5">
            <el-col :span="12">
              <el-input placeholder="搜索学员" size="small" clearable @input="getStudentList" @clear="getStudentList" v-model="searchForm.keyword"/>
            </el-col>
            <el-col :span="2">
              <el-button type="primary" size="small" @click="getStudentList">搜索</el-button>
            </el-col>
          </el-row>
          <el-tabs v-model="searchForm.onlineStatus" @tab-click="handleTabChange" style="margin-left: 3px">
            <el-tab-pane label="在线学员" name="1"></el-tab-pane>
            <el-tab-pane label="离线学员" name="0"></el-tab-pane>
          </el-tabs>
        </el-row>
        <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 :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-row>
      </div>
    </div>
@@ -37,10 +39,13 @@
<script>
import { getStudentList } from '@/api/meet'
let jitsiApi = null
export default {
  data () {
    return {
      jitsiApi: null,
      width: 0,
      height: 0,
      showStudent: true,
      intervalId: null,
      meetId: null,
      roomName: '',
@@ -55,6 +60,19 @@
    }
  },
  methods: {
    hiddenStudent () {
      this.showStudent = !this.showStudent
    },
    changeJitsiWindowSize (width, height) {
      this.jitsiApi.resizeLargeVideo(width, height)
    },
    getShowText () {
      if (this.showStudent) {
        return '隐藏'
      } else {
        return '显示'
      }
    },
    getStatus (status) {
      if (status === 1) {
        return '在线'
@@ -80,7 +98,7 @@
      })
    },
    getRoomInfo () {
      jitsiApi.getRoomsInfo().then(rooms => {
      this.jitsiApi.getRoomsInfo().then(rooms => {
        rooms.rooms.forEach(room => {
          // 房间的id是一个子域名,且@符前的会议名称是经过URL编码的
          let encodedPart = room.id.split('@')[0]
@@ -110,8 +128,7 @@
    }
  },
  mounted () {
    const width = window.innerWidth * 0.7
    const height = window.innerHeight
    this.height = window.innerHeight
    this.meetId = this.$route.query.meetId
    this.getStudentList()
    const domain = this.$route.query.domain
@@ -121,8 +138,7 @@
    const userInfo = userInfoStr ? JSON.parse(userInfoStr) : null
    const options = {
      roomName: roomName,
      width: width,
      height: height,
      height: this.height,
      parentNode: this.$refs.meet,
      lang: 'zh_CN',
      userInfo: userInfo,
@@ -137,9 +153,9 @@
      toolbarButtons: ['whiteboard']
    }
    jitsiApi = new window.JitsiMeetExternalAPI(domain, options)
    this.jitsiApi = new window.JitsiMeetExternalAPI(domain, options)
    jitsiApi.addListener('readyToClose', () => {
    this.jitsiApi.addListener('readyToClose', () => {
      window.close()
    })
    // 每三秒更学员在线状态
@@ -170,7 +186,7 @@
}
.studentWarp {
  display: flex;
  flex-display: row;
  flex-direction: row;
}
.student-row {
  margin-top: 8px;