|
@@ -18,19 +18,19 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
setup(__props) {
|
|
|
const $api = common_vendor.inject("$api");
|
|
|
const config = common_vendor.ref({ logo: [], file: [] });
|
|
|
+ const active = common_vendor.ref(0);
|
|
|
const type = common_vendor.ref("");
|
|
|
const subject = common_vendor.ref("-1");
|
|
|
- common_vendor.ref("-1");
|
|
|
+ const grade = common_vendor.ref("-1");
|
|
|
const list = common_vendor.ref([]);
|
|
|
const total = common_vendor.ref(0);
|
|
|
const skip = common_vendor.ref(0);
|
|
|
const limit = common_vendor.ref(5);
|
|
|
const page = common_vendor.ref(0);
|
|
|
const is_bottom = common_vendor.ref(false);
|
|
|
+ const scrollTop = common_vendor.ref(0);
|
|
|
const show = common_vendor.ref(false);
|
|
|
const nick_name = common_vendor.ref("");
|
|
|
- const educationList = common_vendor.ref([]);
|
|
|
- const active = common_vendor.ref(0);
|
|
|
const subjectList = common_vendor.ref([]);
|
|
|
const gradeList = common_vendor.ref([]);
|
|
|
const user = common_vendor.computed(() => {
|
|
@@ -60,9 +60,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
};
|
|
|
const searchOther = async () => {
|
|
|
let res;
|
|
|
- res = await $api(`dictData`, "GET", { code: "education", is_use: "0" });
|
|
|
- if (res.errcode === 0)
|
|
|
- educationList.value = res.data;
|
|
|
res = await $api(`dictData`, "GET", { code: "subject", is_use: "0" });
|
|
|
if (res.errcode === 0)
|
|
|
subjectList.value = res.data;
|
|
@@ -81,11 +78,16 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
skip: skip.value,
|
|
|
limit: limit.value,
|
|
|
status: "1",
|
|
|
- is_show: "0"
|
|
|
+ is_show: "0",
|
|
|
+ type: type.value
|
|
|
};
|
|
|
if (nick_name.value)
|
|
|
- info.nick_name = nick_name.value;
|
|
|
- const res = await $api("teacher", "GET", info);
|
|
|
+ info.name = nick_name.value;
|
|
|
+ if (subject.value && subject.value !== "-1")
|
|
|
+ info.subject = subject.value;
|
|
|
+ if (grade.value && grade.value !== "-1")
|
|
|
+ info.grade = grade.value;
|
|
|
+ const res = await $api("course/appHome", "GET", info);
|
|
|
if (res.errcode === 0) {
|
|
|
list.value = list.value.concat(res.data);
|
|
|
total.value = res.total;
|
|
@@ -99,13 +101,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
const showChange = () => {
|
|
|
show.value = false;
|
|
|
};
|
|
|
- const toChange = (index, e) => {
|
|
|
+ const toChange = async (index, e) => {
|
|
|
console.log(index, e);
|
|
|
active.value = index;
|
|
|
subject.value = e.value;
|
|
|
+ await clearPage();
|
|
|
+ await search();
|
|
|
};
|
|
|
const toTab = async (data) => {
|
|
|
- console.log(data);
|
|
|
+ grade.value = data.value;
|
|
|
+ await clearPage();
|
|
|
+ await search();
|
|
|
};
|
|
|
const toPage = () => {
|
|
|
if (total.value > list.value.length) {
|
|
@@ -120,6 +126,13 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
} else
|
|
|
is_bottom.value = true;
|
|
|
};
|
|
|
+ const toScroll = (e) => {
|
|
|
+ let up = scrollTop.value;
|
|
|
+ scrollTop.value = e.detail.scrollTop;
|
|
|
+ let num = Math.sign(up - e.detail.scrollTop);
|
|
|
+ if (num == 1)
|
|
|
+ is_bottom.value = false;
|
|
|
+ };
|
|
|
const clearPage = () => {
|
|
|
list.value = [];
|
|
|
skip.value = 0;
|
|
@@ -146,22 +159,29 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
}),
|
|
|
g: total.value > 0
|
|
|
}, total.value > 0 ? common_vendor.e({
|
|
|
- h: common_vendor.f(list.value, (tag, index, i0) => {
|
|
|
- return {
|
|
|
- a: common_vendor.t(tag.nick_name),
|
|
|
- b: index,
|
|
|
- c: common_vendor.o(($event) => _ctx.toBuy(tag), index)
|
|
|
- };
|
|
|
+ h: common_vendor.f(list.value, (item, index, i0) => {
|
|
|
+ return common_vendor.e({
|
|
|
+ a: item.icon && item.icon.length > 0 && item.icon
|
|
|
+ }, item.icon && item.icon.length > 0 && item.icon ? {
|
|
|
+ b: item.icon[0].url
|
|
|
+ } : {
|
|
|
+ c: config.value.icon[0].url
|
|
|
+ }, {
|
|
|
+ d: common_vendor.t(item.name || "暂无"),
|
|
|
+ e: common_vendor.t(item.teacher_name || "暂无"),
|
|
|
+ f: common_vendor.t(item.start_time || "休息中"),
|
|
|
+ g: common_vendor.t(item.money || "免费"),
|
|
|
+ h: common_vendor.o(($event) => _ctx.toBuy(item), index),
|
|
|
+ i: index,
|
|
|
+ j: common_vendor.o(($event) => _ctx.toBuy(_ctx.tag), index)
|
|
|
+ });
|
|
|
}),
|
|
|
i: is_bottom.value
|
|
|
}, is_bottom.value ? {
|
|
|
j: common_vendor.t(config.value.bottom_title)
|
|
|
} : {}, {
|
|
|
k: common_vendor.o(toPage),
|
|
|
- l: common_vendor.o(
|
|
|
- //@ts-ignore
|
|
|
- (...args) => _ctx.toScroll && _ctx.toScroll(...args)
|
|
|
- )
|
|
|
+ l: common_vendor.o(toScroll)
|
|
|
}) : {
|
|
|
m: common_vendor.p({
|
|
|
mode: "list",
|