Kaynağa Gözat

refactor: 优化批量互动工具相关逻辑与文案提示

1. 更新多语言文案,添加批量生成工具的预计耗时提示
2. 新增panAllToolsArray方法处理幻灯片工具数组
3. 切换子页面时自动清空已全选的工具数组
4. 优化缩略图子页面的激活态样式
lsc 6 gün önce
ebeveyn
işleme
57f0f54ee5

+ 2 - 0
src/store/main.ts

@@ -219,6 +219,8 @@ export const useMainStore = defineStore('main', {
       this.showAIPPTDialog = show
     },
     setChildPageState(show: boolean, tools: any[], pageIndex: number) {
+      const slidesStore = useSlidesStore()
+      slidesStore.panAllToolsArray()
       this.childPageVisible = show
       this.childPageToolsArray = tools
       this.childPageIndex = pageIndex

+ 11 - 0
src/store/slides.ts

@@ -189,6 +189,7 @@ export const useSlidesStore = defineStore('slides', {
     },
   
     updateSlideIndex(index: number) {
+      this.panAllToolsArray()
       this.slideIndex = index
     },
   
@@ -230,5 +231,15 @@ export const useSlidesStore = defineStore('slides', {
       })
       this.slides[slideIndex].elements = (elements as PPTElement[])
     },
+    panAllToolsArray() {
+      this.slides.forEach(slide => {
+        if (slide.toolsArray) {
+          const allToolsSet = slide.toolsArray.every(t => t.isSet)
+          if (allToolsSet) {
+            slide.toolsArray = []
+          }
+        }
+      })
+    },
   },
 })

+ 8 - 3
src/views/Editor/Thumbnails/ThumbnailChildPage.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="thumbnail-child-page" @click="handleClick">
+  <div class="thumbnail-child-page" @click="handleClick" :class="{ 'active': slideIndexStore === props.slideIndex || 0 }">
     <div class="child-page-icon">
       <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
         <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
@@ -26,17 +26,18 @@ const props = defineProps<{
 const mainStore = useMainStore()
 const { setChildPageState } = mainStore
 const slidesStore = useSlidesStore()
-const { slideIndex } = storeToRefs(slidesStore)
+const { currentSlide, slideIndex: slideIndexStore } = storeToRefs(slidesStore)
 
 // 切换页面
 const changeSlideIndex = (index: number) => {
   mainStore.setActiveElementIdList([])
 
-  if (slideIndex.value === index) return
+  if (slideIndexStore.value === index) return
   slidesStore.updateSlideIndex(index)
 }
 
 const handleClick = () => {
+  if (slideIndexStore.value === props.slideIndex) return
   console.log(props.slideIndex)
   changeSlideIndex(props.slideIndex || 0)
   setChildPageState(false, [], props.slideIndex || 0)
@@ -66,6 +67,10 @@ const pendingCount = computed(() => {
   cursor: pointer;
   transition: all 0.2s;
 
+  &.active {
+    border-style: solid;
+  }
+
   &:hover {
     background-color: #fef3c7;
     border-style: solid;

+ 1 - 1
src/views/lang/cn.json

@@ -941,7 +941,7 @@
   "ssDiscard": "丢弃",
   "ssKeepAll": "保留全部",
   "ssUploadSuccess": "上传完成",
-  "ssBatchInteractiveWebConfirm": "是否需要为课件批量生成工具?",
+  "ssBatchInteractiveWebConfirm": "是否需要为课件批量生成工具(预计3-5分钟完成)?",
   "ssBatchInteractiveWebConfirmDesc": "是,立即添加",
   "ssBatchInteractiveWebConfirmDesc2": "暂不需要",
   "ssPendingCount": "待处理"

+ 1 - 1
src/views/lang/en.json

@@ -941,7 +941,7 @@
   "ssDiscard": "Discard",
   "ssKeepAll": "Keep All",
   "ssUploadSuccess": "Upload Success",
-  "ssBatchInteractiveWebConfirm": "Need to generate tools for the course?",
+  "ssBatchInteractiveWebConfirm": "Need to generate tools for the course (estimated 3-5 minutes)?",
   "ssBatchInteractiveWebConfirmDesc": "Yes, add now",
   "ssBatchInteractiveWebConfirmDesc2": "No",
   "ssPendingCount": "Pending Count"

+ 6 - 6
src/views/lang/hk.json

@@ -930,9 +930,9 @@
   "ssOpenWorkspace": "打開工作台",
   "ssInteractiveWebWorkspaceDesc": "點擊卡片進入工作台,確認互動網頁。",
   "ssBatchInteractiveWeb": "為課件批量生成互動工具",
-  "ssBatchInteractiveWebDesc": "已收到「新课程」的批量生成任务,正在读取资料来源...",
-  "ssBatchInteractiveWebDesc2": "工具待选区,请在底部待选区页面处理「保留/丢弃/全部保留」。",
-  "ssBatchInteractiveWebDesc3": "还存在未处理的待选区,请先处理待选区后再批量生成互动工具。",
+  "ssBatchInteractiveWebDesc": "已收到「新課程」的批量生成任務,正在讀取資料來源。",
+  "ssBatchInteractiveWebDesc2": "工具待選區,請在底部待選區頁面處理「保留/丟棄/全部保留」。",
+  "ssBatchInteractiveWebDesc3": "尚有未處理的待選區,請先處理待選區後再批量生成互動工具。",
   "ssChildPageLabel": "待選頁",
   "ssWaitSelection": "待選區",
   "ssWaitSelectionHint": "此位置有 {0} 個候選工具",
@@ -941,8 +941,8 @@
   "ssDiscard": "丟棄",
   "ssKeepAll": "保留全部",
   "ssUploadSuccess": "上傳成功",
-  "ssBatchInteractiveWebConfirm": "是否需要為課件批量生成工具?",
+  "ssBatchInteractiveWebConfirm": "是否需要為課件批量生成工具(預計3-5分鐘完成)?",
   "ssBatchInteractiveWebConfirmDesc": "是,立即添加",
-  "ssBatchInteractiveWebConfirmDesc2": "不需要添加",
-  "ssPendingCount": "待理"
+  "ssBatchInteractiveWebConfirmDesc2": "不需要添加",
+  "ssPendingCount": "待理"
 }