mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-08-12 17:10:37 +00:00
docs: 删减合并冲突出现的问题
This commit is contained in:
parent
89de56d2a2
commit
8c212be86b
@ -5756,7 +5756,6 @@ let data = encodeURIComponent(
|
|||||||
**接口地址 :** `/device/kickoff`
|
**接口地址 :** `/device/kickoff`
|
||||||
|
|
||||||
**调用例子 :** `/device/kickoff?key=00ALDFGEXXXXXXXXXXXXXXXXX&captcha=1234`
|
**调用例子 :** `/device/kickoff?key=00ALDFGEXXXXXXXXXXXXXXXXX&captcha=1234`
|
||||||
>>>>>>>>> Temporary merge branch 2
|
|
||||||
|
|
||||||
## 离线访问此文档
|
## 离线访问此文档
|
||||||
|
|
||||||
|
|||||||
@ -8,16 +8,6 @@
|
|||||||
<link rel="icon" href="docs/netease.png" />
|
<link rel="icon" href="docs/netease.png" />
|
||||||
<title>云小编每日抽奖 - 网易云音乐 API Enhanced</title>
|
<title>云小编每日抽奖 - 网易云音乐 API Enhanced</title>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
|
||||||
--gold: #fdcb6e;
|
|
||||||
--text-light: #636e72;
|
|
||||||
--fg: #333;
|
|
||||||
--muted: #666;
|
|
||||||
--border: #ddd;
|
|
||||||
--bg: #f5f5f5;
|
|
||||||
--panel: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@ -25,83 +15,221 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Segoe UI', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||||
background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 50%, #fce4ec 100%);
|
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
background: #f5f5f5;
|
||||||
align-items: center;
|
padding: 20px;
|
||||||
justify-content: center;
|
|
||||||
padding: 1.5rem;
|
|
||||||
color: var(--text);
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
max-width: 520px;
|
max-width: 520px;
|
||||||
|
margin: 40px auto;
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 32px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle b {
|
||||||
|
color: #d63031;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Section ---- */
|
||||||
|
.section {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section:last-of-type {
|
||||||
|
border-bottom: none;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
gap: 1.5rem;
|
justify-content: space-between;
|
||||||
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 标题编辑卡片 */
|
.section-title {
|
||||||
.card {
|
font-size: 16px;
|
||||||
background: var(--card-bg);
|
font-weight: 600;
|
||||||
border-radius: var(--radius);
|
color: #333;
|
||||||
padding: 1.8rem 2rem;
|
|
||||||
box-shadow: var(--shadow);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
transition: var(--transition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-section {
|
/* ---- Form Elements ---- */
|
||||||
text-align: center;
|
.form-group {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-input {
|
label {
|
||||||
|
display: block;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #555;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label .tag {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
padding: 1px 6px;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label .tag.o {
|
||||||
|
background: #fef3c7;
|
||||||
|
color: #92400e;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="text"],
|
||||||
|
input[type="number"],
|
||||||
|
textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 2px solid transparent;
|
padding: 10px 14px;
|
||||||
border-radius: var(--radius-sm);
|
border: 1px solid #ddd;
|
||||||
font-size: 1.6rem;
|
border-radius: 6px;
|
||||||
font-weight: 700;
|
font-size: 14px;
|
||||||
text-align: center;
|
|
||||||
padding: 0.6rem 1rem;
|
|
||||||
color: var(--text);
|
|
||||||
background: #fafafa;
|
|
||||||
transition: var(--transition);
|
|
||||||
outline: none;
|
outline: none;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
|
transition: border-color 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-input:hover {
|
input[type="text"]:focus,
|
||||||
background: #f5f3ff;
|
input[type="number"]:focus,
|
||||||
|
textarea:focus {
|
||||||
|
border-color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-input:focus {
|
textarea {
|
||||||
border-color: var(--primary-light);
|
resize: vertical;
|
||||||
background: #fff;
|
|
||||||
box-shadow: 0 0 0 4px rgba(124, 108, 240, 0.06);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-hint {
|
.btn {
|
||||||
font-size: 0.8rem;
|
display: block;
|
||||||
color: #b2bec3;
|
width: 100%;
|
||||||
margin-top: 0.4rem;
|
padding: 12px;
|
||||||
}
|
background: #333;
|
||||||
|
color: white;
|
||||||
/* 抽奖主卡片 */
|
font-size: 15px;
|
||||||
.lottery-card {
|
font-weight: 500;
|
||||||
background: var(--card-bg);
|
border-radius: 6px;
|
||||||
border-radius: var(--radius);
|
cursor: pointer;
|
||||||
padding: 2rem 2rem 2.2rem;
|
transition: background 0.2s ease;
|
||||||
box-shadow: var(--shadow);
|
border: none;
|
||||||
border: 1px solid var(--border);
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:disabled {
|
||||||
|
background: #ccc;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm {
|
||||||
|
display: inline-block;
|
||||||
|
width: auto;
|
||||||
|
padding: 6px 16px;
|
||||||
|
background: #333;
|
||||||
|
color: white;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s ease;
|
||||||
|
border: none;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm:disabled {
|
||||||
|
background: #ccc;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm.gray {
|
||||||
|
background: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm.gray:hover {
|
||||||
|
background: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm.gray:disabled {
|
||||||
|
background: #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm.green {
|
||||||
|
background: #059669;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm.green:hover {
|
||||||
|
background: #047857;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm.green:disabled {
|
||||||
|
background: #a7f3d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-fill {
|
||||||
|
margin-top: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-fill span {
|
||||||
|
color: #0066cc;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-fill span:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Lottery Display ---- */
|
||||||
|
.lottery-display {
|
||||||
|
text-align: center;
|
||||||
|
padding: 24px 16px;
|
||||||
|
background: #f9fafb;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rolling-display {
|
.rolling-display {
|
||||||
font-size: 2.4rem;
|
font-size: 2.4rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
color: var(--primary);
|
color: #333;
|
||||||
min-height: 4rem;
|
min-height: 4rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -111,19 +239,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.rolling-display.idle {
|
.rolling-display.idle {
|
||||||
color: #c4b5fd;
|
color: #999;
|
||||||
font-size: 1.3rem;
|
font-size: 1.2rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- Winner Result ---- */
|
/* ---- Winner Result ---- */
|
||||||
.winner-display {
|
.winner-display {
|
||||||
background: linear-gradient(135deg, #fff9e6, #fff3cd);
|
background: #f0fdf4;
|
||||||
border: 2px solid var(--gold);
|
border: 1px solid #86efac;
|
||||||
border-radius: var(--radius);
|
border-radius: 8px;
|
||||||
padding: 1.5rem;
|
padding: 20px 16px;
|
||||||
margin: 1rem 0 1.5rem;
|
margin-top: 16px;
|
||||||
animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.winner-label {
|
.winner-label {
|
||||||
@ -141,12 +269,6 @@
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.winner-img {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
margin: -20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.confetti-row {
|
.confetti-row {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -168,64 +290,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes bounce {
|
@keyframes bounce {
|
||||||
from { transform: translateY(0); }
|
from {
|
||||||
to { transform: translateY(-8px); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 按钮 */
|
|
||||||
.btn {
|
|
||||||
padding: 0.9rem 2.5rem;
|
|
||||||
border: none;
|
|
||||||
border-radius: 50px;
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 1.05rem;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: var(--transition);
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
width: 100%;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-lottery {
|
|
||||||
background: linear-gradient(135deg, #fd79a8, #e84393);
|
|
||||||
color: #fff;
|
|
||||||
box-shadow: 0 6px 20px rgba(253, 121, 168, 0.35);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-lottery:hover:not(:disabled) {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 10px 28px rgba(253, 121, 168, 0.45);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-lottery:active:not(:disabled) {
|
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-lottery:disabled {
|
to {
|
||||||
background: #b2bec3;
|
transform: translateY(-8px);
|
||||||
box-shadow: none;
|
}
|
||||||
cursor: not-allowed;
|
|
||||||
transform: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-reset {
|
/* ---- Status ---- */
|
||||||
background: transparent;
|
|
||||||
border: 2px solid var(--border);
|
|
||||||
color: var(--text-light);
|
|
||||||
margin-top: 0.8rem;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-reset:hover {
|
|
||||||
border-color: var(--primary-light);
|
|
||||||
color: var(--primary);
|
|
||||||
background: #f8f7ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 状态提示 */
|
|
||||||
.status-bar {
|
.status-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -257,8 +331,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse {
|
@keyframes pulse {
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0.4; }
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-text {
|
.status-text {
|
||||||
@ -285,14 +366,13 @@
|
|||||||
|
|
||||||
/* ---- Responsive ---- */
|
/* ---- Responsive ---- */
|
||||||
@media (max-width: 500px) {
|
@media (max-width: 500px) {
|
||||||
|
.container {
|
||||||
.card,
|
padding: 20px 16px;
|
||||||
.lottery-card {
|
margin: 20px auto;
|
||||||
padding: 1.4rem 1.2rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-input {
|
h1 {
|
||||||
font-size: 1.3rem;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rolling-display {
|
.rolling-display {
|
||||||
@ -309,33 +389,53 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- 标题编辑区 -->
|
<h1>云小编每日抽奖</h1>
|
||||||
<div class="card title-section">
|
<p class="subtitle">每次抽奖消耗 <b>200 个曲库编辑部积分</b>,每日最多可抽奖 3 次</p>
|
||||||
<input type="text" class="title-input" id="titleInput" value="🎉 云小编每日抽奖 🎉" autocomplete="off" disabled>
|
|
||||||
<div class="title-hint">每次抽奖消耗 <b>200 个曲库编辑部积分</b>,每日最多可抽奖 3 次</div>
|
<!-- Cookie 管理 -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="cookieInput">令牌 <span class="tag o">可选</span></label>
|
||||||
|
<input type="text" id="cookieInput" placeholder="留空则默认读取本地存储的令牌" autocomplete="off" />
|
||||||
|
<div class="quick-fill">
|
||||||
|
<span onclick="readLocalCookie()">读取本地令牌</span>
|
||||||
|
<span onclick="clearCookie()">清除令牌</span>
|
||||||
|
<span onclick="saveCookie()">保存令牌</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 抽奖主区域 -->
|
<!-- 抽奖区域 -->
|
||||||
<div class="lottery-card">
|
<div class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<span class="section-title">每日抽奖</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lottery-display">
|
||||||
<div class="rolling-display idle" id="rollingDisplay">等待抽奖</div>
|
<div class="rolling-display idle" id="rollingDisplay">等待抽奖</div>
|
||||||
<div id="resultContainer"></div>
|
<div id="resultContainer"></div>
|
||||||
<button class="btn btn-lottery" id="lotteryBtn">
|
</div>
|
||||||
<span>🎲</span> 开始抽奖
|
|
||||||
</button>
|
<button class="btn" id="lotteryBtn">
|
||||||
<button class="btn btn-reset" id="resetBtn">
|
🎲 开始抽奖
|
||||||
<span>🔄</span> 编辑令牌
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="status-bar" id="statusBar">
|
<div class="status-bar" id="statusBar">
|
||||||
<span class="status-dot idle" id="statusDot"></span>
|
<span class="status-dot idle" id="statusDot"></span>
|
||||||
<span class="status-text" id="statusText">就绪,点击按钮开始抽奖</span>
|
<span class="status-text" id="statusText">就绪,点击按钮开始抽奖</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 页脚 -->
|
||||||
|
<div class="footer-link">
|
||||||
|
<a href="/">← 返回首页</a>
|
||||||
|
<span style="margin: 0 8px; color: #ddd;">·</span>
|
||||||
|
<a href="/ugc.html">云小编任务中心</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
// ============ DOM 元素 ============
|
// ============ DOM 元素 ============
|
||||||
const titleInput = document.getElementById('titleInput');
|
const cookieInput = document.getElementById('cookieInput');
|
||||||
const rollingDisplay = document.getElementById('rollingDisplay');
|
const rollingDisplay = document.getElementById('rollingDisplay');
|
||||||
const resultContainer = document.getElementById('resultContainer');
|
const resultContainer = document.getElementById('resultContainer');
|
||||||
const lotteryBtn = document.getElementById('lotteryBtn');
|
const lotteryBtn = document.getElementById('lotteryBtn');
|
||||||
@ -452,20 +552,18 @@
|
|||||||
|
|
||||||
const res = await request('middle/play/do/lottery', '&activityId=6501202&drawCount=1');
|
const res = await request('middle/play/do/lottery', '&activityId=6501202&drawCount=1');
|
||||||
|
|
||||||
// 根据你的后端返回格式提取中奖者名称
|
|
||||||
const winner = res.data?.prizeDetailInfoMap?.['8186002']?.prizeName;
|
const winner = res.data?.prizeDetailInfoMap?.['8186002']?.prizeName;
|
||||||
if (!winner) {
|
if (!winner) {
|
||||||
throw new Error('无法解析响应数据');
|
throw new Error('无法解析响应数据');
|
||||||
}
|
}
|
||||||
|
|
||||||
// [抽奖结果, 剩余机会]
|
|
||||||
return [winner, res.data.restChance];
|
return [winner, res.data.restChance];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============ 滚动动画 ============
|
// ============ 滚动动画 ============
|
||||||
function startRollingAnimation(finalWinner, img) {
|
function startRollingAnimation(finalWinner) {
|
||||||
const placeholderNames = ['🎰', '🎲', '🎯', '✨', '💫', '🌟', '🎪', '🎭'];
|
const placeholderNames = ['🎰', '🎲', '🎯', '✨', '💫', '🌟', '🎪', '🎭'];
|
||||||
const totalDuration = 2000;
|
const totalDuration = 2800;
|
||||||
const startInterval = 50;
|
const startInterval = 50;
|
||||||
const endInterval = 280;
|
const endInterval = 280;
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
@ -485,8 +583,7 @@
|
|||||||
if (progress >= 1.0) {
|
if (progress >= 1.0) {
|
||||||
clearTimeout(rollingTimer);
|
clearTimeout(rollingTimer);
|
||||||
rollingDisplay.textContent = finalWinner;
|
rollingDisplay.textContent = finalWinner;
|
||||||
rollingDisplay.style.display = 'none';
|
showWinnerResult(finalWinner);
|
||||||
showWinnerResult(finalWinner, img);
|
|
||||||
finishDrawing();
|
finishDrawing();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -498,17 +595,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showWinnerResult(winner) {
|
function showWinnerResult(winner) {
|
||||||
resultContainer.innerHTML = `
|
resultContainer.innerHTML =
|
||||||
<div class="winner-display">
|
'<div class="winner-display">' +
|
||||||
<div class="winner-label">🏆 恭喜中奖</div>
|
'<div class="winner-label">🏆 恭喜中奖</div>' +
|
||||||
<div class="winner-name">${escapeHTML(winner)}</div>
|
'<div class="winner-name">' + escapeHTML(winner) + '</div>' +
|
||||||
<div class="confetti-row">
|
'<div class="confetti-row">' +
|
||||||
<span class="confetti-emoji">🎉</span>
|
'<span class="confetti-emoji">🎉</span>' +
|
||||||
<span class="confetti-emoji">🎊</span>
|
'<span class="confetti-emoji">🎊</span>' +
|
||||||
<span class="confetti-emoji">✨</span>
|
'<span class="confetti-emoji">✨</span>' +
|
||||||
</div>
|
'</div>' +
|
||||||
</div>
|
'</div>';
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHTML(str) {
|
function escapeHTML(str) {
|
||||||
@ -531,13 +627,11 @@
|
|||||||
resultContainer.innerHTML = '';
|
resultContainer.innerHTML = '';
|
||||||
rollingDisplay.className = 'rolling-display';
|
rollingDisplay.className = 'rolling-display';
|
||||||
rollingDisplay.textContent = '🎰';
|
rollingDisplay.textContent = '🎰';
|
||||||
rollingDisplay.style.display = 'flex';
|
|
||||||
setStatus('info', '正在获取抽奖结果...');
|
setStatus('info', '正在获取抽奖结果...');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetchLotteryResult();
|
const res = await fetchLotteryResult();
|
||||||
setStatus('info', '抽奖成功,剩余次数 ' + res[1]);
|
setStatus('info', '抽奖成功,剩余次数 ' + res[1]);
|
||||||
// 启动滚动动画,最终定格在中奖者
|
|
||||||
startRollingAnimation(res[0]);
|
startRollingAnimation(res[0]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rollingDisplay.textContent = '抽奖失败';
|
rollingDisplay.textContent = '抽奖失败';
|
||||||
@ -551,9 +645,8 @@
|
|||||||
// ============ 事件绑定 ============
|
// ============ 事件绑定 ============
|
||||||
lotteryBtn.addEventListener('click', startLottery);
|
lotteryBtn.addEventListener('click', startLottery);
|
||||||
|
|
||||||
// 空格键快捷抽奖
|
document.addEventListener('keydown', function (e) {
|
||||||
document.addEventListener('keydown', (e) => {
|
if (e.key === ' ' && document.activeElement !== cookieInput) {
|
||||||
if (e.key === ' ' && document.activeElement !== titleInput) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!isDrawing && !lotteryBtn.disabled) {
|
if (!isDrawing && !lotteryBtn.disabled) {
|
||||||
startLottery();
|
startLottery();
|
||||||
@ -570,12 +663,6 @@
|
|||||||
|
|
||||||
// ============ 初始化 ============
|
// ============ 初始化 ============
|
||||||
resetResult();
|
resetResult();
|
||||||
|
|
||||||
window.demo = function (name, chance, img) {
|
|
||||||
rollingDisplay.style.display = 'flex';
|
|
||||||
setStatus('info', '抽奖成功,剩余次数 ' + (chance || '0'));
|
|
||||||
startRollingAnimation(name || '演示', img || 'https://p5.music.126.net/obj/worDmcOCw6HCnzzCmsKx/61891591760/8d1c/528a/e977/10cbaa3fb39e8057be5d2560182cc5c7.png');
|
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user