hku-class/miniprogram/pages/schedule-detail/index.js
2026-05-12 23:10:05 +08:00

25 lines
570 B
JavaScript

const { get } = require("../../utils/api");
const { showError } = require("../../utils/page-helpers");
Page({
data: { item: null, loading: false },
onLoad(options) {
wx.setNavigationBarTitle({ title: "排期详情" });
this.load(options.id);
},
async load(id) {
if (!id) return;
this.setData({ loading: true });
try {
const item = await get(`/api/schedule/${id}`);
this.setData({ item });
} catch (error) {
showError(error, "加载排期失败");
} finally {
this.setData({ loading: false });
}
}
});