hookehuyr

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

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