82 lines
2.6 KiB
JavaScript
82 lines
2.6 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_mold = require("../../api/mold.js");
|
|
const utils_moldSearch = require("../../utils/moldSearch.js");
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "index",
|
|
setup(__props) {
|
|
const molds = common_vendor.ref([]);
|
|
const keyword = common_vendor.ref("");
|
|
const loading = common_vendor.ref(false);
|
|
const filteredMolds = common_vendor.computed(() => utils_moldSearch.searchMolds(molds.value, keyword.value));
|
|
function onSearchInput(e) {
|
|
keyword.value = e.detail.value;
|
|
}
|
|
function doSearch() {
|
|
}
|
|
function contactService() {
|
|
common_vendor.index.showModal({
|
|
title: "联系客服",
|
|
content: "如需定制服务,请添加客服微信咨询",
|
|
showCancel: false
|
|
});
|
|
}
|
|
async function loadMolds() {
|
|
loading.value = true;
|
|
try {
|
|
molds.value = await api_mold.getMoldList();
|
|
} catch {
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}
|
|
common_vendor.onMounted(() => {
|
|
loadMolds();
|
|
});
|
|
common_vendor.onShow(() => {
|
|
loadMolds();
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: keyword.value,
|
|
b: common_vendor.o(onSearchInput),
|
|
c: common_vendor.o(doSearch),
|
|
d: common_vendor.f(filteredMolds.value, (mold, k0, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(mold.name),
|
|
b: mold.images.length > 0
|
|
}, mold.images.length > 0 ? {
|
|
c: common_vendor.f(mold.images, (img, idx, i1) => {
|
|
return {
|
|
a: idx,
|
|
b: img
|
|
};
|
|
})
|
|
} : {}, {
|
|
d: mold.styleNo
|
|
}, mold.styleNo ? {
|
|
e: common_vendor.t(mold.styleNo)
|
|
} : {}, {
|
|
f: mold.style
|
|
}, mold.style ? {
|
|
g: common_vendor.t(mold.style)
|
|
} : {}, {
|
|
h: mold.id
|
|
});
|
|
}),
|
|
e: !loading.value && filteredMolds.value.length === 0
|
|
}, !loading.value && filteredMolds.value.length === 0 ? common_vendor.e({
|
|
f: common_vendor.t(keyword.value ? "未找到匹配结果" : "暂无版房信息"),
|
|
g: keyword.value
|
|
}, keyword.value ? {
|
|
h: common_vendor.o(contactService)
|
|
} : {}) : {}, {
|
|
i: loading.value
|
|
}, loading.value ? {} : {});
|
|
};
|
|
}
|
|
});
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-406d5d2c"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mold/index.js.map
|