200 lines
6.1 KiB
JavaScript
200 lines
6.1 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 {
|
|
list: [],
|
|
// 骨架屏
|
|
hideTools: true,
|
|
// 项目列表
|
|
itemList: []
|
|
};
|
|
},
|
|
onLoad() {
|
|
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];
|
|
});
|
|
},
|
|
getCourseList() {
|
|
return new Promise((resolve, reject) => {
|
|
api_booking_course_index.pageCourse({}).then((result) => {
|
|
resolve(result.list);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
getItemList() {
|
|
return new Promise((resolve, reject) => {
|
|
api_booking_item_index.listItem({}).then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
onItem(e) {
|
|
const { index } = e.detail;
|
|
this.openUrl(`/package/course/list?categoryId=${this.itemList[index].id}&categoryName=${this.itemList[index].name}`);
|
|
},
|
|
openUrl(url) {
|
|
common_vendor.index.navigateTo({
|
|
url
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
|
|
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
|
|
const _easycom_uni_grid_item2 = common_vendor.resolveComponent("uni-grid-item");
|
|
const _easycom_uni_grid2 = common_vendor.resolveComponent("uni-grid");
|
|
const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_uv_image2 = common_vendor.resolveComponent("uv-image");
|
|
const _easycom_uv_text2 = common_vendor.resolveComponent("uv-text");
|
|
(_easycom_uv_gap2 + _easycom_uv_avatar2 + _easycom_uni_grid_item2 + _easycom_uni_grid2 + _easycom_uv_skeleton2 + _easycom_uni_card2 + _easycom_uv_image2 + _easycom_uv_text2)();
|
|
}
|
|
const _easycom_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
|
|
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
|
|
const _easycom_uni_grid_item = () => "../../uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.js";
|
|
const _easycom_uni_grid = () => "../../uni_modules/uni-grid/components/uni-grid/uni-grid.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";
|
|
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";
|
|
if (!Math) {
|
|
(_easycom_uv_gap + _easycom_uv_avatar + _easycom_uni_grid_item + _easycom_uni_grid + _easycom_uv_skeleton + _easycom_uni_card + _easycom_uv_image + _easycom_uv_text)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: $data.itemList.length > 0
|
|
}, $data.itemList.length > 0 ? {
|
|
b: common_vendor.p({
|
|
height: "10"
|
|
}),
|
|
c: common_vendor.f($data.itemList, (item, index, i0) => {
|
|
return {
|
|
a: "84f783ca-3-" + i0 + "," + ("84f783ca-2-" + i0),
|
|
b: common_vendor.p({
|
|
src: item.image,
|
|
size: 30,
|
|
shape: "square",
|
|
fontSize: "16",
|
|
randomBgColor: true
|
|
}),
|
|
c: common_vendor.t(item.name),
|
|
d: index,
|
|
e: "84f783ca-2-" + i0 + ",84f783ca-1",
|
|
f: common_vendor.p({
|
|
index
|
|
})
|
|
};
|
|
}),
|
|
d: common_vendor.o($options.onItem),
|
|
e: common_vendor.p({
|
|
column: 5,
|
|
highlight: true,
|
|
showBorder: false
|
|
})
|
|
} : {
|
|
f: common_vendor.p({
|
|
rows: "3",
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
g: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: "12px 4px"
|
|
})
|
|
}, {
|
|
h: $data.list.length > 0
|
|
}, $data.list.length > 0 ? {
|
|
i: common_vendor.f($data.list, (item, index, i0) => {
|
|
return {
|
|
a: "84f783ca-6-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.image,
|
|
width: "200",
|
|
height: "110"
|
|
}),
|
|
c: "84f783ca-7-" + i0,
|
|
d: common_vendor.p({
|
|
size: "15",
|
|
lineHeight: "24",
|
|
lines: 1,
|
|
text: item.courseName
|
|
}),
|
|
e: "84f783ca-8-" + i0,
|
|
f: common_vendor.p({
|
|
lineHeight: "24",
|
|
size: "13",
|
|
text: `${item.classPeriod}课时`
|
|
}),
|
|
g: "84f783ca-9-" + i0,
|
|
h: common_vendor.p({
|
|
mode: "price",
|
|
color: "#ff0000",
|
|
text: `${item.price}`
|
|
}),
|
|
i: "84f783ca-10-" + i0,
|
|
j: common_vendor.o(($event) => $options.openUrl(`/package/course/detail?id=` + item.courseId), index),
|
|
k: index
|
|
};
|
|
}),
|
|
j: common_vendor.p({
|
|
text: `1.3km`
|
|
})
|
|
} : {
|
|
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({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
p: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
q: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
r: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
s: 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-84f783ca"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/course/index.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|