FanHong hace 1 semana
padre
commit
e7178cd43b

+ 13 - 0
shudao-vue-frontend/src/views/Chat.vue

@@ -4717,6 +4717,19 @@ onMounted(async () => {
     
     console.log('🎉 AI问答页面初始化完成')
     
+    // 检查是否带有指定的模式
+    const targetMode = route.query.mode
+    if (targetMode && ['ai-qa', 'ai-writing', 'safety-training', 'exam-workshop'].includes(targetMode)) {
+      console.log('检测到目标模式:', targetMode)
+      setMode(targetMode)
+      
+      // 立即清除URL中的mode参数,防止刷新时问题
+      router.replace({
+        path: route.path,
+        query: { ...route.query, mode: undefined }
+      })
+    }
+
     // 检查是否有自动发送的消息
     const autoMessage = route.query.autoMessage
     if (autoMessage) {

+ 1 - 1
shudao-vue-frontend/src/views/ExamWorkshop.vue

@@ -1012,7 +1012,7 @@ const clearSettings = () => {
   // 根据当前选择的工程类型设置试卷名称
   const projectTypeName = projectTypes[selectedProjectType.value].name;
   examName.value = `${projectTypeName}工程施工技术考核`;
-  totalScore.value = 0; // 清空时配置总分也应该为 0
+  totalScore.value = 100; // 清空时配置总分恢复默认值 100
   // 保留原数组引用,更新每个对象的属性,避免破坏 Vue 3 响应式绑定
   questionTypes.value.forEach(type => {
     type.scorePerQuestion = 0;

+ 12 - 3
shudao-vue-frontend/src/views/Index.vue

@@ -473,7 +473,10 @@ const goToHazardDetection = () => {
 }
 
 const goToSafetyTraining = () => {
-  router.push('/safety-hazard')
+  router.push({
+    path: '/chat',
+    query: { mode: 'safety-training' }
+  })
 }
 
 const goToAIChat = () => {
@@ -481,11 +484,17 @@ const goToAIChat = () => {
 }
 
 const goToExamWorkshop = () => {
-  router.push('/exam-workshop')
+  router.push({
+    path: '/chat',
+    query: { mode: 'exam-workshop' }
+  })
 }
 
 const goToAIWriting = () => {
-  router.push('/ai-writing')
+  router.push({
+    path: '/chat',
+    query: { mode: 'ai-writing' }
+  })
 }
 
 const goToPolicyDocument = () => {