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.
745 lines
24 KiB
745 lines
24 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>
|
|
:root {
|
|
--youth-primary: #26C2BB;
|
|
--youth-primary-light: #54CAC5;
|
|
--primary-bg: #E6F7F6;
|
|
--primary-border: #B3E8E4;
|
|
--bg-page: #F7F8FA;
|
|
--bg-card: #FFFFFF;
|
|
--text-title: #1F1F1F;
|
|
--text-body: #595959;
|
|
--text-muted: #8C8C8C;
|
|
--youth-border-light: #E8E8E8;
|
|
--youth-success: #52C41A;
|
|
--youth-warning: #FAAD14;
|
|
--danger: #F5222D;
|
|
--shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
|
|
--tag-bg: #F0F1F3;
|
|
--mint-light: #E8F8F5;
|
|
--orange-light: #FFF4E8;
|
|
--btn-gradient: linear-gradient(135deg, #54CAC5 0%, #26C2BB 50%, #1FA8A2 100%);
|
|
--overlay: rgba(0, 0, 0, 0.5);
|
|
--glass-bg: rgba(255, 255, 255, 0.85);
|
|
--glass-border: rgba(255, 255, 255, 0.5);
|
|
|
|
/* =====================================================
|
|
* 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-bottom: 64px;
|
|
|
|
/* 间距(4px 基础栅格) */
|
|
--space-1: 4px;
|
|
--space-2: 8px;
|
|
--space-3: 12px;
|
|
--space-4: 16px;
|
|
--space-5: 20px;
|
|
--space-6: 24px;
|
|
--space-page-x: 16px;
|
|
--space-card: 16px;
|
|
|
|
/* 柔和弥散阴影 */
|
|
--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.04);
|
|
--shadow-inset-focus: inset 0 1px 3px rgba(38, 194, 187, 0.08);
|
|
|
|
/* 毛玻璃 */
|
|
--glass-bg: rgba(255, 255, 255, 0.72);
|
|
--glass-blur: blur(20px);
|
|
--glass-border: rgba(255, 255, 255, 0.3);
|
|
|
|
}
|
|
|
|
* {
|
|
|
|
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'SF Pro Display', 'Helvetica Neue', sans-serif;
|
|
background: var(--youth-bg-page);
|
|
color: var(--youth-text-secondary);
|
|
min-height: 100vh;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
.app-container {
|
|
width: 375px;
|
|
height: 812px;
|
|
margin: 0 auto;
|
|
background: var(--youth-bg-page);
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* 模拟背景页面(模糊淡化) */
|
|
.bg-page-mock {
|
|
position: absolute;
|
|
inset: 0;
|
|
opacity: 0.4;
|
|
filter: blur(2px);
|
|
z-index: 0;
|
|
}
|
|
|
|
.bg-top-bar {
|
|
height: 88px;
|
|
background: var(--youth-bg-card);
|
|
display: flex;
|
|
align-items: flex-end;
|
|
padding: 0 16px 12px;
|
|
box-shadow: var(--youth-shadow-card);
|
|
}
|
|
|
|
.bg-top-bar .back-icon {
|
|
color: var(--youth-text-primary);
|
|
}
|
|
|
|
.bg-dynamic-card {
|
|
margin: 16px;
|
|
background: var(--youth-bg-card);
|
|
border-radius: 12px;
|
|
height: 300px;
|
|
box-shadow: var(--youth-shadow-card);
|
|
}
|
|
|
|
/* 遮罩 */
|
|
.modal-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;
|
|
backdrop-filter: blur(4px);
|
|
-webkit-backdrop-filter: blur(4px);
|
|
}
|
|
|
|
/* 弹窗主体 */
|
|
.gift-modal {
|
|
width: 100%;
|
|
background: #FFFFFF;
|
|
border-radius: 20px 20px 0 0;
|
|
padding: 12px 0 0;
|
|
position: relative;
|
|
animation: slideUp 0.3s ease;
|
|
z-index: 999;
|
|
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
|
|
}
|
|
|
|
@keyframes slideUp {
|
|
from { transform: translateY(100%); }
|
|
to { transform: translateY(0); }
|
|
}
|
|
|
|
/* 顶部把手 */
|
|
.modal-handle {
|
|
width: 36px;
|
|
height: 4px;
|
|
background: var(--youth-border-light);
|
|
border-radius: 2px;
|
|
margin: 0 auto 10px;
|
|
}
|
|
|
|
/* 弹窗头部 */
|
|
.modal-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 16px 12px;
|
|
border-bottom: 1px solid var(--youth-border-light);
|
|
}
|
|
|
|
.modal-title {
|
|
font-size: 17px;
|
|
font-weight: 700;
|
|
color: var(--youth-text-primary);
|
|
}
|
|
|
|
.modal-close {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--youth-text-tertiary);
|
|
cursor: pointer;
|
|
transition: background 0.2s ease;
|
|
}
|
|
|
|
.modal-close:active {
|
|
background: var(--tag-bg);
|
|
}
|
|
|
|
/* 积分展示 */
|
|
.points-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 12px 16px;
|
|
border-bottom: 1px solid var(--youth-border-light);
|
|
}
|
|
|
|
.points-info {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.points-icon {
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 50%;
|
|
background: var(--youth-primary-bg);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--youth-primary);
|
|
}
|
|
|
|
.points-label {
|
|
font-size: 13px;
|
|
color: var(--youth-text-tertiary);
|
|
}
|
|
|
|
.points-value {
|
|
font-size: 20px;
|
|
font-weight: 700;
|
|
color: var(--youth-primary);
|
|
line-height: 1;
|
|
}
|
|
|
|
.points-value .unit {
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
margin-left: 2px;
|
|
}
|
|
|
|
.points-recharge {
|
|
font-size: 12px;
|
|
color: var(--youth-primary);
|
|
font-weight: 500;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* 选中提示 */
|
|
.selected-info {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 10px 16px;
|
|
background: var(--youth-primary-bg);
|
|
margin: 12px 16px 0;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.selected-info .selected-name {
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--youth-text-primary);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
}
|
|
|
|
.selected-info .selected-name::before {
|
|
content: '';
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
background: var(--youth-primary);
|
|
}
|
|
|
|
.selected-info .selected-cost {
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--youth-primary);
|
|
}
|
|
|
|
/* 礼物网格 */
|
|
.gift-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, 1fr);
|
|
gap: 10px;
|
|
padding: 14px 16px;
|
|
}
|
|
|
|
.gift-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 6px;
|
|
padding: 10px 6px 8px;
|
|
border-radius: 12px;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
border: 1.5px solid transparent;
|
|
background: transparent;
|
|
}
|
|
|
|
.gift-item:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
.gift-item.selected {
|
|
border-color: var(--youth-primary);
|
|
background: var(--youth-primary-bg);
|
|
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.15);
|
|
}
|
|
|
|
.gift-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: var(--tag-bg);
|
|
color: var(--youth-text-secondary);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.gift-item.selected .gift-icon {
|
|
background: var(--youth-primary);
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.gift-name {
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
color: var(--youth-text-secondary);
|
|
text-align: center;
|
|
}
|
|
|
|
.gift-cost {
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
color: var(--youth-text-tertiary);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
}
|
|
|
|
.gift-item.selected .gift-cost {
|
|
color: var(--youth-primary);
|
|
}
|
|
|
|
.gift-cost svg {
|
|
width: 10px;
|
|
height: 10px;
|
|
}
|
|
|
|
/* 积分不足提示 */
|
|
.not-enough-tip {
|
|
display: none;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 4px;
|
|
padding: 6px 16px 0;
|
|
font-size: 12px;
|
|
color: var(--youth-warning);
|
|
}
|
|
|
|
.not-enough-tip.show {
|
|
display: flex;
|
|
}
|
|
|
|
/* 底部操作 */
|
|
.modal-footer {
|
|
padding: 12px 16px 24px;
|
|
border-top: 1px solid var(--youth-border-light);
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.send-btn {
|
|
width: 100%;
|
|
height: 44px;
|
|
border: none;
|
|
border-radius: 8px;
|
|
background: var(--youth-gradient-primary);
|
|
color: #FFFFFF;
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
position: relative;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 12px rgba(38, 194, 187, 0.25);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
}
|
|
|
|
.send-btn::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;
|
|
}
|
|
|
|
.send-btn:active {
|
|
transform: scale(0.98);
|
|
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.2);
|
|
}
|
|
|
|
.send-btn:disabled {
|
|
background: var(--youth-text-tertiary);
|
|
box-shadow: none;
|
|
cursor: not-allowed;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.send-btn:disabled::before {
|
|
display: none;
|
|
}
|
|
|
|
.send-btn .cost-text {
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
|
|
/* 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" data-dom-id="app-container">
|
|
<!-- 模拟背景页 -->
|
|
<div class="bg-page-mock">
|
|
<div class="bg-top-bar">
|
|
<svg class="back-icon" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<polyline points="15 18 9 12 15 6"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="bg-dynamic-card"></div>
|
|
<div class="bg-dynamic-card" style="height: 180px;"></div>
|
|
</div>
|
|
|
|
<!-- 遮罩 + 弹窗 -->
|
|
<div class="modal-overlay" data-dom-id="gift-modal" onclick="handleOverlayClick(event)">
|
|
<div class="gift-modal">
|
|
<!-- 顶部把手 -->
|
|
<div class="modal-handle"></div>
|
|
|
|
<!-- 弹窗头部 -->
|
|
<div class="modal-header">
|
|
<div class="modal-title">送礼物</div>
|
|
<div class="modal-close" data-dom-id="btn-close" onclick="closeModal()">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 积分展示 -->
|
|
<div class="points-bar">
|
|
<div class="points-info">
|
|
<div class="points-icon">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<div class="points-label">我的青核积分</div>
|
|
<div class="points-value" id="user-points">1,280<span class="unit">积分</span></div>
|
|
</div>
|
|
</div>
|
|
<div class="points-recharge" data-dom-id="btn-recharge">
|
|
充值
|
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polyline points="9 18 15 12 9 6"></polyline>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 选中提示 -->
|
|
<div class="selected-info" data-dom-id="selected-info">
|
|
<div class="selected-name" id="selected-name">小心心</div>
|
|
<div class="selected-cost" id="selected-cost">10 积分</div>
|
|
</div>
|
|
|
|
<!-- 礼物网格 -->
|
|
<div class="gift-grid" data-dom-id="gift-grid">
|
|
<div class="gift-item selected" data-cost="10" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">小心心</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
10
|
|
</div>
|
|
</div>
|
|
|
|
<div class="gift-item" data-cost="30" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M20 12V22H4V12"></path>
|
|
<path d="M2 7H22V12H2z"></path>
|
|
<path d="M12 22V7"></path>
|
|
<path d="M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"></path>
|
|
<path d="M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">小奖杯</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
30
|
|
</div>
|
|
</div>
|
|
|
|
<div class="gift-item" data-cost="50" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" 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>
|
|
<polygon points="10 8 16 12 10 16 10 8"></polygon>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">打赏</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
50
|
|
</div>
|
|
</div>
|
|
|
|
<div class="gift-item" data-cost="88" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<rect x="2" y="7" width="20" height="14" rx="2"></rect>
|
|
<path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">冰淇淋</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
88
|
|
</div>
|
|
</div>
|
|
|
|
<div class="gift-item" data-cost="100" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path>
|
|
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
<path d="M16 10a4 4 0 0 1-8 0"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">小礼盒</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
100
|
|
</div>
|
|
</div>
|
|
|
|
<div class="gift-item" data-cost="188" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M12 2L15 8L22 9L17 14L18 21L12 18L6 21L7 14L2 9L9 8L12 2Z"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">小星星</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
188
|
|
</div>
|
|
</div>
|
|
|
|
<div class="gift-item" data-cost="288" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" 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>
|
|
<path d="M8 14s1.5 2 4 2 4-2 4-2"></path>
|
|
<line x1="9" y1="9" x2="9.01" y2="9"></line>
|
|
<line x1="15" y1="9" x2="15.01" y2="9"></line>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">大笑脸</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
288
|
|
</div>
|
|
</div>
|
|
|
|
<div class="gift-item" data-cost="520" onclick="selectGift(this)">
|
|
<div class="gift-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="gift-name">超喜欢你</div>
|
|
<div class="gift-cost">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
</svg>
|
|
520
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 积分不足提示 -->
|
|
<div class="not-enough-tip" data-dom-id="not-enough-tip" id="not-enough-tip">
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
|
|
<line x1="12" y1="9" x2="12" y2="13"></line>
|
|
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
</svg>
|
|
积分不足,前往充值获取更多积分
|
|
</div>
|
|
|
|
<!-- 底部按钮 -->
|
|
<div class="modal-footer">
|
|
<button class="send-btn" data-dom-id="btn-send" id="btn-send" onclick="sendGift()">
|
|
赠送
|
|
<span class="cost-text" id="send-cost">· 10 积分</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// 用户积分
|
|
const userPoints = 1280;
|
|
let selectedCost = 10;
|
|
let selectedName = '小心心';
|
|
|
|
// 选择礼物
|
|
function selectGift(el) {
|
|
document.querySelectorAll('.gift-item').forEach(function(item) {
|
|
item.classList.remove('selected');
|
|
});
|
|
el.classList.add('selected');
|
|
|
|
selectedCost = parseInt(el.getAttribute('data-cost'));
|
|
selectedName = el.querySelector('.gift-name').textContent;
|
|
|
|
document.getElementById('selected-name').textContent = selectedName;
|
|
document.getElementById('selected-cost').textContent = selectedCost + ' 积分';
|
|
document.getElementById('send-cost').textContent = '· ' + selectedCost + ' 积分';
|
|
|
|
// 检查积分是否足够
|
|
const tip = document.getElementById('not-enough-tip');
|
|
const btn = document.getElementById('btn-send');
|
|
if (selectedCost > userPoints) {
|
|
tip.classList.add('show');
|
|
btn.disabled = true;
|
|
} else {
|
|
tip.classList.remove('show');
|
|
btn.disabled = false;
|
|
}
|
|
}
|
|
|
|
// 赠送
|
|
function sendGift() {
|
|
if (selectedCost > userPoints) return;
|
|
alert('赠送' + selectedName + '成功!消耗 ' + selectedCost + ' 积分');
|
|
closeModal();
|
|
}
|
|
|
|
// 关闭弹窗
|
|
function closeModal() {
|
|
const modal = document.querySelector('.gift-modal');
|
|
modal.style.animation = 'slideUp 0.25s ease reverse';
|
|
setTimeout(function() {
|
|
document.querySelector('.modal-overlay').style.display = 'none';
|
|
}, 200);
|
|
}
|
|
|
|
// 点击遮罩关闭
|
|
function handleOverlayClick(e) {
|
|
if (e.target.classList.contains('modal-overlay')) {
|
|
closeModal();
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|