This commit is contained in:
jeremygan2021
2026-03-26 20:27:59 +08:00
parent 1b5faf00cc
commit 3ab71269d7
2 changed files with 200 additions and 2 deletions

View File

@@ -463,6 +463,45 @@
100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}
/* 入群二维码样式 */
.qrcode-section {
margin-top: 25px;
padding: 20px;
background: rgba(255, 255, 255, 0.05);
border-radius: 12px;
border: 1px solid rgba(0, 242, 255, 0.3);
text-align: center;
}
.qrcode-title {
color: var(--primary-color);
font-size: 0.9rem;
margin-bottom: 15px;
font-weight: 600;
}
.qrcode-image {
max-width: 180px;
width: 100%;
border-radius: 8px;
border: 1px solid rgba(0, 242, 255, 0.4);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.qrcode-image:hover {
transform: scale(1.02);
box-shadow: 0 6px 20px rgba(0, 242, 255, 0.3);
}
.qrcode-hint {
color: var(--text-muted);
font-size: 0.75rem;
margin-top: 10px;
opacity: 0.8;
}
</style>
</head>
<body>
@@ -576,6 +615,12 @@
</div>
</div>
<div id="qrcode-container-success" class="qrcode-section hidden">
<p class="qrcode-title">📱 扫码加入社群</p>
<img id="qrcode-img-success" class="qrcode-image" src="" alt="入群二维码" oncontextmenu="handleQrcodeLongPress(event)">
<p class="qrcode-hint">长按二维码保存到相册</p>
</div>
<p style="margin-top: 20px;">请入座等待会议开始</p>
<button id="success-btn" onclick="window.location.href='/wall'" style="margin-top: 30px; background: transparent; border: 1px solid rgba(255,255,255,0.2);">前往活动</button>
</div>
@@ -601,6 +646,12 @@
</div>
</div>
<div id="qrcode-container-signed" class="qrcode-section hidden">
<p class="qrcode-title">📱 扫码加入社群</p>
<img id="qrcode-img-signed" class="qrcode-image" src="" alt="入群二维码" oncontextmenu="handleQrcodeLongPress(event)">
<p class="qrcode-hint">长按二维码保存到相册</p>
</div>
<p style="margin-top: 20px;">请入座等待会议开始</p>
<button id="signed-btn" onclick="window.location.href='/wall'" style="margin-top: 30px; background: transparent; border: 1px solid rgba(255,255,255,0.2);">前往活动</button>
</div>
@@ -646,6 +697,25 @@
let isCheckinCodeVerified = false;
/**
* 获取座位单位名称
*/
function getSeatUnitName() {
return CONFIG.seat_unit_name || '桌';
}
/**
* 格式化座位号显示(替换"桌"为单位名称)
* @param {string} seatText 原始座位文字
* @returns {string} 格式化后的座位文字
*/
function formatSeatDisplay(seatText) {
if (!seatText) return '';
const unit = getSeatUnitName();
if (unit === '桌') return seatText;
return seatText.replace(/桌/g, unit);
}
async function refreshConfig() {
try {
const res = await fetch('/api/admin/config');
@@ -844,7 +914,7 @@
document.getElementById('signed-phone').textContent = data.user.phone;
if (CONFIG.enable_seating !== false) {
document.getElementById('signed-seat-display').textContent = data.seat || "自由";
document.getElementById('signed-seat-display').textContent = formatSeatDisplay(data.seat) || ("自由" + getSeatUnitName());
document.getElementById('signed-seat-display').style.display = 'block';
document.getElementById('signed-seat-label').textContent = "您的座位是";
document.getElementById('signed-seat-label').style.display = 'block';
@@ -860,6 +930,9 @@
document.getElementById('signed-seat-label').textContent = "签到成功,请自由入座";
document.getElementById('signed-tablemates-container').classList.add('hidden');
}
// 显示二维码(如果配置开启)
updateQrcodeDisplay();
} else {
// Single user found
await refreshConfig();
@@ -968,7 +1041,7 @@
document.getElementById('success-btn').textContent = payload.name + '/点击进入活动大厅';
if (CONFIG.enable_seating !== false) {
// Show assigned seat
document.getElementById('seat-display').textContent = data.seat || "自由";
document.getElementById('seat-display').textContent = formatSeatDisplay(data.seat) || ("自由" + getSeatUnitName());
document.getElementById('seat-display').style.display = 'block';
document.getElementById('success-seat-label').textContent = "您的座位已分配";
document.getElementById('success-seat-label').style.display = 'block';
@@ -985,6 +1058,9 @@
document.getElementById('tablemates-container').classList.add('hidden');
}
// 显示二维码(如果配置开启)
updateQrcodeDisplay();
document.getElementById('step-form').classList.add('hidden');
document.getElementById('step-success').classList.remove('hidden');
} else {
@@ -1061,6 +1137,49 @@
updateCheckinButtonState();
}
/**
* 根据配置控制二维码显示
*/
function updateQrcodeDisplay() {
const enableQrcode = CONFIG.enable_qrcode === true;
const qrcodeImage = CONFIG.qrcode_image;
if (enableQrcode && qrcodeImage) {
// 签到成功页面的二维码
const successContainer = document.getElementById('qrcode-container-success');
const successImg = document.getElementById('qrcode-img-success');
if (successContainer) {
successImg.src = qrcodeImage;
successContainer.classList.remove('hidden');
}
// 已签到页面的二维码
const signedContainer = document.getElementById('qrcode-container-signed');
const signedImg = document.getElementById('qrcode-img-signed');
if (signedContainer) {
signedImg.src = qrcodeImage;
signedContainer.classList.remove('hidden');
}
} else {
document.getElementById('qrcode-container-success')?.classList.add('hidden');
document.getElementById('qrcode-container-signed')?.classList.add('hidden');
}
}
/**
* 处理二维码长按保存(在 PC 端右键保存)
*/
function handleQrcodeLongPress(event) {
event.preventDefault();
const img = event.target;
if (img.src) {
const link = document.createElement('a');
link.href = img.src;
link.download = '入群二维码';
link.click();
}
}
async function sendCheckinSms() {
const phone = document.getElementById('form-phone').value.trim();
const errorDiv = document.getElementById('submit-error');