初始化参股
This commit is contained in:
186
前端/unpackage/dist/dev/mp-weixin/pages/cases/detail.js
vendored
Normal file
186
前端/unpackage/dist/dev/mp-weixin/pages/cases/detail.js
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_index = require("../../api/index.js");
|
||||
if (!Array) {
|
||||
const _easycom_before_after_1 = common_vendor.resolveComponent("before-after");
|
||||
_easycom_before_after_1();
|
||||
}
|
||||
const _easycom_before_after = () => "../../components/before-after/before-after.js";
|
||||
if (!Math) {
|
||||
_easycom_before_after();
|
||||
}
|
||||
class CaseDetail extends UTS.UTSType {
|
||||
static get$UTSMetadata$() {
|
||||
return {
|
||||
kind: 2,
|
||||
get fields() {
|
||||
return {
|
||||
id: { type: String, optional: false },
|
||||
title: { type: String, optional: false },
|
||||
category: { type: String, optional: false },
|
||||
categoryName: { type: String, optional: false },
|
||||
beforeImages: { type: UTS.UTSType.withGenerics(Array, [String]), optional: false },
|
||||
afterImages: { type: UTS.UTSType.withGenerics(Array, [String]), optional: false },
|
||||
description: { type: String, optional: false },
|
||||
material: { type: String, optional: false },
|
||||
duration: { type: String, optional: false },
|
||||
price: { type: String, optional: false },
|
||||
views: { type: Number, optional: false },
|
||||
likes: { type: Number, optional: false },
|
||||
createTime: { type: String, optional: false }
|
||||
};
|
||||
},
|
||||
name: "CaseDetail"
|
||||
};
|
||||
}
|
||||
constructor(options, metadata = CaseDetail.get$UTSMetadata$(), isJSONParse = false) {
|
||||
super();
|
||||
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
|
||||
this.id = this.__props__.id;
|
||||
this.title = this.__props__.title;
|
||||
this.category = this.__props__.category;
|
||||
this.categoryName = this.__props__.categoryName;
|
||||
this.beforeImages = this.__props__.beforeImages;
|
||||
this.afterImages = this.__props__.afterImages;
|
||||
this.description = this.__props__.description;
|
||||
this.material = this.__props__.material;
|
||||
this.duration = this.__props__.duration;
|
||||
this.price = this.__props__.price;
|
||||
this.views = this.__props__.views;
|
||||
this.likes = this.__props__.likes;
|
||||
this.createTime = this.__props__.createTime;
|
||||
delete this.__props__;
|
||||
}
|
||||
}
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "detail",
|
||||
setup(__props) {
|
||||
const caseId = common_vendor.ref("");
|
||||
const caseDetail = common_vendor.ref(new CaseDetail({
|
||||
id: "",
|
||||
title: "",
|
||||
category: "",
|
||||
categoryName: "",
|
||||
beforeImages: [],
|
||||
afterImages: [],
|
||||
description: "",
|
||||
material: "",
|
||||
duration: "",
|
||||
price: "",
|
||||
views: 0,
|
||||
likes: 0,
|
||||
createTime: ""
|
||||
}));
|
||||
const isFavorite = common_vendor.ref(false);
|
||||
const fetchCaseDetail = () => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getCaseDetail(caseId.value);
|
||||
const data = res.data;
|
||||
caseDetail.value = new CaseDetail(
|
||||
{
|
||||
id: data["id"],
|
||||
title: data["title"],
|
||||
category: data["category"],
|
||||
categoryName: data["categoryName"],
|
||||
beforeImages: data["beforeImages"],
|
||||
afterImages: data["afterImages"],
|
||||
description: data["description"],
|
||||
material: data["material"],
|
||||
duration: data["duration"],
|
||||
price: data["price"],
|
||||
views: data["views"],
|
||||
likes: data["likes"],
|
||||
createTime: data["createTime"]
|
||||
}
|
||||
// 更新标题
|
||||
);
|
||||
common_vendor.index.setNavigationBarTitle({
|
||||
title: caseDetail.value.title
|
||||
});
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/cases/detail.uvue:173", "获取案例详情失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
const previewImages = (index) => {
|
||||
common_vendor.index.previewImage({
|
||||
current: index,
|
||||
urls: caseDetail.value.afterImages
|
||||
});
|
||||
};
|
||||
const handleFavorite = () => {
|
||||
isFavorite.value = !isFavorite.value;
|
||||
common_vendor.index.showToast({
|
||||
title: isFavorite.value ? "已收藏" : "已取消收藏",
|
||||
icon: "none"
|
||||
});
|
||||
};
|
||||
const handleShare = () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "分享功能开发中",
|
||||
icon: "none"
|
||||
});
|
||||
};
|
||||
const handleContact = () => {
|
||||
common_vendor.index.makePhoneCall({
|
||||
phoneNumber: "400-888-8888",
|
||||
fail: () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "拨打电话失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
const goToBooking = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/booking/index"
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad((options) => {
|
||||
var _a;
|
||||
caseId.value = (_a = options["id"]) !== null && _a !== void 0 ? _a : "";
|
||||
if (caseId.value != "") {
|
||||
fetchCaseDetail();
|
||||
}
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
"raw js";
|
||||
const __returned__ = {
|
||||
a: common_vendor.f(common_vendor.unref(caseDetail).afterImages, (item, index, i0) => {
|
||||
return {
|
||||
a: item,
|
||||
b: common_vendor.o(($event) => {
|
||||
return previewImages(index);
|
||||
}, index),
|
||||
c: index
|
||||
};
|
||||
}),
|
||||
b: common_vendor.t(common_vendor.unref(caseDetail).categoryName),
|
||||
c: common_vendor.t(common_vendor.unref(caseDetail).title),
|
||||
d: common_vendor.t(common_vendor.unref(caseDetail).price),
|
||||
e: common_vendor.t(common_vendor.unref(caseDetail).views),
|
||||
f: common_vendor.t(common_vendor.unref(caseDetail).likes),
|
||||
g: common_vendor.p({
|
||||
beforeImage: common_vendor.unref(caseDetail).beforeImages[0] || "",
|
||||
afterImage: common_vendor.unref(caseDetail).afterImages[0] || "",
|
||||
showTitle: true
|
||||
}),
|
||||
h: common_vendor.t(common_vendor.unref(caseDetail).material),
|
||||
i: common_vendor.t(common_vendor.unref(caseDetail).duration),
|
||||
j: common_vendor.t(common_vendor.unref(caseDetail).createTime),
|
||||
k: common_vendor.t(common_vendor.unref(caseDetail).description),
|
||||
l: common_vendor.t(common_vendor.unref(isFavorite) ? "❤️" : "🤍"),
|
||||
m: common_vendor.o(handleFavorite),
|
||||
n: common_vendor.o(handleShare),
|
||||
o: common_vendor.o(handleContact),
|
||||
p: common_vendor.o(goToBooking),
|
||||
q: common_vendor.sei(common_vendor.gei(_ctx, ""), "view")
|
||||
};
|
||||
return __returned__;
|
||||
};
|
||||
}
|
||||
});
|
||||
wx.createPage(_sfc_main);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/cases/detail.js.map
|
||||
Reference in New Issue
Block a user