Просмотр исходного кода

feat: 新增互动网页工具类型并完善相关逻辑

1. 新增工具类型81,对应互动网页工具
2. 更新多语言文案,新增提示文案和快捷操作
3. 调整网页链接上传逻辑,增加警告提示和自动创建幻灯片与框架元素
4. 修复ai聊天快捷操作面板的显示逻辑
lsc 1 неделя назад
Родитель
Сommit
c981753224

+ 7 - 5
src/components/CollapsibleToolbar/componets/aiChat.vue

@@ -22,12 +22,12 @@
           </span>
         </button>
         <div class="coco-collapse-body" v-if="isQuickActions.includes('quick')">
-          <!-- <div class="coco-quick-tabs">
+          <div class="coco-quick-tabs">
             <button type="button" class="coco-quick-tab" :class="{ 'active': cocoQuickTab === 'page' }"
               @click="setCocoQuickTab('page')">{{ lang.ssAiChatQuickTabPage }}</button>
             <button type="button" class="coco-quick-tab" :class="{ 'active': cocoQuickTab === 'course' }"
               @click="setCocoQuickTab('course')">{{ lang.ssAiChatQuickTabCourse }}</button>
-          </div> -->
+          </div>
           <div class="coco-quick-list">
             <button type="button" class="coco-quick-action" v-if="cocoQuickTab === 'page'" @click="sendQuickAction(lang.ssAiChatQuickAction3)">
               <span class="coco-quick-action-copy">
@@ -56,7 +56,7 @@
                 </svg>
               </span>
             </button> -->
-            <button type="button" class="coco-quick-action" v-if="cocoQuickTab === 'course'">
+            <button type="button" class="coco-quick-action" v-if="cocoQuickTab === 'course'"  @click="sendQuickAction(lang.ssAiChatQuickAction5)">
                 <span class="coco-quick-action-copy">
                     <span class="coco-quick-action-title">{{ lang.ssAiChatQuickRecommendToolsTitle }}</span>
                     <span class="coco-quick-action-desc">{{ lang.ssAiChatQuickRecommendToolsDesc }}</span>
@@ -68,7 +68,7 @@
                     </svg>
                 </span>
             </button>
-            <button type="button" class="coco-quick-action" v-if="cocoQuickTab === 'course'">
+            <!-- <button type="button" class="coco-quick-action" v-if="cocoQuickTab === 'course'">
                 <span class="coco-quick-action-copy">
                     <span class="coco-quick-action-title">{{ lang.ssAiChatQuickBatchGenToolsTitle }}</span>
                     <span class="coco-quick-action-desc">{{ lang.ssAiChatQuickBatchGenToolsDesc }}</span>
@@ -79,7 +79,7 @@
                         <path d="M13 5l7 7-7 7"></path>
                     </svg>
                 </span>
-            </button>
+            </button> -->
           </div>
         </div>
       </div>
