Browse Source

refactor(Student): 移除作业检查框及相关功能代码

移除不再使用的作业检查框UI组件及相关处理函数,简化代码结构
lsc 1 week ago
parent
commit
6e6709f9cc
2 changed files with 76 additions and 76 deletions
  1. 7 69
      src/views/Student/index.vue
  2. 69 7
      src/views/Student/index2_copy.vue

+ 7 - 69
src/views/Student/index.vue

@@ -78,16 +78,6 @@
           left: isFullscreen ? '0' : `${(containerWidth - slideWidth * canvasScale) / 2}px`,
           top: isFullscreen ? '0' : `${(containerHeight - slideHeight * canvasScale) / 2}px`
         }" @mousemove="handleLaserMove">
-          <div class="homework-check-box" v-if="currentSlideHasIframe && !currentSlideHasBilibiliVideo" v-show="currentSlideHasIframe" :style="{
-            top: isFullscreen ? '0' : `15px`
-          }">
-            <div class="homework-check-box-item" @click="openChoiceQuestionDetail2(slideIndex)" :class="{'active': !choiceQuestionDetailDialogOpenList.includes(slideIndex)}">
-              <div class="homework-check-box-item-title">{{ lang.ssQuestion }}</div>
-            </div>
-            <div class="homework-check-box-item" @click="openChoiceQuestionDetail3(slideIndex)" :class="{'active': choiceQuestionDetailDialogOpenList.includes(slideIndex)}">
-              <div class="homework-check-box-item-title">{{ lang.ssAnswer }}</div>
-            </div>
-          </div>
           <div class="viewport" v-if="false">
             <div class="background" :style="backgroundStyle"></div>
 
@@ -99,7 +89,7 @@
           <ScreenSlideList :style="{ width: isFullscreen ? '100%' : slideWidth2 * canvasScale + 'px', height: isFullscreen ? '100%' : slideHeight2 * canvasScale + 'px', margin: '0 auto' }" :slideWidth="isFullscreen ? slideWidth * canvasScale : slideWidth2 * canvasScale" :slideHeight="isFullscreen ? slideHeight * canvasScale : slideHeight2 * canvasScale"
             :animationIndex="0" :turnSlideToId="() => { }" :manualExitFullscreen="() => { }"  :slideIndex="slideIndex" v-show="!choiceQuestionDetailDialogOpenList.includes(slideIndex)"/>
 
-          <choiceQuestionDetailDialog v-if="choiceQuestionDetailDialogOpenList.includes(slideIndex)"  :userId="props.userid" :courseDetail="courseDetail" :workArray="workArray" @changeWorkIndex="changeWorkIndex" v-model:visible="choiceQuestionDetailDialogOpenList" :showData="answerTheResultRef" :slideIndex="slideIndex" :workIndex="0" :style="{ width: isFullscreen ? '100%' : slideWidth2 * canvasScale + 'px', height: isFullscreen ? '100%' : slideHeight2 * canvasScale + 'px', margin: '0 auto' }" :slideWidth="isFullscreen ? slideWidth * canvasScale : slideWidth2 * canvasScale" :slideHeight="isFullscreen ? slideHeight * canvasScale : slideHeight2 * canvasScale"/>
+          <choiceQuestionDetailDialog v-if="choiceQuestionDetailDialogOpenList.includes(slideIndex)" :userId="props.userid" :courseDetail="courseDetail" :workArray="workArray" @changeWorkIndex="changeWorkIndex" v-model:visible="choiceQuestionDetailDialogOpenList" :showData="answerTheResultRef" :slideIndex="slideIndex" :workIndex="0" :style="{ width: isFullscreen ? '100%' : slideWidth2 * canvasScale + 'px', height: isFullscreen ? '100%' : slideHeight2 * canvasScale + 'px', margin: '0 auto' }" :slideWidth="isFullscreen ? slideWidth * canvasScale : slideWidth2 * canvasScale" :slideHeight="isFullscreen ? slideHeight * canvasScale : slideHeight2 * canvasScale"/>
 
 
           <div class="slide-bottom" v-if="!isFullscreen">
