Browse Source

修改从督课出来后左侧滚动偶尔出现滚动条问题

mifei 2 months ago
parent
commit
9dc3ada95a
5 changed files with 1234 additions and 1210 deletions
  1. 1 1
      public/config.js
  2. 8 3
      src/assets/css/left.scss
  3. 2 1
      src/components/home.vue
  4. 67 49
      src/components/left.vue
  5. 1156 1156
      yarn.lock

+ 1 - 1
public/config.js

@@ -15,6 +15,6 @@ window.g = {
15
     // BASE_API: "http://192.168.4.219:12397/ioc-server",
15
     // BASE_API: "http://192.168.4.219:12397/ioc-server",
16
     // UE_IP: "http://192.168.4.159"
16
     // UE_IP: "http://192.168.4.159"
17
     // UE_IP: "http://127.0.0.1:80"
17
     // UE_IP: "http://127.0.0.1:80"
18
-    // UE_IP: "ws://192.168.4.152:81"
18
+    // UE_IP: "ws://192.168.4.148:88"
19
     UE_IP: "http://192.168.4.101:81/"
19
     UE_IP: "http://192.168.4.101:81/"
20
 };
20
 };

+ 8 - 3
src/assets/css/left.scss

@@ -411,13 +411,18 @@
411
                     line-height: 22px;
411
                     line-height: 22px;
412
 
412
 
413
                     .item-content-left {
413
                     .item-content-left {
414
-                        flex: 6;
415
-
414
+                        flex: 1;
415
+                        .position {
416
+                           width: 150px;
417
+                           white-space: nowrap;
418
+                           text-overflow: ellipsis;
419
+                           overflow: hidden;
420
+                        }
416
                     }
421
                     }
417
 
422
 
