lsc 18 hodín pred
rodič
commit
a54333003c

+ 13 - 0
src/views/Editor/Canvas/index.vue

@@ -247,6 +247,11 @@ onMounted(() => {
     nextTick(() => mainStore.setActiveElementIdList([]))
   }
   if (props.courseid) {
+    // 优化暴露到 window 对象的方式,避免重复赋值
+    if (typeof window !== 'undefined') {
+      const win = window as any
+      win.pptLoading = 1
+    }
     getCourseDetail()
   }
 })
@@ -273,10 +278,18 @@ const getCourseDetail = async () => {
         try {
           const jsonObj = JSON.parse(jsonStr)
           readJSON(jsonObj, true)
+          if (typeof window !== 'undefined') {
+            const win = window as any
+            win.pptLoading = 2
+          }
         }
         catch (e) {
           console.error('解析pptdata.data失败:', e)
           message.error('解析PPT数据失败')
+          if (typeof window !== 'undefined') {
+            const win = window as any
+            win.pptLoading = 2
+          }
         }
       }
     }

+ 9 - 1
src/views/Student/index.vue

@@ -192,6 +192,9 @@ const slideHeight = ref(0)
 // 添加loading状态
 const isLoading = ref(false)
 
+// 作业数组
+const workArray = ref([])
+
 // 计算幻灯片尺寸的函数
 const calculateSlideSize = () => {
   const slideWrapRef = isFullscreen.value ? document.body : viewerCanvasRef.value
@@ -950,7 +953,12 @@ const getWork = async () => {
     
     const res = await api.selectSWorks(props.courseid, '0', slideIndex.value.toString())
     console.log('getWork 执行成功,结果:', res)
-    return res
+    workArray.value = props.cid
+      ? res[0].filter((work: any) => {
+        return work.type === 1 || (work.type === 2 && work.classid.includes(props.cid))
+      })
+      : res[0]
+    console.log('getWork 执行成功,结果:', workArray.value)
   }
   catch (error) {
     console.error('getWork 执行失败:', error)