@@ -120,8 +110,7 @@
                 <IconLoading v-else-if="currentSlideHasIframe && !currentSlideHasBilibiliVideo" class="tool-btn loading" v-tooltip="lang.ssSubmitting"></IconLoading>
                 <IconStopwatchStart v-if="props.type == '1' && courseDetail.userid == props.userid && isFollowModeActive" class="tool-btn" v-tooltip="lang.ssTimer" @click="timerlVisible = !timerlVisible"  />
                 <IconWrite v-if="isFollowModeActive && props.type == '1' && courseDetail.userid == props.userid" class="tool-btn" v-tooltip="lang.ssPenTool" @click="writingBoardToolVisible = true"  />
-                <!-- <IconMagic v-if="isFollowModeActive && props.type == '1' && courseDetail.userid == props.userid" class="tool-btn" v-tooltip="lang.ssLaserPen" :class="{ 'active': laserPen }" @click="toggleLaserPen"  /> -->
-                <IconTips v-if="props.type == '1'" class="tool-btn" v-tooltip="lang.ssAiHelper" :class="{ 'active': !workPanelCollapsed }" @click="workPanelCollapsed = !workPanelCollapsed"  />
+                <IconMagic v-if="isFollowModeActive && props.type == '1' && courseDetail.userid == props.userid" class="tool-btn" v-tooltip="lang.ssLaserPen" :class="{ 'active': laserPen }" @click="toggleLaserPen"  />
                 <IconFullScreenOne class="tool-btn" v-tooltip="lang.ssOpenFull" @click="enterFullscreen" />
               </div>
           </div>
@@ -205,7 +194,7 @@
           </button>
           <!-- 标签页切换按钮 -->
           <div v-show="!workPanelCollapsed" class="tab-switcher">
-            <!-- <button 
+            <button 
               v-if="currentSlideHasIframe && !currentSlideHasBilibiliVideo"
               v-show="currentSlideHasIframe"
               class="tab-btn" 
@@ -214,7 +203,7 @@
               :title="lang.ssAnswerRes"
             >
               {{ lang.ssAnswerRes }}
-            </button> -->
+            </button>
             <button 
               class="tab-btn" 
               :class="{ active: rightPanelMode === 'dialogue' }"
@@ -660,9 +649,9 @@ const autoSwitchToAvailablePanel = () => {
     rightPanelMode.value = 'dialogue'
     console.log('自动切换到对话面板')
   }
-  // else if (currentSlideHasIframe.value && rightPanelMode.value !== 'homework' && !currentSlideHasBilibiliVideo.value) {
-  //   rightPanelMode.value = 'homework'
-  // }
+  else if (currentSlideHasIframe.value && rightPanelMode.value !== 'homework' && !currentSlideHasBilibiliVideo.value) {
+    rightPanelMode.value = 'homework'
+  }
 }
 
 // 移除定时器相关函数,改用socket监听
@@ -3230,24 +3219,6 @@ const openChoiceQuestionDetail = (index:number) => {
   }
 }
 
-// 打开作业查看详细
-const openChoiceQuestionDetail2 = (index:number) => {
-  if (!choiceQuestionDetailDialogOpenList.value.includes(index)) {
-  }
-  else {
-    choiceQuestionDetailDialogOpenList.value = choiceQuestionDetailDialogOpenList.value.filter(i => i !== index)
-  }
-}
-
-
-// 打开作业查看详细
-const openChoiceQuestionDetail3 = (index:number) => {
-  if (!choiceQuestionDetailDialogOpenList.value.includes(index)) {
-    choiceQuestionDetailDialogOpenList.value.push(index)
-  }
-}
-
-
 const handlePageUnload = () => {
   if (isCreator.value && timerIndicator.value.visible && props.type === '1') {
     sendMessage({ type: 'timer_stop', courseid: props.courseid })
@@ -5291,37 +5262,4 @@ const clearTimerState = () => {
     }
   }
 }
-
-.homework-check-box {
-  position: absolute;
-  top: 15px;
-  left: 50%;
-  transform: translate(-50%, 0);
-  display: flex;
-  align-items: center;
-  box-shadow: 0px 3px 4px 3px #f2f2f2;
-  padding: 8px;
-  border-radius: 5px;
-  background: #fff;
-  z-index: 999;
-
-  .homework-check-box-item{
-    padding: 10px 18px;
-    border-radius: 5px;
-    font-weight: 600;
-    cursor: pointer;
-    transition: all 0.3s ease;
-
-    &.active{
-      background: #f6c82b;
-    }
-    
-    &:hover{
-      background: #fff;
-      color: #f6c82b;
-    }
-  }
-
-  .homework-check-box-item-title{}
-}
 </style>

