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.
 
 

1109 lines
37 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">
<script src="https://cdn.tailwindcss.com"></script>
<style>
* {
-webkit-tap-highlight-color: transparent;
box-sizing: border-box;
}
: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);
}
body {
font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
margin: 0;
padding: 0;
overflow: hidden;
background: #0a0a0a;
overflow-x: hidden;}
/* 页面容器 - 固定375x812 */
.app-container {
width: 375px;
height: 812px;
margin: 0 auto;
position: relative;
overflow: hidden;
background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 50%, #0a0a0f 100%);
display: flex;
flex-direction: column;
}
/* 相机取景背景纹理 */
.camera-bg {
position: absolute;
inset: 0;
background:
radial-gradient(ellipse at 50% 40%, rgba(38, 194, 187, 0.08) 0%, transparent 60%),
linear-gradient(180deg, #1a1d2e 0%, #0d0f1a 50%, #070810 100%);
}
/* 模拟相机噪点纹理 */
.camera-noise {
position: absolute;
inset: 0;
opacity: 0.03;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
/* 状态栏 */
.status-bar {
height: 44px;
display: flex;
align-items: flex-end;
justify-content: space-between;
padding: 0 20px 8px;
font-size: 15px;
font-weight: 600;
color: #ffffff;
position: relative;
z-index: 50;
}
.status-bar .right-icons {
display: flex;
align-items: center;
gap: 6px;
padding-bottom: 2px;
}
.status-bar .battery {
width: 24px;
height: 11px;
border: 1px solid rgba(255,255,255,0.6);
border-radius: 3px;
position: relative;
padding: 1px;
}
.status-bar .battery::after {
content: '';
position: absolute;
right: -3px;
top: 50%;
transform: translateY(-50%);
width: 2px;
height: 5px;
background: rgba(255,255,255,0.6);
border-radius: 0 1px 1px 0;
}
.status-bar .battery-level {
width: 80%;
height: 100%;
background: #ffffff;
border-radius: 1px;
}
/* 顶部导航栏 - 毛玻璃悬浮 */
.top-nav {
position: absolute;
top: 44px;
left: 0;
right: 0;
height: 52px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
z-index: 40;
background: rgba(0, 0, 0, 0.35);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}
.nav-btn {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: background 0.2s ease;
}
.nav-btn:active {
background: rgba(255, 255, 255, 0.15);
}
.nav-title {
font-size: 17px;
font-weight: 600;
color: #ffffff;
letter-spacing: 0.5px;
}
/* 扫码区域 */
.scan-area {
position: absolute;
top: 96px;
left: 0;
right: 0;
bottom: 200px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
/* 扫码框 */
.scan-frame-wrapper {
position: relative;
width: 260px;
height: 260px;
}
.scan-frame {
position: absolute;
inset: 0;
border-radius: 16px;
overflow: visible;
}
/* 四角L形高亮 */
.corner {
position: absolute;
width: 28px;
height: 28px;
border-color: #26C2BB;
border-style: solid;
border-width: 0;
}
.corner-tl {
top: -2px;
left: -2px;
border-top-width: 3px;
border-left-width: 3px;
border-top-left-radius: 16px;
box-shadow: -2px -2px 8px rgba(38, 194, 187, 0.4);
}
.corner-tr {
top: -2px;
right: -2px;
border-top-width: 3px;
border-right-width: 3px;
border-top-right-radius: 16px;
box-shadow: 2px -2px 8px rgba(38, 194, 187, 0.4);
}
.corner-bl {
bottom: -2px;
left: -2px;
border-bottom-width: 3px;
border-left-width: 3px;
border-bottom-left-radius: 16px;
box-shadow: -2px 2px 8px rgba(38, 194, 187, 0.4);
}
.corner-br {
bottom: -2px;
right: -2px;
border-bottom-width: 3px;
border-right-width: 3px;
border-bottom-right-radius: 16px;
box-shadow: 2px 2px 8px rgba(38, 194, 187, 0.4);
}
/* 扫码框内光晕 */
.scan-glow {
position: absolute;
inset: 0;
border-radius: 16px;
background: radial-gradient(ellipse at center, rgba(38, 194, 187, 0.12) 0%, transparent 70%);
pointer-events: none;
}
/* 扫描线 */
.scan-line {
position: absolute;
left: 8px;
right: 8px;
height: 2px;
background: linear-gradient(90deg,
transparent 0%,
rgba(38, 194, 187, 0.3) 20%,
#26C2BB 50%,
rgba(38, 194, 187, 0.3) 80%,
transparent 100%);
box-shadow: 0 0 12px rgba(38, 194, 187, 0.6), 0 0 24px rgba(38, 194, 187, 0.3);
animation: scanMove 2.5s ease-in-out infinite;
top: 8px;
}
.scan-line::before {
content: '';
position: absolute;
top: -4px;
left: 50%;
transform: translateX(-50%);
width: 8px;
height: 8px;
background: #26C2BB;
border-radius: 50%;
box-shadow: 0 0 8px rgba(38, 194, 187, 0.8);
}
.scan-line::after {
content: '';
position: absolute;
top: -20px;
left: 0;
right: 0;
height: 40px;
background: linear-gradient(180deg,
rgba(38, 194, 187, 0) 0%,
rgba(38, 194, 187, 0.08) 50%,
rgba(38, 194, 187, 0) 100%);
}
@keyframes scanMove {
0% { top: 8px; }
50% { top: calc(100% - 10px); }
100% { top: 8px; }
}
/* 提示文字 */
.scan-tip {
margin-top: 32px;
font-size: 14px;
color: rgba(255, 255, 255, 0.7);
text-align: center;
letter-spacing: 0.3px;
}
/* 底部功能按钮区 */
.bottom-actions {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 0 30px 40px;
display: flex;
justify-content: space-around;
align-items: flex-start;
z-index: 30;
}
.action-btn {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
cursor: pointer;
transition: transform 0.2s ease;
}
.action-btn:active {
transform: scale(0.92);
}
.action-icon {
width: 56px;
height: 56px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.12);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.18);
display: flex;
align-items: center;
justify-content: center;
box-shadow:
0 4px 16px rgba(0, 0, 0, 0.3),
inset 0 1px 1px rgba(255, 255, 255, 0.15);
transition: all 0.2s ease;
}
.action-btn:active .action-icon {
background: rgba(255, 255, 255, 0.2);
box-shadow:
0 2px 8px rgba(0, 0, 0, 0.3),
inset 0 1px 1px rgba(255, 255, 255, 0.2);
}
.action-icon.active {
background: rgba(38, 194, 187, 0.25);
border-color: rgba(38, 194, 187, 0.5);
box-shadow:
0 4px 16px rgba(38, 194, 187, 0.25),
inset 0 1px 1px rgba(255, 255, 255, 0.2);
}
.action-label {
font-size: 12px;
color: rgba(255, 255, 255, 0.85);
letter-spacing: 0.2px;
}
/* 结果弹窗遮罩 */
.result-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
z-index: 998;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.result-overlay.show {
opacity: 1;
visibility: visible;
}
/* 结果弹窗 */
.result-modal {
width: 300px;
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(40px) saturate(180%);
-webkit-backdrop-filter: blur(40px) saturate(180%);
border-radius: 20px;
padding: 28px 24px 24px;
text-align: center;
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
border: 1px solid rgba(255, 255, 255, 0.5);
transform: scale(0.9) translateY(20px);
opacity: 0;
transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
position: relative;
z-index: 999;
}
.result-overlay.show .result-modal {
transform: scale(1) translateY(0);
opacity: 1;
}
.result-avatar-wrapper {
width: 72px;
height: 72px;
margin: 0 auto 16px;
border-radius: 50%;
background: linear-gradient(135deg, #3FCFCA 0%, #26C2BB 100%);
padding: 3px;
box-shadow: 0 4px 20px rgba(38, 194, 187, 0.4);
}
.result-avatar {
width: 100%;
height: 100%;
border-radius: 50%;
background: linear-gradient(135deg, #6BDBD7 0%, #26C2BB 100%);
display: flex;
align-items: center;
justify-content: center;
font-size: 28px;
color: #fff;
font-weight: 600;
overflow: hidden;
}
.result-nickname {
font-size: 20px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 6px;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.verify-badge {
display: inline-flex;
align-items: center;
gap: 3px;
padding: 2px 8px;
background: linear-gradient(135deg, rgba(38, 194, 187, 0.15) 0%, rgba(38, 194, 187, 0.08) 100%);
border-radius: 10px;
font-size: 11px;
color: #26C2BB;
font-weight: 500;
border: 0.5px solid rgba(38, 194, 187, 0.3);
}
.result-school {
font-size: 13px;
color: #666;
margin-bottom: 20px;
}
.result-actions {
display: flex;
gap: 10px;
}
.btn-add-friend {
flex: 1;
height: 44px;
border-radius: 8px;
background: linear-gradient(135deg, #3FCFCA 0%, #26C2BB 100%);
color: #fff;
font-size: 15px;
font-weight: 600;
border: none;
cursor: pointer;
box-shadow: 0 4px 16px rgba(38, 194, 187, 0.35);
transition: all 0.2s ease;
}
.btn-add-friend:active {
transform: scale(0.97);
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.3);
}
.btn-cancel {
width: 72px;
height: 44px;
border-radius: 8px;
background: rgba(0, 0, 0, 0.06);
color: #666;
font-size: 15px;
font-weight: 500;
border: none;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-cancel:active {
transform: scale(0.97);
background: rgba(0, 0, 0, 0.1);
}
/* 我的二维码弹窗 */
.my-qr-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
z-index: 998;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.my-qr-overlay.show {
opacity: 1;
visibility: visible;
}
.my-qr-modal {
width: 280px;
background: rgba(255, 255, 255, 0.92);
backdrop-filter: blur(40px) saturate(180%);
-webkit-backdrop-filter: blur(40px) saturate(180%);
border-radius: 20px;
padding: 24px;
text-align: center;
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
border: 1px solid rgba(255, 255, 255, 0.5);
transform: scale(0.9);
opacity: 0;
transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
z-index: 999;
position: relative;
}
.my-qr-overlay.show .my-qr-modal {
transform: scale(1);
opacity: 1;
}
.my-qr-title {
font-size: 18px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 4px;
}
.my-qr-subtitle {
font-size: 12px;
color: #999;
margin-bottom: 18px;
}
.qr-code-box {
width: 200px;
height: 200px;
margin: 0 auto 16px;
background: #fff;
border-radius: 12px;
padding: 12px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
display: flex;
align-items: center;
justify-content: center;
}
.qr-pattern {
width: 100%;
height: 100%;
background:
linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
background-size: 12px 12px;
background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
position: relative;
border-radius: 4px;
}
.qr-pattern::before,
.qr-pattern::after {
content: '';
position: absolute;
width: 40px;
height: 40px;
border: 6px solid #26C2BB;
border-radius: 4px;
}
.qr-pattern::before {
top: 8px;
left: 8px;
}
.qr-pattern::after {
top: 8px;
right: 8px;
}
.qr-pattern .qr-corner {
position: absolute;
bottom: 8px;
left: 8px;
width: 40px;
height: 40px;
border: 6px solid #26C2BB;
border-radius: 4px;
}
.qr-pattern .qr-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 32px;
height: 32px;
background: linear-gradient(135deg, #3FCFCA, #26C2BB);
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
}
.my-qr-name {
font-size: 16px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 2px;
}
.my-qr-id {
font-size: 12px;
color: #999;
}
.my-qr-close {
margin-top: 16px;
font-size: 14px;
color: #26C2BB;
cursor: pointer;
font-weight: 500;
}
/* 相册选择弹窗 */
.album-overlay {
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: flex;
align-items: flex-end;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.album-overlay.show {
opacity: 1;
visibility: visible;
}
.album-sheet {
width: 100%;
background: rgba(255, 255, 255, 0.92);
backdrop-filter: blur(40px) saturate(180%);
-webkit-backdrop-filter: blur(40px) saturate(180%);
border-radius: 20px 20px 0 0;
padding: 20px 16px 32px;
transform: translateY(100%);
transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
z-index: 999;
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
position: relative;
}
.album-overlay.show .album-sheet {
transform: translateY(0);
}
.album-sheet-title {
text-align: center;
font-size: 16px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 16px;
}
.album-options {
display: flex;
flex-direction: column;
gap: 0;
}
.album-option {
padding: 16px;
text-align: center;
font-size: 16px;
color: #26C2BB;
font-weight: 500;
border-bottom: 0.5px solid rgba(0,0,0,0.08);
cursor: pointer;
transition: background 0.2s ease;
}
.album-option:active {
background: rgba(38, 194, 187, 0.1);
}
.album-option.cancel {
margin-top: 8px;
color: #999;
border-radius: 12px;
border: none;
background: rgba(0,0,0,0.04);
}
/* Home Indicator */
.home-indicator {
position: absolute;
bottom: 8px;
left: 50%;
transform: translateX(-50%);
width: 134px;
height: 5px;
background: rgba(255, 255, 255, 0.4);
border-radius: 3px;
z-index: 50;
}
/* 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="app">
<!-- 相机取景背景 -->
<div class="camera-bg"></div>
<div class="camera-noise"></div>
<!-- 状态栏 -->
<div class="status-bar">
<span>9:41</span>
<div class="right-icons">
<!-- 信号 -->
<svg width="17" height="11" viewBox="0 0 17 11" fill="none">
<rect x="0" y="7" width="3" height="4" rx="0.5" fill="white"/>
<rect x="4.5" y="5" width="3" height="6" rx="0.5" fill="white"/>
<rect x="9" y="2.5" width="3" height="8.5" rx="0.5" fill="white"/>
<rect x="13.5" y="0" width="3" height="11" rx="0.5" fill="white" opacity="0.5"/>
</svg>
<!-- WiFi -->
<svg width="15" height="11" viewBox="0 0 15 11" fill="none">
<path d="M7.5 10.5C8.05228 10.5 8.5 10.0523 8.5 9.5C8.5 8.94772 8.05228 8.5 7.5 8.5C6.94772 8.5 6.5 8.94772 6.5 9.5C6.5 10.0523 6.94772 10.5 7.5 10.5Z" fill="white"/>
<path d="M3.5 6.5C5.5 4.5 9.5 4.5 11.5 6.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
<path d="M0.5 3.5C3.5 0.5 11.5 0.5 14.5 3.5" stroke="white" stroke-width="1.5" stroke-linecap="round" opacity="0.6"/>
</svg>
<!-- 电池 -->
<div class="battery">
<div class="battery-level"></div>
</div>
</div>
</div>
<!-- 顶部导航栏 -->
<div class="top-nav">
<button class="nav-btn" data-dom-id="btn-back" id="btnBack">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<path d="M15 18l-6-6 6-6"/>
</svg>
</button>
<div class="nav-title">扫一扫</div>
<button class="nav-btn" data-dom-id="btn-album" id="btnAlbum">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="5" width="18" height="14" rx="2"/>
<circle cx="8.5" cy="10.5" r="1.5"/>
<path d="M21 15l-5-5L5 21"/>
</svg>
</button>
</div>
<!-- 扫码区域 -->
<div class="scan-area">
<div class="scan-frame-wrapper" data-dom-id="scan-frame">
<div class="scan-frame">
<!-- 四角L形 -->
<div class="corner corner-tl"></div>
<div class="corner corner-tr"></div>
<div class="corner corner-bl"></div>
<div class="corner corner-br"></div>
<!-- 光晕 -->
<div class="scan-glow"></div>
<!-- 扫描线 -->
<div class="scan-line" data-dom-id="scan-line" id="scanLine"></div>
</div>
</div>
<div class="scan-tip">将二维码放入框内,即可自动扫描</div>
</div>
<!-- 底部功能按钮区 -->
<div class="bottom-actions">
<button class="action-btn" data-dom-id="btn-my-qrcode" id="btnMyQrCode">
<div class="action-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="1"/>
<rect x="14" y="3" width="7" height="7" rx="1"/>
<rect x="3" y="14" width="7" height="7" rx="1"/>
<path d="M14 14h3v3h-3z"/>
<path d="M20 14v3"/>
<path d="M14 20h7"/>
</svg>
</div>
<span class="action-label">我的二维码</span>
</button>
<button class="action-btn" data-dom-id="btn-flashlight" id="btnFlashlight">
<div class="action-icon" id="flashlightIcon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M13 2L4.09 12.97a.5.5 0 0 0 .36.85H12l-1 9 8.91-10.97a.5.5 0 0 0-.36-.85H13l1-9z"/>
</svg>
</div>
<span class="action-label">闪光灯</span>
</button>
<button class="action-btn" data-dom-id="btn-add-friend" id="btnAddFriend">
<div class="action-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/>
<circle cx="9" cy="7" r="4"/>
<line x1="19" y1="8" x2="19" y2="14"/>
<line x1="22" y1="11" x2="16" y2="11"/>
</svg>
</div>
<span class="action-label">加好友</span>
</button>
</div>
<!-- 扫码结果弹窗 -->
<div class="result-overlay" data-dom-id="result-modal" id="resultModal">
<div class="result-modal">
<div class="result-avatar-wrapper">
<div class="result-avatar" data-dom-id="result-avatar" id="resultAvatar">
<span>小林</span>
</div>
</div>
<div class="result-nickname" data-dom-id="result-nickname" id="resultNickname">
小林同学
<span class="verify-badge">
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
<polyline points="22 4 12 14.01 9 11.01"/>
</svg>
实名认证
</span>
</div>
<div class="result-school" id="resultSchool">浙江大学 · 计算机学院</div>
<div class="result-actions">
<button class="btn-cancel" data-dom-id="btn-cancel-result" id="btnCancelResult">取消</button>
<button class="btn-add-friend" data-dom-id="btn-add-result" id="btnAddResult">添加好友</button>
</div>
</div>
</div>
<!-- 我的二维码弹窗 -->
<div class="my-qr-overlay" id="myQrOverlay">
<div class="my-qr-modal">
<div class="my-qr-title">我的二维码</div>
<div class="my-qr-subtitle">扫一扫加我为好友</div>
<div class="qr-code-box">
<div class="qr-pattern">
<div class="qr-corner"></div>
<div class="qr-center">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
<path d="M2 17l10 5 10-5"/>
<path d="M2 12l10 5 10-5"/>
</svg>
</div>
</div>
</div>
<div class="my-qr-name">青核用户</div>
<div class="my-qr-id">ID: youth_88888</div>
<div class="my-qr-close" id="closeMyQr">关闭</div>
</div>
</div>
<!-- 相册选择弹窗 -->
<div class="album-overlay" id="albumOverlay">
<div class="album-sheet">
<div class="album-sheet-title">选择二维码</div>
<div class="album-options">
<div class="album-option" id="albumFromPhotos">从相册选择</div>
<div class="album-option" id="albumTakePhoto">拍照</div>
<div class="album-option cancel" id="albumCancel">取消</div>
</div>
</div>
</div>
<!-- Home Indicator -->
<div class="home-indicator"></div>
</div>
<script>// 主题切换
const html = document.documentElement;
// 初始化主题(默认深色,因为扫码页默认是相机取景深色)
}
}
// 返回按钮
const btnBack = document.getElementById('btnBack');
btnBack.addEventListener('click', () => {
// 尝试返回上一页,如果没有历史记录则跳转到feed-home
if (window.history.length > 1) {
window.history.back();
} else {
window.location.href = 'feed-home.html';
}
});
// 闪光灯切换
const btnFlashlight = document.getElementById('btnFlashlight');
const flashlightIcon = document.getElementById('flashlightIcon');
let flashlightOn = false;
btnFlashlight.addEventListener('click', () => {
flashlightOn = !flashlightOn;
if (flashlightOn) {
flashlightIcon.classList.add('active');
// 模拟闪光灯开启 - 背景微微变亮
document.querySelector('.camera-bg').style.filter = 'brightness(1.3)';
} else {
flashlightIcon.classList.remove('active');
document.querySelector('.camera-bg').style.filter = 'brightness(1)';
}
});
// 我的二维码弹窗
const btnMyQrCode = document.getElementById('btnMyQrCode');
const myQrOverlay = document.getElementById('myQrOverlay');
const closeMyQr = document.getElementById('closeMyQr');
btnMyQrCode.addEventListener('click', () => {
myQrOverlay.classList.add('show');
});
closeMyQr.addEventListener('click', () => {
myQrOverlay.classList.remove('show');
});
myQrOverlay.addEventListener('click', (e) => {
if (e.target === myQrOverlay) {
myQrOverlay.classList.remove('show');
}
});
// 加好友按钮跳转
const btnAddFriend = document.getElementById('btnAddFriend');
btnAddFriend.addEventListener('click', () => {
window.location.href = 'friend-requests.html';
});
// 相册按钮
const btnAlbum = document.getElementById('btnAlbum');
const albumOverlay = document.getElementById('albumOverlay');
const albumCancel = document.getElementById('albumCancel');
const albumFromPhotos = document.getElementById('albumFromPhotos');
const albumTakePhoto = document.getElementById('albumTakePhoto');
btnAlbum.addEventListener('click', () => {
albumOverlay.classList.add('show');
});
albumCancel.addEventListener('click', () => {
albumOverlay.classList.remove('show');
});
albumOverlay.addEventListener('click', (e) => {
if (e.target === albumOverlay) {
albumOverlay.classList.remove('show');
}
});
albumFromPhotos.addEventListener('click', () => {
albumOverlay.classList.remove('show');
// 模拟从相册选择二维码后识别成功
setTimeout(() => {
showResultModal();
}, 500);
});
albumTakePhoto.addEventListener('click', () => {
albumOverlay.classList.remove('show');
// 模拟拍照后识别成功
setTimeout(() => {
showResultModal();
}, 500);
});
// 扫码结果弹窗
const resultModal = document.getElementById('resultModal');
const btnCancelResult = document.getElementById('btnCancelResult');
const btnAddResult = document.getElementById('btnAddResult');
function showResultModal() {
resultModal.classList.add('show');
}
function hideResultModal() {
resultModal.classList.remove('show');
}
btnCancelResult.addEventListener('click', hideResultModal);
resultModal.addEventListener('click', (e) => {
if (e.target === resultModal) {
hideResultModal();
}
});
btnAddResult.addEventListener('click', () => {
// 添加好友跳转到好友请求页
window.location.href = 'friend-requests.html';
});
// 模拟扫码成功 - 2秒后弹出结果弹窗
let scanTimer = null;
function startAutoScan() {
scanTimer = setTimeout(() => {
showResultModal();
}, 2000);
}
// 页面加载后开始模拟扫描
window.addEventListener('load', () => {
startAutoScan();
});
// 关闭弹窗后重新开始模拟扫描
btnCancelResult.addEventListener('click', () => {
startAutoScan();
});
resultModal.addEventListener('click', (e) => {
if (e.target === resultModal) {
startAutoScan();
}
});</script>
</body>
</html>