feat: 接入品牌图片资源并优化尺寸
This commit is contained in:
1 parent
60c2937ee2
commit
3da24ede37
7 files changed
+2
-2
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
@@ -11,7 +11,7 @@ Page({
|
||||
getApp().globalData.brand = brand;
|
||||
wx.setNavigationBarTitle({ title: brand.name || '个人品牌' });
|
||||
const copy = getTemplate(brand.templateKey);
|
||||
this.setData({ brand, services, copy, loading: false });
|
||||
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) }); },
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
const { request } = require('../../utils/request');
|
||||
const { getTemplate } = require('../../utils/templates');
|
||||
Page({ data: { loading: true, error: '', services: [], filtered: [], category: 'package', labels: {} }, onLoad() { Promise.all([request('/public/services'), request('/public/brand')]).then(([services, brand]) => { const labels = getTemplate(brand.templateKey); this.setData({ services, labels, filtered: services.filter((item) => item.priceAmount !== null), loading: false }); }).catch(() => this.setData({ loading: false, error: '服务加载失败' })); }, switchCategory(e) { const category = e.currentTarget.dataset.category; const filtered = category === 'package' ? this.data.services.filter((item) => item.priceAmount !== null) : this.data.services.filter((item) => item.priceAmount === null); this.setData({ category, filtered }); }, book(e) { wx.navigateTo({ url: '/pages/booking/index?serviceId=' + encodeURIComponent(e.currentTarget.dataset.id) }); } });
|
||||
Page({ data: { loading: true, error: '', services: [], filtered: [], category: 'package', labels: {} }, onLoad() { Promise.all([request('/public/services'), request('/public/brand')]).then(([services, brand]) => { const labels = getTemplate(brand.templateKey); const mapped = services.map((item) => ({ ...item, coverUrl: item.coverUrl || (item.name.includes('红烧肉') ? '/assets/brand/service-red-braised-pork.jpg' : item.name.includes('小炒鸡') ? '/assets/brand/service-chicken.jpg' : item.name.includes('私厨') ? '/assets/brand/service-private-chef.jpg' : '') })); this.setData({ services: mapped, labels, filtered: mapped.filter((item) => item.priceAmount !== null), loading: false }); }).catch(() => this.setData({ loading: false, error: '服务加载失败' })); }, switchCategory(e) { const category = e.currentTarget.dataset.category; const filtered = category === 'package' ? this.data.services.filter((item) => item.priceAmount !== null) : this.data.services.filter((item) => item.priceAmount === null); this.setData({ category, filtered }); }, book(e) { wx.navigateTo({ url: '/pages/booking/index?serviceId=' + encodeURIComponent(e.currentTarget.dataset.id) }); } });
|
||||
Reference in new issue
Block a user