169 lines
4.8 KiB
JavaScript
169 lines
4.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_booking_course_index = require("../../api/booking/course/index.js");
|
|
const api_booking_item_index = require("../../api/booking/item/index.js");
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
categoryId: 0,
|
|
categoryName: "",
|
|
list: [],
|
|
// 骨架屏
|
|
hideTools: true,
|
|
// 项目列表
|
|
itemList: []
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
if (option) {
|
|
this.categoryId = option.categoryId;
|
|
this.categoryName = option.categoryName;
|
|
common_vendor.index.setNavigationBarTitle({
|
|
title: option.categoryName
|
|
});
|
|
}
|
|
this.reload();
|
|
},
|
|
methods: {
|
|
reload() {
|
|
const app = this;
|
|
Promise.all([app.getCourseList(), app.getItemList()]).then((res) => {
|
|
console.log("res: ", res);
|
|
app.list = res[0];
|
|
app.itemList = res[1];
|
|
app.hideTools = false;
|
|
});
|
|
},
|
|
getCourseList() {
|
|
const { categoryId } = this;
|
|
return new Promise((resolve, reject) => {
|
|
api_booking_course_index.pageCourse({ categoryId }).then((result) => {
|
|
resolve(result.list);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
getItemList() {
|
|
return new Promise((resolve, reject) => {
|
|
api_booking_item_index.listItem({}).then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
openUrl(url) {
|
|
common_vendor.index.navigateTo({
|
|
url
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
|
|
const _easycom_uv_image2 = common_vendor.resolveComponent("uv-image");
|
|
const _easycom_uv_text2 = common_vendor.resolveComponent("uv-text");
|
|
const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
(_easycom_uv_gap2 + _easycom_uv_image2 + _easycom_uv_text2 + _easycom_uv_skeleton2 + _easycom_uni_card2)();
|
|
}
|
|
const _easycom_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
|
|
const _easycom_uv_image = () => "../../uni_modules/uv-image/components/uv-image/uv-image.js";
|
|
const _easycom_uv_text = () => "../../uni_modules/uv-text/components/uv-text/uv-text.js";
|
|
const _easycom_uv_skeleton = () => "../../uni_modules/uv-skeleton/components/uv-skeleton/uv-skeleton.js";
|
|
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
|
if (!Math) {
|
|
(_easycom_uv_gap + _easycom_uv_image + _easycom_uv_text + _easycom_uv_skeleton + _easycom_uni_card)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: !$data.hideTools
|
|
}, !$data.hideTools ? {
|
|
b: common_vendor.p({
|
|
height: "5"
|
|
}),
|
|
c: common_vendor.f($data.list, (item, index, i0) => {
|
|
return {
|
|
a: "312c4c39-1-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.image,
|
|
width: "200",
|
|
height: "110"
|
|
}),
|
|
c: "312c4c39-2-" + i0,
|
|
d: "312c4c39-3-" + i0,
|
|
e: common_vendor.p({
|
|
size: "15",
|
|
lines: 1,
|
|
text: item.courseName
|
|
}),
|
|
f: "312c4c39-4-" + i0,
|
|
g: common_vendor.p({
|
|
size: "13",
|
|
text: `${item.classPeriod}课时`
|
|
}),
|
|
h: "312c4c39-5-" + i0,
|
|
i: common_vendor.p({
|
|
mode: "price",
|
|
color: "#ff0000",
|
|
text: `${item.price}`
|
|
}),
|
|
j: "312c4c39-6-" + i0,
|
|
k: "312c4c39-7-" + i0,
|
|
l: common_vendor.o(($event) => $options.openUrl(`/package/course/detail?id=` + item.courseId), index),
|
|
m: index
|
|
};
|
|
}),
|
|
d: common_vendor.p({
|
|
height: "5"
|
|
}),
|
|
e: common_vendor.p({
|
|
text: `1.3km`
|
|
}),
|
|
f: common_vendor.p({
|
|
height: "5"
|
|
})
|
|
} : {
|
|
g: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
h: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
i: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
j: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
k: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
l: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
m: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
n: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
o: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: "12px 4px"
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-312c4c39"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/course/list.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|