123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- if (!Array) {
- const _easycom_up_tabs2 = common_vendor.resolveComponent("up-tabs");
- const _easycom_up_empty2 = common_vendor.resolveComponent("up-empty");
- const _easycom_up_overlay2 = common_vendor.resolveComponent("up-overlay");
- (_easycom_up_tabs2 + _easycom_up_empty2 + _easycom_up_overlay2)();
- }
- const _easycom_up_tabs = () => "../../node-modules/uview-plus/components/u-tabs/u-tabs.js";
- const _easycom_up_empty = () => "../../node-modules/uview-plus/components/u-empty/u-empty.js";
- const _easycom_up_overlay = () => "../../node-modules/uview-plus/components/u-overlay/u-overlay.js";
- if (!Math) {
- (_easycom_up_tabs + _easycom_up_empty + login + _easycom_up_overlay)();
- }
- const login = () => "../../components/login.js";
- const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
- __name: "index",
- setup(__props) {
- const $api = common_vendor.inject("$api");
- const config = common_vendor.ref({ logo: [], file: [] });
- const type = common_vendor.ref("");
- const subject = common_vendor.ref("-1");
- 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 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(() => {
- return common_vendor.index.getStorageSync("user");
- });
- common_vendor.onLoad(async (options) => {
- type.value = options && options.type;
- common_vendor.index.setNavigationBarTitle({
- title: options && options.name + "课程" || "课程"
- });
- });
- common_vendor.onShow(async () => {
- await searchConfig();
- await searchOther();
- await clearPage();
- await search();
- if (!user.value)
- show.value = true;
- });
- common_vendor.onPullDownRefresh(async () => {
- await clearPage();
- await search();
- common_vendor.index.stopPullDownRefresh();
- });
- const searchConfig = async () => {
- config.value = common_vendor.index.getStorageSync("config");
- };
- 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;
- subjectList.value.unshift({ label: "全部", value: "-1" });
- res = await $api(`dictData`, "GET", { code: "grade", is_use: "0" });
- if (res.errcode === 0)
- gradeList.value = res.data;
- gradeList.value.unshift({ label: "全部", value: "-1" });
- };
- const searchInfo = async () => {
- await clearPage();
- await search();
- };
- const search = async () => {
- const info = {
- skip: skip.value,
- limit: limit.value,
- status: "1",
- is_show: "0"
- };
- if (nick_name.value)
- info.nick_name = nick_name.value;
- const res = await $api("teacher", "GET", info);
- if (res.errcode === 0) {
- list.value = list.value.concat(res.data);
- total.value = res.total;
- } else {
- common_vendor.index.showToast({
- title: res.errmsg || "",
- icon: "error"
- });
- }
- };
- const showChange = () => {
- show.value = false;
- };
- const toChange = (index, e) => {
- console.log(index, e);
- active.value = index;
- subject.value = e.value;
- };
- const toTab = async (data) => {
- console.log(data);
- };
- const toPage = () => {
- if (total.value > list.value.length) {
- common_vendor.index.showLoading({
- title: "加载中",
- mask: true
- });
- page.value = page.value + 1;
- skip.value = page.value * limit.value;
- search();
- common_vendor.index.hideLoading();
- } else
- is_bottom.value = true;
- };
- const clearPage = () => {
- list.value = [];
- skip.value = 0;
- limit.value = 6;
- page.value = 0;
- };
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: nick_name.value,
- b: common_vendor.o(($event) => nick_name.value = $event.detail.value),
- c: common_vendor.o(searchInfo),
- d: common_vendor.f(subjectList.value, (item, index, i0) => {
- return {
- a: common_vendor.t(item.label),
- b: common_vendor.n(active.value == index ? "listActive" : ""),
- c: index,
- d: common_vendor.o(($event) => toChange(index, item), index)
- };
- }),
- e: common_vendor.o(toTab),
- f: common_vendor.p({
- list: gradeList.value,
- keyName: "label"
- }),
- 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)
- };
- }),
- 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)
- )
- }) : {
- m: common_vendor.p({
- mode: "list",
- icon: "/static/list.png"
- })
- }, {
- n: common_vendor.o(showChange),
- o: common_vendor.p({
- show: show.value
- })
- });
- };
- }
- });
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-db68cfa6"], ["__file", "D:/project/学吧/learn_applet/pagesHome/list/index.vue"]]);
- wx.createPage(MiniProgramPage);
|