Pārlūkot izejas kodu

修改数字人侧边栏跳转bug

丸子 9 mēneši atpakaļ
vecāks
revīzija
b1eaa39ec6
2 mainītis faili ar 11 papildinājumiem un 7 dzēšanām
  1. 7 6
      src/components/LeftPanel.vue
  2. 4 1
      src/views/AILaboratory.vue

+ 7 - 6
src/components/LeftPanel.vue

@@ -35,7 +35,7 @@
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue'
+import { ref, onMounted} from 'vue'
 import { useRouter, useRoute } from 'vue-router'
 
 // 导入图片 白色
@@ -78,12 +78,13 @@ const groupList = ref([
 onMounted(() => {
   // 从路由判断当前应该选中的菜单项
   const path = route.path
-  if (path.includes('ai-questions')) {
-    currentActiveIndex.value = '0'
+  const from = route.query.from
+   if (path.includes('ai-questions') && from === 'ai-laboratory') {
+    currentActiveIndex.value = '2'  // 数字人老师
+  } else if (path.includes('ai-questions')) {
+    currentActiveIndex.value = '0'  // 智能问答
   } else if (path.includes('ai-painting')) {
-    currentActiveIndex.value = '1'
-  } else if (path.includes('ai-laboratory')) {
-    currentActiveIndex.value = '2'
+    currentActiveIndex.value = '1'  // 智能绘画
   }
 })
 

+ 4 - 1
src/views/AILaboratory.vue

@@ -118,7 +118,10 @@ onMounted(async () => {
 const navigateToAIQuestions = person => {
   router.push({
     path: '/ai-questions',
-    query: person,
+    query: {
+      ...person,
+      from: 'ai-laboratory'  // 添加来源标识
+    },
     category: grade.value
   })
 }