优化课表校对原图可见性
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
程序根据星期列、节次以及课程块覆盖范围整理周一至周五20个时段。完整定位的彩色课表可根据留白建议“无课”,仅保存 `busy` / `free`;课程名、教师、教室和识别原文留空。表格未完整展示、缺少可靠定位或不是彩色课表时,回退文字位置判断,无法确定的时段保持 `unknown`,不会把识别失败当作无课。节次与星期仅有少量漏字时可参考相邻标签定位;边界或行位置不可靠则交由本人核对。晚间和周末课程不参与当前四个值班时段判断。
|
||||
|
||||
校对页面默认缩小显示完整原图,校对表先收起。点击“校对课表”后,在原图上显示半透明校对层;点击时段按钮即可切换“有课 / 无课”,定位失败时保留“待确认”。有课按钮用红色标注,可随时收起校对层或放大原图;收起、放大不丢失当前修改。界面显示有课、无课及待确认时段数,不再要求填写课程备注。核对后可将其余待确认设为无课。保存草稿不等于确认;只有20个时段均已明确,才能点击“核对无误并确认”。识别组件异常时仍保存图片并提供手动整理。自动结果始终需要核对,只有已确认的无课时段才可供排班使用。
|
||||
校对页面默认缩小显示完整原图,校对表先收起。点击“校对课表”后,在原图上显示透明底板与透明单元格的校对按钮层,原图保持原色;点击时段按钮即可切换“有课 / 无课”,定位失败时保留“待确认”。有课按钮用红色文字和边框标注,保存操作位于图片下方,避免遮挡课表。可点“看清原图”临时隐藏全部标注,再点“恢复校对标注”继续;也可随时收起校对层或放大原图;收起、放大不丢失当前修改。界面显示有课、无课及待确认时段数,不再要求填写课程备注。核对后可将其余待确认设为无课。保存草稿不等于确认;只有20个时段均已明确,才能点击“核对无误并确认”。识别组件异常时仍保存图片并提供手动整理。自动结果始终需要核对,只有已确认的无课时段才可供排班使用。
|
||||
|
||||
这次仅收取和整理数据,不会自动修改已有值班表或发送额外邮件。
|
||||
|
||||
|
||||
Vendored
+11
-11
@@ -616,24 +616,24 @@ button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px s
|
||||
.timetable-source img { display:block; width:auto; height:auto; max-width:100%; max-height:calc(66vh - 20px); object-fit:contain; }
|
||||
.timetable-review-stage.is-expanded .timetable-source { display:block; }
|
||||
.timetable-review-stage.is-expanded .timetable-source img { width:100%; max-height:none; }
|
||||
.timetable-review-panel { grid-area:1 / 1; z-index:1; width:calc(100% - 16px); max-height:calc(66vh - 16px); overflow:auto; justify-self:center; padding:14px; border:1px solid rgba(255,255,255,.85); border-radius:12px; background:rgba(255,255,255,.48); box-shadow:0 8px 28px rgba(38,60,53,.12); }
|
||||
.timetable-review-panel { grid-area:1 / 1; z-index:1; width:calc(100% - 16px); max-height:calc(66vh - 16px); overflow:auto; justify-self:center; padding:14px; border:0; border-radius:12px; background:transparent; box-shadow:none; }
|
||||
.timetable-review-panel[hidden] { display:none; }
|
||||
.timetable-review-stage.is-peeking .timetable-review-panel { visibility:hidden; pointer-events:none; }
|
||||
#timetable-peek-image[hidden],#timetable-review-actions[hidden] { display:none; }
|
||||
.timetable-review-panel .timetable-grid-wrap { margin:0 0 10px; }
|
||||
.timetable-review-panel .timetable-grid { min-width:0; table-layout:fixed; }
|
||||
.timetable-review-panel .timetable-grid th,.timetable-review-panel .timetable-grid td { padding:6px; min-width:0; border-color:rgba(38,60,53,.18); }
|
||||
.timetable-review-panel .timetable-grid th { background:rgba(234,243,237,.65); }
|
||||
.timetable-review-panel .timetable-grid th,.timetable-review-panel .timetable-grid td { padding:6px; min-width:0; border-color:rgba(38,60,53,.15); }
|
||||
.timetable-review-panel .timetable-grid th { background:rgba(255,255,255,.28); text-shadow:0 0 3px #fff,0 1px 2px #fff; }
|
||||
.timetable-review-panel .timetable-grid small { display:block; font-size:10px; font-weight:400; }
|
||||
.timetable-review-panel td[data-status=busy] { background:rgba(255,241,242,.35); }
|
||||
.timetable-review-panel td[data-status=free] { background:rgba(234,243,237,.3); }
|
||||
.timetable-review-panel td[data-status=unknown] { background:rgba(255,247,231,.4); }
|
||||
.timetable-status-button { display:block; width:100%; min-height:42px; padding:6px 3px; border:1px solid rgba(40,102,79,.35); border-radius:8px; background:rgba(234,243,237,.76); color:var(--primary); font-size:13px; font-weight:600; }
|
||||
.timetable-grid td[data-status=busy] .timetable-status-button { border-color:rgba(185,28,28,.5); background:rgba(254,226,226,.8); color:#991b1b; }
|
||||
.timetable-grid td[data-status=unknown] .timetable-status-button { border-color:rgba(180,83,9,.45); background:rgba(255,247,231,.8); color:#92400e; }
|
||||
.timetable-review-panel .timetable-grid td[data-status] { background:transparent; }
|
||||
.timetable-status-button { display:block; width:100%; min-height:42px; padding:6px 3px; border:1px solid rgba(40,102,79,.65); border-radius:8px; background:rgba(255,255,255,.12); color:var(--primary); font-size:13px; font-weight:700; text-shadow:0 0 3px #fff,0 1px 2px #fff; }
|
||||
.timetable-grid td[data-status=busy] .timetable-status-button { border-color:rgba(185,28,28,.75); background:rgba(254,226,226,.14); color:#991b1b; }
|
||||
.timetable-grid td[data-status=unknown] .timetable-status-button { border-color:rgba(180,83,9,.65); background:rgba(255,247,231,.14); color:#92400e; }
|
||||
.timetable-status-button:hover { outline:2px solid currentColor; outline-offset:1px; }
|
||||
.timetable-status-button:focus-visible { outline:3px solid var(--primary); outline-offset:2px; }
|
||||
.timetable-status-button:disabled { opacity:1; cursor:default; }
|
||||
.timetable-review-panel #timetable-confirmation-state { padding:4px 6px; border-radius:4px; color:var(--ink); background:rgba(255,255,255,.7); }
|
||||
.timetable-review-panel .form-actions { margin-top:10px; }
|
||||
#timetable-review-actions { margin-top:12px; }
|
||||
#timetable-review-actions .form-actions { margin-top:10px; }
|
||||
.timetable-recognition-notes { margin-top:12px; font-size:13px; }
|
||||
.timetable-recognition-notes summary { cursor:pointer; color:var(--muted); }
|
||||
.timetable-grid-wrap { overflow-x:auto; margin:16px 0; }
|
||||
|
||||
Vendored
+2
-2
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>WorkLog · 活动记录</title>
|
||||
<meta name="theme-color" content="#f5f7f5" />
|
||||
<link rel="stylesheet" href="/assets/styles.css?v=22" />
|
||||
<link rel="stylesheet" href="/assets/styles.css?v=23" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
@@ -322,7 +322,7 @@
|
||||
|
||||
<div id="toast" class="toast hidden" role="status" aria-live="polite"></div>
|
||||
|
||||
<script src="/js/app.js?v=33"></script>
|
||||
<script src="/js/app.js?v=34"></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Vendored
+20
-10
@@ -1254,7 +1254,7 @@
|
||||
const slots = timetableData.slots, days = timetableData.days;
|
||||
const statusLabels = { unknown: '待确认', busy: '有课', free: '无课' };
|
||||
modal(`<h3>${weekLabel(item.week_type)}课表 · ${editable ? '核对与修改' : '查看'}</h3><p class="modal-sub muted">${editable ? '点击“校对课表”打开半透明校对层,再点时段按钮切换有课/无课。' : '点击“查看时段”对照原图查看有课/无课状态。'}</p>
|
||||
<div class="timetable-review-toolbar"><button class="btn primary" type="button" id="timetable-review-toggle" aria-expanded="false" aria-controls="timetable-review-panel">${editable ? '校对课表' : '查看时段'}</button><button class="btn" type="button" id="timetable-image-zoom" aria-pressed="false">放大原图</button><span class="muted" id="timetable-recognition-summary" role="status"></span></div>
|
||||
<div class="timetable-review-toolbar"><button class="btn primary" type="button" id="timetable-review-toggle" aria-expanded="false" aria-controls="timetable-review-panel">${editable ? '校对课表' : '查看时段'}</button><button class="btn" type="button" id="timetable-image-zoom" aria-pressed="false">放大原图</button><button class="btn" type="button" id="timetable-peek-image" aria-pressed="false" hidden>看清原图</button><span class="muted" id="timetable-recognition-summary" role="status"></span></div>
|
||||
<div class="timetable-review-stage" id="timetable-review-stage">
|
||||
<div class="timetable-source"><img id="timetable-source-image" alt="课表原图" /><p class="muted" id="timetable-image-status">正在加载原图…</p></div>
|
||||
<form id="timetable-correction-form" class="timetable-review-panel" hidden><div id="timetable-review-panel">
|
||||
@@ -1262,11 +1262,13 @@
|
||||
const index = cells.findIndex(cell => cell.day === i+1 && cell.slot === slot.id), cell = cells[index];
|
||||
return `<td data-status="${cell.status}"><button type="button" class="timetable-status-button" aria-label="${days[i]}${slot.label}:${statusLabels[cell.status]}" aria-pressed="${cell.status === 'unknown' ? 'mixed' : cell.status === 'busy'}" data-cell="${index}" data-value="${cell.status}" ${editable ? '' : 'disabled'}>${statusLabels[cell.status]}</button></td>`;
|
||||
}).join('')}</tr>`).join('')}</tbody></table></div>
|
||||
${editable ? '<button class="btn sm" type="button" id="timetable-fill-free">将其余待确认设为无课</button>' : ''}
|
||||
<div class="form-error" role="alert"></div><p class="muted" id="timetable-confirmation-state">${item.confirmed_at ? '已核对,确认时间:' + fmtDate(item.confirmed_at) : '对照背景课表,核对后再确认。'}</p>
|
||||
${editable ? '<div class="form-actions"><button class="btn" type="submit" data-confirm="false">保存草稿</button><button class="btn primary" type="submit" data-confirm="true">核对无误并确认</button></div>' : ''}
|
||||
</div></form>
|
||||
</div>
|
||||
<div id="timetable-review-actions" hidden>
|
||||
${editable ? '<button class="btn sm" type="button" id="timetable-fill-free">将其余待确认设为无课</button>' : ''}
|
||||
<div class="form-error" id="timetable-review-error" role="alert"></div><p class="muted" id="timetable-confirmation-state">${item.confirmed_at ? '已核对,确认时间:' + fmtDate(item.confirmed_at) : '对照背景课表,核对后再确认。'}</p>
|
||||
${editable ? '<div class="form-actions"><button class="btn" type="submit" form="timetable-correction-form" data-confirm="false">保存草稿</button><button class="btn primary" type="submit" form="timetable-correction-form" data-confirm="true">核对无误并确认</button></div>' : ''}
|
||||
</div>
|
||||
<details class="timetable-recognition-notes"><summary>识别说明</summary><p class="muted">${item.structure.warnings.map(esc).join('<br />')}</p></details>
|
||||
<div class="form-actions"><button class="btn" type="button" id="timetable-download-image">下载原图</button><button class="btn" type="button" id="timetable-editor-close">关闭</button></div>`);
|
||||
$('#modal-root .modal').classList.add('timetable-editor');
|
||||
@@ -1286,12 +1288,20 @@
|
||||
imageUrl = URL.createObjectURL(blob); img.src = imageUrl; imageStatus.textContent = ''; imageStatus.classList.add('hidden');
|
||||
}).catch(error => { imageStatus.textContent = error.message; });
|
||||
const stage = $('#timetable-review-stage'), reviewButton = $('#timetable-review-toggle');
|
||||
const reviewActions = $('#timetable-review-actions'), peekButton = $('#timetable-peek-image');
|
||||
reviewButton.addEventListener('click', () => {
|
||||
const open = form.hidden;
|
||||
form.hidden = !open; stage.classList.toggle('is-reviewing', open);
|
||||
form.hidden = !open; reviewActions.hidden = !open; peekButton.hidden = !open;
|
||||
stage.classList.toggle('is-reviewing', open); stage.classList.remove('is-peeking');
|
||||
peekButton.setAttribute('aria-pressed', 'false'); peekButton.textContent = '看清原图';
|
||||
reviewButton.setAttribute('aria-expanded', String(open));
|
||||
reviewButton.textContent = open ? (editable ? '收起校对' : '收起时段') : (editable ? '校对课表' : '查看时段');
|
||||
});
|
||||
peekButton.addEventListener('click', () => {
|
||||
const peeking = stage.classList.toggle('is-peeking');
|
||||
peekButton.setAttribute('aria-pressed', String(peeking));
|
||||
peekButton.textContent = peeking ? '恢复校对标注' : '看清原图';
|
||||
});
|
||||
$('#timetable-image-zoom').addEventListener('click', event => {
|
||||
const expanded = stage.classList.toggle('is-expanded');
|
||||
event.currentTarget.setAttribute('aria-pressed', String(expanded));
|
||||
@@ -1308,11 +1318,11 @@
|
||||
const setCellStatus = (button, status) => {
|
||||
button.dataset.value = status; button.textContent = statusLabels[status];
|
||||
button.closest('td').dataset.status = status;
|
||||
form.querySelector('.form-error').textContent = '';
|
||||
$('#timetable-review-error').textContent = '';
|
||||
const cell = cells[Number(button.dataset.cell)], slot = slots.find(slot => slot.id === cell.slot);
|
||||
button.setAttribute('aria-label', `${days[cell.day-1]}${slot.label}:${statusLabels[status]}`);
|
||||
button.setAttribute('aria-pressed', String(status === 'busy'));
|
||||
form.querySelector('#timetable-confirmation-state').textContent = '有未保存修改,请重新保存并确认。';
|
||||
$('#timetable-confirmation-state').textContent = '有未保存修改,请重新保存并确认。';
|
||||
updateSummary();
|
||||
};
|
||||
form.querySelectorAll('[data-cell]').forEach(button => button.addEventListener('click', () => {
|
||||
@@ -1326,13 +1336,13 @@
|
||||
event.preventDefault(); if (saving) return;
|
||||
const confirm = event.submitter?.dataset.confirm === 'true';
|
||||
const edited = cells.map((cell,index) => ({ day: cell.day, slot: cell.slot, status: form.querySelector(`[data-cell="${index}"]`).dataset.value, courses: '' }));
|
||||
const errorBox = form.querySelector('.form-error'); errorBox.textContent = '';
|
||||
const errorBox = $('#timetable-review-error'); errorBox.textContent = '';
|
||||
if (confirm && edited.some(cell => cell.status === 'unknown')) { errorBox.textContent = '仍有待确认时段,请核对后再确认'; return; }
|
||||
saving = true; form.querySelectorAll('button').forEach(button => button.disabled = true);
|
||||
saving = true; document.querySelectorAll('#timetable-correction-form button, #timetable-review-actions button').forEach(button => button.disabled = true);
|
||||
try {
|
||||
await api('/timetables/me/' + item.week_type, { method: 'PATCH', body: { revision: item.revision, cells: edited, confirm } });
|
||||
closeModal(); toast(confirm ? '课表已核对确认' : '草稿已保存'); loadTimetables();
|
||||
} catch (error) { errorBox.textContent = error.message; saving = false; form.querySelectorAll('button').forEach(button => button.disabled = false); }
|
||||
} catch (error) { errorBox.textContent = error.message; saving = false; document.querySelectorAll('#timetable-correction-form button, #timetable-review-actions button').forEach(button => button.disabled = false); }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user