style: 统一全仓代码格式

This commit is contained in:
que01 committed 2026-09-19 18:46:26 +08:00
1 parent d811478d0f
commit 8033cabff9
30 files changed
+1183 -187

No files matched your search

+41 -18
View File
@@ -1,23 +1,46 @@
const { request } = require('../../utils/request');
const config = require('../../utils/config');
const { getTemplate } = require('../../utils/templates');
const { request } = require("../../utils/request");
const config = require("../../utils/config");
const { getTemplate } = require("../../utils/templates");
Page({
data: { loading: true, error: '', brand: {}, services: [], copy: {} },
onLoad() { this.load(); },
data: { loading: true, error: "", brand: {}, services: [], copy: {} },
onLoad() {
this.load();
},
load() {
this.setData({ loading: true, error: '' });
Promise.all([request('/public/brand'), request('/public/services')]).then(([brand, services]) => {
getApp().globalData.brand = brand;
wx.setNavigationBarTitle({ title: brand.name || '个人品牌' });
const copy = getTemplate(brand.templateKey);
this.setData({ brand: { ...brand, coverUrl: brand.coverUrl || '/assets/brand/home-hero.jpg' }, services, copy, loading: false });
}).catch(() => this.setData({ loading: false, error: '暂时无法加载内容' }));
this.setData({ loading: true, error: "" });
Promise.all([request("/public/brand"), request("/public/services")])
.then(([brand, services]) => {
getApp().globalData.brand = brand;
wx.setNavigationBarTitle({ title: brand.name || "个人品牌" });
const copy = getTemplate(brand.templateKey);
this.setData({
brand: { ...brand, coverUrl: brand.coverUrl || "/assets/brand/home-hero.jpg" },
services,
copy,
loading: false,
});
})
.catch(() => this.setData({ loading: false, error: "暂时无法加载内容" }));
},
selectService(event) {
wx.navigateTo({
url: "/pages/booking/index?serviceId=" + encodeURIComponent(event.currentTarget.dataset.id),
});
},
goServices() {
wx.switchTab({ url: "/pages/services/index" });
},
goPrivateChef() {
wx.navigateTo({ url: "/pages/booking/index?type=private_chef" });
},
goBooking() {
wx.navigateTo({ url: "/pages/booking/index" });
},
goBookings() {
wx.switchTab({ url: "/pages/bookings/index" });
},
goHome() {
wx.switchTab({ url: "/pages/index/index" });
},
selectService(event) { wx.navigateTo({ url: '/pages/booking/index?serviceId=' + encodeURIComponent(event.currentTarget.dataset.id) }); },
goServices() { wx.switchTab({ url: '/pages/services/index' }); },
goPrivateChef() { wx.navigateTo({ url: '/pages/booking/index?type=private_chef' }); },
goBooking() { wx.navigateTo({ url: '/pages/booking/index' }); },
goBookings() { wx.switchTab({ url: '/pages/bookings/index' }); },
goHome() { wx.switchTab({ url: '/pages/index/index' }); },
});