From e9c4997aa45f64643e3026ac3845fc86d2793680 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 12 七月 2024 14:20:46 +0800
Subject: [PATCH] 显示隐藏在线情况

---
 src/views/meet/index.vue |   91 +++++++++++++++++++++++++--------------------
 1 files changed, 50 insertions(+), 41 deletions(-)

diff --git a/src/views/meet/index.vue b/src/views/meet/index.vue
index 01f3959..d66df30 100644
--- a/src/views/meet/index.vue
+++ b/src/views/meet/index.vue
@@ -1,33 +1,34 @@
 <template>
   <div>
-    <div style="display: flex; flex-direction: row">
+    <div style="display: flex; flex-direction: row; position: relative">
       <div id="meet" ref="meet"/>
-      <div style="padding: 5px">
-        <el-row :gutter="5">
-          <el-col :span="22">
-            <el-input placeholder="鎼滅储" size="small" v-model="searchForm.keyword"/>
-          </el-col>
-          <el-col :span="2">
-            <el-button type="primary" size="small" @click="getRoomInfo">鎼滅储</el-button>
-          </el-col>
-        </el-row>
-        <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>
+      <div style="padding: 5px;position: absolute;right: 0">
+        <el-button type="primary" size="small" @click="showStudent = ! showStudent" style="float: right">{{getShowText()}}</el-button>
+        <el-row v-show="showStudent">
+          <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-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 :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>
         </el-row>
       </div>
     </div>
@@ -39,8 +40,9 @@
 
 let jitsiApi = null
 export default {
-  data() {
+  data () {
     return {
+      showStudent: true,
       intervalId: null,
       meetId: null,
       roomName: '',
@@ -48,21 +50,28 @@
       searchForm: {
         keyword: '',
         // 0 鏈湪绾裤�� 1 鍦ㄧ嚎
-        onlineStatus: 0,
+        onlineStatus: 0
       },
       studentList: [],
-      showStudentList: [],
+      showStudentList: []
     }
   },
   methods: {
-    getStatus(status) {
-      if (status === 1) {
-        return "鍦ㄧ嚎"
-      } else if (status === 0) {
-        return "绂荤嚎"
+    getShowText() {
+      if (this.showStudent) {
+        return '闅愯棌鍦ㄧ嚎鎯呭喌'
+      } else {
+        return '灞曠ず鍦ㄧ嚎鎯呭喌'
       }
     },
-    handleTabChange(tab) {
+    getStatus (status) {
+      if (status === 1) {
+        return '鍦ㄧ嚎'
+      } else if (status === 0) {
+        return '绂荤嚎'
+      }
+    },
+    handleTabChange (tab) {
       let status = parseInt(tab.name)
       this.showStudentList = this.studentList.filter(student => {
         return student.onlineStatus === status
@@ -70,12 +79,12 @@
     },
     getStudentList () {
       let params = {
-        keyword: this.keyword
+        keyword: this.searchForm.keyword
       }
       getStudentList(this.meetId, params).then(res => {
         this.studentList = res.data.data
         this.showStudentList = this.studentList.filter(student => {
-          return student.onlineStatus === 0
+          return student.onlineStatus === this.searchForm.onlineStatus
         })
       })
     },
@@ -110,7 +119,7 @@
     }
   },
   mounted () {
-    const width = window.innerWidth * 0.7
+    const width = window.innerWidth * 0.8
     const height = window.innerHeight
     this.meetId = this.$route.query.meetId
     this.getStudentList()
@@ -145,7 +154,7 @@
     // 姣忎笁绉掓洿瀛﹀憳鍦ㄧ嚎鐘舵��
     this.intervalId = setInterval(() => {
       this.getRoomInfo()
-    }, 3000)
+    }, 2500)
   },
   beforeDestroy () {
     // 娓呴櫎瀹氭椂鍣紝閬垮厤鍐呭瓨娉勬紡
@@ -170,7 +179,7 @@
 }
 .studentWarp {
   display: flex;
-  flex-display: row;
+  flex-direction: row;
 }
 .student-row {
   margin-top: 8px;

--
Gitblit v1.8.0