OL-LearnPlatform/src/views/Resources.vue

638 lines
13 KiB
Vue

<template>
<div class="resources-page">
<!-- 横幅图区域 -->
<div class="banner-section">
<div class="banner-container">
<img
src="/images/Featured_resources/精选资源轮播.png"
alt="精选资源横幅"
class="banner-image"
/>
</div>
</div>
<!-- 主要内容区域 -->
<div class="main-content">
<div class="container">
<!-- 精选视频区域 -->
<section class="featured-videos">
<h2 class="section-title">精选视频</h2>
<div class="featured-grid">
<div
v-for="video in featuredVideos"
:key="video.id"
class="featured-card"
>
<div class="card-image">
<img
:src="video.image"
:alt="video.title"
class="video-thumbnail"
/>
<div class="play-button">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
<path d="M8 5V19L19 12L8 5Z" fill="white"/>
</svg>
</div>
</div>
<div class="card-content">
<h3 class="card-title">{{ video.title }}</h3>
</div>
</div>
</div>
</section>
<!-- 全部视频区域 -->
<section class="all-videos">
<h2 class="section-title">全部视频</h2>
<!-- 筛选标签 -->
<div class="filter-tabs">
<button
v-for="tab in videoTabs"
:key="tab.id"
:class="['filter-tab', { active: activeVideoTab === tab.id }]"
@click="activeVideoTab = tab.id"
>
{{ tab.name }}
</button>
</div>
<!-- 视频网格 -->
<div class="video-grid">
<div
v-for="video in allVideos"
:key="video.id"
class="video-card"
>
<div class="card-image">
<img
:src="video.image"
:alt="video.title"
class="video-thumbnail"
/>
<div class="play-button">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path d="M8 5V19L19 12L8 5Z" fill="white"/>
</svg>
</div>
</div>
<div class="card-content">
<h3 class="card-title">{{ video.title }}</h3>
</div>
</div>
</div>
<div class="load-more">
<button class="load-more-btn">查看更多</button>
</div>
</section>
<!-- 全部图片区域 -->
<section class="all-images">
<h2 class="section-title">全部图片</h2>
<!-- 筛选标签 -->
<div class="filter-tabs">
<button
v-for="tab in imageTabs"
:key="tab.id"
:class="['filter-tab', { active: activeImageTab === tab.id }]"
@click="activeImageTab = tab.id"
>
{{ tab.name }}
</button>
</div>
<!-- 图片网格 -->
<div class="image-grid">
<div
v-for="image in allImages"
:key="image.id"
class="image-card"
>
<div class="card-image">
<img
:src="image.image"
:alt="image.title"
class="image-thumbnail"
/>
</div>
<div class="card-content">
<h3 class="card-title">{{ image.title }}</h3>
</div>
</div>
</div>
<div class="load-more">
<button class="load-more-btn">查看更多</button>
</div>
</section>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
// 精选视频数据
const featuredVideos = ref([
{
id: 1,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/精选视频1.png'
},
{
id: 2,
title: '华南工业大学内部资源之一',
image: '/images/Featured_resources/精选视频2.png'
},
{
id: 3,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/精品视频3.png'
}
])
// 视频筛选标签
const videoTabs = ref([
{ id: 'all', name: '全部' },
{ id: 'educational', name: '中小学教育资源' },
{ id: 'training', name: '师资培训' },
{ id: 'technology', name: '技术资源' },
{ id: 'management', name: '管理资源' }
])
const activeVideoTab = ref('all')
// 全部视频数据
const allVideos = ref([
{
id: 1,
title: '北京工业大学内部资源之一',
image: '/images/Featured_resources/全部视频1.png'
},
{
id: 2,
title: '北京工业大学内部资源之一',
image: '/images/Featured_resources/全部视频2.png'
},
{
id: 3,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/全部视频3.png'
},
{
id: 4,
title: '北京工业大学内部资源之一',
image: '/images/Featured_resources/全部视频4.png'
},
{
id: 5,
title: '中国工业大学内部资源之一',
image: '/images/Featured_resources/全部视频5.png'
},
{
id: 6,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/全部视频6.png'
},
{
id: 7,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/全部视频7.png'
},
{
id: 8,
title: '内蒙古工业大学内部资源之一',
image: '/images/Featured_resources/全部视频8.png'
}
])
// 图片筛选标签
const imageTabs = ref([
{ id: 'all', name: '全部' },
{ id: 'educational', name: '中小学教育资源' },
{ id: 'training', name: '师资培训' },
{ id: 'technology', name: '技术资源' },
{ id: 'management', name: '管理资源' }
])
const activeImageTab = ref('all')
// 全部图片数据
const allImages = ref([
{
id: 1,
title: '中国工业大学内部资源之一',
image: '/images/Featured_resources/全部图片1.png'
},
{
id: 2,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/全部图片2.png'
},
{
id: 3,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/全部图片3.png'
},
{
id: 4,
title: '内蒙古工业大学内部资源之一',
image: '/images/Featured_resources/全部图片4.png'
},
{
id: 5,
title: '北京工业大学内部资源之一',
image: '/images/Featured_resources/全部图片5.png'
},
{
id: 6,
title: '北京工业大学内部资源之一',
image: '/images/Featured_resources/全部图片6.png'
},
{
id: 7,
title: '西安工业大学内部资源之一',
image: '/images/Featured_resources/全部图片7.png'
},
{
id: 8,
title: '内蒙古工业大学内部资源之一',
image: '/images/Featured_resources/全部图片8.png'
}
])
</script>
<style scoped>
.resources-page {
min-height: 100vh;
background: #f8f9fa;
}
/* 横幅图区域 */
.banner-section {
position: relative;
width: 100%;
overflow: hidden;
}
.banner-container {
position: relative;
width: 100%;
height: auto;
}
.banner-image {
width: 100%;
height: auto;
display: block;
object-fit: cover;
}
/* 主要内容区域 */
.main-content {
padding: 60px 0;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
.section-title {
font-size: 24px;
font-weight: 600;
color: #333;
margin: 0 0 30px 0;
text-align: center;
}
/* 精选视频区域 */
.featured-videos {
margin-bottom: 80px;
}
.featured-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 24px;
}
.featured-card {
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s;
cursor: pointer;
}
.featured-card:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
}
.card-image {
position: relative;
height: 180px;
background: #f5f5f5;
overflow: hidden;
}
.video-thumbnail {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.image-thumbnail {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.image-placeholder {
width: 100%;
height: 100%;
background: linear-gradient(135deg, #e0e0e0 0%, #f0f0f0 100%);
display: flex;
align-items: center;
justify-content: center;
}
.image-placeholder::after {
content: '图片占位';
color: #999;
font-size: 14px;
}
.play-button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 48px;
height: 48px;
background: rgba(0, 0, 0, 0.6);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
}
.play-button:hover {
background: rgba(0, 0, 0, 0.8);
transform: translate(-50%, -50%) scale(1.1);
}
.card-content {
padding: 16px;
}
.card-title {
font-size: 14px;
font-weight: 500;
color: #333;
margin: 0;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* 筛选标签 */
.filter-tabs {
display: flex;
gap: 20px;
margin: 0 auto 30px auto;
justify-content: center;
align-items: center;
width: fit-content;
}
.filter-tab {
padding: 8px 16px;
border: none;
background: transparent;
color: #999;
font-size: 14px;
cursor: pointer;
border-radius: 4px;
transition: all 0.3s;
white-space: nowrap;
font-weight: 400;
}
.filter-tab:hover {
color: #4A90E2;
}
.filter-tab.active {
background: #4A90E2;
color: white;
font-weight: 500;
}
/* 全部视频区域 */
.all-videos {
margin-bottom: 80px;
}
.video-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 40px;
}
.video-card {
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s;
cursor: pointer;
}
.video-card:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
}
.video-card .card-image {
height: 140px;
}
.video-card .play-button {
width: 40px;
height: 40px;
}
/* 全部图片区域 */
.all-images {
margin-bottom: 40px;
}
.image-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 40px;
}
.image-card {
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s;
cursor: pointer;
}
.image-card:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
}
.image-card .card-image {
height: 140px;
}
/* 查看更多按钮 */
.load-more {
text-align: center;
}
.load-more-btn {
padding: 12px 32px;
background: white;
border: 1px solid #ddd;
color: #666;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: all 0.3s;
}
.load-more-btn:hover {
background: #f8f9fa;
border-color: #4A90E2;
color: #4A90E2;
}
/* 响应式设计 */
@media (max-width: 1024px) {
.container {
padding: 0 16px;
}
.featured-grid {
grid-template-columns: repeat(2, 1fr);
gap: 20px;
}
.video-grid,
.image-grid {
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}
.banner-title {
font-size: 28px;
}
}
@media (max-width: 768px) {
.banner-section {
height: 300px;
}
.banner-title {
font-size: 24px;
}
.main-content {
padding: 40px 0;
}
.featured-grid {
grid-template-columns: 1fr;
gap: 16px;
}
.video-grid,
.image-grid {
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.section-title {
font-size: 20px;
margin-bottom: 20px;
text-align: center;
}
.filter-tabs {
overflow-x: auto;
gap: 16px;
justify-content: flex-start;
padding: 0 20px;
}
.filter-tab {
padding: 6px 16px;
font-size: 13px;
flex-shrink: 0;
}
.featured-videos,
.all-videos {
margin-bottom: 60px;
}
}
@media (max-width: 480px) {
.banner-image {
max-height: 250px;
object-fit: cover;
}
.container {
padding: 0 12px;
}
.video-grid,
.image-grid {
grid-template-columns: 1fr;
gap: 12px;
}
.card-image {
height: 160px;
}
.video-card .card-image,
.image-card .card-image {
height: 120px;
}
.section-title {
font-size: 18px;
text-align: center;
}
.filter-tabs {
margin-bottom: 20px;
gap: 12px;
}
.filter-tab {
padding: 6px 12px;
font-size: 12px;
}
}
</style>