feat: 完成全部接口替换为新后端接口
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { resolvePreviewUrl } from '../../config/assets';
|
||||
import { appSharePageMethods } from '../../base/pageMixin';
|
||||
import { NAV_INNER_PX } from '../../utils/navMetrics';
|
||||
import {
|
||||
@@ -52,6 +53,7 @@ const TAB_BAR_PATHS = new Set([
|
||||
function toItemView(item: HomeDisplayItem): HomeDisplayItemView {
|
||||
return {
|
||||
...item,
|
||||
previewImg: resolvePreviewUrl(item.previewImg),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -218,11 +220,11 @@ Page({
|
||||
void this.initData();
|
||||
},
|
||||
|
||||
async initData() {
|
||||
wx.showLoading({ title: '加载中', mask: false });
|
||||
async initData(override?: PageConfigData) {
|
||||
if (!override) wx.showLoading({ title: '加载中', mask: false });
|
||||
|
||||
const app = getApp<IAppOption>();
|
||||
const config = await app.getPageConfig();
|
||||
const config = override || (await app.getPageConfig());
|
||||
|
||||
let homeData: HomeDisplayDataset;
|
||||
|
||||
@@ -249,13 +251,26 @@ Page({
|
||||
searchPlaceholder: homeData.searchPlaceholder,
|
||||
tabs,
|
||||
ageBands,
|
||||
activeAgeBand: homeData.ageBands[0]?.key || '3-4',
|
||||
activeAgeBand:
|
||||
override &&
|
||||
homeData.ageBands.some(
|
||||
(band) => band.key === this.data.activeAgeBand,
|
||||
)
|
||||
? this.data.activeAgeBand
|
||||
: homeData.ageBands[0]?.key || '3-4',
|
||||
activeTab: tabs.some((tab) => tab.id === this.data.activeTab)
|
||||
? this.data.activeTab
|
||||
: 'all',
|
||||
heroSwiperCurrent: Math.min(
|
||||
this.data.heroSwiperCurrent,
|
||||
Math.max(0, homeData.featured.length - 1),
|
||||
),
|
||||
featuredItems: homeData.featured.map(toItemView),
|
||||
hotRecommends: homeData.hot.slice(0, 3).map(toItemView),
|
||||
sections,
|
||||
});
|
||||
|
||||
wx.hideLoading();
|
||||
if (!override) wx.hideLoading();
|
||||
},
|
||||
|
||||
// ── Tab & Navigation ──
|
||||
|
||||
Reference in New Issue
Block a user