+ 69 - 7
src/views/Student/index2.vue → src/views/Student/index2_copy.vue

@@ -78,6 +78,16 @@
           left: isFullscreen ? '0' : `${(containerWidth - slideWidth * canvasScale) / 2}px`,
           top: isFullscreen ? '0' : `${(containerHeight - slideHeight * canvasScale) / 2}px`
         }" @mousemove="handleLaserMove">
+          <div class="homework-check-box" v-if="currentSlideHasIframe && !currentSlideHasBilibiliVideo" v-show="currentSlideHasIframe" :style="{
+            top: isFullscreen ? '0' : `15px`
+          }">
+            <div class="homework-check-box-item" @click="openChoiceQuestionDetail2(slideIndex)" :class="{'active': !choiceQuestionDetailDialogOpenList.includes(slideIndex)}">
+              <div class="homework-check-box-item-title">{{ lang.ssQuestion }}</div>
+            </div>
+            <div class="homework-check-box-item" @click="openChoiceQuestionDetail3(slideIndex)" :class="{'active': choiceQuestionDetailDialogOpenList.includes(slideIndex)}">
+              <div class="homework-check-box-item-title">{{ lang.ssAnswer }}</div>
+            </div>
+          </div>
           <div class="viewport" v-if="false">
             <div class="background" :style="backgroundStyle"></div>
 
@@ -89,7 +99,7 @@
           <ScreenSlideList :style="{ width: isFullscreen ? '100%' : slideWidth2 * canvasScale + 'px', height: isFullscreen ? '100%' : slideHeight2 * canvasScale + 'px', margin: '0 auto' }" :slideWidth="isFullscreen ? slideWidth * canvasScale : slideWidth2 * canvasScale" :slideHeight="isFullscreen ? slideHeight * canvasScale : slideHeight2 * canvasScale"
             :animationIndex="0" :turnSlideToId="() => { }" :manualExitFullscreen="() => { }"  :slideIndex="slideIndex" v-show="!choiceQuestionDetailDialogOpenList.includes(slideIndex)"/>
 
-          <choiceQuestionDetailDialog v-if="choiceQuestionDetailDialogOpenList.includes(slideIndex)" :userId="props.userid" :courseDetail="courseDetail" :workArray="workArray" @changeWorkIndex="changeWorkIndex" v-model:visible="choiceQuestionDetailDialogOpenList" :showData="answerTheResultRef" :slideIndex="slideIndex" :workIndex="0" :style="{ width: isFullscreen ? '100%' : slideWidth2 * canvasScale + 'px', height: isFullscreen ? '100%' : slideHeight2 * canvasScale + 'px', margin: '0 auto' }" :slideWidth="isFullscreen ? slideWidth * canvasScale : slideWidth2 * canvasScale" :slideHeight="isFullscreen ? slideHeight * canvasScale : slideHeight2 * canvasScale"/>
+          <choiceQuestionDetailDialog v-if="choiceQuestionDetailDialogOpenList.includes(slideIndex)"  :userId="props.userid" :courseDetail="courseDetail" :workArray="workArray" @changeWorkIndex="changeWorkIndex" v-model:visible="choiceQuestionDetailDialogOpenList" :showData="answerTheResultRef" :slideIndex="slideIndex" :workIndex="0" :style="{ width: isFullscreen ? '100%' : slideWidth2 * canvasScale + 'px', height: isFullscreen ? '100%' : slideHeight2 * canvasScale + 'px', margin: '0 auto' }" :slideWidth="isFullscreen ? slideWidth * canvasScale : slideWidth2 * canvasScale" :slideHeight="isFullscreen ? slideHeight * canvasScale : slideHeight2 * canvasScale"/>
 
 
           <div class="slide-bottom" v-if="!isFullscreen">
@@ -110,7 +120,8 @@
                 <IconLoading v-else-if="currentSlideHasIframe && !currentSlideHasBilibiliVideo" class="tool-btn loading" v-tooltip="lang.ssSubmitting"></IconLoading>
                 <IconStopwatchStart v-if="props.type == '1' && courseDetail.userid == props.userid && isFollowModeActive" class="tool-btn" v-tooltip="lang.ssTimer" @click="timerlVisible = !timerlVisible"  />
                 <IconWrite v-if="isFollowModeActive && props.type == '1' && courseDetail.userid == props.userid" class="tool-btn" v-tooltip="lang.ssPenTool" @click="writingBoardToolVisible = true"  />
