feat: 按林境门作原型完善静态小程序
This commit is contained in:
1 parent
4afb6bbbe8
commit
8489c8ca79
26 files changed
+92
-964
No files matched your search
@@ -1,33 +1,6 @@
|
||||
const { request } = require("../../utils/request");
|
||||
const { offerings } = require("../../utils/linjing-data");
|
||||
Page({
|
||||
data: { loading: true, error: "", item: null },
|
||||
onLoad(options) {
|
||||
request("/public/offerings/" + encodeURIComponent(options.id))
|
||||
.then((item) => this.setData({ item, loading: false }))
|
||||
.catch(() => this.setData({ loading: false, error: "详情加载失败" }));
|
||||
},
|
||||
submit() {
|
||||
const cta = this.data.item?.cta || {};
|
||||
const form = this.data.item?.inquiryForms?.[0];
|
||||
if (cta.type === "inquiry" || form?.submissionAction === "create-inquiry") {
|
||||
const formId = form?.id || cta.config?.formId;
|
||||
return wx.navigateTo({
|
||||
url: "/pages/inquiry/index" + (formId ? "?formId=" + encodeURIComponent(formId) : ""),
|
||||
});
|
||||
}
|
||||
if (form?.submissionAction === "create-booking" || cta.type === "booking") {
|
||||
return wx.navigateTo({
|
||||
url: "/pages/booking/index?offeringId=" + encodeURIComponent(this.data.item?.id || ""),
|
||||
});
|
||||
}
|
||||
if (cta.type === "external-link") {
|
||||
return wx.showToast({ title: "请在支持外链的环境打开", icon: "none" });
|
||||
}
|
||||
if (cta.type === "contact") {
|
||||
return wx.showToast({ title: "请从品牌主页查看联系方式", icon: "none" });
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: "/pages/booking/index?offeringId=" + encodeURIComponent(this.data.item?.id || ""),
|
||||
});
|
||||
},
|
||||
data: { item: null, loading: true },
|
||||
onLoad(options) { const item = offerings.find((entry) => entry.id === options.id) || offerings[0]; this.setData({ item, loading: false }); wx.setNavigationBarTitle({ title: item.category }); },
|
||||
inquire() { wx.navigateTo({ url: "/pages/inquiry/index?offeringId=" + this.data.item.id }); },
|
||||
});
|
||||
Reference in new issue
Block a user