瀏覽代碼

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

mifei 2 月之前
父節點
當前提交
9dc3ada95a
共有 5 個文件被更改,包括 1234 次插入1210 次删除
  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 15
     // BASE_API: "http://192.168.4.219:12397/ioc-server",
16 16
     // UE_IP: "http://192.168.4.159"
17 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 19
     UE_IP: "http://192.168.4.101:81/"
20 20
 };

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

@@ -411,13 +411,18 @@
411 411
                     line-height: 22px;
412 412
 
413 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 423
                     .item-content-right {
419 424
                         margin-left: 10px;
420
-                        flex: 7;
425
+                        flex: 1;
421 426
 
422 427
                         // margin-left: 20px;s
423 428
                         .person-rate-container {

+ 2 - 1
src/components/home.vue

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

+ 67 - 49
src/components/left.vue

@@ -8,15 +8,15 @@
8 8
         <div id="myChart"></div>
9 9
         <div class="list">
10 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 20
             <!-- <i :style="{ backgroundColor: item.color }"></i> -->
21 21
             <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"
22 22
               v-if="index === 0">
@@ -99,7 +99,7 @@
99 99
               <template #dropdown>
100 100
                 <el-dropdown-menu>
101 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 103
                 </el-dropdown-menu>
104 104
               </template>
105 105
             </el-dropdown>
@@ -113,7 +113,7 @@
113 113
               <template #dropdown>
114 114
                 <el-dropdown-menu>
115 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 117
                 </el-dropdown-menu>
118 118
               </template>
119 119
             </el-dropdown>
@@ -127,7 +127,7 @@
127 127
               <template #dropdown>
128 128
                 <el-dropdown-menu>
129 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 131
                 </el-dropdown-menu>
132 132
               </template>
133 133
             </el-dropdown>
@@ -141,7 +141,7 @@
141 141
               <template #dropdown>
142 142
                 <el-dropdown-menu>
143 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 145
                 </el-dropdown-menu>
146 146
               </template>
147 147
             </el-dropdown>
@@ -154,12 +154,11 @@
154 154
           <!-- <div v-if="classRoomList.length > 0" style="width: 100%; height: 100%"> -->
155 155
           <div class="scroll-container" ref="scrollContainerRef">
156 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 162
                 <div class="li" v-for="(item, index) in classRoomList" :key="index">
164 163
                   <div class="list-item">
165 164
                     <div class="class-status-btn-container">
@@ -176,7 +175,7 @@
176 175
 
177 176
                     <div class="item-content">
178 177
                       <div class="item-content-left">
179
-                        <div class="position">位置:{{ item.location }}</div>
178
+                        <div class="position" :title="item.location">位置:{{ item.location }}</div>
180 179
                         <div class="course" v-if="item.course_name">
181 180
                           课程:{{ item.course_name }}
182 181
                         </div>
@@ -189,9 +188,9 @@
189 188
                           </div>
190 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 194
                           </div>
196 195
                         </div>
197 196
                       </div>
@@ -228,8 +227,8 @@
228 227
     <div class="model-detail">
229 228
       <span><span class="title">教室状态: </span>
230 229
         <span :class="classInfo.online ? 'green' : 'red'">{{
231
-          classInfo && classInfo.status
232
-        }}</span>
230
+        classInfo && classInfo.status
231
+      }}</span>
233 232
       </span>
234 233
 
235 234
       <span><span class="title">班级: </span>
@@ -265,6 +264,7 @@ import {
265 264
   nextTick,
266 265
   getCurrentInstance,
267 266
   computed,
267
+  watch,
268 268
 } from "vue";
269 269
 import {
270 270
   ElScrollbar,
@@ -305,7 +305,25 @@ export default {
305 305
     Scroll,
306 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 328
     const classRoomCount = ref([]);
311 329
 
@@ -598,16 +616,16 @@ export default {
598 616
     let testMain = ref(null);
599 617
     let scrollContainerRef = ref(null);
600 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 629
         getClassData();
612 630
         //start();
613 631
         // 获取教师下拉选择数据
@@ -615,6 +633,20 @@ export default {
615 633
         //获取教室列表数据
616 634
         getClassRoomList();
617 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 652
     onBeforeUnmount(() => {
@@ -627,19 +659,6 @@ export default {
627 659
     function testMove() {
628 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 662
     function MarqueeTest() {
644 663
       return;
645 664
       let test1 = testMain.value;
@@ -787,7 +806,6 @@ export default {
787 806
       classRoom,
788 807
       interDevice,
789 808
       handleRoom,
790
-      testMend,
791 809
       testMove,
792 810
       testMain,
793 811
       popoverRef,

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