Add one-way task completion and exportable pet identity cards
ci-cd / verify (push) Successful in 1m31s
ci-cd / deploy (push) Skipped

This commit is contained in:
2026-10-05 11:32:32 +08:00
parent f0ee63e642
commit cb4ffa13e9
21 changed files with 999 additions and 117 deletions
+14 -13
View File
@@ -1,4 +1,5 @@
const { secure, toast } = require("../../utils/api");
const completion = require("../../utils/task-completion");
const { secure } = require("../../utils/api");
const { localDate } = require("../../utils/date");
const environment = require("../../utils/environment");
function dateLabel() {
@@ -12,6 +13,9 @@ Page({
pets: [],
selected: [],
tasks: [],
taskBusyIds: [],
completingAll: false,
undoneCount: 0,
walkCount: 0,
name: "铲屎官",
loading: true,
@@ -100,6 +104,7 @@ Page({
pets,
selected: chosen.filter((id) => pets.some((p) => p.id === id)),
tasks: tasks.items,
undoneCount: tasks.items.filter((t) => !t.completed).length,
walkCount: walks.filter((w) => w.started_at.slice(0, 7) === month)
.length,
name: me.nickname || "毛孩家长",
@@ -138,17 +143,13 @@ Page({
goWalks() {
wx.navigateTo({ url: "/pages/walk-records/walk-records" });
},
async complete(e) {
const id = e.currentTarget.dataset.id,
task = this.data.tasks.find((t) => t.id === id);
try {
await secure("/tasks/" + id + "/completion", "PUT", {
date: localDate(),
completed: !task.completed,
});
await this.load();
} catch (err) {
toast(err);
}
complete(e) {
return completion.complete(
this,
this.data.tasks.find((t) => t.id === e.currentTarget.dataset.id),
);
},
completeAll() {
return completion.completeAll(this);
},
});