lsc 3 months ago
parent
commit
a1e5596186
1 changed files with 28 additions and 10 deletions
  1. 28 10
      src/views/Student/index.vue

+ 28 - 10
src/views/Student/index.vue

@@ -2290,6 +2290,10 @@ const toggleFollowMode = async () => {
         await api.updateCourseFollowC(slideIndex.value, props.courseid as string)
         console.log('设置当前幻灯片为跟随目标:', slideIndex.value)
       }
+      if (timerlVisible.value) {
+        timerlVisible.value = false
+      }
+      handleWritingBoardClose() 
     }
     else {
       message.error('操作失败,请重试')
@@ -2896,14 +2900,11 @@ const timerBlocks = () => {
   }
 }
 
-// 块可见性:< 60s 仅秒;< 1h 显示分秒;>=1h 显示时分秒
+// 块可见性:始终显示时分秒
 const timerBlocksVisibility = () => {
-  const total = timerIndicator.value.isCountdown
-    ? Math.max(timerIndicator.value.remainingSec || 0, 0)
-    : Math.max(timerIndicator.value.elapsedSec || 0, 0)
   return {
-    showH: total >= 3600,
-    showM: total >= 60,
+    showH: true,
+    showM: true,
   }
 }
 
@@ -2928,7 +2929,15 @@ const startLocalTick = (isCountdown: boolean) => {
   timerInterval.value = setInterval(() => {
     if (isCountdown) {
       if (timerIndicator.value.remainingSec !== null) {
-        timerIndicator.value.remainingSec = (timerIndicator.value.remainingSec as number) - 1
+        const newRemaining = (timerIndicator.value.remainingSec as number) - 1
+        timerIndicator.value.remainingSec = Math.max(newRemaining, 0)
+        // 时间到了,标记为完成但保持显示
+        if (newRemaining <= 0) {
+          timerIndicator.value.finished = true
+          timerIndicator.value.remainingSec = 0
+          // 保持 visible 为 true,不隐藏
+          timerIndicator.value.visible = true
+        }
       }
     }
     else {
@@ -3024,6 +3033,11 @@ const onTimerStop = () => {
 }
 const onTimerFinish = () => {
   timerIndicator.value.finished = true
+  // 保持 visible 为 true,时间到了也不消失
+  timerIndicator.value.visible = true
+  if (timerIndicator.value.isCountdown) {
+    timerIndicator.value.remainingSec = 0
+  }
   if (timerInterval.value) {
     clearInterval(timerInterval.value)
     timerInterval.value = null
@@ -3115,6 +3129,8 @@ const applyTimerStop = () => {
 }
 const applyTimerFinish = () => {
   timerIndicator.value.finished = true
+  // 保持 visible 为 true,时间到了也不消失
+  timerIndicator.value.visible = true
   if (timerIndicator.value.isCountdown) {
     timerIndicator.value.remainingSec = 0
   }
@@ -3193,6 +3209,8 @@ const applyTimerStateSnapshot = (snap: any) => {
     if (finished || (timerIndicator.value.remainingSec as number) <= 0) {
       timerIndicator.value.finished = true
       timerIndicator.value.remainingSec = 0
+      // 保持 visible 为 true,时间到了也不消失
+      timerIndicator.value.visible = true
       if (timerInterval.value) {
         clearInterval(timerInterval.value); timerInterval.value = null 
       }
@@ -3977,8 +3995,8 @@ const clearTimerState = () => {
     gap: 8px;
   }
   .block {
-    min-width: 36px;
-    height: 28px;
+    min-width: 45px;
+    height: 35px;
     padding: 0 8px;
     border-radius: 6px;
     background: #111;
@@ -3986,7 +4004,7 @@ const clearTimerState = () => {
     align-items: center;
     justify-content: center;
     font-weight: 700;
-    font-size: 16px;
+    font-size: 22px;
     letter-spacing: 1px;
   }
   .colon {