418
                     .item-content-right {
423
                     .item-content-right {
419
                         margin-left: 10px;
424
                         margin-left: 10px;
420
-                        flex: 7;
425
+                        flex: 1;
421
 
426
 
422
                         // margin-left: 20px;s
427
                         // margin-left: 20px;s
423
                         .person-rate-container {
428
                         .person-rate-container {

+ 2 - 1
src/components/home.vue

@@ -1,9 +1,10 @@
1
 <template>
1
 <template>
2
   <!-- <div class="container" > -->
2
   <!-- <div class="container" > -->
3
+
3
   <Header />
4
   <Header />
4
   <img class="bg-shadow" :src="bgShadow" alt="" srcset="">
5
   <img class="bg-shadow" :src="bgShadow" alt="" srcset="">
5
   <div v-show="isShowLeft">
6
   <div v-show="isShowLeft">
6
-    <Left ref="childRef" @childMethod="childMethod"></Left>
7
+    <Left ref="childRef" @childMethod="childMethod" :isShow='isShowLeft'></Left>
7
   </div>
8
   </div>
8
 
9
 
9
   <right v-if="isShowRight"></right>
10
   <right v-if="isShowRight"></right>

+ 67 - 49
src/components/left.vue

@@ -8,15 +8,15 @@
8
         <div id="myChart"></div>
8
         <div id="myChart"></div>
9
         <div class="list">
9
         <div class="list">
10
           <div class="item" v-for="(item, index) in classRoomCount" :key="index" :style="{
10
           <div class="item" v-for="(item, index) in classRoomCount" :key="index" :style="{
11
-            borderRight:
12
-              index == 0
13
-                ? '2px solid #0BF'
14
-                : index == 1
15
-                  ? '2px solid #00EB7D'
16
-                  : index == 2
17
-                    ? '2px solid #FB0'
18
-                    : '',
19
-          }">
11
+        borderRight:
12
+          index == 0
13
+            ? '2px solid #0BF'
14
+            : index == 1
15
+              ? '2px solid #00EB7D'
16
+              : index == 2
17
+                ? '2px solid #FB0'
18
+                : '',
19
+      }">
20
             <!-- <i :style="{ backgroundColor: item.color }"></i> -->
20
             <!-- <i :style="{ backgroundColor: item.color }"></i> -->
21
             <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"
21
             <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"
22
               v-if="index === 0">
22
               v-if="index === 0">
@@ -99,7 +99,7 @@
99
               <template #dropdown>
99
               <template #dropdown>
100
                 <el-dropdown-menu>
100
                 <el-dropdown-menu>
101
                   <el-dropdown-item :command="item.gis_building_code" v-for="(item, index) in buildings" :key="index">{{
101
                   <el-dropdown-item :command="item.gis_building_code" v-for="(item, index) in buildings" :key="index">{{
102
-                    item.building_name }}</el-dropdown-item>
102
+        item.building_name }}</el-dropdown-item>
103
                 </el-dropdown-menu>
103
                 </el-dropdown-menu>
104
               </template>
104
               </template>
105
             </el-dropdown>
105
             </el-dropdown>
@@ -113,7 +113,7 @@
113
               <template #dropdown>
113
               <template #dropdown>
114
                 <el-dropdown-menu>
114
                 <el-dropdown-menu>
115
                   <el-dropdown-item :command="item.category" v-for="(item, index) in categoryType" :key="index">{{
115
                   <el-dropdown-item :command="item.category" v-for="(item, index) in categoryType" :key="index">{{
116
-                    item.category }}</el-dropdown-item>
116
+        item.category }}</el-dropdown-item>
117
                 </el-dropdown-menu>
117
                 </el-dropdown-menu>
118
               </template>
118
               </template>
119
             </el-dropdown>
119
             </el-dropdown>
@@ -127,7 +127,7 @@
127
               <template #dropdown>
127
               <template #dropdown>
128
                 <el-dropdown-menu>
128
                 <el-dropdown-menu>
129
                   <el-dropdown-item :command="item.leaf" v-for="(item, index) in leafs" :key="index">{{ item.leaf_name
129
                   <el-dropdown-item :command="item.leaf" v-for="(item, index) in leafs" :key="index">{{ item.leaf_name
130
-                  }}</el-dropdown-item>
130
+                    }}</el-dropdown-item>
131
                 </el-dropdown-menu>
131
                 </el-dropdown-menu>
132
               </template>
132
               </template>
133
             </el-dropdown>
133
             </el-dropdown>
@@ -141,7 +141,7 @@
141
               <template #dropdown>
141
               <template #dropdown>
142
                 <el-dropdown-menu>
142
                 <el-dropdown-menu>
143
                   <el-dropdown-item :command="item.status_code" v-for="(item, index) in statuses" :key="index">{{
143
                   <el-dropdown-item :command="item.status_code" v-for="(item, index) in statuses" :key="index">{{
144
-                    item.status_name }}</el-dropdown-item>
144
+        item.status_name }}</el-dropdown-item>
145
                 </el-dropdown-menu>
145
                 </el-dropdown-menu>
146
               </template>
146
               </template>
147
             </el-dropdown>
147
             </el-dropdown>
@@ -154,12 +154,11 @@
154
           <!-- <div v-if="classRoomList.length > 0" style="width: 100%; height: 100%"> -->
154
           <!-- <div v-if="classRoomList.length > 0" style="width: 100%; height: 100%"> -->
155
           <div class="scroll-container" ref="scrollContainerRef">
155
           <div class="scroll-container" ref="scrollContainerRef">
156
             <div :style="{
156
             <div :style="{
157
-              height: scrollContainerHeight + 'px',
158
-              overflow: 'hidden',
159
-              paddingTop: '10px',
160
-            }" v-if="classRoomList.length > 0 && isShhow">
161
-              <vue-auto-scroll :data="classRoomList" :steep="0.5" scrollDirection="top" :isRoller="true"
162
-                :rollerScrollDistance="50">
157
+        height: scrollContainerHeight + 'px',
158
+        overflow: 'hidden',
159
+        paddingTop: '10px',
160
+      }" v-if="classRoomList.length > 0 && isShhow">
161
+              <vue-auto-scroll :steep="0.5" scrollDirection="top" :isRoller="true" :rollerScrollDistance="50">
163
                 <div class="li" v-for="(item, index) in classRoomList" :key="index">
162
                 <div class="li" v-for="(item, index) in classRoomList" :key="index">
164
                   <div class="list-item">
163
                   <div class="list-item">
165
                     <div class="class-status-btn-container">
164
                     <div class="class-status-btn-container">
@@ -176,7 +175,7 @@
176
 
175
 
177
                     <div class="item-content">
176
                     <div class="item-content">
178
                       <div class="item-content-left">
177
                       <div class="item-content-left">
179
-                        <div class="position">位置:{{ item.location }}</div>
178
+                        <div class="position" :title="item.location">位置:{{ item.location }}</div>
180
                         <div class="course" v-if="item.course_name">
179
                         <div class="course" v-if="item.course_name">
181
                           课程:{{ item.course_name }}
180
                           课程:{{ item.course_name }}
182
                         </div>
181
                         </div>
@@ -189,9 +188,9 @@
189
                           </div>
188
                           </div>
190
                           <div style="margin-left: 8px" v-if="item.actual != null">
189
                           <div style="margin-left: 8px" v-if="item.actual != null">
191
                             到课率:{{
190
                             到课率:{{
192
-                              (item.actual / item.expected).toFixed(2) * 100 ||
193
-                              0
194
-                            }}%
191
+        (item.actual / item.expected).toFixed(2) * 100 ||
192
+        0
193
+      }}%
195
                           </div>
194
                           </div>
196
                         </div>
195
                         </div>
197
                       </div>
196
                       </div>
@@ -228,8 +227,8 @@
228
     <div class="model-detail">
227
     <div class="model-detail">
229
       <span><span class="title">教室状态: </span>
228
       <span><span class="title">教室状态: </span>
