rollcall-classroom-assets 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/zuoye-app.js +58 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollcall-classroom-assets",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Static assets for the classroom workbench (roll-call): app JS, pinyin/xlsx/zxing engines and icons. Published only so they can be served from a China-friendly CDN.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assets",
|
package/zuoye-app.js
CHANGED
|
@@ -1718,6 +1718,7 @@ function bookLocalSetAll(o) {
|
|
|
1718
1718
|
try { bookLocalSet(((o.templates[o.active] || {}).book) || emptyBook()); } catch (e) { }
|
|
1719
1719
|
}
|
|
1720
1720
|
function renderTplBar() {
|
|
1721
|
+
renderPhTplPick(); // 手机页那个模板下拉跟着一起刷(同一个出口,少一处漂移的机会)
|
|
1721
1722
|
const sel = $('bookTpl'); if (!sel) return;
|
|
1722
1723
|
sel.innerHTML = cmtBooks.map((t, i) => `<option value="${i}"${i === cmtActive ? ' selected' : ''}>${esc(t.name)}</option>`).join('');
|
|
1723
1724
|
const note = $('bookTplNote');
|
|
@@ -1745,6 +1746,10 @@ function cmtSetActive(i, save) {
|
|
|
1745
1746
|
renderBookSelect(); renderBookTabs(); renderTplBar();
|
|
1746
1747
|
try { repRenderCmtPick(); } catch (e) { }
|
|
1747
1748
|
if ($('bookInput')) $('bookInput').value = (bookDraft || cmtBookByTier)[bookTab].join('\n');
|
|
1749
|
+
// 手机页视图跟着走:模板下拉、评语下拉、档位提示、以及开着的评语面板内容(第 175 轮)
|
|
1750
|
+
try { renderPhTplPick(); } catch (e) { }
|
|
1751
|
+
const phBox = $('phBookInput');
|
|
1752
|
+
if (phBox && $('phBookPanel') && $('phBookPanel').style.display !== 'none') phBox.value = cmtBook.join('\n');
|
|
1748
1753
|
if (save) cmtSaveAll().then(ok => { if (!ok) toast('已切到本机(云端未同步)'); });
|
|
1749
1754
|
}
|
|
1750
1755
|
function cmtTplAdd() {
|
|
@@ -4436,6 +4441,50 @@ function renderPhonePick() {
|
|
|
4436
4441
|
if (armedCmt && (cmtBook.indexOf(armedCmt) >= 0 || armedCmt === t)) sel.value = armedCmt;
|
|
4437
4442
|
const note = $('phBookNote');
|
|
4438
4443
|
if (note) note.textContent = cmtBook.length ? `共 ${cmtBook.length} 条` : '还没有常用评语';
|
|
4444
|
+
renderPhTplPick(); // 模板下拉与「当前模板」保持一致(多模板:手机上也能切)
|
|
4445
|
+
}
|
|
4446
|
+
// ---------- 手机页·模板(第 175 轮)----------
|
|
4447
|
+
// 原来手机页的评语下拉只画「当前模板」那几条,多套模板在手机上等于用不上(用户报障)。
|
|
4448
|
+
// 这里补一个模板下拉 + 新建;切换/新建都复用电脑端那一份状态(cmtBooks / cmtActive),
|
|
4449
|
+
// 再经由 cmtSetActive 统一落库与刷新 —— 不另写第二套模板逻辑。
|
|
4450
|
+
function renderPhTplPick() {
|
|
4451
|
+
const sel = $('phTplPick'); if (!sel) return;
|
|
4452
|
+
sel.innerHTML = cmtBooks.map((t, i) =>
|
|
4453
|
+
`<option value="${i}"${i === cmtActive ? ' selected' : ''}>${esc((t && t.name) || '默认')}</option>`).join('');
|
|
4454
|
+
}
|
|
4455
|
+
// 手机页评语面板里**没点保存**的内容 → 先收回「当前模板」,免得切模板/新建时被静默丢掉
|
|
4456
|
+
function phFlushBook() {
|
|
4457
|
+
const p = $('phBookPanel'), box = $('phBookInput');
|
|
4458
|
+
if (!p || p.style.display === 'none' || !box) return;
|
|
4459
|
+
const list = normBook(String(box.value || '').split('\n'));
|
|
4460
|
+
if (!list.length) return;
|
|
4461
|
+
const bk = bookFromFlat(list);
|
|
4462
|
+
cmtBooks[cmtActive] = { name: cmtBooks[cmtActive].name || '默认', book: bk };
|
|
4463
|
+
bookApply(bk); // 兜底路径(bookDraft || cmtBookByTier)也跟着新
|
|
4464
|
+
}
|
|
4465
|
+
function phTplSwitch(i) {
|
|
4466
|
+
if (!cmtBooks.length) return;
|
|
4467
|
+
i = Math.min(Math.max(0, i | 0), cmtBooks.length - 1);
|
|
4468
|
+
if (i === cmtActive) return;
|
|
4469
|
+
phFlushBook();
|
|
4470
|
+
cmtSetActive(i, true);
|
|
4471
|
+
renderPhonePick(); renderPhTier(); // cmtSetActive 只认电脑端几个视图 → 手机页这边补一刀
|
|
4472
|
+
const box = $('phBookInput');
|
|
4473
|
+
if (box && $('phBookPanel') && $('phBookPanel').style.display !== 'none') box.value = cmtBook.join('\n');
|
|
4474
|
+
toast('已切到模板「' + ((cmtBooks[cmtActive] || {}).name || '默认') + '」');
|
|
4475
|
+
}
|
|
4476
|
+
function phTplAdd() {
|
|
4477
|
+
if (cmtBooks.length >= CMT_MAX_TPL) { toast('最多 ' + CMT_MAX_TPL + ' 套模板'); return; }
|
|
4478
|
+
const nm = String(window.prompt('新模板名称(最多 12 字,当前 ' + cmtBooks.length + '/' + CMT_MAX_TPL + ' 套)', '模板' + (cmtBooks.length + 1)) || '')
|
|
4479
|
+
.replace(/\s+/g, ' ').trim().slice(0, 12);
|
|
4480
|
+
if (!nm) return;
|
|
4481
|
+
phFlushBook(); // 先保住当前这套的手机页编辑
|
|
4482
|
+
cmtBooks.push({ name: nm, book: emptyBook() });
|
|
4483
|
+
cmtSetActive(cmtBooks.length - 1, true);
|
|
4484
|
+
renderPhonePick(); renderPhTier();
|
|
4485
|
+
const box = $('phBookInput');
|
|
4486
|
+
if (box && $('phBookPanel') && $('phBookPanel').style.display !== 'none') box.value = '';
|
|
4487
|
+
toast('已新建模板「' + nm + '」,写几条再点保存');
|
|
4439
4488
|
}
|
|
4440
4489
|
function phTmplCmt() { // 电脑端「统一评语」且不在常用评语库里 → 手机页临时带进来
|
|
4441
4490
|
const v = (tmplInput && tmplInput.value || '').trim();
|
|
@@ -4946,6 +4995,9 @@ if ($('phAssignSel')) $('phAssignSel').addEventListener('change', () => {
|
|
|
4946
4995
|
}
|
|
4947
4996
|
else switchAssign(v, 'phone');
|
|
4948
4997
|
});
|
|
4998
|
+
// ---------- 手机页·模板切换 / 新建(第 175 轮)----------
|
|
4999
|
+
if ($('phTplPick')) $('phTplPick').addEventListener('change', () => phTplSwitch(Number($('phTplPick').value)));
|
|
5000
|
+
if ($('phTplAddBtn')) $('phTplAddBtn').addEventListener('click', phTplAdd);
|
|
4949
5001
|
// ---------- 手机页·常用评语管理(与作业页共用 saveCmtBook,本机 + 云端同步) ----------
|
|
4950
5002
|
if ($('phBookBtn')) $('phBookBtn').addEventListener('click', () => {
|
|
4951
5003
|
const p = $('phBookPanel');
|
|
@@ -8178,9 +8230,13 @@ function renderBcSheet() {
|
|
|
8178
8230
|
// 出码 h=25(mw=2 → viewBox 12.5 模块高)→ 条码高 6.15mm;模块宽 30/61 = 0.492mm
|
|
8179
8231
|
// (Code128 下限 0.25mm 的 1.97 倍),左右几乎无白边(静止区只留 2 模块)。
|
|
8180
8232
|
// 上行 3mm + 0.15mm 间距 + 条码 6.15mm ≈ 9.3mm,10mm 纸内不跨页。
|
|
8181
|
-
// A4
|
|
8233
|
+
// A4 拼版 :姓名 / 条码 / 编号 三行,剪开即用。第 176 轮:**条码不再写死 35mm 宽**,
|
|
8234
|
+
// 改由 CSS width:100% 撑满格子(见 .mode-a4 .bc-svg),于是出码比例必须同步压扁
|
|
8235
|
+
// —— h 40 → 35(viewBox 20 → 17.5 模块高):格子内宽 ≈44.6mm 时条码高 ≈11.8mm,
|
|
8236
|
+
// 与一生一版那张图的条码带比例(48:12.8)一致,整格 ≈48×21mm,12 行/页不溢出。
|
|
8237
|
+
// 若沿用 h=40,条码会涨到 13.5mm 高,整格 ≈22.3mm → 12 行 291mm 超一页。
|
|
8182
8238
|
sheet.innerHTML = items.map(x => bcMode === 'a4'
|
|
8183
|
-
? `<div class="bc-label"><div class="bc-nm" title="${esc(x.name)}">${esc(x.name)}</div>${code128Svg(x.code, { mw: 2, h:
|
|
8239
|
+
? `<div class="bc-label"><div class="bc-nm" title="${esc(x.name)}">${esc(x.name)}</div>${code128Svg(x.code, { mw: 2, h: 35 })}<div class="bc-no">${esc(x.code)}</div></div>`
|
|
8184
8240
|
: `<div class="bc-label"><div class="bc-hd"><span class="bc-no">${esc(x.code)}</span> <span class="bc-nm" title="${esc(x.name)}">${esc(x.name)}</span></div>${code128Svg(x.code, { mw: 2, h: bcMode === '30x10' ? 25 : 40, quiet: bcMode === '30x10' ? 2 : 10 })}</div>`
|
|
8185
8241
|
).join('');
|
|
8186
8242
|
applyBcPage();
|