-                <IconMagic v-if="isFollowModeActive && props.type == '1' && courseDetail.userid == props.userid" class="tool-btn" v-tooltip="lang.ssLaserPen" :class="{ 'active': laserPen }" @click="toggleLaserPen"  />
+                <!-- <IconMagic v-if="isFollowModeActive && props.type == '1' && courseDetail.userid == props.userid" class="tool-btn" v-tooltip="lang.ssLaserPen" :class="{ 'active': laserPen }" @click="toggleLaserPen"  /> -->
+                <IconTips v-if="props.type == '1'" class="tool-btn" v-tooltip="lang.ssAiHelper" :class="{ 'active': !workPanelCollapsed }" @click="workPanelCollapsed = !workPanelCollapsed"  />
                 <IconFullScreenOne class="tool-btn" v-tooltip="lang.ssOpenFull" @click="enterFullscreen" />
               </div>
           </div>
@@ -194,7 +205,7 @@
           </button>
           <!-- 标签页切换按钮 -->
           <div v-show="!workPanelCollapsed" class="tab-switcher">
-            <button 
+            <!-- <button 
               v-if="currentSlideHasIframe && !currentSlideHasBilibiliVideo"
               v-show="currentSlideHasIframe"
               class="tab-btn" 
@@ -203,7 +214,7 @@
               :title="lang.ssAnswerRes"
             >
               {{ lang.ssAnswerRes }}
-            </button>
+            </button> -->
             <button 
               class="tab-btn" 
               :class="{ active: rightPanelMode === 'dialogue' }"
@@ -649,9 +660,9 @@ const autoSwitchToAvailablePanel = () => {
     rightPanelMode.value = 'dialogue'
     console.log('自动切换到对话面板')
   }
-  else if (currentSlideHasIframe.value && rightPanelMode.value !== 'homework' && !currentSlideHasBilibiliVideo.value) {
-    rightPanelMode.value = 'homework'
-  }
+  // else if (currentSlideHasIframe.value && rightPanelMode.value !== 'homework' && !currentSlideHasBilibiliVideo.value) {
+  //   rightPanelMode.value = 'homework'
+  // }
 }
 
 // 移除定时器相关函数,改用socket监听
@@ -3219,6 +3230,24 @@ const openChoiceQuestionDetail = (index:number) => {
   }
 }
 
+// 打开作业查看详细
+const openChoiceQuestionDetail2 = (index:number) => {
+  if (!choiceQuestionDetailDialogOpenList.value.includes(index)) {
+  }
+  else {
+    choiceQuestionDetailDialogOpenList.value = choiceQuestionDetailDialogOpenList.value.filter(i => i !== index)
+  }
+}
+
+
+// 打开作业查看详细
+const openChoiceQuestionDetail3 = (index:number) => {
+  if (!choiceQuestionDetailDialogOpenList.value.includes(index)) {
+    choiceQuestionDetailDialogOpenList.value.push(index)
+  }
+}
+
+
 const handlePageUnload = () => {
   if (isCreator.value && timerIndicator.value.visible && props.type === '1') {
     sendMessage({ type: 'timer_stop', courseid: props.courseid })
@@ -5262,4 +5291,37 @@ const clearTimerState = () => {
     }
   }
 }
+
+.homework-check-box {
+  position: absolute;
+  top: 15px;
+  left: 50%;
+  transform: translate(-50%, 0);
+  display: flex;
+  align-items: center;
+  box-shadow: 0px 3px 4px 3px #f2f2f2;
+  padding: 8px;
+  border-radius: 5px;
+  background: #fff;
+  z-index: 999;
+
+  .homework-check-box-item{
+    padding: 10px 18px;
+    border-radius: 5px;
+    font-weight: 600;
+    cursor: pointer;
+    transition: all 0.3s ease;
+
+    &.active{
+      background: #f6c82b;
+    }
+    
+    &:hover{
+      background: #fff;
+      color: #f6c82b;
+    }
+  }
+
+  .homework-check-box-item-title{}
+}
 </style>