feat:"完成页面接口的对接"

This commit is contained in:
2026-01-29 17:58:19 +08:00
parent 2774a539bf
commit 2b69da3c15
98 changed files with 9504 additions and 592 deletions

View File

@@ -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
})