fenzhuo
This commit is contained in:
@@ -584,6 +584,11 @@
|
||||
<label for="enable_seating">开启分桌功能</label>
|
||||
</div>
|
||||
<div id="seating_inputs">
|
||||
<div class="form-group">
|
||||
<label>座位单位名称</label>
|
||||
<input type="text" id="seat_unit_name" placeholder="如:桌、座位、区、组" style="width: 200px;">
|
||||
<p style="font-size: 0.8em; color: var(--text-muted); margin-top: 5px;">显示在座位号旁边的单位,如"桌"、"座位"、"区"等</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>总桌数</label>
|
||||
<input type="number" id="total_tables" min="1">
|
||||
@@ -819,6 +824,22 @@
|
||||
<img id="image_preview" class="preview-img" src="">
|
||||
</div>
|
||||
<button onclick="uploadImage()">上传图片</button>
|
||||
|
||||
<hr style="border-color: rgba(0,242,255,0.2); margin: 25px 0;">
|
||||
|
||||
<div class="checkbox-wrapper" style="margin-bottom: 15px;">
|
||||
<input type="checkbox" id="enable_qrcode">
|
||||
<label for="enable_qrcode">显示入群二维码(签到成功后将展示)</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>入群二维码图片</label>
|
||||
<input type="file" id="qrcode_image_file" accept="image/*" style="padding: 10px 0;">
|
||||
<img id="qrcode_preview" class="preview-img" src="" style="max-width: 200px;">
|
||||
</div>
|
||||
<button onclick="uploadQrcode()">上传二维码</button>
|
||||
<p style="font-size: 0.85em; color: var(--text-muted); margin-top: 10px;">
|
||||
💡 开启后,签到成功页面将显示二维码,长按可保存图片
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -863,6 +884,13 @@
|
||||
});
|
||||
|
||||
checkAuthStatus();
|
||||
|
||||
const seatUnitInput = document.getElementById('seat_unit_name');
|
||||
if (seatUnitInput) {
|
||||
seatUnitInput.addEventListener('input', function() {
|
||||
updateSeatingLabels(this.value);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
async function checkAuthStatus() {
|
||||
@@ -948,6 +976,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据座位单位名称更新标签文字
|
||||
*/
|
||||
function updateSeatingLabels(unitName) {
|
||||
const unit = unitName || '桌';
|
||||
const labels = document.querySelectorAll('#seating_inputs .form-group label');
|
||||
if (labels.length >= 2) {
|
||||
labels[1].textContent = `总${unit}数`;
|
||||
labels[2].textContent = `每${unit}最大人数`;
|
||||
}
|
||||
}
|
||||
|
||||
// Load config on startup
|
||||
fetch('/api/admin/config')
|
||||
.then(res => res.json())
|
||||
@@ -962,6 +1002,9 @@
|
||||
document.getElementById('bg_color').value = config.bg_color;
|
||||
document.getElementById('image_preview').src = config.header_image;
|
||||
|
||||
document.getElementById('enable_qrcode').checked = config.enable_qrcode === true;
|
||||
document.getElementById('qrcode_preview').src = config.qrcode_image || '';
|
||||
|
||||
// Checkin Config
|
||||
document.getElementById('enable_ticket_validation').checked = config.enable_ticket_validation !== false;
|
||||
document.getElementById('enable_sms_verification').checked = config.enable_sms_verification === true;
|
||||
@@ -982,6 +1025,8 @@
|
||||
document.getElementById('enable_seating').checked = config.enable_seating !== false; // Default true
|
||||
document.getElementById('total_tables').value = config.total_tables || 14;
|
||||
document.getElementById('max_per_table').value = config.max_per_table || 10;
|
||||
document.getElementById('seat_unit_name').value = config.seat_unit_name || '桌';
|
||||
updateSeatingLabels(config.seat_unit_name);
|
||||
toggleSeatingInputs();
|
||||
|
||||
// Field Configs - 使用新版渲染函数
|
||||
@@ -1467,6 +1512,9 @@
|
||||
bg_color: document.getElementById('bg_color').value,
|
||||
header_image: document.getElementById('image_preview').src.replace(window.location.origin, ''),
|
||||
|
||||
enable_qrcode: document.getElementById('enable_qrcode').checked,
|
||||
qrcode_image: document.getElementById('qrcode_preview').src.replace(window.location.origin, ''),
|
||||
|
||||
// Checkin Config
|
||||
enable_ticket_validation: document.getElementById('enable_ticket_validation').checked,
|
||||
enable_sms_verification: document.getElementById('enable_sms_verification').checked,
|
||||
@@ -1485,6 +1533,7 @@
|
||||
|
||||
// Seating Config
|
||||
enable_seating: document.getElementById('enable_seating').checked,
|
||||
seat_unit_name: document.getElementById('seat_unit_name').value || '桌',
|
||||
total_tables: parseInt(document.getElementById('total_tables').value),
|
||||
max_per_table: parseInt(document.getElementById('max_per_table').value),
|
||||
|
||||
@@ -1583,6 +1632,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传入群二维码图片
|
||||
*/
|
||||
async function uploadQrcode() {
|
||||
const fileInput = document.getElementById('qrcode_image_file');
|
||||
if (!fileInput.files[0]) {
|
||||
showMessage('请先选择图片', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', fileInput.files[0]);
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/admin/upload', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
const data = await res.json();
|
||||
if (res.ok) {
|
||||
document.getElementById('qrcode_preview').src = data.url;
|
||||
showMessage('二维码上传成功,请记得点击保存设置', 'success');
|
||||
} else {
|
||||
showMessage('上传失败: ' + data.message, 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
showMessage('网络错误', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function initDatabase() {
|
||||
if (!confirm('确定要在当前配置的数据库中初始化/迁移表结构吗?\n(此操作安全,不会删除现有数据)')) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user