feat:"完成页面接口的对接"
This commit is contained in:
@@ -136,30 +136,47 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
new AdvantageItem({ icon: "🚗", title: "上门服务", desc: "免费评估" }),
|
||||
new AdvantageItem({ icon: "💰", title: "价格透明", desc: "无隐形消费" })
|
||||
]);
|
||||
const initServiceTypes = () => {
|
||||
serviceTypes.value = utils_config.SERVICE_TYPES.map((item) => {
|
||||
return new ServiceType({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.icon
|
||||
});
|
||||
const fetchServiceTypes = () => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getActiveServices();
|
||||
if (res.code === 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
const list = data["list"] || [];
|
||||
serviceTypes.value = list.map((item) => {
|
||||
return new ServiceType({
|
||||
id: String(item["id"]),
|
||||
name: item["name"],
|
||||
icon: item["icon"] || "/static/icons/default.png"
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:165", "获取服务类型失败", e);
|
||||
serviceTypes.value = [
|
||||
new ServiceType({ id: "repair", name: "局部修复", icon: "/static/icons/repair.png" }),
|
||||
new ServiceType({ id: "refurbish", name: "整体翻新", icon: "/static/icons/refurbish.png" })
|
||||
];
|
||||
}
|
||||
});
|
||||
};
|
||||
const fetchBanners = () => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getBanners();
|
||||
const data = res.data;
|
||||
bannerList.value = data.map((item) => {
|
||||
return new BannerItem({
|
||||
id: item["id"],
|
||||
image: item["image"],
|
||||
title: item["title"],
|
||||
link: item["link"]
|
||||
if (res.code === 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
bannerList.value = data.map((item) => {
|
||||
return new BannerItem({
|
||||
id: item["id"],
|
||||
image: item["image"],
|
||||
title: item["title"],
|
||||
link: item["link"]
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:174", "获取轮播图失败", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:190", "获取轮播图失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -167,24 +184,30 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getHotCases();
|
||||
const data = res.data;
|
||||
const list = data["items"] || [];
|
||||
hotCases.value = list.map((item) => {
|
||||
return new CaseItem({
|
||||
id: item["id"],
|
||||
title: item["title"],
|
||||
category: item["category"],
|
||||
categoryName: item["categoryName"],
|
||||
coverImage: item["coverImage"],
|
||||
material: item["material"],
|
||||
duration: item["duration"],
|
||||
price: item["price"],
|
||||
views: item["views"],
|
||||
likes: item["likes"]
|
||||
if (res.code == 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
const list = data["list"] || [];
|
||||
hotCases.value = list.map((item) => {
|
||||
const images = item["images"] || [];
|
||||
const afterImages = item["afterImages"] || [];
|
||||
const beforeImages = item["beforeImages"] || [];
|
||||
const coverImage = images.length > 0 ? images[0] : afterImages.length > 0 ? afterImages[0] : beforeImages.length > 0 ? beforeImages[0] : "";
|
||||
return new CaseItem({
|
||||
id: String(item["id"]),
|
||||
title: item["title"],
|
||||
category: item["serviceType"] || "",
|
||||
categoryName: utils_config.getServiceTypeName(item["serviceType"]),
|
||||
coverImage,
|
||||
material: item["materials"] || "暂无",
|
||||
duration: (item["duration"] || 0) + "天",
|
||||
price: item["price"] != null ? "¥" + item["price"] : "面议",
|
||||
views: item["views"] || 0,
|
||||
likes: item["likes"] || 0
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:200", "获取热门案例失败", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:224", "获取热门案例失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -221,7 +244,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad(() => {
|
||||
initServiceTypes();
|
||||
fetchServiceTypes();
|
||||
fetchBanners();
|
||||
fetchHotCases();
|
||||
});
|
||||
@@ -245,7 +268,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
a: item.id,
|
||||
b: item.id,
|
||||
c: common_vendor.o(handleServiceClick, item.id),
|
||||
d: "767a328a-1-" + i0,
|
||||
d: "0a3a932a-1-" + i0,
|
||||
e: common_vendor.p({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
@@ -270,7 +293,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
return {
|
||||
a: item.id,
|
||||
b: common_vendor.o(goToCaseDetail, item.id),
|
||||
c: "767a328a-3-" + i0,
|
||||
c: "0a3a932a-3-" + i0,
|
||||
d: common_vendor.p({
|
||||
caseData: item
|
||||
})
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view id="{{i}}" change:eS="{{uV.sS}}" eS="{{$eS[i]}}" change:eA="{{uV.sA}}" eA="{{$eA[i]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><nav-bar u-i="767a328a-0" bind:__l="__l" u-p="{{a||''}}"></nav-bar><scroll-view class="page-content" scroll-y enable-flex="true" enhanced="true"><view class="banner-section"><swiper class="banner-swiper" circular autoplay indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#ffffff"><swiper-item wx:for="{{b}}" wx:for-item="item" wx:key="c"><image class="banner-image" src="{{item.a}}" mode="aspectFill" bindtap="{{item.b}}"></image></swiper-item></swiper></view><view class="service-section"><view class="service-grid"><service-card wx:for="{{c}}" wx:for-item="item" wx:key="b" id="{{item.a}}" virtualHostId="{{item.a}}" bindclick="{{item.c}}" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e||''}}"></service-card></view></view><view class="advantage-section"><view class="advantage-list"><view wx:for="{{d}}" wx:for-item="item" wx:key="d" class="advantage-item"><text class="advantage-icon">{{item.a}}</text><view class="advantage-info"><text class="advantage-title">{{item.b}}</text><text class="advantage-desc">{{item.c}}</text></view></view></view></view><view class="case-section"><section-header bindmore="{{e}}" u-i="767a328a-2" bind:__l="__l" u-p="{{f||''}}"></section-header><view class="case-list"><case-card wx:for="{{g}}" wx:for-item="item" wx:key="a" bindclick="{{item.b}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d||''}}"></case-card></view></view><view class="booking-section" bindtap="{{h}}"><view class="booking-content"><view class="booking-left"><text class="booking-title">免费上门评估</text><text class="booking-desc">专业师傅免费上门,为您的沙发量身定制翻新方案</text></view><view class="booking-btn"><text class="booking-btn-text">立即预约</text></view></view></view><view class="bottom-space"></view></scroll-view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
<view id="{{i}}" change:eS="{{uV.sS}}" eS="{{$eS[i]}}" change:eA="{{uV.sA}}" eA="{{$eA[i]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><nav-bar u-i="0a3a932a-0" bind:__l="__l" u-p="{{a||''}}"></nav-bar><scroll-view class="page-content" scroll-y enable-flex="true" enhanced="true"><view class="banner-section"><swiper class="banner-swiper" circular autoplay indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#ffffff"><swiper-item wx:for="{{b}}" wx:for-item="item" wx:key="c"><image class="banner-image" src="{{item.a}}" mode="aspectFill" bindtap="{{item.b}}"></image></swiper-item></swiper></view><view class="service-section"><view class="service-grid"><service-card wx:for="{{c}}" wx:for-item="item" wx:key="b" id="{{item.a}}" virtualHostId="{{item.a}}" bindclick="{{item.c}}" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e||''}}"></service-card></view></view><view class="advantage-section"><view class="advantage-list"><view wx:for="{{d}}" wx:for-item="item" wx:key="d" class="advantage-item"><text class="advantage-icon">{{item.a}}</text><view class="advantage-info"><text class="advantage-title">{{item.b}}</text><text class="advantage-desc">{{item.c}}</text></view></view></view></view><view class="case-section"><section-header bindmore="{{e}}" u-i="0a3a932a-2" bind:__l="__l" u-p="{{f||''}}"></section-header><view class="case-list"><case-card wx:for="{{g}}" wx:for-item="item" wx:key="a" bindclick="{{item.b}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d||''}}"></case-card></view></view><view class="booking-section" bindtap="{{h}}"><view class="booking-content"><view class="booking-left"><text class="booking-title">免费上门评估</text><text class="booking-desc">专业师傅免费上门,为您的沙发量身定制翻新方案</text></view><view class="booking-btn"><text class="booking-btn-text">立即预约</text></view></view></view><view class="bottom-space"></view></scroll-view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
|
||||
Reference in New Issue
Block a user