feat:精选资源
This commit is contained in:
parent
3ff9e43877
commit
b093dcd630
@ -31,8 +31,8 @@
|
|||||||
<div v-for="video in featuredVideos" :key="video.id" class="featured-card" @click="handleVideoClick(video)">
|
<div v-for="video in featuredVideos" :key="video.id" class="featured-card" @click="handleVideoClick(video)">
|
||||||
<div class="card-image">
|
<div class="card-image">
|
||||||
<img
|
<img
|
||||||
:src="video.thumbnailUrl || video.image"
|
:src="video.thumbnailUrl"
|
||||||
:alt="video.name || video.title"
|
:alt="video.name"
|
||||||
class="video-thumbnail"
|
class="video-thumbnail"
|
||||||
/>
|
/>
|
||||||
<div v-if="video.type === 0 && video.duration" class="duration-badge">
|
<div v-if="video.type === 0 && video.duration" class="duration-badge">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<h3 class="card-title">{{ video.name || video.title }}</h3>
|
<h3 class="card-title">{{ video.name }}</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 视频网格 -->
|
<!-- 视频网格 -->
|
||||||
<div class="video-grid">
|
<div class="video-grid">
|
||||||
<div v-for="video in allVideos" :key="video.id" class="video-card" @click="handleVideoClick(video)">
|
<div v-for="video in allVideos" :key="video.id" class="video-card" @click="handleLegacyVideoClick(video)">
|
||||||
<div class="card-image">
|
<div class="card-image">
|
||||||
<img :src="video.image" :alt="video.title" class="video-thumbnail" />
|
<img :src="video.image" :alt="video.title" class="video-thumbnail" />
|
||||||
<div class="duration-badge">
|
<div class="duration-badge">
|
||||||
@ -370,6 +370,32 @@ const handleVideoClick = async (video: FeaturedResource) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理旧格式视频数据的点击事件
|
||||||
|
const handleLegacyVideoClick = async (video: any) => {
|
||||||
|
console.log('🎬 点击旧格式视频:', video.title)
|
||||||
|
|
||||||
|
// 转换为 FeaturedResource 格式
|
||||||
|
const convertedVideo: FeaturedResource = {
|
||||||
|
id: video.id.toString(),
|
||||||
|
name: video.title,
|
||||||
|
description: video.title,
|
||||||
|
type: 0, // 视频类型
|
||||||
|
fileUrl: video.videoUrl,
|
||||||
|
thumbnailUrl: video.image,
|
||||||
|
duration: null,
|
||||||
|
fileSize: 0,
|
||||||
|
metadata: null,
|
||||||
|
izFeatured: 1,
|
||||||
|
status: 0,
|
||||||
|
createdBy: null,
|
||||||
|
createdTime: null,
|
||||||
|
updatedBy: null,
|
||||||
|
updatedTime: null
|
||||||
|
}
|
||||||
|
|
||||||
|
await handleVideoClick(convertedVideo)
|
||||||
|
}
|
||||||
|
|
||||||
const closeVideoModal = () => {
|
const closeVideoModal = () => {
|
||||||
showVideoModal.value = false
|
showVideoModal.value = false
|
||||||
currentVideo.value = null
|
currentVideo.value = null
|
||||||
@ -381,18 +407,7 @@ const closeVideoModal = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 图片加载处理
|
|
||||||
const handleImageError = (event: Event) => {
|
|
||||||
const img = event.target as HTMLImageElement
|
|
||||||
console.error('❌ 图片加载失败:', img.src)
|
|
||||||
// 设置默认图片
|
|
||||||
img.src = '/images/Featured_resources/default-thumbnail.png'
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleImageLoad = (event: Event) => {
|
|
||||||
const img = event.target as HTMLImageElement
|
|
||||||
console.log('✅ 图片加载成功:', img.src)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 页面初始化
|
// 页面初始化
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user