@@ -254,6 +254,8 @@ const files = ref<Array<{ title: string; id?: string | null; url?: string; isPro
 const quickActions = [
   lang.ssAiChatQuickAction1,
   lang.ssAiChatQuickAction2,
+  lang.ssAiChatQuickAction6,
+  lang.ssAiChatQuickAction7,
 ]
 
 // 监听输入变化,当输入"/"时显示快捷操作

+ 1 - 0
src/components/CollapsibleToolbar/index.vue

@@ -283,6 +283,7 @@ const getTypeLabel = (type?: number) => {
     15: lang.ssQATest,
     72: lang.ssAiApp,
     73: lang.ssHPage,
+    81: lang.ssHPage,
     74: lang.ssVideo,
     75: lang.lang == 'cn' ? lang.ssBiliVideo : lang.ssYouTube,
     76: lang.ssCreative,

+ 9 - 1
src/components/CollapsibleToolbar/index2.vue

@@ -879,8 +879,15 @@ const uploadWebpageLink = async () => {
   })
 
   if (!isValid) {
-    message.error(lang.ssCocoLinkTip)
+    // message.error(lang.ssCocoLinkTip)
+
+    message.warning(lang.ssCocoLinkTip2)
+    createSlide()
+    createFrameElement(webpageUrl.value, 81) // 假设15是网页工具的类型
     isLoading.value = false
+    // 清空输入框和验证状态
+    webpageUrl.value = ''
+    isValidUrl.value = null
     return
   }
   isLoading.value = false
@@ -1073,6 +1080,7 @@ const getTypeLabel = (type?: number) => {
     15: lang.ssQATest,
     72: lang.ssAiApp,
     73: lang.ssHPage,
+    81: lang.ssHPage,
     74: lang.ssVideo,
     75: lang.lang == 'cn' ? lang.ssBiliVideo : lang.ssYouTube,
     76: lang.ssCreative,

+ 1 - 0
src/components/CollapsibleToolbar/index22.vue

@@ -973,6 +973,7 @@ const getTypeLabel = (type?: number) => {
     15: lang.ssQATest,
     72: lang.ssAiApp,
     73: lang.ssHPage,
+    81: lang.ssHPage,
     74: lang.ssVideo,
     75: lang.lang == 'cn' ? lang.ssBiliVideo : lang.ssYouTube,
     76: lang.ssCreative,

+ 1 - 0
src/views/Editor/CanvasTool/WebpageInput.vue

@@ -103,6 +103,7 @@ const getTypeLabel = (type: number) => {
     15: lang.ssQATest,
     72: lang.ssAiApp,
     73: lang.ssHPage,
+    81: lang.ssHPage,
     74: lang.ssVideo,
     75: lang.lang == 'cn' ? lang.ssBiliVideo : lang.ssYouTube,
     76: lang.ssCreative,

+ 1 - 0
src/views/Editor/CanvasTool/index2.vue

@@ -327,6 +327,7 @@ const getTypeLabel = (type: number) => {
     15: lang.ssQATest,
     72: lang.ssAiApp,
     73: lang.ssHPage,
+    81: lang.ssHPage,
     74: lang.ssVideo,
     75: lang.lang == 'cn' ? lang.ssBiliVideo : lang.ssYouTube,
     76: lang.ssCreative,

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

@@ -1065,7 +1065,7 @@ const currentSlideConfigId = computed(() => {
 // 检测当前幻灯片是否包含B站视频
 const currentSlideHasBilibiliVideo = computed(() => {
   return elementList.value.some(element => 
-    element.type === ElementTypes.FRAME && (element.toolType === 75 || element.toolType === 74 || element.toolType === 76)
+    element.type === ElementTypes.FRAME && (element.toolType === 75 || element.toolType === 74 || element.toolType === 76 || element.toolType === 81)
   )
 })
 

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

@@ -728,6 +728,7 @@
   "ssClearToolContent": "该操作将清除当前工具的编辑内容,是否继续?",
   "ssUploadWebpageLink": "上传链接",
   "ssCocoLinkTip":"请添加 Cocorobo 同域、亚马逊或可访问的 HTML 链接。",
+  "ssCocoLinkTip2": "非平台域名支持链接,可能存在显示异常,且不支持学生端提交作业。",
   "ssChoiceQuestion":"选择题",
   "ssAnswerCount":"回答人数",
   "ssQuestion":"题目",
@@ -742,6 +743,8 @@
   "ssAiChatShortcut": "输入 / 获取快捷操作短语",
   "ssAiChatQuickAction1": "为当前页面内容生成2道选择题",
   "ssAiChatQuickAction2": "为当前页面内容生成1道问答题",
+  "ssAiChatQuickAction6": "为当前页面生成投票",
+  "ssAiChatQuickAction7": "为当前页面生成拍照题",
   "ssAiChatParsing": "解析中...",
   "ssAiChatWaitUpload": "请等待文件上传完成后再发送消息",
   "ssAiChatFileSizeLimit": "文件大小不能超过10MB",
@@ -897,5 +900,6 @@
   "ssImportAndSaveDesc": "导入为课件页面,并同步保存到资源库。",
   "ssReadingFile": "正在读取文件...",
   "ssAiChatQuickAction3": "为当前页面内容生成2道选择题",
-  "ssAiChatQuickAction4": "为当前页面生成互动网页"
+  "ssAiChatQuickAction4": "为当前页面生成互动网页",
+  "ssAiChatQuickAction5": "为课件推荐适合页面的互动工具"
 }

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

@@ -729,6 +729,7 @@
   "ssClearToolContent": "This operation will clear the current tool's editing content. Continue?",
   "ssUploadWebpageLink": "Upload Webpage Link",
   "ssCocoLinkTip":"Please add Cocorobo, Amazon, or accessible HTML link.",
+  "ssCocoLinkTip2": "Non-platform domain links may cause display exceptions and do not support student submission of assignments.",
   "ssChoiceQuestion":"Choice Question",
   "ssAnswerCount":"Answer count",
   "ssQuestion":"Question",
@@ -743,6 +744,8 @@
   "ssAiChatShortcut": "Type / for quick actions",
   "ssAiChatQuickAction1": "Generate 2 multiple choice questions for the current page content",
   "ssAiChatQuickAction2": "Generate 1 essay question for the current page content",
+  "ssAiChatQuickAction6": "Generate a poll for the current page",
+  "ssAiChatQuickAction7": "Generate a photo question for the current page",
   "ssAiChatParsing": "Parsing...",
   "ssAiChatWaitUpload": "Please wait for the file upload to complete before sending a message",
   "ssAiChatFileSizeLimit": "File size cannot exceed 10MB",
@@ -897,5 +900,6 @@
   "ssImportAndSaveDesc": "Import as course slides and save to library.",
   "ssReadingFile": "Reading file...",
   "ssAiChatQuickAction3": "Generate 2 multiple-choice questions for the current page content",
-  "ssAiChatQuickAction4": "Generate an interactive web page for the current page"
+  "ssAiChatQuickAction4": "Generate an interactive web page for the current page",
+  "ssAiChatQuickAction5": "Recommend interactive tools for the current page"
 }

+ 5 - 1
src/views/lang/hk.json

@@ -729,6 +729,7 @@
   "ssClearToolContent": "該操作將清除當前工具的編輯內容,是否繼續?",
   "ssUploadWebpageLink": "上傳鏈接",
   "ssCocoLinkTip":"請添加 Cocorobo 同域、亚马逊或可访问的 HTML 链接。",
+  "ssCocoLinkTip2": "非平台域名支持鏈接,可能存在顯示異常,且不支持學生端提交作業。",
   "ssChoiceQuestion":"選擇題",
   "ssAnswerCount":"回答人數",
   "ssQuestion":"題目",
@@ -743,6 +744,8 @@
   "ssAiChatShortcut": "輸入 / 獲取快捷操作短語",
   "ssAiChatQuickAction1": "為當前頁面內容生成2道選擇題",
   "ssAiChatQuickAction2": "為當前頁面內容生成1道問答題",
+  "ssAiChatQuickAction6": "為當前頁面生成投票",
+  "ssAiChatQuickAction7": "為當前頁面生成拍照題",
   "ssAiChatParsing": "解析中...",
   "ssAiChatWaitUpload": "請等待文件上傳完成後再發送消息",
   "ssAiChatFileSizeLimit": "文件大小不能超過10MB",
@@ -897,5 +900,6 @@
   "ssImportAndSaveDesc": "導入為課件頁面,並同步保存到資源庫。",
   "ssReadingFile": "正在讀取文件...",
   "ssAiChatQuickAction3": "為當頁內容生成2道選擇題",
-  "ssAiChatQuickAction4": "為當頁生成互動網頁。"
+  "ssAiChatQuickAction4": "為當頁生成互動網頁。",
+  "ssAiChatQuickAction5": "為課件推薦適合的互動工具。"
 }