- 用户名校验改用白名单正则(中英文/数字/下划线/连字符),字符数计法统一 - 简介→个性签名,新增 textarea 可编辑,上限 128 字符 - 用户名+签名各增加实时字符计数器(x/16、x/128) - API 合并为 PUT /api/settings/profile,一次提交两字段,按变更写入 - Toast 移至 NAV 下方,独立样式,5 秒自动消失 - 移除用户 ID 灰色底色,提示改为「个人资料已更新」 - 纯文本存储 + Go 模板自动转义防 XSS
332 lines
6.9 KiB
CSS
332 lines
6.9 KiB
CSS
/* ============================================================
|
|
MetaLab Settings Styles — 个人设置页样式
|
|
左侧导航 + 右侧卡片信息展示,只读
|
|
============================================================ */
|
|
|
|
/* ---------- Page Body ---------- */
|
|
body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
/* ---------- Toast Notification ---------- */
|
|
.settings-toast {
|
|
position: fixed;
|
|
top: 55px; /* 紧贴导航栏下方 */
|
|
left: 50%;
|
|
transform: translateX(-50%) translateY(-20px);
|
|
padding: .6rem 1.5rem;
|
|
font-size: .88rem;
|
|
font-weight: 500;
|
|
color: #fff;
|
|
background: #2ecc71;
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
|
|
z-index: 1000;
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
transition: opacity .25s ease, transform .25s ease;
|
|
max-width: calc(100% - 40px);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.settings-toast.show {
|
|
opacity: 1;
|
|
transform: translateX(-50%) translateY(0);
|
|
pointer-events: auto;
|
|
}
|
|
|
|
.settings-toast.error {
|
|
background: #e74c3c;
|
|
}
|
|
|
|
/* ---------- Layout ---------- */
|
|
.settings-layout {
|
|
display: flex;
|
|
flex: 1;
|
|
max-width: 1200px;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
padding: 2rem 20px;
|
|
gap: 2rem;
|
|
}
|
|
|
|
/* ---------- Left Sidebar Nav ---------- */
|
|
.settings-sidebar {
|
|
width: 220px;
|
|
flex-shrink: 0;
|
|
background: var(--color-surface);
|
|
border-radius: var(--radius);
|
|
box-shadow: var(--shadow);
|
|
border: 1px solid var(--color-border);
|
|
padding: 1.25rem 1rem;
|
|
align-self: flex-start;
|
|
}
|
|
|
|
.settings-nav {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
|
|
.settings-nav-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: .6rem;
|
|
padding: .65rem 1rem;
|
|
border-radius: var(--radius);
|
|
font-size: .92rem;
|
|
color: var(--color-secondary);
|
|
font-weight: 500;
|
|
transition: all .15s ease;
|
|
}
|
|
|
|
.settings-nav-item:hover {
|
|
background: rgba(52, 152, 219, .06);
|
|
color: var(--color-accent);
|
|
}
|
|
|
|
.settings-nav-item.active {
|
|
background: rgba(52, 152, 219, .1);
|
|
color: var(--color-accent);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.settings-nav-icon {
|
|
width: 18px;
|
|
height: 18px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* ---------- Right Content Area ---------- */
|
|
.settings-main {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.settings-card {
|
|
background: var(--color-surface);
|
|
border-radius: var(--radius);
|
|
box-shadow: var(--shadow);
|
|
border: 1px solid var(--color-border);
|
|
}
|
|
|
|
.settings-card-header {
|
|
padding: 1.5rem 2rem 0;
|
|
}
|
|
|
|
.settings-card-header h2 {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: var(--color-primary);
|
|
margin-bottom: .3rem;
|
|
}
|
|
|
|
.settings-card-desc {
|
|
font-size: .85rem;
|
|
color: var(--color-text-light);
|
|
padding-bottom: 1.25rem;
|
|
border-bottom: 1px solid var(--color-border);
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.settings-card-body {
|
|
padding: 1.25rem 2rem 1.5rem;
|
|
}
|
|
|
|
/* ---------- Input Field ---------- */
|
|
.settings-text-input {
|
|
width: 100%;
|
|
max-width: 260px;
|
|
padding: .45rem .7rem;
|
|
font-size: .92rem;
|
|
font-family: inherit;
|
|
color: var(--color-text);
|
|
background: #f9fafb;
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 6px;
|
|
outline: none;
|
|
transition: border-color .15s ease, box-shadow .15s ease;
|
|
}
|
|
|
|
.settings-text-input:focus {
|
|
border-color: var(--color-accent);
|
|
box-shadow: 0 0 0 3px rgba(52, 152, 219, .15);
|
|
background: #fff;
|
|
}
|
|
|
|
/* ---------- Textarea Field ---------- */
|
|
.settings-textarea {
|
|
width: 100%;
|
|
max-width: 460px;
|
|
height: 80px;
|
|
padding: .5rem .7rem;
|
|
font-size: .92rem;
|
|
font-family: inherit;
|
|
color: var(--color-text);
|
|
background: #f9fafb;
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 6px;
|
|
outline: none;
|
|
resize: vertical;
|
|
transition: border-color .15s ease, box-shadow .15s ease;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.settings-textarea:focus {
|
|
border-color: var(--color-accent);
|
|
box-shadow: 0 0 0 3px rgba(52, 152, 219, .15);
|
|
background: #fff;
|
|
}
|
|
|
|
/* ---------- Character Counter ---------- */
|
|
.char-counter {
|
|
font-size: .78rem;
|
|
color: #aaa;
|
|
margin-top: 4px;
|
|
display: block;
|
|
}
|
|
|
|
/* ---------- Save Button ---------- */
|
|
.settings-card-footer {
|
|
padding: 1rem 2rem 1.5rem;
|
|
border-top: 1px solid var(--color-border);
|
|
margin-top: .25rem;
|
|
}
|
|
|
|
.settings-save-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: .55rem 1.5rem;
|
|
font-size: .88rem;
|
|
font-weight: 600;
|
|
font-family: inherit;
|
|
color: #fff;
|
|
background: var(--color-accent);
|
|
border: none;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
transition: background .15s ease, opacity .15s ease;
|
|
}
|
|
|
|
.settings-save-btn:hover {
|
|
background: #2980b9;
|
|
}
|
|
|
|
.settings-save-btn:disabled {
|
|
opacity: .6;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* ---------- Info Rows ---------- */
|
|
.info-row {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
padding: .9rem 0;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
}
|
|
|
|
.info-row:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.info-label {
|
|
width: 100px;
|
|
flex-shrink: 0;
|
|
font-size: .88rem;
|
|
color: var(--color-text-light);
|
|
font-weight: 500;
|
|
padding-top: 1px;
|
|
}
|
|
|
|
.info-value {
|
|
flex: 1;
|
|
font-size: .92rem;
|
|
color: var(--color-text);
|
|
min-width: 0;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.info-muted {
|
|
color: #aaa;
|
|
}
|
|
|
|
.info-mono {
|
|
font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
|
|
font-size: .85rem;
|
|
background: #f5f5f5;
|
|
padding: 1px 8px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
/* ---------- Avatar Preview ---------- */
|
|
.avatar-preview {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 50%;
|
|
object-fit: cover;
|
|
border: 2px solid var(--color-border);
|
|
}
|
|
|
|
/* ---------- Role Tag ---------- */
|
|
.role-tag {
|
|
display: inline-block;
|
|
padding: 2px 10px;
|
|
border-radius: 4px;
|
|
font-size: .82rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.role-user { background: #e3f2fd; color: #1976d2; }
|
|
.role-moderator { background: #e8f5e9; color: #2e7d32; }
|
|
.role-admin { background: #fce4ec; color: #c62828; }
|
|
.role-owner { background: #fff3e0; color: #e65100; }
|
|
|
|
/* ---------- Status Badge ---------- */
|
|
.status-badge {
|
|
display: inline-block;
|
|
padding: 2px 10px;
|
|
border-radius: 12px;
|
|
font-size: .82rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.status-active { background: #e8f5e9; color: #2e7d32; }
|
|
.status-banned { background: #ffebee; color: #c62828; }
|
|
.status-deleted { background: #fff3e0; color: #e65100; }
|
|
.status-locked { background: #eceff1; color: #546e7a; }
|
|
|
|
/* ---------- Responsive ---------- */
|
|
@media (max-width: 768px) {
|
|
.settings-layout {
|
|
flex-direction: column;
|
|
padding: 1rem 16px;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.settings-sidebar {
|
|
width: 100%;
|
|
align-self: auto;
|
|
}
|
|
|
|
.settings-nav {
|
|
flex-direction: row;
|
|
gap: 2px;
|
|
}
|
|
|
|
.settings-nav-item {
|
|
padding: .5rem .9rem;
|
|
font-size: .85rem;
|
|
}
|
|
|
|
.settings-card-header {
|
|
padding: 1.25rem 1.25rem 0;
|
|
}
|
|
|
|
.settings-card-body {
|
|
padding: 1rem 1.25rem 1.25rem;
|
|
}
|
|
}
|