B-4 逐条勾选:入库前把一块里的题摊开,只收勾上的(prepare 接口 + 弹窗,239 测试)

This commit is contained in:
2026-11-22 15:30:47 +08:00
parent 11a7f18b31
commit ef201ffacc
13 changed files with 305 additions and 15 deletions
+11
View File
@@ -282,6 +282,17 @@ def post_scan_detect(ctx: Ctx, **kw):
return scanflow.detect(image, str(ctx.body.get("filename") or "page.jpg"))
@route("POST", "/api/papers/scan/prepare", auth="parent")
def post_scan_prepare(ctx: Ctx, **kw):
"""入库前预览:勾中的块里到底有哪几道(口算卡一块十几道,要逐条勾)。"""
picks = ctx.body.get("picks") or []
if not isinstance(picks, list):
raise svc.ApiError(400, "BAD_PICKS", "picks 要是数组")
return svc.prepare_scan_picks(
ctx.conn, ctx.gid, str(ctx.body.get("child_id") or ""),
str(ctx.body.get("subject") or "math"), str(ctx.body.get("draft_id") or ""), picks)
@route("POST", "/api/papers/scan/import", auth="parent")
def post_scan_import(ctx: Ctx, **kw):
"""家长勾完 → 只把选中的块裁出来单独识别并入库。"""