|
@@ -24,6 +24,11 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
const page = common_vendor.ref(0);
|
|
|
const is_bottom = common_vendor.ref(false);
|
|
|
const name = common_vendor.ref("");
|
|
|
+ const subjectList = common_vendor.ref([]);
|
|
|
+ const gradeList = common_vendor.ref([]);
|
|
|
+ const showList = common_vendor.ref([]);
|
|
|
+ const typeList = common_vendor.ref([]);
|
|
|
+ const statusList = common_vendor.ref([]);
|
|
|
const user = common_vendor.computed(() => {
|
|
|
return common_vendor.index.getStorageSync("user");
|
|
|
});
|
|
@@ -42,6 +47,22 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
config.value = common_vendor.index.getStorageSync("config");
|
|
|
};
|
|
|
const searchOther = async () => {
|
|
|
+ let res;
|
|
|
+ res = await $api(`dictData`, "GET", { code: "subject", is_use: "0" });
|
|
|
+ if (res.errcode === 0)
|
|
|
+ subjectList.value = res.data;
|
|
|
+ res = await $api(`dictData`, "GET", { code: "grade", is_use: "0" });
|
|
|
+ if (res.errcode === 0)
|
|
|
+ gradeList.value = res.data;
|
|
|
+ res = await $api(`dictData`, "GET", { code: "courseType", is_use: "0" });
|
|
|
+ if (res.errcode === 0)
|
|
|
+ typeList.value = res.data;
|
|
|
+ res = await $api(`dictData`, "GET", { code: "courseStatus", is_use: "0" });
|
|
|
+ if (res.errcode === 0)
|
|
|
+ statusList.value = res.data;
|
|
|
+ res = await $api(`dictData`, "GET", { code: "show", is_use: "0" });
|
|
|
+ if (res.errcode === 0)
|
|
|
+ showList.value = res.data;
|
|
|
};
|
|
|
const search = async () => {
|
|
|
const info = {
|
|
@@ -63,7 +84,19 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
- const toInput = async (e) => {
|
|
|
+ const getDict = (data, model) => {
|
|
|
+ let res;
|
|
|
+ if (model == "subject")
|
|
|
+ res = subjectList.value.find((f) => f.value == data);
|
|
|
+ else if (model == "grade")
|
|
|
+ res = gradeList.value.find((f) => f.value == data);
|
|
|
+ else if (model == "type")
|
|
|
+ res = typeList.value.find((f) => f.value == data);
|
|
|
+ else if (model == "status")
|
|
|
+ res = statusList.value.find((f) => f.value == data);
|
|
|
+ return res.label || "暂无";
|
|
|
+ };
|
|
|
+ const toInput = async (e2) => {
|
|
|
await clearPage();
|
|
|
await search();
|
|
|
};
|
|
@@ -72,6 +105,35 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
url: `/pagesMy/course/add`
|
|
|
});
|
|
|
};
|
|
|
+ const toEdit = async (item) => {
|
|
|
+ common_vendor.index.navigateTo({
|
|
|
+ url: `/pagesMy/course/add?id=${item.id || item._id}`
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const toDelete = async () => {
|
|
|
+ common_vendor.index.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "确定删除该课程吗?",
|
|
|
+ success: async function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ const arr = await $api(`course/${e._id}`, "DELETE");
|
|
|
+ if (arr.errcode == "0") {
|
|
|
+ common_vendor.index.showToast({
|
|
|
+ title: "删除信息成功",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ await clearPage();
|
|
|
+ await search();
|
|
|
+ } else {
|
|
|
+ common_vendor.index.showToast({
|
|
|
+ title: arr.errmsg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
const scrolltolower = () => {
|
|
|
if (total.value > list.value.length) {
|
|
|
common_vendor.index.showLoading({
|
|
@@ -99,10 +161,24 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
d: total.value > 0
|
|
|
}, total.value > 0 ? {
|
|
|
e: common_vendor.f(list.value, (item, index, i0) => {
|
|
|
- return {
|
|
|
- a: index,
|
|
|
- b: "5cb065a7-1-" + i0 + ",5cb065a7-0"
|
|
|
- };
|
|
|
+ return common_vendor.e({
|
|
|
+ a: common_vendor.t(item.name || "暂无"),
|
|
|
+ b: common_vendor.t(getDict(item.type, "type")),
|
|
|
+ c: common_vendor.t(getDict(item.subject, "subject")),
|
|
|
+ d: common_vendor.t(getDict(item.grade, "grade")),
|
|
|
+ e: common_vendor.t(item.money || "免费"),
|
|
|
+ f: common_vendor.t(item.start_time),
|
|
|
+ g: common_vendor.t(item.end_time),
|
|
|
+ h: common_vendor.t(getDict(item.status, "status")),
|
|
|
+ i: common_vendor.n(item.status == "0" ? "red" : ""),
|
|
|
+ j: common_vendor.o(($event) => toEdit(item), index),
|
|
|
+ k: item.status == "0"
|
|
|
+ }, item.status == "0" ? {
|
|
|
+ l: common_vendor.o(($event) => toDelete(), index)
|
|
|
+ } : {}, {
|
|
|
+ m: index,
|
|
|
+ n: "5cb065a7-1-" + i0 + ",5cb065a7-0"
|
|
|
+ });
|
|
|
}),
|
|
|
f: common_vendor.o(scrolltolower)
|
|
|
} : {
|