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.
 
 

1138 lines
33 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">
<script src="https://cdn.tailwindcss.com"></script>
<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', '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;
}
@media (max-width: 375px) {
.app-container { width: 100%; height: 100vh; }
}
/* ===== 状态栏 ===== */
.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: 56px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 16px;
position: relative;
flex-shrink: 0;
}
.nav-btn {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--youth-radius-md);
background: var(--youth-gradient-matte-card);
border: 1px solid var(--youth-border-light);
box-shadow:
0 2px 8px rgba(0, 0, 0, 0.04),
inset 0 1px 0 rgba(255, 255, 255, 0.8);
cursor: pointer;
transition: all 0.2s ease;
color: var(--youth-text-primary);
position: absolute;
left: 16px;
top: 50%;
transform: translateY(-50%);
}
.nav-btn:active {
transform: translateY(-50%) scale(0.95);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}
.nav-btn svg {
width: 20px;
height: 20px;
stroke-width: 2px;
}
.nav-title {
font-size: 17px;
font-weight: 600;
color: var(--youth-text-primary);
letter-spacing: -0.01em;
}
.nav-action-btn {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--youth-radius-md);
background: var(--youth-gradient-matte-card);
border: 1px solid var(--youth-border-light);
box-shadow:
0 2px 8px rgba(0, 0, 0, 0.04),
inset 0 1px 0 rgba(255, 255, 255, 0.8);
cursor: pointer;
transition: all 0.2s ease;
color: var(--youth-text-primary);
position: absolute;
right: 16px;
top: 50%;
transform: translateY(-50%);
}
.nav-action-btn:active {
transform: translateY(-50%) scale(0.95);
}
.nav-action-btn svg {
width: 18px;
height: 18px;
stroke-width: 2px;
}
/* ===== 分段控件 ===== */
.segment-wrap {
padding: 4px 16px 12px;
flex-shrink: 0;
}
.segment-control {
display: flex;
background: var(--youth-bg-input);
border-radius: var(--youth-radius-md);
padding: 3px;
position: relative;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
border: 1px solid var(--youth-border-light);
}
.segment-btn {
flex: 1;
height: 36px;
border: none;
background: transparent;
color: var(--youth-text-tertiary);
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
position: relative;
z-index: 1;
font-family: inherit;
}
.segment-btn.active {
color: var(--youth-text-primary);
font-weight: 600;
}
.segment-slider {
position: absolute;
top: 3px;
bottom: 3px;
width: calc(50% - 3px);
left: 3px;
background: var(--youth-gradient-matte-light);
border-radius: 10px;
box-shadow:
0 2px 6px rgba(0, 0, 0, 0.06),
inset 0 1px 0 rgba(255, 255, 255, 0.9);
border: 1px solid var(--youth-border-light);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
z-index: 0;
}
.badge-num {
min-width: 20px;
height: 20px;
padding: 0 6px;
border-radius: var(--youth-radius-full);
font-size: 11px;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
}
.badge-num.red {
background: var(--youth-danger-500);
color: white;
}
.badge-num.gray {
background: var(--youth-gray-200);
color: var(--youth-gray-600);
}
.segment-btn.active .badge-num.gray {
background: var(--youth-primary-bg);
color: var(--youth-primary-dark);
}
/* ===== 滚动内容区 ===== */
.scroll-area {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
}
.scroll-area::-webkit-scrollbar {
width: 0;
}
.list-content {
padding: 0 16px 24px;
}
/* ===== 申请面板 ===== */
.request-panel {
display: none;
flex-direction: column;
gap: 12px;
}
.request-panel.active {
display: flex;
animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
/* ===== 申请卡片 ===== */
.req-card {
background: var(--youth-bg-card);
border-radius: var(--youth-radius-md);
padding: 14px;
box-shadow:
0 2px 12px rgba(0, 0, 0, 0.04),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
border: 1px solid var(--youth-border-light);
position: relative;
transition: all 0.3s ease;
}
.req-card.is-new::before {
content: '';
position: absolute;
left: 0;
top: 14px;
bottom: 14px;
width: 3px;
background: var(--youth-primary);
border-radius: 0 2px 2px 0;
}
.req-card.slide-out {
transform: translateX(120%);
opacity: 0;
height: 0;
padding-top: 0;
padding-bottom: 0;
margin-bottom: -12px;
}
.req-card-body {
display: flex;
gap: 12px;
}
/* 头像 */
.avatar-box {
position: relative;
flex-shrink: 0;
width: 48px;
height: 48px;
}
.avatar {
width: 48px;
height: 48px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
font-weight: 700;
color: white;
border: 2px solid var(--youth-bg-card);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.new-dot {
position: absolute;
top: -2px;
right: -2px;
width: 12px;
height: 12px;
background: var(--youth-danger-500);
border-radius: 50%;
border: 2px solid var(--youth-bg-card);
}
/* 卡片中间信息 */
.req-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 4px;
}
.req-head {
display: flex;
align-items: baseline;
gap: 6px;
}
.user-name {
font-size: 15px;
font-weight: 600;
color: var(--youth-text-primary);
line-height: 1.2;
}
.req-label {
font-size: 11px;
color: var(--youth-text-tertiary);
}
.user-meta {
font-size: 12px;
color: var(--youth-text-tertiary);
display: flex;
align-items: center;
gap: 4px;
}
.user-meta svg {
width: 12px;
height: 12px;
flex-shrink: 0;
color: var(--youth-primary);
}
.verify-badge {
color: var(--youth-primary);
}
/* 验证消息 */
.msg-bubble {
margin-top: 6px;
padding: 8px 12px;
background: var(--youth-bg-input);
border-radius: var(--youth-radius-sm);
border-top-left-radius: 4px;
font-size: 13px;
color: var(--youth-text-secondary);
line-height: 1.4;
}
/* 共同好友 */
.mutual-row {
display: flex;
align-items: center;
gap: 6px;
margin-top: 6px;
}
.mutual-avatars {
display: flex;
}
.mutual-avatar {
width: 18px;
height: 18px;
border-radius: 50%;
border: 1.5px solid var(--youth-bg-card);
margin-left: -5px;
display: flex;
align-items: center;
justify-content: center;
font-size: 9px;
font-weight: 600;
color: white;
}
.mutual-avatar:first-child {
margin-left: 0;
}
.mutual-text {
font-size: 11px;
color: var(--youth-text-tertiary);
}
/* 操作按钮区 */
.req-actions {
display: flex;
flex-direction: column;
gap: 8px;
justify-content: center;
flex-shrink: 0;
}
.btn-primary-sm {
min-width: 64px;
height: 32px;
padding: 0 14px;
border-radius: var(--youth-radius-sm);
background: linear-gradient(135deg, #3FCFCA 0%, #26C2BB 100%);
border: none;
color: white;
font-size: 13px;
font-weight: 600;
cursor: pointer;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.25);
transition: all 0.2s ease;
font-family: inherit;
white-space: nowrap;
position: relative;
overflow: hidden;
}
.btn-primary-sm::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 50%;
background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
pointer-events: none;
}
.btn-primary-sm:active {
transform: scale(0.96);
box-shadow: 0 1px 4px rgba(38, 194, 187, 0.2);
}
.btn-primary-sm.accepted {
background: linear-gradient(135deg, #67E188 0%, #34C759 100%);
box-shadow: 0 2px 8px rgba(52, 199, 89, 0.25);
}
.btn-ghost-sm {
min-width: 64px;
height: 32px;
padding: 0 14px;
border-radius: var(--youth-radius-sm);
background: var(--youth-gradient-matte-card);
border: 1px solid var(--youth-border);
color: var(--youth-text-secondary);
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
font-family: inherit;
white-space: nowrap;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.btn-ghost-sm:active {
transform: scale(0.96);
background: var(--youth-bg-hover);
}
/* ===== 发出的申请卡片 ===== */
.sent-card {
background: var(--youth-bg-card);
border-radius: var(--youth-radius-md);
padding: 14px;
box-shadow:
0 2px 12px rgba(0, 0, 0, 0.04),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
border: 1px solid var(--youth-border-light);
transition: all 0.3s ease;
}
.sent-body {
display: flex;
align-items: center;
gap: 12px;
}
.sent-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 4px;
}
.sent-head {
display: flex;
align-items: center;
gap: 8px;
}
.status-tag {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 10px;
border-radius: var(--youth-radius-full);
font-size: 11px;
font-weight: 600;
background: var(--youth-orange-50);
color: var(--youth-orange-600);
}
.status-tag svg {
width: 10px;
height: 10px;
}
.sent-desc {
font-size: 12px;
color: var(--youth-text-secondary);
}
.sent-time {
font-size: 11px;
color: var(--youth-text-tertiary);
}
/* ===== 弹窗 ===== */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.45);
display: flex;
align-items: center;
justify-content: center;
z-index: 998;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.modal-overlay.show {
opacity: 1;
visibility: visible;
}
.modal-dialog {
width: 280px;
background: var(--youth-bg-card);
border-radius: var(--youth-radius-xl);
padding: 20px 20px 16px;
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
border: 1px solid var(--youth-border-light);
z-index: 999;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0.9);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.show .modal-dialog {
transform: translate(-50%, -50%) scale(1);
}
.modal-icon {
width: 48px;
height: 48px;
border-radius: var(--youth-radius-md);
background: var(--youth-primary-bg);
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 12px;
color: var(--youth-primary);
}
.modal-icon svg {
width: 24px;
height: 24px;
}
.modal-title {
font-size: 17px;
font-weight: 600;
text-align: center;
color: var(--youth-text-primary);
margin-bottom: 6px;
}
.modal-message {
font-size: 13px;
text-align: center;
color: var(--youth-text-secondary);
line-height: 1.5;
margin-bottom: 18px;
}
.modal-actions {
display: flex;
gap: 10px;
}
.modal-btn {
flex: 1;
height: 44px;
border-radius: var(--youth-radius-lg);
font-size: 15px;
font-weight: 600;
cursor: pointer;
font-family: inherit;
transition: all 0.2s ease;
border: none;
}
.modal-btn:active {
transform: scale(0.97);
}
.modal-btn.cancel {
background: var(--youth-bg-input);
color: var(--youth-text-secondary);
border: 1px solid var(--youth-border-light);
}
.modal-btn.danger {
background: linear-gradient(135deg, #FF665F 0%, #F5222D 100%);
color: white;
box-shadow: 0 4px 12px rgba(245, 34, 45, 0.25);
position: relative;
overflow: hidden;
}
.modal-btn.danger::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 50%;
background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
pointer-events: none;
}
/* ===== Toast ===== */
.toast {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0.9);
padding: 12px 20px;
background: rgba(26, 26, 26, 0.9);
color: white;
border-radius: var(--youth-radius-lg);
font-size: 14px;
font-weight: 500;
z-index: 200;
opacity: 0;
visibility: hidden;
transition: all 0.25s ease;
display: flex;
align-items: center;
gap: 8px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.toast.show {
opacity: 1;
visibility: visible;
transform: translate(-50%, -50%) scale(1);
}
.toast svg {
width: 18px;
height: 18px;
}
/* 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; }
/* Hide scrollbar */
::-webkit-scrollbar { display: none; width: 0; height: 0; }
* { -ms-overflow-style: none; scrollbar-width: none; }
</style>
</head>
<body>
<div class="app-container">
<!-- 状态栏 -->
<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="goBack()">
<svg 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="nav-action-btn" data-dom-id="btn-search" onclick="onSearch()">
<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>
</button>
</div>
<!-- 分段Tab -->
<div class="segment-wrap">
<div class="segment-control">
<div class="segment-slider" id="segment-slider"></div>
<button class="segment-btn active" data-dom-id="tab-received" onclick="switchTab('received')">
收到的申请
<span class="badge-num red" id="badge-received">3</span>
</button>
<button class="segment-btn" data-dom-id="tab-sent" onclick="switchTab('sent')">
发出的申请
<span class="badge-num gray" id="badge-sent">2</span>
</button>
</div>
</div>
<!-- 滚动内容区 -->
<div class="scroll-area">
<div class="list-content">
<!-- 收到的申请 -->
<div class="request-panel active" id="panel-received">
<!-- 申请1 - 新申请 -->
<div class="req-card is-new" data-dom-id="req-1" id="req-1">
<div class="new-dot"></div>
<div class="req-card-body">
<div class="avatar-box">
<div class="avatar" style="background: linear-gradient(135deg, #E6FAF9 0%, #9AE7E4 100%); color: #18827E;">林</div>
</div>
<div class="req-info">
<div class="req-head">
<span class="user-name">林小雨</span>
<span class="req-label">申请加你为好友</span>
</div>
<div class="user-meta">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z"></path>
</svg>
清华大学 · 计算机系
</div>
<div class="msg-bubble">
你好~我是隔壁系的,看到我们都喜欢摄影😊
</div>
<div class="mutual-row">
<div class="mutual-avatars">
<div class="mutual-avatar" style="background: linear-gradient(135deg, #FFE5E5, #FFB3B3);">张</div>
<div class="mutual-avatar" style="background: linear-gradient(135deg, #D4E5FF, #8CB8F0);">王</div>
<div class="mutual-avatar" style="background: linear-gradient(135deg, #D4FFE0, #8CE0A5);">李</div>
</div>
<span class="mutual-text">3位共同好友</span>
</div>
</div>
<div class="req-actions">
<button class="btn-primary-sm" data-dom-id="btn-accept-1" onclick="acceptFriend(1)">接受</button>
<button class="btn-ghost-sm" data-dom-id="btn-ignore-1" onclick="ignoreFriend(1)">忽略</button>
</div>
</div>
</div>
<!-- 申请2 -->
<div class="req-card" data-dom-id="req-2" id="req-2">
<div class="req-card-body">
<div class="avatar-box">
<div class="avatar" style="background: linear-gradient(135deg, #D4E5FF 0%, #8CB8F0 100%); color: #2D5AA8;">陈</div>
</div>
<div class="req-info">
<div class="req-head">
<span class="user-name">陈明轩</span>
<span class="req-label">申请加你为好友</span>
</div>
<div class="user-meta">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z"></path>
</svg>
北京大学 · 新闻传播学院
</div>
<div class="msg-bubble">
你好,我是新闻传播学院的,想认识一下~
</div>
<div class="mutual-row">
<div class="mutual-avatars">
<div class="mutual-avatar" style="background: linear-gradient(135deg, #E5D4FF, #B894F0);">赵</div>
<div class="mutual-avatar" style="background: linear-gradient(135deg, #FFD4E5, #F08CB0);">刘</div>
</div>
<span class="mutual-text">2位共同好友</span>
</div>
</div>
<div class="req-actions">
<button class="btn-primary-sm" data-dom-id="btn-accept-2" onclick="acceptFriend(2)">接受</button>
<button class="btn-ghost-sm" data-dom-id="btn-ignore-2" onclick="ignoreFriend(2)">忽略</button>
</div>
</div>
</div>
<!-- 申请3 -->
<div class="req-card" data-dom-id="req-3" id="req-3">
<div class="req-card-body">
<div class="avatar-box">
<div class="avatar" style="background: linear-gradient(135deg, #FFE8D4 0%, #FFB380 100%); color: #C25A1A;">周</div>
</div>
<div class="req-info">
<div class="req-head">
<span class="user-name">周梓涵</span>
<span class="req-label">申请加你为好友</span>
</div>
<div class="user-meta">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z"></path>
</svg>
复旦大学 · 经济学院
</div>
<div class="msg-bubble">
社团活动认识的,加个好友呀~
</div>
<div class="mutual-row">
<div class="mutual-avatars">
<div class="mutual-avatar" style="background: linear-gradient(135deg, #D4F0FF, #8CC8F0);">孙</div>
</div>
<span class="mutual-text">1位共同好友</span>
</div>
</div>
<div class="req-actions">
<button class="btn-primary-sm" data-dom-id="btn-accept-3" onclick="acceptFriend(3)">接受</button>
<button class="btn-ghost-sm" data-dom-id="btn-ignore-3" onclick="ignoreFriend(3)">忽略</button>
</div>
</div>
</div>
</div>
<!-- 发出的申请 -->
<div class="request-panel" id="panel-sent">
<!-- 发出1 -->
<div class="sent-card" data-dom-id="sent-1" id="sent-1">
<div class="sent-body">
<div class="avatar-box">
<div class="avatar" style="background: linear-gradient(135deg, #FFF5E5 0%, #FFD68C 100%); color: #C28A1A;">苏</div>
</div>
<div class="sent-info">
<div class="sent-head">
<span class="user-name">苏婉清</span>
<span class="status-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
等待验证
</span>
</div>
<div class="sent-desc">等待对方验证中</div>
<div class="sent-time">2天前</div>
</div>
<button class="btn-ghost-sm" data-dom-id="btn-withdraw-1" onclick="openWithdrawModal(1)">撤回</button>
</div>
</div>
<!-- 发出2 -->
<div class="sent-card" data-dom-id="sent-2" id="sent-2">
<div class="sent-body">
<div class="avatar-box">
<div class="avatar" style="background: linear-gradient(135deg, #E5FFE8 0%, #8CE09C 100%); color: #2A8A3F;">何</div>
</div>
<div class="sent-info">
<div class="sent-head">
<span class="user-name">何雨桐</span>
<span class="status-tag">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
等待验证
</span>
</div>
<div class="sent-desc">等待对方验证中</div>
<div class="sent-time">5天前</div>
</div>
<button class="btn-ghost-sm" data-dom-id="btn-withdraw-2" onclick="openWithdrawModal(2)">撤回</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 撤回确认弹窗 -->
<div class="modal-overlay" id="withdraw-modal" onclick="closeModalOutside(event, 'withdraw-modal')">
<div class="modal-dialog">
<div class="modal-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"></path>
<path d="M3 3v5h5"></path>
</svg>
</div>
<div class="modal-title">撤回申请</div>
<div class="modal-message">确定要撤回这条好友申请吗?<br>撤回后对方将无法看到你的申请</div>
<div class="modal-actions">
<button class="modal-btn cancel" onclick="closeWithdrawModal()">再想想</button>
<button class="modal-btn danger" onclick="confirmWithdraw()">确定撤回</button>
</div>
</div>
</div>
<!-- Toast -->
<div class="toast" id="toast">
<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>
<span id="toast-text">操作成功</span>
</div>
<script>
// ===== 返回 =====
function goBack() {
window.location.href = 'friends-list.html';
}
// ===== 搜索 =====
function onSearch() {
showToast('搜索功能');
}
// ===== Tab切换 =====
let currentTab = 'received';
const slider = document.getElementById('segment-slider');
const tabReceived = document.getElementById('tab-received').parentElement;
const panelReceived = document.getElementById('panel-received');
const panelSent = document.getElementById('panel-sent');
function switchTab(tab) {
if (tab === currentTab) return;
currentTab = tab;
const btns = document.querySelectorAll('.segment-btn');
btns.forEach(b => b.classList.toggle('active', b.dataset.domId === 'tab-' + tab));
if (tab === 'received') {
slider.style.transform = 'translateX(0)';
panelReceived.classList.add('active');
panelSent.classList.remove('active');
} else {
slider.style.transform = 'translateX(100%)';
panelSent.classList.add('active');
panelReceived.classList.remove('active');
}
}
// ===== 接受好友 =====
function acceptFriend(index) {
const btn = document.getElementById(`btn-accept-${index}`);
if (btn.classList.contains('accepted')) return;
btn.classList.add('accepted');
btn.textContent = '已添加';
const ignoreBtn = document.getElementById(`btn-ignore-${index}`);
if (ignoreBtn) {
ignoreBtn.style.opacity = '0.4';
ignoreBtn.style.pointerEvents = 'none';
}
// 更新角标
const badge = document.getElementById('badge-received');
let num = parseInt(badge.textContent) - 1;
if (num < 0) num = 0;
badge.textContent = num;
if (num === 0) {
badge.classList.remove('red');
badge.classList.add('gray');
}
showToast('已添加好友');
}
// ===== 忽略申请 =====
function ignoreFriend(index) {
const card = document.getElementById(`req-${index}`);
if (card) {
card.classList.add('slide-out');
setTimeout(() => {
card.style.display = 'none';
}, 300);
// 更新角标
const badge = document.getElementById('badge-received');
let num = parseInt(badge.textContent) - 1;
if (num < 0) num = 0;
badge.textContent = num;
if (num === 0) {
badge.classList.remove('red');
badge.classList.add('gray');
}
showToast('已忽略');
}
}
// ===== 撤回申请 =====
let currentWithdrawIndex = -1;
function openWithdrawModal(index) {
currentWithdrawIndex = index;
document.getElementById('withdraw-modal').classList.add('show');
}
function closeWithdrawModal() {
document.getElementById('withdraw-modal').classList.remove('show');
currentWithdrawIndex = -1;
}
function confirmWithdraw() {
closeWithdrawModal();
if (currentWithdrawIndex > 0) {
const card = document.getElementById(`sent-${currentWithdrawIndex}`);
if (card) {
card.style.transform = 'translateX(120%)';
card.style.opacity = '0';
card.style.marginBottom = '-12px';
setTimeout(() => {
card.style.display = 'none';
}, 300);
}
// 更新角标
const badge = document.getElementById('badge-sent');
let num = parseInt(badge.textContent) - 1;
if (num < 0) num = 0;
badge.textContent = num;
showToast('已撤回申请');
}
}
function closeModalOutside(event, modalId) {
if (event.target.classList.contains('modal-overlay')) {
document.getElementById(modalId).classList.remove('show');
currentWithdrawIndex = -1;
}
}
// ===== Toast =====
let toastTimer = null;
function showToast(message) {
const toast = document.getElementById('toast');
const toastText = document.getElementById('toast-text');
toastText.textContent = message;
toast.classList.add('show');
if (toastTimer) clearTimeout(toastTimer);
toastTimer = setTimeout(() => {
toast.classList.remove('show');
}, 1800);
}
</script>
</body>
</html>