You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

892 lines
32 KiB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=375, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>青核 Youthome - 校园活动</title>
<link rel="stylesheet" href="../colors_and_type.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
html, body {
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'SF Pro Display', 'Helvetica Neue', sans-serif;
background: var(--youth-bg-page);
color: var(--youth-text-primary);
min-height: 100vh;
overflow-x: hidden;
}
.page-container {
width: 375px;
margin: 0 auto;
min-height: 812px;
background: var(--youth-bg-page);
position: relative;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* 状态栏 */
.status-bar {
height: 44px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
font-size: 15px;
font-weight: 600;
color: var(--youth-text-primary);
flex-shrink: 0;
}
.status-bar .right-icons {
display: flex;
align-items: center;
gap: 6px;
}
/* 顶部导航 */
.top-nav {
display: flex;
align-items: center;
gap: 10px;
padding: 0 16px 12px;
flex-shrink: 0;
}
.location-btn {
display: flex;
align-items: center;
gap: 4px;
font-size: 14px;
font-weight: 600;
color: var(--youth-text-primary);
cursor: pointer;
flex-shrink: 0;
}
.location-btn svg.chevron {
width: 12px;
height: 12px;
color: var(--youth-text-tertiary);
}
.search-box {
flex: 1;
display: flex;
align-items: center;
gap: 6px;
padding: 0 14px;
height: 38px;
background: var(--youth-bg-card, #fff);
border-radius: 20px;
border: 1px solid var(--youth-border-light, #E8E8E8);
cursor: pointer;
transition: all 0.2s ease;
}
.search-box:active {
border-color: var(--youth-primary, #26C2BB);
}
.search-box svg {
width: 16px;
height: 16px;
color: var(--youth-text-tertiary);
flex-shrink: 0;
}
.search-box span {
font-size: 13px;
color: var(--youth-text-placeholder, #B0B0B0);
}
.filter-btn {
width: 38px;
height: 38px;
border-radius: 50%;
background: var(--youth-bg-card, #fff);
border: 1px solid var(--youth-border-light, #E8E8E8);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
flex-shrink: 0;
color: var(--youth-text-primary);
transition: all 0.2s ease;
}
.filter-btn:active {
transform: scale(0.92);
}
.filter-btn svg {
width: 18px;
height: 18px;
}
/* 分类筛选 - 横向滚动 */
.category-bar {
display: flex;
gap: 8px;
padding: 0 16px 14px;
overflow-x: auto;
flex-shrink: 0;
scrollbar-width: none;
-ms-overflow-style: none;
}
.category-bar::-webkit-scrollbar {
display: none;
}
.cat-tag {
flex-shrink: 0;
padding: 6px 14px;
border-radius: 16px;
font-size: 13px;
font-weight: 500;
color: var(--youth-text-secondary);
background: var(--youth-bg-card, #fff);
border: 1px solid var(--youth-border-light, #E8E8E8);
cursor: pointer;
transition: all 0.2s ease;
}
.cat-tag:active {
transform: scale(0.96);
}
.cat-tag.active {
background: var(--youth-primary, #26C2BB);
color: #fff;
border-color: var(--youth-primary, #26C2BB);
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.25);
font-weight: 600;
}
/* 双列网格活动列表 */
.activity-grid {
flex: 1;
overflow-y: auto;
padding: 0 16px 100px;
display: grid;
grid-template-columns: repeat(2, 1fr);
column-gap: 12px;
row-gap: 16px;
min-height: 0;
}
.activity-grid::-webkit-scrollbar {
display: none;
}
/* 双列卡片 */
.activity-card {
background: var(--youth-bg-card, #fff);
border-radius: 12px;
overflow: hidden;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.activity-card:active {
transform: scale(0.97);
}
.card-cover {
position: relative;
width: 100%;
padding-top: 75%; /* 4:3 比例 */
overflow: hidden;
}
.card-cover .cover-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* 左上角状态标签 */
.card-cover .status-tag {
position: absolute;
top: 8px;
left: 8px;
padding: 3px 8px;
border-radius: 10px;
font-size: 10px;
font-weight: 600;
color: #fff;
z-index: 2;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.card-cover .status-tag.signing {
background: rgba(38, 194, 187, 0.9);
}
.card-cover .status-tag.upcoming {
background: rgba(255, 159, 69, 0.9);
}
.card-cover .status-tag.ongoing {
background: rgba(82, 196, 26, 0.9);
}
/* 右上角学时角标 */
.card-cover .hours-tag {
position: absolute;
top: 8px;
right: 8px;
padding: 3px 7px;
border-radius: 10px;
font-size: 10px;
font-weight: 600;
color: #fff;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
z-index: 2;
display: flex;
align-items: center;
gap: 2px;
}
.card-cover .hours-tag svg {
width: 10px;
height: 10px;
}
/* 卡片内容区 */
.card-body {
padding: 10px 12px 12px;
}
.card-time {
font-size: 11px;
color: var(--youth-text-tertiary, #8C8C8C);
margin-bottom: 6px;
display: flex;
align-items: center;
gap: 4px;
}
.card-time svg {
width: 11px;
height: 11px;
flex-shrink: 0;
}
.card-title {
font-size: 14px;
font-weight: 600;
color: var(--youth-text-primary);
line-height: 1.35;
margin-bottom: 8px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.card-category {
display: inline-flex;
align-items: center;
padding: 3px 8px;
background: var(--youth-primary-bg, #E6FAF9);
color: var(--youth-primary, #26C2BB);
font-size: 10px;
font-weight: 500;
border-radius: 8px;
}
/* 浮动发布按钮 */
.fab-btn {
position: absolute;
right: 16px;
bottom: 32px;
width: 52px;
height: 52px;
border-radius: 50%;
background: linear-gradient(135deg, #3FCFCA 0%, #26C2BB 100%);
display: flex;
align-items: center;
justify-content: center;
color: #fff;
box-shadow: 0 6px 20px rgba(38, 194, 187, 0.35);
cursor: pointer;
z-index: 60;
transition: all 0.2s ease;
border: none;
}
.fab-btn:active {
transform: scale(0.9);
}
.fab-btn svg {
width: 24px;
height: 24px;
stroke-width: 2.5;
}
/* 空数据状态 */
.empty-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 40px 80px;
text-align: center;
}
.empty-icon {
width: 100px;
height: 100px;
margin-bottom: 20px;
display: flex;
align-items: center;
justify-content: center;
background: var(--youth-primary-bg, #E6FAF9);
border-radius: 50%;
}
.empty-icon svg {
width: 48px;
height: 48px;
color: var(--youth-primary, #26C2BB);
}
.empty-title {
font-size: 16px;
font-weight: 600;
color: var(--youth-text-primary);
margin-bottom: 8px;
}
.empty-desc {
font-size: 13px;
color: var(--youth-text-tertiary, #8C8C8C);
line-height: 1.6;
}
/* 筛选面板遮罩 */
.filter-panel-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
z-index: 998;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.filter-panel-overlay.show {
opacity: 1;
visibility: visible;
}
.filter-panel {
position: fixed;
top: 0;
right: -300px;
width: 280px;
height: 100%;
background: #fff;
z-index: 999;
transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
padding: 60px 20px 20px;
box-sizing: border-box;
border-left: 1px solid #eee;
overflow-y: auto;
}
.filter-panel.show {
right: 0;
}
@media (min-width: 376px) {
.filter-panel {
right: calc(50% - 187.5px - 300px);
}
.filter-panel.show {
right: calc(50% - 187.5px);
}
.filter-panel-overlay {
left: 50%;
transform: translateX(-50%);
width: 375px;
}
}
.filter-panel-title {
font-size: 18px;
font-weight: 700;
margin-bottom: 20px;
}
.filter-group {
margin-bottom: 24px;
}
.filter-group-label {
font-size: 13px;
font-weight: 600;
margin-bottom: 10px;
}
.filter-options {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.filter-option {
padding: 7px 14px;
border-radius: 999px;
font-size: 12px;
font-weight: 500;
background: #f5f5f5;
color: #666;
cursor: pointer;
transition: all 0.2s ease;
border: 1px solid transparent;
}
.filter-option.selected {
background: rgba(38, 194, 187, 0.1);
color: var(--youth-primary, #26C2BB);
border-color: rgba(38, 194, 187, 0.3);
}
.filter-actions {
display: flex;
gap: 10px;
margin-top: 30px;
}
.filter-reset-btn {
flex: 1;
padding: 12px;
border-radius: 12px;
font-size: 14px;
font-weight: 500;
background: #f5f5f5;
color: #666;
border: none;
cursor: pointer;
}
.filter-apply-btn {
flex: 2;
padding: 12px;
border-radius: 12px;
font-size: 14px;
font-weight: 600;
background: var(--youth-primary, #26C2BB);
color: #fff;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<div class="page-container">
<!-- 状态栏 -->
<div class="status-bar">
<span>9:41</span>
<div class="right-icons">
<svg width="17" height="11" viewBox="0 0 17 11" fill="currentColor">
<rect x="0" y="7" width="3" height="4" rx="0.5"></rect>
<rect x="4.5" y="5" width="3" height="6" rx="0.5"></rect>
<rect x="9" y="2.5" width="3" height="8.5" rx="0.5"></rect>
<rect x="13.5" y="0" width="3" height="11" rx="0.5"></rect>
</svg>
<svg width="15" height="11" viewBox="0 0 15 11" fill="currentColor">
<path d="M7.5 1C5.3 1 3.2 1.7 1.5 3C-0.5 4.7 -0.5 7.5 1.5 9.2C1.9 9.6 2.5 9.6 2.9 9.2C3.3 8.8 3.3 8.2 2.9 7.8C1.6 6.5 1.6 4.4 2.9 3.1C4.2 1.8 6.3 1.4 8 2C10.1 2.7 11.7 4.4 12.2 6.5C12.5 7.3 12.4 8.1 11.8 8.7C11.4 9.1 11.4 9.7 11.8 10.1C12.2 10.5 12.8 10.5 13.2 10.1C14.2 9.1 14.5 7.7 14.2 6.3C13.6 4 12.1 2.3 10.2 1.3C9.3 1 8.4 0.9 7.5 1Z"></path>
</svg>
<svg width="25" height="12" viewBox="0 0 25 12" fill="none">
<rect x="0.5" y="0.5" width="21" height="11" rx="2.5" stroke="currentColor" opacity="0.5"></rect>
<rect x="2" y="2" width="18" height="8" rx="1.5" fill="currentColor"></rect>
<rect x="22.5" y="4" width="1.5" height="4" rx="0.5" fill="currentColor" opacity="0.5"></rect>
</svg>
</div>
</div>
<!-- 顶部导航 -->
<div class="top-nav">
<div class="location-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>
<span>清华大学</span>
<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="m6 9 6 6 6-6"></path>
</svg>
</div>
<div class="search-box">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8"></circle>
<path d="m21 21-4.3-4.3"></path>
</svg>
<span>搜索活动名称/主办方</span>
</div>
<button class="filter-btn" id="btn-filter" aria-label="筛选">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 3H2l8 9.46V19l4 2v-8.54L22 3z"></path>
</svg>
</button>
</div>
<!-- 分类筛选 -->
<div class="category-bar">
<div class="cat-tag active" data-cat="all">全部</div>
<div class="cat-tag" data-cat="thought">思想成长</div>
<div class="cat-tag" data-cat="innovation">创新创业</div>
<div class="cat-tag" data-cat="academic">学术科技</div>
<div class="cat-tag" data-cat="culture">文化艺术</div>
<div class="cat-tag" data-cat="sports">体育健康</div>
<div class="cat-tag" data-cat="volunteer">志愿公益</div>
<div class="cat-tag" data-cat="practice">社会实践</div>
</div>
<!-- 双列网格活动列表 -->
<div class="activity-grid">
<!-- 活动卡片1 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #E6FAF9 0%, #9AE7E4 100%);"></div>
<span class="status-tag signing">报名中</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+2学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
周五 19:00
</div>
<div class="card-title">青年大学习主题宣讲会</div>
<span class="card-category">思想成长</span>
</div>
</div>
<!-- 活动卡片2 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #FFF1B8 0%, #FFC53D 100%);"></div>
<span class="status-tag upcoming">即将开始</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+3学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
周六 14:00
</div>
<div class="card-title">互联网+创新创业大赛宣讲</div>
<span class="card-category">创新创业</span>
</div>
</div>
<!-- 活动卡片3 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #F0EEFF 0%, #9B8DFF 100%);"></div>
<span class="status-tag signing">报名中</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+1.5学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
周日 09:30
</div>
<div class="card-title">人工智能前沿技术学术讲座</div>
<span class="card-category">学术科技</span>
</div>
</div>
<!-- 活动卡片4 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #FFEBF2 0%, #FF8AAE 100%);"></div>
<span class="status-tag ongoing">进行中</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+4学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
每天 10:00
</div>
<div class="card-title">校园文化艺术节系列活动</div>
<span class="card-category">文化艺术</span>
</div>
</div>
<!-- 活动卡片5 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #E8F5E9 0%, #81C784 100%);"></div>
<span class="status-tag signing">报名中</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+1学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
周六 08:00
</div>
<div class="card-title">校园马拉松健康跑</div>
<span class="card-category">体育健康</span>
</div>
</div>
<!-- 活动卡片6 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #E8F8F6 0%, #68CFC9 100%);"></div>
<span class="status-tag upcoming">即将开始</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+2.5学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
下周一 14:00
</div>
<div class="card-title">敬老院志愿服务活动</div>
<span class="card-category">志愿公益</span>
</div>
</div>
<!-- 活动卡片7 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #FFEEDD 0%, #FFB980 100%);"></div>
<span class="status-tag signing">报名中</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+3学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
周日 09:00
</div>
<div class="card-title">乡村振兴暑期实践招募</div>
<span class="card-category">社会实践</span>
</div>
</div>
<!-- 活动卡片8 -->
<div class="activity-card">
<div class="card-cover">
<div class="cover-bg" style="background: linear-gradient(135deg, #E8EAF6 0%, #9FA8DA 100%);"></div>
<span class="status-tag signing">报名中</span>
<span class="hours-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
</svg>
+2学时
</span>
</div>
<div class="card-body">
<div class="card-time">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
周四 18:30
</div>
<div class="card-title">团课学习暨优秀团员分享会</div>
<span class="card-category">思想成长</span>
</div>
</div>
</div>
<!-- 浮动发布按钮 -->
<button class="fab-btn" aria-label="发布活动">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 5v14"></path>
<path d="M5 12h14"></path>
</svg>
</button>
<!-- 筛选面板遮罩 -->
<div class="filter-panel-overlay" id="filter-overlay"></div>
<!-- 筛选面板 -->
<div class="filter-panel" id="filter-panel">
<h3 class="filter-panel-title">筛选条件</h3>
<div class="filter-group">
<div class="filter-group-label">活动状态</div>
<div class="filter-options">
<div class="filter-option selected">全部</div>
<div class="filter-option">报名中</div>
<div class="filter-option">即将开始</div>
<div class="filter-option">进行中</div>
<div class="filter-option">已结束</div>
</div>
</div>
<div class="filter-group">
<div class="filter-group-label">学时类型</div>
<div class="filter-options">
<div class="filter-option selected">思想成长</div>
<div class="filter-option">创新创业</div>
<div class="filter-option">学术科技</div>
<div class="filter-option">文化艺术</div>
<div class="filter-option">体育健康</div>
<div class="filter-option">志愿公益</div>
<div class="filter-option">社会实践</div>
</div>
</div>
<div class="filter-group">
<div class="filter-group-label">活动时间</div>
<div class="filter-options">
<div class="filter-option selected">本周</div>
<div class="filter-option">下周</div>
<div class="filter-option">本月</div>
<div class="filter-option">本学期</div>
<div class="filter-option">不限</div>
</div>
</div>
<div class="filter-actions">
<button class="filter-reset-btn" id="filter-reset">重置</button>
<button class="filter-apply-btn" id="filter-apply">应用</button>
</div>
</div>
</div>
<script>
// 分类切换
const catTags = document.querySelectorAll('.cat-tag');
catTags.forEach(tag => {
tag.addEventListener('click', function() {
catTags.forEach(t => t.classList.remove('active'));
this.classList.add('active');
this.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
});
});
// 筛选面板
const filterBtn = document.getElementById('btn-filter');
const filterPanel = document.getElementById('filter-panel');
const filterOverlay = document.getElementById('filter-overlay');
const filterApply = document.getElementById('filter-apply');
const filterReset = document.getElementById('filter-reset');
function openFilter() {
filterPanel.classList.add('show');
filterOverlay.classList.add('show');
document.body.style.overflow = 'hidden';
}
function closeFilter() {
filterPanel.classList.remove('show');
filterOverlay.classList.remove('show');
document.body.style.overflow = '';
}
filterBtn.addEventListener('click', openFilter);
filterOverlay.addEventListener('click', closeFilter);
filterApply.addEventListener('click', closeFilter);
filterReset.addEventListener('click', function() {
document.querySelectorAll('.filter-option').forEach(opt => {
opt.classList.remove('selected');
});
const groups = document.querySelectorAll('.filter-group');
groups.forEach((group, index) => {
const opts = group.querySelectorAll('.filter-option');
if (opts[0]) opts[0].classList.add('selected');
});
});
// 筛选选项点击(单选组)
document.querySelectorAll('.filter-group').forEach(group => {
const opts = group.querySelectorAll('.filter-option');
opts.forEach(opt => {
opt.addEventListener('click', function() {
const label = group.querySelector('.filter-group-label').textContent;
if (label === '学时类型') {
// 多选
this.classList.toggle('selected');
} else {
// 单选
opts.forEach(o => o.classList.remove('selected'));
this.classList.add('selected');
}
});
});
});
</script>
</body>
</html>