丸子 9 月之前
父节点
当前提交
3b969d1f05
共有 3 个文件被更改,包括 16 次插入14 次删除
  1. 12 7
      src/views/AIDevelop.vue
  2. 3 7
      src/views/AIGeneralCourse.vue
  3. 1 0
      src/views/AILaboratory.vue

+ 12 - 7
src/views/AIDevelop.vue

@@ -222,7 +222,7 @@
 <script setup>
 import { ref, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
-// import { ClassType } from '@/api/class.js'
+import { ClassType } from '@/api/class.js'
 import {
   ArrowDown,
   ArrowRightBold,
@@ -290,23 +290,28 @@ const videoMap = {
 // 定义视频源
 const videoSrc = ref(video1)
 
-
-// // 获取课程列表
-// ClassType().then(res=>{
-//   console.log(res);
-// })
-
 // 返回上一页
 const goBack = () => {
   router.go(-1)
 }
 // 渲染页面标题
 const boxIconTitle = ref('')
+// 教学大纲id
+const outlineId = ref('')
 onMounted(() => {
   const title = router.currentRoute.value.query.title
+  const id = router.currentRoute.value.query.id
   if (title) {
     boxIconTitle.value = String(title)
   }
+  if (id) {
+    outlineId.value = id // 接收并存储id参数
+  }
+  console.log(outlineId.value);
+  // 获取课程列表
+  ClassType({ typeId: outlineId.value }).then(res => {
+    console.log(res);
+  })
 })
 
 // 菜单打开和关闭的处理函数

+ 3 - 7
src/views/AIGeneralCourse.vue

@@ -143,7 +143,6 @@ const fetchCtTypes = async () => {
         selectedGrade.value = classData.value[0].ctType
       }
     }
-    console.log(classData.value, selectedGrade.value)
   } catch (error) {
     console.error('获取 ctType 数据失败:', error)
   }
@@ -152,23 +151,19 @@ const fetchCtTypes = async () => {
 
 // 添加 watch 监听 selectedGrade 的变化
 watch(selectedGrade, newValue => {
-  console.log('当前选中的年级是:', newValue)
   // 根据 id 切换高年级或低年级
   const selectedItem = classData.value.find(item => item.ctType === newValue)
   if (selectedItem) {
     if (selectedItem.id === 1) {
       selectedGrade.value = '小学底年级'
-      console.log(selectedGrade.value)
     } else if (selectedItem.id === 3) {
       selectedGrade.value = '小学高年级'
-      console.log(selectedGrade.value)
     }
     // 调用获取教学大纲函数并传入年级id
     ClassOutline(selectedItem.id).then(res => {
        if (res.code === 0) {
         classOutlineData.value = res.data
       }
-      console.log(classOutlineData.value)
     })
   }
 })
@@ -223,10 +218,11 @@ const goToAIExperience = index => {
   ]
   // 跳转页面渲染title
   const title = `0${index} ${getCourseTitle(index)}` // 定义 title 变量
-  if (index >= 1 && index <= routes.length) {
+  if (index >= 1 && index <= routes.length && classOutlineData.value.length >= index) {
+    const selectedItem = classOutlineData.value[index - 1]
     router.push({
       path: routes[index - 1],
-      query: { title: title }
+      query: { title: title, id: selectedItem.id }
     })
   }
 }

+ 1 - 0
src/views/AILaboratory.vue

@@ -59,6 +59,7 @@
           <div class="people-title">{{ person.name }}</div>
         </div>
       </div>
+      
     </div>
   </div>
 </template>