Complete core mini program flows
ci-cd / verify (push) Successful in 5s
ci-cd / deploy (push) Skipped

This commit is contained in:
2026-10-04 09:26:58 +08:00
parent 5688db4d63
commit c72cf24f56
28 changed files with 490 additions and 65 deletions
+15 -1
View File
@@ -11,6 +11,7 @@ Page({
date: "",
time: "",
max_people: 8,
saving: false,
},
onLoad() {
this.load();
@@ -47,6 +48,7 @@ Page({
}
},
async save() {
if (this.data.saving) return;
const d = this.data;
if (
!d.title.trim() ||
@@ -58,6 +60,16 @@ Page({
wx.showToast({ title: "请填完时间地点并选择狗狗", icon: "none" });
return;
}
const startsAt = new Date(d.date + "T" + d.time + ":00+08:00");
if (startsAt <= new Date()) {
wx.showToast({ title: "请选择未来的时间", icon: "none" });
return;
}
if (Number(d.max_people) < 2 || Number(d.max_people) > 100) {
wx.showToast({ title: "人数应为 2 到 100", icon: "none" });
return;
}
this.setData({ saving: true });
try {
await secure("/meetups", "POST", {
title: d.title,
@@ -65,13 +77,15 @@ Page({
place_name: d.place_name,
latitude: d.latitude,
longitude: d.longitude,
starts_at: new Date(d.date + "T" + d.time + ":00+08:00").toISOString(),
starts_at: startsAt.toISOString(),
max_people: Number(d.max_people),
pet_ids: d.selected,
});
wx.navigateBack();
} catch (e) {
toast(e);
} finally {
this.setData({ saving: false });
}
},
});
+1 -1
View File
@@ -49,5 +49,5 @@
<view class="field-label">带哪些狗狗?可以多选</view>
<pet-picker pets="{{pets}}" selected="{{selected}}" bind:change="pick" />
</view>
<button class="primary" bindtap="save">发布约遛 →</button>
<button class="primary" bindtap="save" disabled="{{saving}}">发布约遛 →</button>
</view>