230
         <span :class="classInfo.online ? 'green' : 'red'">{{
229
         <span :class="classInfo.online ? 'green' : 'red'">{{
231
-          classInfo && classInfo.status
232
-        }}</span>
230
+        classInfo && classInfo.status
231
+      }}</span>
233
       </span>
232
       </span>
234
 
233
 
235
       <span><span class="title">班级: </span>
234
       <span><span class="title">班级: </span>
@@ -265,6 +264,7 @@ import {
265
   nextTick,
264
   nextTick,
266
   getCurrentInstance,
265
   getCurrentInstance,
267
   computed,
266
   computed,
267
+  watch,
268
 } from "vue";
268
 } from "vue";
269
 import {
269
 import {
270
   ElScrollbar,
270
   ElScrollbar,
@@ -305,7 +305,25 @@ export default {
305
     Scroll,
305
     Scroll,
306
     ArrowDown,
306
     ArrowDown,
307
   },
307
   },
308
-  setup(_, { emit }) {
308
+  props: {
309
+    isShow: {
310
+      type: Boolean,
311
+      default: true,
312
+    },
313
+
314
+  },
315
+  setup(props, { emit }) {
316
+    watch(
317
+      () => props.isShow,
318
+      (newValue) => {
319
+        if (newValue) {
320
+          clearTimeoutTimer(); // 清除定时器
321
+          startTimeInterval();// 重新开始定时器
322
+        } else {
323
+          clearTimeoutTimer(); // 清除定时器
324
+        }
325
+      }
326
+    )
309
     // 教室分类统计
327
     // 教室分类统计
310
     const classRoomCount = ref([]);
328
     const classRoomCount = ref([]);
311
 
329
 
@@ -598,16 +616,16 @@ export default {
598
     let testMain = ref(null);
616
     let testMain = ref(null);
599
     let scrollContainerRef = ref(null);
617
     let scrollContainerRef = ref(null);
600
     let scrollContainerHeight = ref(null);
618
     let scrollContainerHeight = ref(null);
601
-    onMounted(() => {
602
-      getClassData();
603
-      //start();
604
-      // 获取教师下拉选择数据
605
-      getClassSelections();
606
-      //获取教室列表数据
607
-      getClassRoomList();
608
-      scrollContainerHeight.value = scrollContainerRef.value.clientHeight;
619
+    let setTimeoutTimerId = ref(null);
609
 
620
 
610
-      setInterval(() => {
621
+    const clearTimeoutTimer = () => {
622
+      if (setTimeoutTimerId.value) {
623
+        clearTimeout(setTimeoutTimerId.value);
624
+        setTimeoutTimerId.value = null; // 重置定时器 ID
625
+      }
626
+    };
627
+    const startTimeInterval = () => {
628
+      setTimeoutTimerId.value = setInterval(() => {
611
         getClassData();
629
         getClassData();
612
         //start();
630
         //start();
613
         // 获取教师下拉选择数据
631
         // 获取教师下拉选择数据
@@ -615,6 +633,20 @@ export default {
615
         //获取教室列表数据
633
         //获取教室列表数据
616
         getClassRoomList();
634
         getClassRoomList();
617
       }, 30000);
635
       }, 30000);
636
+    };
637
+    onMounted(() => {
638
+      getClassData();
639
+      // 获取教师下拉选择数据
640
+      getClassSelections();
641
+      //获取教室列表数据
642
+      getClassRoomList();
643
+      scrollContainerHeight.value = scrollContainerRef.value.clientHeight;
644
+
645
+      clearTimeoutTimer();//清除定时器
646
+      startTimeInterval();//开启定时器
647
+
648
+
649
+
618
     });
650
     });
619
 
651
 
620
     onBeforeUnmount(() => {
652
     onBeforeUnmount(() => {
@@ -627,19 +659,6 @@ export default {
627
     function testMove() {
659
     function testMove() {
628
       clearTimeout(timer.value);
660
       clearTimeout(timer.value);
629
     }
661
     }
630
-
631
-    function testMend() {
632
-      start();
633
-    }
634
-    //开启定时器方法
635
-    function start() {
636
-      //清除定时器
637
-      clearTimeout(timer.value);
638
-      //定时器触发周期
639
-      let speed = ref(75);
640
-      timer.value = setInterval(MarqueeTest, speed.value);
641
-      starttimeInterval()
642
-    }
643
     function MarqueeTest() {
662
     function MarqueeTest() {
644
       return;
663
       return;
645
       let test1 = testMain.value;
664
       let test1 = testMain.value;
@@ -787,7 +806,6 @@ export default {
787
       classRoom,
806
       classRoom,
788
       interDevice,
807
       interDevice,
789
       handleRoom,
808
       handleRoom,
790
-      testMend,
791
       testMove,
809
       testMove,
792
       testMain,
810
       testMain,
793
       popoverRef,
811
       popoverRef,

File diff suppressed because it is too large
+ 1156 - 1156
yarn.lock