Bläddra i källkod

fix(Student): 处理iframe无输出内容时显示警告

当iframe的exposed_outputs为空数组时,显示警告信息并跳过当前循环,避免后续处理空数据
lsc 1 månad sedan
förälder
incheckning
a7a25a9b24
1 ändrade filer med 4 tillägg och 0 borttagningar
  1. 4 0
      src/views/Student/index.vue

+ 4 - 0
src/views/Student/index.vue

@@ -1813,6 +1813,10 @@ const handleHomeworkSubmit = async () => {
         // 由于TS类型检查,需通过 any 绕过类型限制
         const iframeWindow = iframe.contentWindow as any
         if (iframeWindow && iframeWindow.exposed_outputs) {
+          if (iframeWindow.exposed_outputs.length === 0) {
+            message.warning('没有找到作业内容')
+            continue
+          }
           console.log('执行iframe中的submitWork方法,参数可变')
           const iframeSlideIndex = slideIndex.value
           const jsonString = JSON.stringify(iframeWindow.exposed_outputs)