小程序拍题:接整页点选链路(detect→点框→prepare 逐条勾→import),换相机图标
This commit is contained in:
@@ -60,7 +60,7 @@ curl -X POST http://127.0.0.1:8000/api/auth/wx-login -H "Content-Type: applicati
|
||||
| 监护人同意 | `pages/consent` | 收什么 / 存多久 / 不做什么,两个必须手勾 | P22 |
|
||||
| 孩子档案 | `pages/children` | 昵称、年级、科目开关、多孩切换、填充演示数据 | P23 / P11 |
|
||||
| 首页 | `pages/home` | 今天几道(附「约 N 分钟」)、待讲清、本周三个数、去工作台 | P01 |
|
||||
| 拍题 | `pages/queue` | 拍一张 / **手输一道** → OCR 切题 → 勾选 → 入库 → 题单预览(N 道 · 约 X 分钟) | P03 / P04 / P05 |
|
||||
| 拍题 | `pages/queue` | 拍一张 → 切块带框 → **在图上点哪几道错了** → 一块多道时逐条勾 → 入库 → 题单预览(N 道 · 约 X 分钟);也能手输一道 | P03 / P04 / P05 |
|
||||
| 工作台 | `pages/wb` | web-view 打开电脑端工作台(做题、讲一遍、解析、周报) | 工作台 |
|
||||
| 我的 | `pages/me` | 六组:孩子 / 科目 / 提醒 / 开通 / 数据 / 关于;含删号 7 天冷静期与撤销 | P19 / P20 |
|
||||
|
||||
@@ -68,7 +68,7 @@ curl -X POST http://127.0.0.1:8000/api/auth/wx-login -H "Content-Type: applicati
|
||||
|
||||
原来的 `quiz` / `explain` / `report` / `print` 四个页面已移到 `miniprogram/_legacy/`(不在 `app.json` 的 pages 里,不参与编译),保留代码是为了以后要做「手机也能做题」时能捡回来。
|
||||
|
||||
底部没有 tabBar:主流程是「拍一张 → 去工作台」,走完就结束,不引导逗留。
|
||||
底部三个 tab:首页 / 拍题 / 我的。主流程仍是「拍一张 → 去工作台」,走完就结束,不引导逗留。
|
||||
|
||||
---
|
||||
|
||||
@@ -79,13 +79,16 @@ curl -X POST http://127.0.0.1:8000/api/auth/wx-login -H "Content-Type: applicati
|
||||
- 一开始画的是线性,实际缩到 tab 上只有 27px、线宽剩 2px,浅色底(`#FFFDF7`)上会**发虚**、像没对齐;
|
||||
面性缩到 27px 仍是完整剪影,对比更强。这也是为什么细节只能靠**镂空**、不能靠描边。
|
||||
- 未选中 `#9A8C7A`、选中 `#E4634A`,与 tabBar 文字色一致;底色透明,所以深色模式或换底都不用重画。
|
||||
- 拍题图标是相机(`shoot.png` / `shoot-on.png`):改名后一起换掉,相机比题单更能一眼看出「这里是拍照的地方」。旧版是圆点 + 长条(读作题单/排队)。
|
||||
- 拍题图标是**描边**相机(`shoot.png` / `shoot-on.png`):镜头是空心圆,做剪影会糊成一坨,所以这一枚是 2px 描边、27px 下仍能认出是相机。改名时一并换掉(旧版是圆点 + 长条,读作题单)。
|
||||
|
||||
## 三、接口对照(后端 39 条里用到的 18 条)
|
||||
## 三、接口对照(后端 60 条里用到的这些)
|
||||
|
||||
| 小程序动作 | 接口 |
|
||||
|---|---|
|
||||
| 登录 | `POST /api/auth/wx-login {code}` |
|
||||
| 拍题·切块 | `POST /api/papers/scan/detect {image_b64, filename}` → `{draft_id, width, height, blocks[{i, box, stem, judge_type, subs}]}` |
|
||||
| 拍题·逐条预览 | `POST /api/papers/scan/prepare {child_id, subject, draft_id, picks}` → `items[{block, sub, stem, tag}]` |
|
||||
| 拍题·入库 | `POST /api/papers/scan/import {child_id, subject, draft_id, picks}`,`picks` 可为 `3` 或 `{i:3, subs:[0,2]}` |
|
||||
| 同意 | `POST /api/consent {version:"v1"}` |
|
||||
| 建档 / 切孩子 | `POST /api/children`、`GET /api/children`、`GET /api/children/{cid}` |
|
||||
| 拍卷 | `POST /api/papers {child_id, subject, image_count}` |
|
||||
|
||||
+203
-100
@@ -11,25 +11,42 @@ function estimate(queue) {
|
||||
return Math.max(1, Math.round(sec / 60));
|
||||
}
|
||||
|
||||
/** 一块里有几道:口算卡一块十几道,靠 subs 判断。 */
|
||||
function qtyOf(block) {
|
||||
const n = (block && block.subs && block.subs.length) || 0;
|
||||
return n > 1 ? n : 1;
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
mode: "photo",
|
||||
images: [],
|
||||
subject: "math",
|
||||
subjects: [
|
||||
{ k: "math", name: "数学" },
|
||||
{ k: "chinese", name: "语文" },
|
||||
],
|
||||
questions: [],
|
||||
|
||||
// 拍照 → 切块 → 点选
|
||||
photo: "",
|
||||
draft: "",
|
||||
blocks: [],
|
||||
pickedBlocks: 0,
|
||||
pickedQty: 0,
|
||||
detecting: false,
|
||||
cutInfo: "",
|
||||
cutting: false,
|
||||
|
||||
// 逐条勾选(一块多道)
|
||||
pickItems: [],
|
||||
pickOpen: false,
|
||||
importing: false,
|
||||
|
||||
// 手输
|
||||
stem: "",
|
||||
answer: "",
|
||||
isChoice: false,
|
||||
optionsText: "",
|
||||
saving: false,
|
||||
|
||||
// 题单预览
|
||||
queue: { n: 0, minutes: 0 },
|
||||
},
|
||||
@@ -43,11 +60,12 @@ Page({
|
||||
},
|
||||
|
||||
onSubject(e) {
|
||||
this.setData({ subject: e.currentTarget.dataset.k, questions: [] });
|
||||
this.setData({ subject: e.currentTarget.dataset.k, blocks: [], pickedBlocks: 0, pickedQty: 0, cutInfo: "" });
|
||||
},
|
||||
|
||||
onToggleMode() {
|
||||
this.setData({ mode: this.data.mode === "photo" ? "manual" : "photo", cutInfo: "" });
|
||||
const mode = this.data.mode === "photo" ? "manual" : "photo";
|
||||
this.setData({ mode, cutInfo: "" });
|
||||
},
|
||||
|
||||
/** 排完看一眼今天几道、大概几分钟 */
|
||||
@@ -64,7 +82,7 @@ Page({
|
||||
|
||||
onPick() {
|
||||
wx.chooseMedia({
|
||||
count: 3,
|
||||
count: 1,
|
||||
mediaType: ["image"],
|
||||
sourceType: ["camera", "album"],
|
||||
camera: "back",
|
||||
@@ -72,7 +90,9 @@ Page({
|
||||
const images = (res.tempFiles || []).map((f) => f.tempFilePath);
|
||||
if (!images.length) return;
|
||||
this.checkSize(images).then((ok) => {
|
||||
if (ok) this.setData({ images });
|
||||
if (!ok) return;
|
||||
this.setData({ photo: images[0], blocks: [], pickedBlocks: 0, pickedQty: 0, cutInfo: "" });
|
||||
this.onDetect();
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -111,131 +131,214 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
onCut() {
|
||||
if (!this.data.images.length) {
|
||||
wx.showToast({ title: "先拍一张", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (this.data.cutting) return;
|
||||
this.setData({ cutting: true });
|
||||
|
||||
/** 整页 → 切成块 → 把框画在图上,等家长点 */
|
||||
onDetect() {
|
||||
if (!this.data.photo || this.data.detecting) return;
|
||||
const child = getApp().globalData.child;
|
||||
const fs = wx.getFileSystemManager();
|
||||
wx.showLoading({ title: "识别中", mask: true });
|
||||
if (!child) return;
|
||||
this.setData({ detecting: true, cutInfo: "" });
|
||||
wx.showLoading({ title: "切题中", mask: true });
|
||||
|
||||
// 手机拍出来 3–8MB,直接 base64 会撞 wx.request 的包体上限,先压到长边 1600、质量 72。
|
||||
const send = (filePath) => {
|
||||
fs.readFile({
|
||||
filePath,
|
||||
encoding: "base64",
|
||||
success: (f) => {
|
||||
api
|
||||
.post("/api/papers/ocr", {
|
||||
child_id: child.id,
|
||||
subject: this.data.subject,
|
||||
image_b64: f.data,
|
||||
filename: "page.jpg",
|
||||
fallback_demo: false,
|
||||
})
|
||||
.then((p) => this.afterCut(p))
|
||||
.catch((e) => this.onCutFail(e))
|
||||
.then(() => wx.hideLoading());
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: "读不到这张图", icon: "none" });
|
||||
this.setData({ cutting: false });
|
||||
},
|
||||
const done = () => {
|
||||
wx.hideLoading();
|
||||
this.setData({ detecting: false });
|
||||
};
|
||||
const fail = (e) => {
|
||||
done();
|
||||
const msg = (e && e.message) || "这次没切出来";
|
||||
wx.showModal({
|
||||
title: "这次没切出来",
|
||||
content: msg + "\n\n可以:① 卷子放平、光线亮一点重拍;② 换个科目试试;③ 这道题改成手输。",
|
||||
showCancel: false,
|
||||
});
|
||||
};
|
||||
|
||||
// 手机拍出来 3–8MB,直接 base64 会撞 wx.request 的包体上限,先压到长边 1600、质量 72。
|
||||
wx.compressImage({
|
||||
src: this.data.images[0],
|
||||
src: this.data.photo,
|
||||
quality: 72,
|
||||
compressedWidth: 1600,
|
||||
success: (r) => send(r.tempFilePath || this.data.images[0]),
|
||||
fail: () => send(this.data.images[0]),
|
||||
success: (r) => this.sendDetect(r.tempFilePath || this.data.photo, done, fail),
|
||||
fail: () => this.sendDetect(this.data.photo, done, fail),
|
||||
});
|
||||
},
|
||||
|
||||
afterCut(p) {
|
||||
const questions = (p.questions || []).map((q) => ({
|
||||
...q,
|
||||
checked: true,
|
||||
tag: (q.judge_type === "manual" ? "你自己判" : "机器判") + " · " + (q.subject === "chinese" ? "语文" : "数学"),
|
||||
}));
|
||||
const ocr = p.ocr || {};
|
||||
let info = "";
|
||||
if (ocr.ok) {
|
||||
info = "识别到 " + ocr.lines + " 行,切出 " + questions.length + " 道题";
|
||||
if (ocr.warn) info += "\n" + ocr.warn;
|
||||
} else {
|
||||
info = "没认出题,可以手动拍清楚一点,或者改成手输";
|
||||
// 小图 / 太糊时,后端会带一句「这张图只有 400×520」——比「没认出题」有用得多
|
||||
if (ocr.warn) info = ocr.warn + "\n" + info;
|
||||
}
|
||||
this.setData({ questions, cutting: false, cutInfo: info });
|
||||
},
|
||||
|
||||
/** 识别失败:给「用演示题库」这条后路,而不是卡死在这儿。 */
|
||||
onCutFail(e) {
|
||||
this.setData({ cutting: false });
|
||||
wx.hideLoading();
|
||||
const msg = (e && e.message) || "没认出来";
|
||||
wx.showModal({
|
||||
title: "这次没认出来",
|
||||
content: msg + "\n\n可以:① 把卷子放平、光线亮一点重拍;② 这道题改成手输;③ 先用演示题库走一遍流程。",
|
||||
confirmText: "用演示题库",
|
||||
cancelText: "重新拍",
|
||||
success: (r) => {
|
||||
if (!r.confirm) return;
|
||||
this.setData({ cutting: true });
|
||||
sendDetect(filePath, done, fail) {
|
||||
wx.getFileSystemManager().readFile({
|
||||
filePath,
|
||||
encoding: "base64",
|
||||
success: (f) => {
|
||||
api
|
||||
.post("/api/papers/ocr", {
|
||||
child_id: getApp().globalData.child.id,
|
||||
subject: this.data.subject,
|
||||
image_b64: "ZGVtbw==",
|
||||
filename: "demo.jpg",
|
||||
fallback_demo: true,
|
||||
})
|
||||
.then((p) => this.afterCut(p))
|
||||
.catch((err) => api.toastError(err))
|
||||
.then(() => this.setData({ cutting: false }));
|
||||
.post("/api/papers/scan/detect", { image_b64: f.data, filename: "page.jpg" })
|
||||
.then((r) => this.afterDetect(r))
|
||||
.catch((e) => fail(e))
|
||||
.then(done);
|
||||
},
|
||||
fail: () => {
|
||||
done();
|
||||
wx.showToast({ title: "读不到这张图", icon: "none" });
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
toggleQ(e) {
|
||||
const i = Number(e.currentTarget.dataset.i);
|
||||
const questions = this.data.questions.slice();
|
||||
questions[i].checked = !questions[i].checked;
|
||||
this.setData({ questions });
|
||||
afterDetect(r) {
|
||||
const w = r.width || 1;
|
||||
const h = r.height || 1;
|
||||
const blocks = (r.blocks || []).map((b) => {
|
||||
const box = b.box || { x: 0, y: 0, w: 0, h: 0 };
|
||||
const n = qtyOf(b);
|
||||
return {
|
||||
i: b.i,
|
||||
stem: b.stem || "",
|
||||
judge_type: b.judge_type || "manual",
|
||||
n,
|
||||
on: false,
|
||||
px: (box.x / w) * 100,
|
||||
py: (box.y / h) * 100,
|
||||
pw: (box.w / w) * 100,
|
||||
ph: (box.h / h) * 100,
|
||||
};
|
||||
});
|
||||
const info = blocks.length
|
||||
? "切出 " + blocks.length + " 块。点你觉得做错的那几道(可多选),再点下面的按钮。"
|
||||
: "这一页没切出整块的题。可以重拍一张,或者改成手输。";
|
||||
this.setData({ draft: r.draft_id || "", blocks, cutInfo: info, pickedBlocks: 0, pickedQty: 0 });
|
||||
},
|
||||
|
||||
toggleBlock(e) {
|
||||
const i = Number(e.currentTarget.dataset.i);
|
||||
const blocks = this.data.blocks.slice();
|
||||
const idx = blocks.findIndex((b) => b.i === i);
|
||||
if (idx < 0) return;
|
||||
blocks[idx].on = !blocks[idx].on;
|
||||
if (wx.vibrateShort) wx.vibrateShort({ type: "light" });
|
||||
const on = blocks.filter((b) => b.on);
|
||||
this.setData({
|
||||
blocks,
|
||||
pickedBlocks: on.length,
|
||||
pickedQty: on.reduce((s, b) => s + b.n, 0),
|
||||
});
|
||||
},
|
||||
|
||||
onRetake() {
|
||||
this.setData({ photo: "", draft: "", blocks: [], pickedBlocks: 0, pickedQty: 0, cutInfo: "" });
|
||||
},
|
||||
|
||||
/** 入库前:一块多道就先摊开逐条勾;都是单题就直接入库 */
|
||||
onImport() {
|
||||
const ids = this.data.questions.filter((q) => q.checked).map((q) => q.id);
|
||||
if (!ids.length) {
|
||||
wx.showToast({ title: "一道都没选", icon: "none" });
|
||||
const picked = this.data.blocks.filter((b) => b.on);
|
||||
if (!picked.length) {
|
||||
wx.showToast({ title: "先点选做错的题", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (this.data.importing) return;
|
||||
this.setData({ importing: true });
|
||||
|
||||
if (!picked.some((b) => b.n > 1)) {
|
||||
this.doImport(picked.map((b) => b.i));
|
||||
return;
|
||||
}
|
||||
this.preparePicks(picked.map((b) => b.i));
|
||||
},
|
||||
|
||||
preparePicks(picks) {
|
||||
const child = getApp().globalData.child;
|
||||
this.setData({ importing: true });
|
||||
wx.showLoading({ title: "整理中", mask: true });
|
||||
api
|
||||
.post("/api/mistakes/import", {
|
||||
child_id: getApp().globalData.child.id,
|
||||
question_ids: ids,
|
||||
.post("/api/papers/scan/prepare", {
|
||||
child_id: child.id,
|
||||
subject: this.data.subject,
|
||||
draft_id: this.data.draft,
|
||||
picks,
|
||||
})
|
||||
.then((r) => {
|
||||
const n = (r.created || []).length;
|
||||
this.setData({ importing: false, questions: [] });
|
||||
const items = (r.items || []).map((it, k) => ({
|
||||
k,
|
||||
block: it.block,
|
||||
sub: it.sub,
|
||||
stem: it.stem || "",
|
||||
tag: it.sub === null || it.sub === undefined ? "单题" : "第 " + (it.sub + 1) + " 道",
|
||||
on: true,
|
||||
}));
|
||||
this.setData({ pickItems: items, pickOpen: true, importing: false });
|
||||
})
|
||||
.catch((e) => {
|
||||
api.toastError(e);
|
||||
this.setData({ importing: false });
|
||||
})
|
||||
.then(() => wx.hideLoading());
|
||||
},
|
||||
|
||||
togglePick(e) {
|
||||
const k = Number(e.currentTarget.dataset.k);
|
||||
const pickItems = this.data.pickItems.slice();
|
||||
if (!pickItems[k]) return;
|
||||
pickItems[k].on = !pickItems[k].on;
|
||||
if (wx.vibrateShort) wx.vibrateShort({ type: "light" });
|
||||
this.setData({ pickItems });
|
||||
},
|
||||
|
||||
onPickAll() {
|
||||
const pickItems = this.data.pickItems.map((it) => ({ ...it, on: true }));
|
||||
this.setData({ pickItems });
|
||||
},
|
||||
|
||||
onPickNone() {
|
||||
const pickItems = this.data.pickItems.map((it) => ({ ...it, on: false }));
|
||||
this.setData({ pickItems });
|
||||
},
|
||||
|
||||
closePick() {
|
||||
this.setData({ pickOpen: false, pickItems: [] });
|
||||
},
|
||||
|
||||
confirmPick() {
|
||||
const on = this.data.pickItems.filter((it) => it.on);
|
||||
if (!on.length) {
|
||||
wx.showToast({ title: "一道都没勾", icon: "none" });
|
||||
return;
|
||||
}
|
||||
// 单题还原成块号;多道按块归组 {i, subs:[...]}
|
||||
const singles = [];
|
||||
const grouped = {};
|
||||
on.forEach((it) => {
|
||||
if (it.sub === null || it.sub === undefined) singles.push(it.block);
|
||||
else {
|
||||
grouped[it.block] = grouped[it.block] || [];
|
||||
grouped[it.block].push(it.sub);
|
||||
}
|
||||
});
|
||||
const picks = singles.slice();
|
||||
Object.keys(grouped).forEach((b) => picks.push({ i: Number(b), subs: grouped[b] }));
|
||||
this.setData({ pickOpen: false, pickItems: [] });
|
||||
this.doImport(picks);
|
||||
},
|
||||
|
||||
doImport(picks) {
|
||||
const child = getApp().globalData.child;
|
||||
if (this.data.importing) return;
|
||||
this.setData({ importing: true });
|
||||
wx.showLoading({ title: "入库中", mask: true });
|
||||
|
||||
api
|
||||
.post("/api/papers/scan/import", {
|
||||
child_id: child.id,
|
||||
subject: this.data.subject,
|
||||
draft_id: this.data.draft,
|
||||
picks,
|
||||
})
|
||||
.then((r) => {
|
||||
const ocr = r.ocr || {};
|
||||
const n = ocr.created === undefined ? (ocr.questions || 0) : ocr.created;
|
||||
this.setData({ photo: "", draft: "", blocks: [], pickedBlocks: 0, pickedQty: 0, cutInfo: "", importing: false });
|
||||
wx.showToast({ title: "入库 " + n + " 道", icon: "success" });
|
||||
this.loadQueue();
|
||||
})
|
||||
.catch((e) => {
|
||||
api.toastError(e);
|
||||
this.setData({ importing: false });
|
||||
});
|
||||
})
|
||||
.then(() => wx.hideLoading());
|
||||
},
|
||||
|
||||
// ---------------- 手输一道
|
||||
|
||||
@@ -4,25 +4,42 @@
|
||||
<view class="chip mode" bindtap="onToggleMode">{{mode === "photo" ? "改成手输" : "改成拍一张"}}</view>
|
||||
</view>
|
||||
|
||||
<!-- ① 拍一张 -->
|
||||
<!-- ① 拍一张 → 切块 → 点选 -->
|
||||
<block wx:if="{{mode === 'photo'}}">
|
||||
<view class="shot {{subject === 'chinese' ? 'chn' : 'math'}}" bindtap="onPick">
|
||||
<block wx:if="{{images.length}}">
|
||||
<image class="thumb" src="{{images[0]}}" mode="aspectFill" />
|
||||
<view class="shot-n">已选 {{images.length}} 张,点一下重拍</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view class="plus">+</view>
|
||||
<view class="shot-t">整页拍一张</view>
|
||||
<view class="shot-s">卷子放平、光打亮,一次拍半页(5–8 道)最准</view>
|
||||
</block>
|
||||
<view wx:if="{{!photo}}" class="shot {{subject === 'chinese' ? 'chn' : 'math'}}" bindtap="onPick">
|
||||
<view class="plus">+</view>
|
||||
<view class="shot-t">整页拍一张</view>
|
||||
<view class="shot-s">卷子放平、光打亮,一次拍半页(5–8 道)最准</view>
|
||||
</view>
|
||||
|
||||
<button class="btn" bindtap="onCut" disabled="{{cutting}}">
|
||||
{{cutting ? "识别中…" : "识别这一页"}}
|
||||
</button>
|
||||
<block wx:else>
|
||||
<view class="stage">
|
||||
<image class="page" src="{{photo}}" mode="widthFix" />
|
||||
<view class="overlay">
|
||||
<view
|
||||
wx:for="{{blocks}}"
|
||||
wx:key="i"
|
||||
class="blk {{item.on ? 'on' : ''}}"
|
||||
style="left:{{item.px}}%; top:{{item.py}}%; width:{{item.pw}}%; height:{{item.ph}}%"
|
||||
data-i="{{item.i}}"
|
||||
catchtap="toggleBlock"
|
||||
>
|
||||
<view class="blk-n">{{item.i + 1}}<text wx:if="{{item.n > 1}}" class="blk-more">×{{item.n}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cutinfo" wx:if="{{cutInfo}}">{{cutInfo}}</view>
|
||||
<view class="cutinfo" wx:if="{{cutInfo}}">{{cutInfo}}</view>
|
||||
|
||||
<view class="row2" wx:if="{{blocks.length}}">
|
||||
<button class="btn plain half" bindtap="onRetake" disabled="{{importing}}">重拍</button>
|
||||
<button class="btn half" bindtap="onImport" disabled="{{detecting || importing || !pickedBlocks}}">
|
||||
{{importing ? "入库中…" : (pickedBlocks ? "入库选中的 " + pickedQty + " 道" : "先点选做错的")}}
|
||||
</button>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="muted small" wx:if="{{photo}}" style="margin-top:8px">看不清就点「重拍」;切多切少无所谓,最后是你在图上点。</view>
|
||||
</block>
|
||||
|
||||
<!-- ② 手输一道 -->
|
||||
@@ -57,23 +74,30 @@
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- ③ 切出来的题:勾选 -->
|
||||
<view class="card" style="margin-top:18px" wx:if="{{questions.length}}">
|
||||
<view class="card-title">切出 {{questions.length}} 道,把做错的勾上</view>
|
||||
<view class="muted" style="margin-bottom:6px">默认全选,你只需要取消勾选「做对了」的。</view>
|
||||
<view class="q" wx:for="{{questions}}" wx:key="id" data-i="{{index}}" bindtap="toggleQ">
|
||||
<view class="box {{item.checked ? 'on' : ''}}">{{item.checked ? "✓" : ""}}</view>
|
||||
<!-- ③ 一块多道:逐条勾选 -->
|
||||
<view class="card" style="margin-top:16px" wx:if="{{pickOpen}}">
|
||||
<view class="card-title">这块里有几道?</view>
|
||||
<view class="muted" style="margin-bottom:8px">口算卡一块十几道,切题时会把没做错的也一起切进来。取消不要的那几道再入库。</view>
|
||||
|
||||
<view class="q" wx:for="{{pickItems}}" wx:key="k" data-k="{{index}}" bindtap="togglePick">
|
||||
<view class="box {{item.on ? 'on' : ''}}">{{item.on ? "✓" : ""}}</view>
|
||||
<view class="qmain">
|
||||
<view class="qstem">{{item.stem}}</view>
|
||||
<view class="qstem {{item.on ? '' : 'off'}}">{{item.stem}}</view>
|
||||
<view class="muted small">{{item.tag}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="btn" style="margin-top:14px" bindtap="onImport" disabled="{{importing}}">
|
||||
{{importing ? "入库中…" : "加入错题本"}}
|
||||
|
||||
<view class="row2" style="margin-top:12px">
|
||||
<button class="btn plain half" bindtap="onPickNone">全不勾</button>
|
||||
<button class="btn plain half" bindtap="onPickAll">全勾</button>
|
||||
</view>
|
||||
<button class="btn" style="margin-top:10px" bindtap="confirmPick" disabled="{{importing}}">
|
||||
{{importing ? "入库中…" : "入库勾上的"}}
|
||||
</button>
|
||||
<view class="muted small" style="margin-top:6px" bindtap="closePick">先不入库,回去重新点</view>
|
||||
</view>
|
||||
|
||||
<!-- ④ 题单预览:排完就地显示今天的量 -->
|
||||
<!-- ④ 题单预览 -->
|
||||
<view class="card queue" wx:if="{{queue.n > 0}}">
|
||||
<view class="card-title">今天的题单</view>
|
||||
<view class="qbig">
|
||||
@@ -86,7 +110,6 @@
|
||||
</view>
|
||||
|
||||
<view class="note">
|
||||
{{mode === "photo" ? "识别用的是本机的 Windows 中文 OCR(不联网、不上传第三方)。算式的答案会自己算出来;应用题、看拼音写词这类没有标准答案的,标成「你自己判」。" : "手输适合几种情况:卷子已经扔了、老师口头报的题、错题想马上记一道。题干抄关键词就行,不用一字不差。"}}
|
||||
{{mode === "photo" ? "拍一整页,系统先切成块;你在图上点哪几道做错了,只把点中的裁出来单独识别。算式的答案会自己算出来;应用题、看拼音写词这类没有标准答案的,标成「你自己判」。" : "手输适合几种情况:卷子已经扔了、老师口头报的题、错题想马上记一道。题干抄关键词就行,不用一字不差。"}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
|
||||
.chip.mode { margin-left: auto; color: var(--brand); border-color: #f0cfc4; background: #fff7f4; }
|
||||
|
||||
/* 空着的时候:一个大方框让人点 */
|
||||
.shot {
|
||||
position: relative; height: 210px; border-radius: 16px; border: 2px dashed #e0d5c9;
|
||||
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
||||
@@ -13,8 +14,28 @@
|
||||
.plus { font-size: 40px; color: #c9bda9; line-height: 1; }
|
||||
.shot-t { margin-top: 8px; font-size: 15px; font-weight: 700; }
|
||||
.shot-s { margin-top: 4px; font-size: 12px; color: var(--muted); }
|
||||
.thumb { width: 100%; height: 100%; }
|
||||
.shot-n { position: absolute; bottom: 10px; font-size: 11px; color: #6b6560; background: rgba(255,255,255,.9); padding: 3px 10px; border-radius: 999px; }
|
||||
|
||||
/* 拍完:图 + 切块框 */
|
||||
.stage { position: relative; margin-bottom: 10px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
|
||||
.page { display: block; width: 100%; }
|
||||
.overlay { position: absolute; left: 0; top: 0; right: 0; bottom: 0; }
|
||||
.blk {
|
||||
position: absolute; border: 2px dashed rgba(140,130,120,.55); border-radius: 8px;
|
||||
background: rgba(255,255,255,.04);
|
||||
}
|
||||
.blk.on { border: 2px solid var(--brand); background: rgba(179,39,45,.16); }
|
||||
.blk-n {
|
||||
position: absolute; left: -2px; top: -2px; min-width: 18px; height: 18px; line-height: 18px;
|
||||
padding: 0 5px; border-radius: 8px 0 8px 0; background: rgba(140,130,120,.92);
|
||||
color: #fff; font-size: 11px; text-align: center;
|
||||
}
|
||||
.blk.on .blk-n { background: var(--brand); }
|
||||
.blk-more { font-size: 10px; }
|
||||
|
||||
/* 并排两个按钮 */
|
||||
.row2 { display: flex; gap: 10px; }
|
||||
.row2 .btn { flex: 1; }
|
||||
.btn.half { width: auto; }
|
||||
|
||||
/* 手输 */
|
||||
.ta {
|
||||
@@ -28,6 +49,7 @@
|
||||
background: #fff; font-size: 15px;
|
||||
}
|
||||
|
||||
/* 逐条勾选 */
|
||||
.q { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid #f5efe8; }
|
||||
.q:last-of-type { border-bottom: none; }
|
||||
.box {
|
||||
@@ -38,9 +60,10 @@
|
||||
.box.on { background: var(--brand); border-color: var(--brand); }
|
||||
.qmain { flex: 1; }
|
||||
.qstem { font-size: 14px; line-height: 1.5; }
|
||||
.qstem.off { color: #b7afa8; text-decoration: line-through; }
|
||||
|
||||
/* 题单预览 */
|
||||
.queue { border: 1px solid #f0cfc4; background: #fffaf7; }
|
||||
.queue { border: 1px solid #f0cfc4; background: #fffaf7; margin-top: 16px; }
|
||||
.qbig { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 8px; }
|
||||
.qnum { font-size: 34px; font-weight: 800; color: var(--brand); line-height: 1; }
|
||||
.qunit { font-size: 13px; color: #6b6560; }
|
||||
@@ -48,7 +71,7 @@
|
||||
.note { margin-top: 18px; padding: 11px 13px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 11px; color: #9a938c; line-height: 1.7; }
|
||||
|
||||
.cutinfo {
|
||||
margin-top: 10px; padding: 8px 12px; border-radius: 10px;
|
||||
margin: 0 0 12px; padding: 9px 12px; border-radius: 10px;
|
||||
background: #fbf2e1; border: 1px solid #ecd9b6; color: #7a6440; font-size: 12px;
|
||||
white-space: pre-line; line-height: 1.6;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user