hookehuyr

feat(学习记录页): 添加点击跳转课程详情功能

...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 :key="record.id" 13 :key="record.id"
14 class="p-4 rounded-xl" 14 class="p-4 rounded-xl"
15 > 15 >
16 - <div class="flex items-start"> 16 + <div class="flex items-start" @click="handleClick(record)">
17 <div 17 <div
18 class="w-20 h-20 rounded-lg overflow-hidden flex-shrink-0 mr-3" 18 class="w-20 h-20 rounded-lg overflow-hidden flex-shrink-0 mr-3"
19 > 19 >
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
107 107
108 <script setup> 108 <script setup>
109 import { ref } from 'vue'; 109 import { ref } from 'vue';
110 -import { useRoute } from 'vue-router'; 110 +import { useRoute, useRouter } from 'vue-router';
111 import { useTitle } from '@vueuse/core'; 111 import { useTitle } from '@vueuse/core';
112 import FrostedGlass from '@/components/ui/FrostedGlass.vue'; 112 import FrostedGlass from '@/components/ui/FrostedGlass.vue';
113 import { formatDate } from '@/utils/tools'; 113 import { formatDate } from '@/utils/tools';
...@@ -116,6 +116,8 @@ import { formatDate } from '@/utils/tools'; ...@@ -116,6 +116,8 @@ import { formatDate } from '@/utils/tools';
116 import { getStudyRecordListAPI } from "@/api/record"; 116 import { getStudyRecordListAPI } from "@/api/record";
117 117
118 const $route = useRoute(); 118 const $route = useRoute();
119 +const $router = useRouter();
120 +
119 useTitle($route.meta.title); 121 useTitle($route.meta.title);
120 122
121 const records = ref([]); 123 const records = ref([]);
...@@ -154,4 +156,9 @@ const handleImageError = (e) => { ...@@ -154,4 +156,9 @@ const handleImageError = (e) => {
154 e.target.onerror = null; 156 e.target.onerror = null;
155 e.target.src = '/assets/images/course-placeholder.jpg'; 157 e.target.src = '/assets/images/course-placeholder.jpg';
156 }; 158 };
159 +
160 +// 跳转到课程详情页
161 +const handleClick = (record) => {
162 + $router.push(`/studyCourse/${record.id}`);
163 +};
157 </script> 164 </script>
......