This commit is contained in:
jeremygan2021
2026-03-27 13:27:47 +08:00
parent df261106da
commit 84b243dc52
10 changed files with 464 additions and 350 deletions

View File

@@ -776,22 +776,14 @@
<label>了解我们 URL (手机端底部按钮)</label>
<input type="text" id="wall_learn_more_url" placeholder="https://...">
</div>
<div class="checkbox-wrapper">
<input type="checkbox" id="wall_show_qrcode"> <label for="wall_show_qrcode">显示扫码签到二维码</label>
</div>
<div class="form-group">
<label>显示字段</label>
<div class="checkbox-wrapper">
<input type="checkbox" id="wall_show_name"> <label for="wall_show_name">姓名</label>
</div>
<div class="checkbox-wrapper">
<input type="checkbox" id="wall_show_company"> <label for="wall_show_company">单位名称</label>
</div>
<div class="checkbox-wrapper">
<input type="checkbox" id="wall_show_position"> <label for="wall_show_position">职务</label>
</div>
<div class="checkbox-wrapper">
<input type="checkbox" id="wall_show_vision"> <label for="wall_show_vision">愿景 (Vision)</label>
</div>
<div class="checkbox-wrapper">
<input type="checkbox" id="wall_show_scope"> <label for="wall_show_scope">业务范围 (弹幕)</label>
<label>大屏显示字段(基于签到字段配置)</label>
<p style="font-size: 0.85em; color: var(--text-muted); margin-bottom: 10px;">勾选要在签到大屏上显示的字段,字段名称与签到字段设置同步</p>
<div id="wall_display_fields" style="display: flex; flex-wrap: wrap; gap: 8px;">
<!-- 动态字段将在这里渲染 -->
</div>
</div>
</div>
@@ -1045,6 +1037,9 @@
"vision_2026": {"label": "2026年业务愿景", "show": true, "required": false}
});
// 渲染大屏显示字段
renderWallDisplayFields(config.checkin_field_config || {}, config.wall_config || {});
// DB Config
document.getElementById('db_host').value = config.db_host || '';
document.getElementById('db_port').value = config.db_port || '';
@@ -1054,14 +1049,10 @@
// Wall Config
const wc = config.wall_config || {};
const show = wc.show_fields || {};
document.getElementById('wall_bg_opacity').value = wc.bg_opacity !== undefined ? wc.bg_opacity : 0.3;
document.getElementById('wall_show_title').checked = wc.show_title !== false;
document.getElementById('wall_learn_more_url').value = wc.learn_more_url || '';
document.getElementById('wall_show_name').checked = show.name !== false;
document.getElementById('wall_show_position').checked = show.position !== false;
document.getElementById('wall_show_vision').checked = show.vision_2026 !== false;
document.getElementById('wall_show_scope').checked = show.business_scope !== false;
document.getElementById('wall_show_qrcode').checked = wc.show_qrcode === true;
});
function renderFieldConfig(tbodyId, fieldConfig, orderedKeys) {
@@ -1132,6 +1123,8 @@
Object.keys(fieldConfig).forEach(key => {
const field = fieldConfig[key];
if (!field) return;
const isLocked = (key === 'name' || key === 'phone');
const row = document.createElement('div');
@@ -1166,6 +1159,8 @@
Object.keys(fieldConfig).forEach(key => {
const field = fieldConfig[key];
if (!field) return;
const isLocked = (key === 'name' || key === 'phone');
const row = document.createElement('div');
@@ -1191,6 +1186,63 @@
});
}
/**
* 渲染大屏显示字段复选框
* @param {Object} checkinFieldConfig 签到字段配置
* @param {Object} wallConfig 大屏配置
*/
function renderWallDisplayFields(checkinFieldConfig, wallConfig) {
const container = document.getElementById('wall_display_fields');
container.innerHTML = '';
const showFields = wallConfig.show_fields || {};
Object.keys(checkinFieldConfig).forEach(key => {
const field = checkinFieldConfig[key];
if (!field || !field.show) return;
const isChecked = showFields[key] !== false;
const label = document.createElement('label');
label.className = 'checkbox-wrapper';
label.style.marginBottom = '0';
label.innerHTML = `
<input type="checkbox" class="wall-display-field" data-key="${key}" ${isChecked ? 'checked' : ''}>
<span style="color: white; cursor: pointer;">${field.label}</span>
<span style="color: #888; font-size: 0.85em; margin-left: 4px;">(${key})</span>
`;
container.appendChild(label);
});
// 如果没有可用字段,显示提示
if (container.children.length === 0) {
container.innerHTML = '<p style="color: var(--text-muted); font-size: 0.9em;">请在"签到/大屏字段设置"中配置需要显示的字段</p>';
}
}
/**
* 获取大屏显示字段配置(从 UI
*/
function getWallDisplayFieldsFromUI() {
const config = {};
const checkboxes = document.querySelectorAll('.wall-display-field');
checkboxes.forEach(cb => {
config[cb.dataset.key] = cb.checked;
});
return config;
}
/**
* 刷新大屏显示字段(当签到字段配置改变时调用)
*/
function refreshWallDisplayFields() {
const checkinConfig = getCheckinFieldConfigFromUI();
const wallConfig = {
show_fields: getWallDisplayFieldsFromUI()
};
renderWallDisplayFields(checkinConfig, wallConfig);
}
/**
* 获取报名字段配置(从 UI
*/
@@ -1480,6 +1532,8 @@
renderTicketFields(config);
} else {
renderCheckinFields(config);
// 刷新大屏显示字段配置
refreshWallDisplayFields();
}
closeDeleteModal();
@@ -1546,13 +1600,8 @@
bg_opacity: parseFloat(document.getElementById('wall_bg_opacity').value),
show_title: document.getElementById('wall_show_title').checked,
learn_more_url: document.getElementById('wall_learn_more_url').value,
show_fields: {
name: document.getElementById('wall_show_name').checked,
company_name: document.getElementById('wall_show_company').checked,
position: document.getElementById('wall_show_position').checked,
vision_2026: document.getElementById('wall_show_vision').checked,
business_scope: document.getElementById('wall_show_scope').checked
}
show_qrcode: document.getElementById('wall_show_qrcode').checked,
show_fields: getWallDisplayFieldsFromUI()
},
// DB Config