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.
 
 

777 lines
23 KiB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>筛选 - Youthome</title>
<link rel="stylesheet" href="../colors_and_type.css" />
<style>
/* ============================================================
* 页面容器 - 375 x 812 移动端视口
* ============================================================ */
.page {
width: 375px;
height: 812px;
margin: 0 auto;
background: var(--youth-bg-page);
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
}
/* ============================================================
* 状态栏 44px
* ============================================================ */
.status-bar {
height: 44px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
font-size: 15px;
font-weight: 600;
color: var(--youth-text-primary);
background: var(--youth-bg-page);
}
.status-bar .status-right {
display: flex;
align-items: center;
gap: 5px;
font-size: 12px;
}
/* ============================================================
* 顶部导航栏
* ============================================================ */
.nav-bar {
height: 44px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
background: var(--youth-bg-page);
position: relative;
}
.nav-btn {
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
color: var(--youth-text-primary);
font-size: 20px;
cursor: pointer;
border-radius: 8px;
transition: background 0.2s ease;
}
.nav-btn:active {
background: var(--youth-bg-hover);
}
.nav-title {
position: absolute;
left: 50%;
transform: translateX(-50%);
font-size: 17px;
font-weight: 600;
color: var(--youth-text-primary);
}
.nav-reset {
font-size: 14px;
font-weight: 500;
color: var(--youth-primary);
cursor: pointer;
padding: 6px 4px;
transition: opacity 0.2s ease;
}
.nav-reset:active {
opacity: 0.7;
}
/* ============================================================
* 筛选内容区(内部滚动)
* ============================================================ */
.filter-content {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 8px 16px 24px;
-webkit-overflow-scrolling: touch;
}
/* 隐藏滚动条 */
.filter-content::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
}
.filter-content {
scrollbar-width: none;
-ms-overflow-style: none;
}
/* 筛选区块 */
.filter-section {
margin-bottom: 20px;
}
.filter-section-title {
font-size: 14px;
font-weight: 600;
color: var(--youth-text-primary);
margin-bottom: 10px;
}
/* ============================================================
* 输入框(带图标)
* ============================================================ */
.filter-input-wrap {
position: relative;
margin-bottom: 10px;
}
.filter-input {
width: 100%;
height: 44px;
padding: 0 16px 0 40px;
background: var(--youth-bg-card);
border: 1px solid var(--youth-border-light);
border-radius: 8px;
font-size: 14px;
color: var(--youth-text-primary);
outline: none;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
transition: all 0.2s ease;
}
.filter-input::placeholder {
color: var(--youth-text-placeholder);
}
.filter-input:focus {
border-color: var(--youth-primary);
box-shadow: inset 0 1px 3px rgba(38, 194, 187, 0.06), 0 0 0 3px rgba(38, 194, 187, 0.1);
}
.filter-input-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
width: 20px;
height: 20px;
color: var(--youth-text-tertiary);
display: flex;
align-items: center;
justify-content: center;
}
/* ============================================================
* 热门标签行(横向滚动)
* ============================================================ */
.hot-tags-row {
display: flex;
gap: 8px;
overflow-x: auto;
overflow-y: hidden;
padding-bottom: 2px;
-webkit-overflow-scrolling: touch;
}
.hot-tags-row::-webkit-scrollbar {
display: none;
}
.hot-tags-row {
scrollbar-width: none;
-ms-overflow-style: none;
}
.tag-chip {
flex-shrink: 0;
height: 32px;
padding: 0 14px;
display: inline-flex;
align-items: center;
justify-content: center;
background: var(--youth-bg-input);
color: var(--youth-text-secondary);
font-size: 13px;
border-radius: 16px;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
user-select: none;
}
.tag-chip:active {
transform: scale(0.96);
}
.tag-chip.active {
background: linear-gradient(135deg, #54CAC5 0%, #26C2BB 50%, #1FA8A2 100%);
color: #fff;
font-weight: 500;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.25);
}
/* ============================================================
* 性别单选按钮
* ============================================================ */
.gender-group {
display: flex;
gap: 12px;
}
.gender-option {
flex: 1;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
background: var(--youth-bg-card);
border: 1.5px solid var(--youth-border);
border-radius: 8px;
font-size: 14px;
color: var(--youth-text-secondary);
cursor: pointer;
transition: all 0.2s ease;
user-select: none;
}
.gender-option:active {
transform: scale(0.98);
}
.gender-option.active {
border-color: var(--youth-primary);
color: var(--youth-primary);
font-weight: 500;
}
.gender-radio {
width: 18px;
height: 18px;
border-radius: 50%;
border: 1.5px solid var(--youth-gray-400);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.gender-option.active .gender-radio {
border-color: var(--youth-primary);
}
.gender-radio-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--youth-primary);
transform: scale(0);
transition: transform 0.2s ease;
}
.gender-option.active .gender-radio-dot {
transform: scale(1);
}
/* ============================================================
* 学历标签(等分)
* ============================================================ */
.degree-group {
display: flex;
gap: 10px;
}
.degree-tag {
flex: 1;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: var(--youth-bg-input);
color: var(--youth-text-secondary);
font-size: 14px;
border-radius: 16px;
cursor: pointer;
transition: all 0.2s ease;
user-select: none;
}
.degree-tag:active {
transform: scale(0.97);
}
.degree-tag.active {
background: linear-gradient(135deg, #54CAC5 0%, #26C2BB 50%, #1FA8A2 100%);
color: #fff;
font-weight: 500;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.25);
}
/* ============================================================
* 年级标签行(横向滚动)
* ============================================================ */
.grade-row {
display: flex;
gap: 8px;
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
padding-bottom: 2px;
}
.grade-row::-webkit-scrollbar {
display: none;
}
.grade-row {
scrollbar-width: none;
-ms-overflow-style: none;
}
.grade-tag {
flex-shrink: 0;
height: 34px;
padding: 0 16px;
display: inline-flex;
align-items: center;
justify-content: center;
background: var(--youth-bg-input);
color: var(--youth-text-secondary);
font-size: 13px;
border-radius: 16px;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
user-select: none;
}
.grade-tag:active {
transform: scale(0.96);
}
.grade-tag.active {
background: linear-gradient(135deg, #54CAC5 0%, #26C2BB 50%, #1FA8A2 100%);
color: #fff;
font-weight: 500;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.25);
}
/* ============================================================
* 城市标签网格
* ============================================================ */
.city-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
}
.city-tag {
height: 44px;
display: flex;
align-items: center;
justify-content: center;
background: var(--youth-bg-input);
color: var(--youth-text-secondary);
font-size: 13px;
border-radius: 12px;
cursor: pointer;
transition: all 0.2s ease;
user-select: none;
}
.city-tag:active {
transform: scale(0.96);
}
.city-tag.active {
background: linear-gradient(135deg, #54CAC5 0%, #26C2BB 50%, #1FA8A2 100%);
color: #fff;
font-weight: 500;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.25);
}
/* ============================================================
* 底部操作栏(毛玻璃)
* ============================================================ */
.bottom-bar {
flex-shrink: 0;
height: 84px;
padding: 12px 16px 28px;
display: flex;
align-items: center;
justify-content: space-between;
background: rgba(255, 255, 255, 0.72);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border-top: 1px solid rgba(255, 255, 255, 0.3);
position: relative;
}
.bottom-bar::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 1px;
background: var(--youth-divider);
opacity: 0.5;
}
.result-count {
font-size: 12px;
color: var(--youth-text-tertiary);
}
.result-count strong {
color: var(--youth-primary);
font-weight: 600;
font-size: 14px;
}
.btn-view-result {
height: 44px;
padding: 0 28px;
background: linear-gradient(135deg, #54CAC5 0%, #26C2BB 50%, #1FA8A2 100%);
color: #fff;
border: none;
border-radius: 8px;
font-size: 15px;
font-weight: 600;
cursor: pointer;
box-shadow: 0 2px 12px rgba(38, 194, 187, 0.3);
transition: all 0.2s ease;
}
.btn-view-result:active {
transform: scale(0.97);
box-shadow: 0 1px 4px rgba(38, 194, 187, 0.2);
}
</style>
</head>
<body>
<div class="page">
<!-- 状态栏 -->
<div class="status-bar">
<span>9:41</span>
<div class="status-right">
<svg width="16" height="12" viewBox="0 0 16 12" fill="currentColor">
<path d="M1 8C2.5 8 3.5 7 4.5 6C5.5 5 7 4 8 4C9 4 10.5 5 11.5 6C12.5 7 13.5 8 15 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" fill="none"/>
<circle cx="8" cy="9.5" r="1.5" fill="currentColor"/>
</svg>
<svg width="24" height="12" viewBox="0 0 24 12" fill="currentColor">
<rect x="0.5" y="0.5" width="20" height="11" rx="2.5" stroke="currentColor" fill="none"/>
<rect x="2" y="2" width="15" height="8" rx="1.5" fill="currentColor"/>
<rect x="21.5" y="4" width="2" height="4" rx="1" fill="currentColor"/>
</svg>
</div>
</div>
<!-- 顶部导航栏 -->
<div class="nav-bar">
<div class="nav-btn" onclick="closeFilter()" aria-label="关闭">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="5" y1="5" x2="15" y2="15"></line>
<line x1="15" y1="5" x2="5" y2="15"></line>
</svg>
</div>
<div class="nav-title">筛选</div>
<div class="nav-reset" onclick="resetFilter()">重置</div>
</div>
<!-- 筛选内容区 -->
<div class="filter-content" id="filterContent">
<!-- 学校 -->
<div class="filter-section">
<div class="filter-section-title">学校</div>
<div class="filter-input-wrap">
<div class="filter-input-icon">
<!-- 学校建筑图标 -->
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 10v12"/>
<path d="M2 22V7l10-5 10 5v3"/>
<path d="M6 12v10"/>
<path d="M10 12v10"/>
<path d="M14 12v10"/>
<path d="M18 12v10"/>
</svg>
</div>
<input type="text" class="filter-input" placeholder="输入学校名称" id="schoolInput" />
</div>
<div class="hot-tags-row" id="schoolTags">
<div class="tag-chip" data-value="清华大学">清华大学</div>
<div class="tag-chip" data-value="北京大学">北京大学</div>
<div class="tag-chip" data-value="浙江大学">浙江大学</div>
<div class="tag-chip" data-value="复旦大学">复旦大学</div>
<div class="tag-chip" data-value="上海交大">上海交大</div>
<div class="tag-chip" data-value="南京大学">南京大学</div>
</div>
</div>
<!-- 性别 -->
<div class="filter-section">
<div class="filter-section-title">性别</div>
<div class="gender-group" id="genderGroup">
<div class="gender-option active" data-value="不限">
<div class="gender-radio">
<div class="gender-radio-dot"></div>
</div>
<span>不限</span>
</div>
<div class="gender-option" data-value="男">
<div class="gender-radio">
<div class="gender-radio-dot"></div>
</div>
<span>男</span>
</div>
<div class="gender-option" data-value="女">
<div class="gender-radio">
<div class="gender-radio-dot"></div>
</div>
<span>女</span>
</div>
</div>
</div>
<!-- 专业 -->
<div class="filter-section">
<div class="filter-section-title">专业</div>
<div class="filter-input-wrap">
<div class="filter-input-icon">
<!-- 书本图标 -->
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/>
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>
</svg>
</div>
<input type="text" class="filter-input" placeholder="输入专业名称" id="majorInput" />
</div>
</div>
<!-- 学历 -->
<div class="filter-section">
<div class="filter-section-title">学历</div>
<div class="degree-group" id="degreeGroup">
<div class="degree-tag active" data-value="本科">本科</div>
<div class="degree-tag" data-value="硕士">硕士</div>
<div class="degree-tag" data-value="博士">博士</div>
</div>
</div>
<!-- 年级 -->
<div class="filter-section">
<div class="filter-section-title">年级</div>
<div class="grade-row" id="gradeRow">
<div class="grade-tag" data-value="大一">大一</div>
<div class="grade-tag" data-value="大二">大二</div>
<div class="grade-tag" data-value="大三">大三</div>
<div class="grade-tag" data-value="大四">大四</div>
<div class="grade-tag" data-value="研一">研一</div>
<div class="grade-tag" data-value="研二">研二</div>
<div class="grade-tag" data-value="研三">研三</div>
<div class="grade-tag" data-value="博士">博士</div>
</div>
</div>
<!-- 所在城市 -->
<div class="filter-section">
<div class="filter-section-title">所在城市</div>
<div class="city-grid" id="cityGrid">
<div class="city-tag" data-value="北京">北京</div>
<div class="city-tag" data-value="上海">上海</div>
<div class="city-tag" data-value="杭州">杭州</div>
<div class="city-tag" data-value="南京">南京</div>
<div class="city-tag" data-value="广州">广州</div>
<div class="city-tag" data-value="成都">成都</div>
<div class="city-tag" data-value="武汉">武汉</div>
<div class="city-tag" data-value="西安">西安</div>
</div>
</div>
</div>
<!-- 底部操作栏 -->
<div class="bottom-bar">
<div class="result-count">
共找到 <strong id="resultCount">128</strong> 人
</div>
<button class="btn-view-result" onclick="viewResults()">查看结果</button>
</div>
</div>
<script>
// 筛选状态管理
const filterState = {
school: '',
schoolTags: [],
gender: '不限',
major: '',
degree: '本科',
grade: [],
city: []
};
// 学校标签 - 单选
document.querySelectorAll('#schoolTags .tag-chip').forEach(tag => {
tag.addEventListener('click', function() {
const value = this.dataset.value;
const isActive = this.classList.contains('active');
// 单选逻辑
document.querySelectorAll('#schoolTags .tag-chip').forEach(t => t.classList.remove('active'));
if (!isActive) {
this.classList.add('active');
filterState.schoolTags = [value];
} else {
filterState.schoolTags = [];
}
updateResultCount();
});
});
// 性别单选
document.querySelectorAll('#genderGroup .gender-option').forEach(option => {
option.addEventListener('click', function() {
document.querySelectorAll('#genderGroup .gender-option').forEach(o => o.classList.remove('active'));
this.classList.add('active');
filterState.gender = this.dataset.value;
updateResultCount();
});
});
// 学历单选
document.querySelectorAll('#degreeGroup .degree-tag').forEach(tag => {
tag.addEventListener('click', function() {
document.querySelectorAll('#degreeGroup .degree-tag').forEach(t => t.classList.remove('active'));
this.classList.add('active');
filterState.degree = this.dataset.value;
updateResultCount();
});
});
// 年级多选
document.querySelectorAll('#gradeRow .grade-tag').forEach(tag => {
tag.addEventListener('click', function() {
const value = this.dataset.value;
this.classList.toggle('active');
if (this.classList.contains('active')) {
if (!filterState.grade.includes(value)) {
filterState.grade.push(value);
}
} else {
filterState.grade = filterState.grade.filter(v => v !== value);
}
updateResultCount();
});
});
// 城市多选
document.querySelectorAll('#cityGrid .city-tag').forEach(tag => {
tag.addEventListener('click', function() {
const value = this.dataset.value;
this.classList.toggle('active');
if (this.classList.contains('active')) {
if (!filterState.city.includes(value)) {
filterState.city.push(value);
}
} else {
filterState.city = filterState.city.filter(v => v !== value);
}
updateResultCount();
});
});
// 学校输入框
document.getElementById('schoolInput').addEventListener('input', function(e) {
filterState.school = e.target.value;
updateResultCount();
});
// 专业输入框
document.getElementById('majorInput').addEventListener('input', function(e) {
filterState.major = e.target.value;
updateResultCount();
});
// 更新结果计数(模拟)
function updateResultCount() {
let count = 128;
if (filterState.school || filterState.schoolTags.length > 0) count = Math.max(8, count - 40);
if (filterState.gender !== '不限') count = Math.max(5, count - 20);
if (filterState.major) count = Math.max(3, count - 30);
if (filterState.grade.length > 0) count = Math.max(2, count - 15 * filterState.grade.length);
if (filterState.city.length > 0) count = Math.max(1, count - 10 * filterState.city.length);
document.getElementById('resultCount').textContent = count;
}
// 重置筛选
function resetFilter() {
filterState.school = '';
filterState.schoolTags = [];
filterState.gender = '不限';
filterState.major = '';
filterState.degree = '本科';
filterState.grade = [];
filterState.city = [];
// 清空输入框
document.getElementById('schoolInput').value = '';
document.getElementById('majorInput').value = '';
// 重置学校标签
document.querySelectorAll('#schoolTags .tag-chip').forEach(t => t.classList.remove('active'));
// 重置性别
document.querySelectorAll('#genderGroup .gender-option').forEach((o, i) => {
o.classList.toggle('active', i === 0);
});
// 重置学历
document.querySelectorAll('#degreeGroup .degree-tag').forEach((t, i) => {
t.classList.toggle('active', i === 0);
});
// 重置年级
document.querySelectorAll('#gradeRow .grade-tag').forEach(t => t.classList.remove('active'));
// 重置城市
document.querySelectorAll('#cityGrid .city-tag').forEach(t => t.classList.remove('active'));
updateResultCount();
}
// 关闭筛选
function closeFilter() {
if (window.history.length > 1) {
window.history.back();
} else {
window.close();
}
}
// 查看结果
function viewResults() {
const params = new URLSearchParams();
if (filterState.school) params.set('school', filterState.school);
if (filterState.schoolTags.length > 0) params.set('schoolTags', filterState.schoolTags.join(','));
if (filterState.gender && filterState.gender !== '不限') params.set('gender', filterState.gender);
if (filterState.major) params.set('major', filterState.major);
if (filterState.degree) params.set('degree', filterState.degree);
if (filterState.grade.length > 0) params.set('grade', filterState.grade.join(','));
if (filterState.city.length > 0) params.set('city', filterState.city.join(','));
const url = 'friends-list.html' + (params.toString() ? '?' + params.toString() : '');
window.location.href = url;
}
</script>
</body>
</html>