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.
 
 

1271 lines
37 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>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="../colors_and_type.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
:root {
/* Traework 设计令牌 - 圆角/间距/阴影/高度 */
--radius-xs: 4px;
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--radius-xl: 20px;
--radius-full: 9999px;
--height-btn: 44px;
--height-input: 44px;
--height-nav: 64px;
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 24px;
--shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
--shadow-card-hover: 0 6px 20px rgba(0, 0, 0, 0.06);
--shadow-btn: 0 2px 8px rgba(38, 194, 187, 0.25);
--shadow-btn-hover: 0 4px 16px rgba(38, 194, 187, 0.35);
--shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.12);
--shadow-float: 0 4px 24px rgba(0, 0, 0, 0.08);
--shadow-inset: inset 0 1px 3px rgba(0, 0, 0, 0.03);
--glass-bg: rgba(255, 255, 255, 0.72);
--glass-blur: blur(20px);
--glass-border: rgba(255, 255, 255, 0.3);
}
html, body {
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'SF Pro Display', 'Helvetica Neue', 'Segoe UI', Roboto, sans-serif;
background: var(--youth-bg-page);
color: var(--youth-text-primary);
min-height: 100vh;
overflow-x: hidden;
}
.app-container {
width: 375px;
height: 812px;
margin: 0 auto;
background: var(--youth-bg-page);
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
}
/* ===== 状态栏 ===== */
.status-bar {
height: 36px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
font-size: 14px;
font-weight: 600;
color: var(--youth-text-primary);
position: relative;
z-index: 10;
flex-shrink: 0;
}
.status-bar .right-icons {
display: flex;
align-items: center;
gap: 6px;
}
.status-bar svg {
width: 16px;
height: 16px;
}
/* ===== 导航栏 ===== */
.nav-bar {
height: 64px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
position: relative;
flex-shrink: 0;
}
.nav-btn {
width: 34px;
height: 34px;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--youth-radius-lg);
background: var(--youth-gradient-matte-card);
border: 1px solid var(--youth-border-light);
box-shadow: var(--shadow-card), var(--youth-shadow-inset-light);
cursor: pointer;
transition: all 0.2s ease;
color: var(--youth-text-primary);
}
.nav-btn:active {
transform: scale(0.95);
box-shadow: var(--youth-shadow-inset-deep);
}
.nav-title {
font-size: 17px;
font-weight: 600;
color: var(--youth-text-primary);
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.btn-save {
height: 32px;
padding: 0 16px;
border-radius: var(--youth-radius-full);
background: var(--youth-gradient-primary);
color: white;
font-size: 13px;
font-weight: 600;
border: none;
cursor: pointer;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.3);
transition: all 0.2s ease;
position: relative;
overflow: hidden;
}
.btn-save::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 50%;
background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 100%);
pointer-events: none;
}
.btn-save:active {
transform: scale(0.96);
box-shadow: 0 1px 4px rgba(38, 194, 187, 0.2);
}
/* ===== 内容滚动区 ===== */
.content-scroll {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
position: relative;
z-index: 1;
min-height: 0;
-webkit-overflow-scrolling: touch;
}
.content-scroll::-webkit-scrollbar {
display: none;
}
/* ===== 头像区 ===== */
.avatar-section {
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 20px 16px;
}
.avatar-wrapper {
position: relative;
width: 82px;
height: 82px;
cursor: pointer;
transition: all 0.2s ease;
}
.avatar-wrapper:active {
transform: scale(0.96);
}
.avatar-ring {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 50%;
padding: 3px;
background: var(--youth-gradient-primary);
box-shadow: 0 4px 16px rgba(38, 194, 187, 0.3);
}
.avatar-inner {
width: 100%;
height: 100%;
border-radius: 50%;
background: var(--youth-gradient-matte-card);
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--youth-shadow-inset-dark);
position: relative;
overflow: hidden;
border: 2px solid var(--youth-bg-card);
}
.avatar-inner img {
width: 100%;
height: 100%;
object-fit: cover;
}
.avatar-placeholder-icon {
color: var(--youth-gray-400);
}
.avatar-camera-btn {
position: absolute;
bottom: 0;
right: 0;
width: 30px;
height: 30px;
border-radius: 50%;
background: var(--youth-gradient-primary);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 3px 10px rgba(38, 194, 187, 0.45),
var(--youth-shadow-inset-light);
border: 2.5px solid var(--youth-bg-card);
z-index: 2;
}
.avatar-camera-btn svg {
width: 15px;
height: 15px;
color: white;
}
.avatar-hint {
margin-top: 10px;
font-size: 13px;
color: var(--youth-primary);
font-weight: 500;
cursor: pointer;
}
.avatar-hint:active {
opacity: 0.7;
}
/* ===== 表单分组卡片 ===== */
.form-group-card {
margin: 0 16px 12px;
background: var(--youth-gradient-matte-card);
border-radius: 16px;
border: 1px solid var(--youth-border-light);
box-shadow: var(--youth-shadow-card), var(--youth-shadow-inset-light);
overflow: hidden;
}
.form-item {
display: flex;
align-items: center;
padding: 12px 16px;
min-height: 48px;
border-bottom: 1px solid var(--youth-border-light);
cursor: pointer;
transition: background-color 0.2s ease;
}
.form-item:last-child {
border-bottom: none;
}
.form-item:active {
background: var(--youth-bg-hover);
}
.form-item-label {
font-size: 15px;
color: var(--youth-text-primary);
font-weight: 500;
flex-shrink: 0;
width: 80px;
}
.form-item-content {
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 6px;
}
.form-item-input {
flex: 1;
text-align: right;
background: transparent;
border: none;
outline: none;
font-size: 15px;
color: var(--youth-text-primary);
font-weight: 500;
padding: 0;
}
.form-item-input::placeholder {
color: var(--youth-text-placeholder);
}
.form-item-value {
font-size: 15px;
color: var(--youth-text-secondary);
font-weight: 500;
}
.form-item-value.primary {
color: var(--youth-text-primary);
}
.form-item-arrow {
color: var(--youth-gray-400);
flex-shrink: 0;
margin-left: 2px;
}
.form-item-arrow svg {
width: 16px;
height: 16px;
}
/* 青青号样式 */
.qingqing-id {
font-size: 14px;
color: var(--youth-text-tertiary);
font-weight: 500;
}
.id-locked-hint {
font-size: 11px;
color: var(--youth-text-quaternary);
margin-left: 4px;
}
/* 已认证徽章 */
.verified-badge {
display: inline-flex;
align-items: center;
gap: 3px;
padding: 3px 8px;
background: linear-gradient(135deg, rgba(38, 194, 187, 0.12) 0%, rgba(38, 194, 187, 0.06) 100%);
border-radius: var(--youth-radius-full);
font-size: 11px;
color: var(--youth-primary);
font-weight: 600;
flex-shrink: 0;
border: 1px solid rgba(38, 194, 187, 0.2);
}
.verified-badge svg {
width: 12px;
height: 12px;
}
.locked-value {
color: var(--youth-text-tertiary);
font-size: 14px;
}
/* 学校信息提示 */
.school-hint {
padding: 10px 16px 14px;
font-size: 12px;
color: var(--youth-text-tertiary);
line-height: 1.5;
display: flex;
align-items: flex-start;
gap: 6px;
}
.school-hint svg {
width: 14px;
height: 14px;
flex-shrink: 0;
margin-top: 1px;
color: var(--youth-text-quaternary);
}
/* ===== 个人简介 ===== */
.bio-section {
padding: 12px 16px 14px;
}
.bio-label {
font-size: 15px;
font-weight: 500;
color: var(--youth-text-primary);
margin-bottom: 10px;
}
.bio-textarea-wrapper {
position: relative;
background: var(--youth-bg-input);
border-radius: 12px;
border: 1px solid var(--youth-border-light);
box-shadow: var(--youth-shadow-inset-dark);
padding: 12px;
transition: all 0.2s ease;
}
.bio-textarea-wrapper:focus-within {
border-color: var(--youth-primary);
box-shadow: var(--youth-shadow-inset-dark), 0 0 0 3px rgba(38, 194, 187, 0.12);
}
.bio-textarea {
width: 100%;
min-height: 72px;
background: transparent;
border: none;
outline: none;
font-size: 14px;
color: var(--youth-text-primary);
line-height: 1.6;
resize: none;
font-family: inherit;
}
.bio-textarea::placeholder {
color: var(--youth-text-placeholder);
}
.bio-count {
position: absolute;
right: 12px;
bottom: 8px;
font-size: 11px;
color: var(--youth-text-quaternary);
font-weight: 500;
}
/* ===== 标签区 ===== */
.tags-section {
margin: 0 16px 12px;
padding: 14px 16px;
background: var(--youth-gradient-matte-card);
border-radius: 16px;
border: 1px solid var(--youth-border-light);
box-shadow: var(--youth-shadow-card), var(--youth-shadow-inset-light);
}
.tags-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.tags-title {
font-size: 15px;
font-weight: 500;
color: var(--youth-text-primary);
}
.tags-edit-link {
font-size: 13px;
color: var(--youth-primary);
font-weight: 500;
cursor: pointer;
}
.tags-edit-link:active {
opacity: 0.7;
}
.tags-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tag-item {
padding: 6px 12px;
border-radius: var(--youth-radius-full);
font-size: 12px;
font-weight: 500;
line-height: 1.4;
box-shadow: var(--youth-shadow-inset-light);
}
.tag-photography {
background: linear-gradient(135deg, #FFE4C8 0%, #FFCF99 100%);
color: #995817;
}
.tag-travel {
background: linear-gradient(135deg, #C8F3F1 0%, #9AE7E4 100%);
color: #11615E;
}
.tag-coding {
background: linear-gradient(135deg, #DED9FF 0%, #BCB3FF 100%);
color: #3A2699;
}
/* ===== 底部安全区域 ===== */
.bottom-safe-area {
height: 34px;
flex-shrink: 0;
background: var(--youth-bg-page);
}
.home-indicator {
position: absolute;
bottom: 8px;
left: 50%;
transform: translateX(-50%);
width: 134px;
height: 5px;
border-radius: var(--youth-radius-full);
background: var(--youth-text-primary);
opacity: 0.3;
}
/* ===== 选择器蒙层 ===== */
.picker-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.45);
z-index: 998;
display: none;
opacity: 0;
transition: opacity 0.3s ease;
}
.picker-mask.show {
display: block;
opacity: 1;
}
.bottom-sheet {
position: fixed;
left: 0;
right: 0;
bottom: 0;
background: var(--youth-bg-card);
border-radius: 20px 20px 0 0;
z-index: 999;
transform: translateY(100%);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
padding-bottom: 34px;
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}
.bottom-sheet.show {
transform: translateY(0);
}
.sheet-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 16px;
border-bottom: 1px solid var(--youth-border-light);
}
.sheet-title {
font-size: 16px;
font-weight: 600;
color: var(--youth-text-primary);
}
.sheet-cancel, .sheet-confirm {
font-size: 15px;
font-weight: 500;
cursor: pointer;
padding: 4px 8px;
}
.sheet-cancel {
color: var(--youth-text-tertiary);
}
.sheet-confirm {
color: var(--youth-primary);
}
.sheet-options {
padding: 8px 0;
}
.sheet-option {
padding: 14px 20px;
font-size: 16px;
color: var(--youth-text-primary);
cursor: pointer;
transition: background-color 0.2s ease;
display: flex;
align-items: center;
justify-content: space-between;
}
.sheet-option:active {
background: var(--youth-bg-hover);
}
.sheet-option.selected {
color: var(--youth-primary);
font-weight: 500;
}
.sheet-option svg {
width: 18px;
height: 18px;
}
/* 头像选择器 */
.avatar-sheet-options {
padding: 12px 16px 16px;
}
.avatar-sheet-btn {
width: 100%;
height: 50px;
border-radius: 12px;
background: var(--youth-bg-input);
border: 1px solid var(--youth-border-light);
box-shadow: var(--youth-shadow-inset-dark);
font-size: 16px;
color: var(--youth-text-primary);
font-weight: 500;
cursor: pointer;
margin-bottom: 10px;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.avatar-sheet-btn:active {
transform: scale(0.98);
background: var(--youth-bg-hover);
}
.avatar-sheet-btn svg {
width: 20px;
height: 20px;
color: var(--youth-primary);
}
.avatar-sheet-cancel {
width: 100%;
height: 50px;
border-radius: 12px;
background: var(--youth-bg-card);
border: 1px solid var(--youth-border-light);
font-size: 16px;
color: var(--youth-text-secondary);
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.avatar-sheet-cancel:active {
transform: scale(0.98);
background: var(--youth-bg-hover);
}
/* ===== Toast 提示 ===== */
.toast {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 12px 20px;
background: rgba(0, 0, 0, 0.8);
color: white;
font-size: 14px;
border-radius: 12px;
z-index: 300;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
white-space: nowrap;
}
.toast.show {
opacity: 1;
}
/* ===== 背景装饰 ===== */
.bg-decoration {
position: absolute;
top: -80px;
right: -100px;
width: 300px;
height: 300px;
background: radial-gradient(circle, rgba(38, 194, 187, 0.08) 0%, transparent 70%);
border-radius: 50%;
pointer-events: none;
z-index: 0;
}
.bg-decoration-2 {
position: absolute;
bottom: 100px;
left: -120px;
width: 280px;
height: 280px;
background: radial-gradient(circle, rgba(123, 97, 255, 0.05) 0%, transparent 70%);
border-radius: 50%;
pointer-events: none;
z-index: 0;
}
/* ===== 分组标题 ===== */
.group-title {
padding: 14px 20px 8px;
font-size: 13px;
font-weight: 600;
color: var(--youth-text-tertiary);
letter-spacing: 0.02em;
}
/* SVG 图标统一尺寸 */
.icon-svg {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1em;
height: 1em;
vertical-align: middle;
line-height: 1;
}
.icon-svg svg {
width: 100%;
height: 100%;
stroke: currentColor;
}
/* 侧栏图标 */
.sidebar-icon .icon-svg { width: 22px; height: 22px; font-size: 22px; }
/* 社团logo图标 */
.club-logo .icon-svg { width: 28px; height: 28px; font-size: 28px; color: #fff; }
/* 头图大图标 */
.hero-icon .icon-svg { width: 56px; height: 56px; font-size: 56px; opacity: 0.3; }
/* meta 小图标 */
.club-meta .icon-svg { width: 12px; height: 12px; font-size: 12px; }
/* 分类选择网格图标 */
.cat-option .icon-svg { width: 26px; height: 26px; font-size: 26px; }
/* logo预览图标 */
.logo-preview .icon-svg { width: 40px; height: 40px; font-size: 40px; color: #fff; }
/* 提示图标 */
.notice-icon .icon-svg { width: 18px; height: 18px; font-size: 18px; }
</style>
</head>
<body>
<div class="app-container" id="page-profile-edit">
<!-- 背景装饰 -->
<div class="bg-decoration"></div>
<div class="bg-decoration-2"></div>
<!-- 状态栏 -->
<div class="status-bar">
<span>9:41</span>
<div class="right-icons">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z"></path>
</svg>
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4z"></path>
</svg>
</div>
</div>
<!-- 导航栏 -->
<div class="nav-bar">
<button class="nav-btn" data-dom-id="btn-back" onclick="handleBack()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="15 18 9 12 15 6"></polyline>
</svg>
</button>
<span class="nav-title">编辑资料</span>
<button class="btn-save" data-dom-id="btn-save" onclick="handleSave()">保存</button>
</div>
<!-- 内容滚动区 -->
<div class="content-scroll">
<!-- 头像区 -->
<div class="avatar-section" data-dom-id="avatar-container">
<div class="avatar-wrapper" data-dom-id="btn-change-avatar" onclick="showAvatarPicker()">
<div class="avatar-ring">
<div class="avatar-inner">
<svg class="avatar-placeholder-icon" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
</div>
</div>
<div class="avatar-camera-btn">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path>
<circle cx="12" cy="13" r="4"></circle>
</svg>
</div>
</div>
<span class="avatar-hint" onclick="showAvatarPicker()">更换头像</span>
</div>
<!-- 分组标题:基本信息 -->
<div class="group-title">基本信息</div>
<!-- 第一组:基本信息 -->
<div class="form-group-card">
<!-- 昵称 -->
<div class="form-item" onclick="document.getElementById('input-nickname').focus()">
<span class="form-item-label">昵称</span>
<div class="form-item-content">
<input
type="text"
id="input-nickname"
class="form-item-input"
data-dom-id="input-nickname"
value="张同学"
maxlength="20"
placeholder="请输入昵称"
onclick="event.stopPropagation()"
oninput="handleNicknameInput(this)"
>
</div>
</div>
<!-- 青青号 -->
<div class="form-item" onclick="showToast('青青号不可修改')">
<span class="form-item-label">青青号</span>
<div class="form-item-content">
<span class="qingqing-id" data-dom-id="input-qingqing-id">@zhangtx</span>
<span class="id-locked-hint">不可修改</span>
</div>
</div>
<!-- 性别 -->
<div class="form-item" data-dom-id="item-gender" onclick="showGenderPicker()">
<span class="form-item-label">性别</span>
<div class="form-item-content">
<span class="form-item-value primary" id="value-gender">男</span>
<span class="form-item-arrow">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</span>
</div>
</div>
<!-- 生日 -->
<div class="form-item" data-dom-id="item-birthday" onclick="showBirthdayPicker()">
<span class="form-item-label">生日</span>
<div class="form-item-content">
<span class="form-item-value primary" id="value-birthday">2001-06-15</span>
<span class="form-item-arrow">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</span>
</div>
</div>
<!-- 家乡 -->
<div class="form-item" data-dom-id="item-hometown" onclick="showHometownPicker()">
<span class="form-item-label">家乡</span>
<div class="form-item-content">
<span class="form-item-value primary" id="value-hometown">浙江·杭州</span>
<span class="form-item-arrow">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</span>
</div>
</div>
</div>
<!-- 分组标题:学校信息 -->
<div class="group-title">学校信息(已认证)</div>
<!-- 第二组:学校信息 -->
<div class="form-group-card">
<!-- 学校 -->
<div class="form-item" data-dom-id="info-school" onclick="showVerifiedHint()">
<span class="form-item-label">学校</span>
<div class="form-item-content">
<span class="locked-value">清华大学</span>
</div>
</div>
<!-- 学历 -->
<div class="form-item" data-dom-id="info-degree" onclick="showVerifiedHint()">
<span class="form-item-label">学历</span>
<div class="form-item-content">
<span class="locked-value">本科</span>
</div>
</div>
<!-- 入学年份 -->
<div class="form-item" data-dom-id="info-year" onclick="showVerifiedHint()">
<span class="form-item-label">入学年份</span>
<div class="form-item-content">
<span class="locked-value">2022级</span>
</div>
</div>
<!-- 专业 -->
<div class="form-item" data-dom-id="info-major" onclick="showVerifiedHint()">
<span class="form-item-label">专业</span>
<div class="form-item-content">
<span class="locked-value">计算机科学与技术</span>
</div>
</div>
<!-- 提示文字 -->
<div class="school-hint">
<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>
<line x1="12" y1="16" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12.01" y2="8"></line>
</svg>
<span>学校信息通过学信网认证,不可自行修改</span>
</div>
</div>
<!-- 分组标题:个人简介 -->
<div class="group-title">个人简介</div>
<!-- 第三组:个人简介 -->
<div class="form-group-card">
<div class="bio-section">
<div class="bio-label">介绍一下自己吧</div>
<div class="bio-textarea-wrapper">
<textarea
id="input-bio"
class="bio-textarea"
data-dom-id="input-bio"
maxlength="200"
placeholder="介绍一下自己吧,让同学们更好地认识你~"
oninput="handleBioInput(this)"
>热爱摄影和旅行的计算机系学生,喜欢探索城市角落,用镜头记录生活。偶尔写点代码,做点小项目。</textarea>
<span class="bio-count" data-dom-id="bio-count" id="bio-count">48/200</span>
</div>
</div>
</div>
<!-- 标签区 -->
<div class="tags-section">
<div class="tags-header">
<span class="tags-title">我的标签</span>
<span class="tags-edit-link" data-dom-id="btn-edit-tags" onclick="handleEditTags()">编辑</span>
</div>
<div class="tags-list">
<span class="tag-item tag-photography">摄影</span>
<span class="tag-item tag-travel">旅行</span>
<span class="tag-item tag-coding">编程</span>
</div>
</div>
<!-- 底部留白 -->
<div style="height: 16px;"></div>
</div>
<!-- 底部安全区域 -->
<div class="bottom-safe-area">
<div class="home-indicator"></div>
</div>
<!-- 底部选择器遮罩 -->
<div class="picker-mask" id="picker-mask" onclick="hideAllPickers()"></div>
<!-- 性别选择器 -->
<div class="bottom-sheet" id="gender-picker">
<div class="sheet-header">
<span class="sheet-cancel" onclick="hideAllPickers()">取消</span>
<span class="sheet-title">选择性别</span>
<span class="sheet-confirm" onclick="confirmGender()">确定</span>
</div>
<div class="sheet-options">
<div class="sheet-option selected" data-gender="male" onclick="selectGenderOption('male')">
<span>男</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
</div>
<div class="sheet-option" data-gender="female" onclick="selectGenderOption('female')">
<span>女</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
</div>
</div>
</div>
<!-- 生日选择器 -->
<div class="bottom-sheet" id="birthday-picker">
<div class="sheet-header">
<span class="sheet-cancel" onclick="hideAllPickers()">取消</span>
<span class="sheet-title">选择生日</span>
<span class="sheet-confirm" onclick="confirmBirthday()">确定</span>
</div>
<div class="sheet-options" style="padding: 20px; text-align: center;">
<div style="font-size: 20px; font-weight: 600; color: var(--youth-primary); margin-bottom: 8px;" id="picker-birthday-display">2001-06-15</div>
<div style="font-size: 13px; color: var(--youth-text-tertiary);">(演示页面,实际可接入日期选择器组件)</div>
</div>
</div>
<!-- 家乡选择器 -->
<div class="bottom-sheet" id="hometown-picker">
<div class="sheet-header">
<span class="sheet-cancel" onclick="hideAllPickers()">取消</span>
<span class="sheet-title">选择家乡</span>
<span class="sheet-confirm" onclick="confirmHometown()">确定</span>
</div>
<div class="sheet-options" style="padding: 20px; text-align: center;">
<div style="font-size: 20px; font-weight: 600; color: var(--youth-primary); margin-bottom: 8px;" id="picker-hometown-display">浙江 · 杭州</div>
<div style="font-size: 13px; color: var(--youth-text-tertiary);">(演示页面,实际可接入三级联动选择器)</div>
</div>
</div>
<!-- 头像选择器 -->
<div class="bottom-sheet" id="avatar-picker">
<div class="sheet-header">
<span class="sheet-cancel" onclick="hideAllPickers()">取消</span>
<span class="sheet-title">更换头像</span>
<span style="width: 40px;"></span>
</div>
<div class="avatar-sheet-options">
<button class="avatar-sheet-btn" onclick="handleAvatarCamera()">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path>
<circle cx="12" cy="13" r="4"></circle>
</svg>
拍照
</button>
<button class="avatar-sheet-btn" onclick="handleAvatarAlbum()">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
<circle cx="8.5" cy="8.5" r="1.5"></circle>
<polyline points="21 15 16 10 5 21"></polyline>
</svg>
从相册选择
</button>
</div>
</div>
<!-- Toast 提示 -->
<div class="toast" id="toast"></div>
</div>
<script>// ===== 主题切换 =====
// 初始化主题
})();
// ===== 返回按钮 =====
function handleBack() {
window.location.href = 'profile-home.html';
}
// ===== 保存按钮 =====
function handleSave() {
const nickname = document.getElementById('input-nickname').value.trim();
const bio = document.getElementById('input-bio').value.trim();
// 验证昵称
if (!nickname) {
showToast('请输入昵称');
return;
}
if (nickname.length < 2) {
showToast('昵称至少2个字符');
return;
}
if (nickname.length > 20) {
showToast('昵称不能超过20个字符');
return;
}
// 验证简介
if (bio.length > 200) {
showToast('个人简介不能超过200字');
return;
}
// 模拟保存
showToast('保存成功');
// 保存到 localStorage
localStorage.setItem('youth-profile-nickname', nickname);
localStorage.setItem('youth-profile-bio', bio);
localStorage.setItem('youth-profile-gender', selectedGender);
localStorage.setItem('youth-profile-birthday', selectedBirthday);
localStorage.setItem('youth-profile-hometown', selectedHometown);
// 延迟跳转
setTimeout(() => {
window.location.href = 'profile-home.html';
}, 800);
}
// ===== 昵称输入实时校验 =====
function handleNicknameInput(input) {
const value = input.value;
// 可添加敏感词过滤等逻辑
if (value.length >= 20) {
showToast('昵称最多20个字符');
}
}
// ===== 个人简介字数统计 =====
function handleBioInput(textarea) {
const count = textarea.value.length;
document.getElementById('bio-count').textContent = count + '/200';
}
// ===== 性别选择 =====
let selectedGender = 'male';
function showGenderPicker() {
showPicker('gender-picker');
// 更新选中状态
updateGenderOptionUI();
}
function selectGenderOption(gender) {
selectedGender = gender;
updateGenderOptionUI();
}
function updateGenderOptionUI() {
const options = document.querySelectorAll('#gender-picker .sheet-option');
options.forEach(opt => {
if (opt.dataset.gender === selectedGender) {
opt.classList.add('selected');
} else {
opt.classList.remove('selected');
}
});
}
function confirmGender() {
const genderText = selectedGender === 'male' ? '男' : '女';
document.getElementById('value-gender').textContent = genderText;
hideAllPickers();
}
// ===== 生日选择 =====
let selectedBirthday = '2001-06-15';
function showBirthdayPicker() {
document.getElementById('picker-birthday-display').textContent = selectedBirthday;
showPicker('birthday-picker');
}
function confirmBirthday() {
document.getElementById('value-birthday').textContent = selectedBirthday;
hideAllPickers();
showToast('生日已更新');
}
// ===== 家乡选择 =====
let selectedHometown = '浙江·杭州';
function showHometownPicker() {
document.getElementById('picker-hometown-display').textContent = selectedHometown.replace('·', ' · ');
showPicker('hometown-picker');
}
function confirmHometown() {
document.getElementById('value-hometown').textContent = selectedHometown;
hideAllPickers();
showToast('家乡已更新');
}
// ===== 头像选择 =====
function showAvatarPicker() {
showPicker('avatar-picker');
}
function handleAvatarCamera() {
hideAllPickers();
showToast('打开相机拍照');
// 实际项目中调用相机 API
}
function handleAvatarAlbum() {
hideAllPickers();
showToast('打开相册选择');
// 实际项目中调用相册选择
}
// ===== 学校信息已认证提示 =====
function showVerifiedHint() {
showToast('已通过学信网认证,不可修改');
}
// ===== 编辑标签跳转 =====
function handleEditTags() {
// 跳转到标签编辑页
showToast('跳转到标签编辑页');
// window.location.href = 'tags-edit.html';
}
// ===== 底部选择器通用方法 =====
function showPicker(pickerId) {
const mask = document.getElementById('picker-mask');
const picker = document.getElementById(pickerId);
mask.classList.add('show');
picker.classList.add('show');
}
function hideAllPickers() {
const mask = document.getElementById('picker-mask');
const pickers = document.querySelectorAll('.bottom-sheet');
mask.classList.remove('show');
pickers.forEach(p => p.classList.remove('show'));
}
// ===== Toast 提示 =====
let toastTimer = null;
function showToast(message) {
const toast = document.getElementById('toast');
toast.textContent = message;
toast.classList.add('show');
if (toastTimer) {
clearTimeout(toastTimer);
}
toastTimer = setTimeout(() => {
toast.classList.remove('show');
}, 2000);
}
// ===== 页面初始化 =====
(function initPage() {
// 初始化简介字数
const bioTextarea = document.getElementById('input-bio');
document.getElementById('bio-count').textContent = bioTextarea.value.length + '/200';
})();</script>
</body>
</html>