hookehuyr

refactor(course-detail): 将教师信息改为支持多个讲师显示

修改了课程详情页的教师信息部分,使其支持显示多个讲师的信息。将`teacher`变量替换为`lecturers`数组,并更新了相关模板和逻辑,以便正确渲染每个讲师的详细内容。
...@@ -96,18 +96,18 @@ ...@@ -96,18 +96,18 @@
96 </div> 96 </div>
97 </FrostedGlass> 97 </FrostedGlass>
98 98
99 - <!-- Teacher Introduction --> 99 + <!-- lecturers Introduction -->
100 <FrostedGlass class="mb-6 p-4 rounded-xl"> 100 <FrostedGlass class="mb-6 p-4 rounded-xl">
101 <h3 class="text-lg font-bold text-gray-800 mb-3">主讲老师</h3> 101 <h3 class="text-lg font-bold text-gray-800 mb-3">主讲老师</h3>
102 - <div class="flex items-center"> 102 + <div v-for="(item, index) in lecturers" :key="index" class="flex items-center">
103 <div class="w-16 h-16 rounded-full overflow-hidden mr-4"> 103 <div class="w-16 h-16 rounded-full overflow-hidden mr-4">
104 - <img :src="teacher?.avatar || 'https://cdn.ipadbiz.cn/mlaj/images/default_block.png'" alt="Teacher" 104 + <img :src="item?.photo || 'https://cdn.ipadbiz.cn/mlaj/images/default_block.png'" alt="lecturer"
105 class="w-full h-full object-cover" @error="handleImageError" /> 105 class="w-full h-full object-cover" @error="handleImageError" />
106 </div> 106 </div>
107 <div> 107 <div>
108 - <h4 class="font-bold text-gray-900">{{ teacher?.name || '没字段' }}</h4> 108 + <h4 class="font-bold text-gray-900">{{ item?.name }}</h4>
109 - <p class="text-sm text-gray-600">{{ teacher?.position || '没字段' }}</p> 109 + <p class="text-sm text-gray-600">{{ item?.educational }}</p>
110 - <p class="text-xs text-gray-500 mt-1">{{ teacher?.description || '没字段' }}</p> 110 + <p class="text-xs text-gray-500 mt-1">{{ item?.introduce }}</p>
111 </div> 111 </div>
112 </div> 112 </div>
113 </FrostedGlass> 113 </FrostedGlass>
...@@ -238,7 +238,7 @@ const route = useRoute() ...@@ -238,7 +238,7 @@ const route = useRoute()
238 const router = useRouter() 238 const router = useRouter()
239 239
240 const course = ref(null) 240 const course = ref(null)
241 -const teacher = ref(null) 241 +const lecturers = ref([])
242 const activeTab = ref('课程特色') 242 const activeTab = ref('课程特色')
243 // 是否收藏状态 243 // 是否收藏状态
244 const isFavorite = ref(false) 244 const isFavorite = ref(false)
...@@ -366,12 +366,7 @@ onMounted(async () => { ...@@ -366,12 +366,7 @@ onMounted(async () => {
366 const foundCourse = data; 366 const foundCourse = data;
367 if (foundCourse) { 367 if (foundCourse) {
368 course.value = foundCourse; 368 course.value = foundCourse;
369 - teacher.value = { 369 + lecturers.value = foundCourse.lecturer;
370 - name: '',
371 - avatar: '',
372 - position: '',
373 - description: '',
374 - }
375 isFavorite.value = foundCourse.is_favorite; 370 isFavorite.value = foundCourse.is_favorite;
376 isPurchased.value = foundCourse.is_buy; 371 isPurchased.value = foundCourse.is_buy;
377 isReviewed.value = foundCourse.is_comment; 372 isReviewed.value = foundCourse.is_comment;
......