From 465700969abd49f51205c614618ccb8aa85cfa51 Mon Sep 17 00:00:00 2001 From: lovife <474239041@qq.com> Date: Tue, 29 Sep 2026 11:43:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(h5):=20=E5=A1=AB=E6=8A=A5=E9=A1=B5?= =?UTF-8?q?=EF=BC=88=E4=B8=89=E6=80=81=20+=20=E6=9D=A1=E4=BB=B6=E7=BA=A7?= =?UTF-8?q?=E8=81=94=20+=20=E5=A4=B1=E7=84=A6=E8=87=AA=E5=8A=A8=E5=AD=98?= =?UTF-8?q?=E8=8D=89=E7=A8=BF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 学生终于能在手机上真正填一份表了。 三态渲染(契约 §9.2): locked=true → 只读灰底 + 「如有误请联系班主任」 prefilled=true,locked=false → 可编辑 + 橙字「老师已填,请核对」 其余 → 普通空白 实测:姓名/身份证号/联系电话/报考职业/工种/等级 只读,学历可改并标注来源。 条件级联(visibleWhen)在前端求值,实测正确: 「是否在校生=是」→ 在读学校/所学专业/入学时间 出现; 「是否补考」未填 → 补考三科不出现。 **隐藏 ≠ 清空**:学生把「是否补考」改回"否",已填的补考科目仍留在草稿里 (万一他改回来)。要不要清空由后端在提交时判断 —— 前端不该替用户做不可逆的事。 保存策略:**失焦即存单个字段**。不做"整表提交"——学生填到一半切出去接电话, 回来整表丢失是最让人恼火的失败。单字段保存的代价是一次请求, 远小于"白填一遍"。 进页面时若还没有草稿会先建一份(否则第一次失焦保存会因 submissionId 为空而静默不存)。 前端拦住只读字段的保存请求(能省一次必然失败的请求),但**服务端那道拒绝才是真的**。 顺带:核验页的「开始填写材料」接上了(带 taskId + scene —— H5 跳转不保留 URL 参数)。 验收:构建产物含 pages-fill-fill;用无头浏览器实测渲染, 三态与两处级联均正确,抬头显示「请在 2026-10-15 前提交」。 --- frontend-mp/src/pages.json | 8 + frontend-mp/src/pages/fill/fill.vue | 385 ++++++++++++++++++++++++ frontend-mp/src/pages/verify/verify.vue | 19 +- 3 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 frontend-mp/src/pages/fill/fill.vue diff --git a/frontend-mp/src/pages.json b/frontend-mp/src/pages.json index 36be32e..f1ee802 100644 --- a/frontend-mp/src/pages.json +++ b/frontend-mp/src/pages.json @@ -16,6 +16,14 @@ "navigationBarBackgroundColor": "#0052D9", "navigationBarTextStyle": "white" } + }, + { + "path": "pages/fill/fill", + "style": { + "navigationBarTitleText": "填写材料", + "navigationBarBackgroundColor": "#0052D9", + "navigationBarTextStyle": "white" + } } ], "globalStyle": { diff --git a/frontend-mp/src/pages/fill/fill.vue b/frontend-mp/src/pages/fill/fill.vue new file mode 100644 index 0000000..61985c0 --- /dev/null +++ b/frontend-mp/src/pages/fill/fill.vue @@ -0,0 +1,385 @@ + + + + + diff --git a/frontend-mp/src/pages/verify/verify.vue b/frontend-mp/src/pages/verify/verify.vue index c9f92a2..8eec884 100644 --- a/frontend-mp/src/pages/verify/verify.vue +++ b/frontend-mp/src/pages/verify/verify.vue @@ -152,6 +152,17 @@ function token(): string { } } +/** 当前 URL 里的 scene(在 hash 路由的 query 里;H5 跳转不保留参数)。 */ +function sceneFromUrl(): string { + try { + const hash = typeof location !== 'undefined' ? location.hash : '' + const q = hash.includes('?') ? hash.slice(hash.indexOf('?') + 1) : '' + return new URLSearchParams(q).get('scene') || '' + } catch { + return '' + } +} + async function loadContext(scene: string) { if (!scene) return try { @@ -194,7 +205,13 @@ async function submit() { } function next() { - uni.showToast({ title: '填写材料功能开发中', icon: 'none' }) + // 带着 scene 与 taskId 跳到填报页 —— H5 的页面跳转不保留 URL 参数, + // 所以显式拼(同 index → verify 的处理) + const scene = sceneFromUrl() + const tid = ctx.value.taskId || 0 + uni.navigateTo({ + url: `/pages/fill/fill?taskId=${tid}&scene=${encodeURIComponent(scene)}` + }) } onLoad((options) => {