"use strict"; const common_vendor = require("../../common/vendor.js"); if (!Array) { const _easycom_up_list_item2 = common_vendor.resolveComponent("up-list-item"); const _easycom_up_list2 = common_vendor.resolveComponent("up-list"); (_easycom_up_list_item2 + _easycom_up_list2)(); } const _easycom_up_list_item = () => "../../node-modules/uview-plus/components/u-list-item/u-list-item.js"; const _easycom_up_list = () => "../../node-modules/uview-plus/components/u-list/u-list.js"; if (!Math) { (_easycom_up_list_item + _easycom_up_list)(); } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "list", setup(__props) { const $api = common_vendor.inject("$api"); common_vendor.inject("$config"); const config = common_vendor.ref({ logo: [], file: [] }); 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 typeList = common_vendor.ref([]); const statusList = common_vendor.ref([]); const user = common_vendor.computed(() => { return common_vendor.index.getStorageSync("user"); }); common_vendor.onShow(async () => { await searchConfig(); await searchOther(); await search(); }); 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: "opinionType", is_use: "0" }); if (res.errcode === 0) typeList.value = res.data; res = await $api(`dictData`, "GET", { code: "opinionStatus", is_use: "0" }); if (res.errcode === 0) statusList.value = res.data; }; const search = async () => { const info = { skip: skip.value, limit: limit.value, user: user.value._id }; const res = await $api("opinion", "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 getDict = (data, model) => { let res; if (model == "status") res = statusList.value.find((f) => f.value == data); else if (model == "type") res = typeList.value.find((f) => f.value == data); return res.label || "暂无"; }; const scrolltolower = () => { 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: common_vendor.f(list.value, (item, index, i0) => { return { a: common_vendor.t(getDict(item.type, "type")), b: common_vendor.t(item.brief || "暂无"), c: common_vendor.t(item.time || "暂无"), d: common_vendor.t(getDict(item.status, "status")), e: common_vendor.n(item.status == "0" ? "red" : ""), f: index, g: "c9b53715-1-" + i0 + ",c9b53715-0" }; }), b: common_vendor.o(scrolltolower), c: is_bottom.value }, is_bottom.value ? { d: common_vendor.t(config.value.bottom_title || "没有更多了!") } : {}); }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c9b53715"], ["__file", "D:/project/学吧/learn_applet/pagesMy/opinion/list.vue"]]); wx.createPage(MiniProgramPage);