"use strict"; const common_vendor = require("../../common/vendor.js"); const config = require("../../config.js"); if (!Array) { const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon"); const _easycom_uni_badge2 = common_vendor.resolveComponent("uni-badge"); const _easycom_up_overlay2 = common_vendor.resolveComponent("up-overlay"); (_easycom_up_icon2 + _easycom_uni_badge2 + _easycom_up_overlay2)(); } const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_uni_badge = () => "../../uni_modules/uni-badge/components/uni-badge/uni-badge.js"; const _easycom_up_overlay = () => "../../node-modules/uview-plus/components/u-overlay/u-overlay.js"; if (!Math) { (_easycom_up_icon + _easycom_uni_badge + 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.inject("$config"); const config$1 = common_vendor.ref({ logo: [], icon: [], file: [] }); const show = common_vendor.ref(false); const user = common_vendor.ref({ icon: [] }); const genderList = common_vendor.ref([]); const menuList = common_vendor.ref([]); common_vendor.onShow(async () => { await searchConfig(); await searchUser(); await searchOther(); await search(); if (!user.value) show.value = true; }); const searchUser = async () => { user.value = common_vendor.index.getStorageSync("user"); }; const searchConfig = async () => { config$1.value = common_vendor.index.getStorageSync("config"); }; const searchOther = async () => { let res; res = await $api(`dictData`, "GET", { code: "gender", is_use: "0" }); if (res.errcode === 0) genderList.value = res.data; let menu = []; for (let val of $config.menuList) { const role = val.role.find((i) => i == user.value.role_type); if (role) menu.push(val); } menuList.value = menu; }; const search = async () => { }; const showChange = () => { show.value = false; }; const getGender = (i) => { if (i) { const r = genderList.value.find((f) => f.value === i); if (r) return r.label; else return "暂无"; } else return "暂无"; }; const toRoute = (item) => { if (user.value && user.value._id) { common_vendor.index.navigateTo({ url: `/${item.route}?status=${item.status}` }); } else show.value = true; }; const toCommon = (e) => { if (user.value && user.value._id) { common_vendor.index.navigateTo({ url: `/${e}` }); } else show.value = true; }; return (_ctx, _cache) => { return common_vendor.e({ a: user.value && user.value._id }, user.value && user.value._id ? common_vendor.e({ b: user.value && user.value.icon && user.value.icon.length > 0 }, user.value && user.value.icon && user.value.icon.length > 0 ? { c: user.value.icon[0].url } : { d: config$1.value.icon[0].url }, { e: common_vendor.t(user.value.nick_name || "暂无昵称"), f: common_vendor.t(getGender(user.value.gender)) }) : common_vendor.e({ g: config$1.value && config$1.value.icon && config$1.value.icon.length > 0 }, config$1.value && config$1.value.icon && config$1.value.icon.length > 0 ? { h: config$1.value.icon[0].url } : {}, { i: common_vendor.o(($event) => show.value = true) }), { j: common_vendor.p({ name: "arrow-right", size: "16" }), k: common_vendor.o(($event) => toCommon(`pagesMy/order/index?status=${"-1"}`)), l: common_vendor.f(common_vendor.unref(config.configInfo).orderList, (item, index, i0) => { return { a: common_vendor.n(item.icon), b: common_vendor.t(item.title), c: "f97bc692-1-" + i0, d: common_vendor.p({ text: item.num, absolute: "rightTop", size: "normal" }), e: index, f: common_vendor.o(($event) => toRoute(item), index) }; }), m: common_vendor.f(menuList.value, (item, index, i0) => { return { a: common_vendor.n(item.icon), b: common_vendor.t(item.title), c: "f97bc692-2-" + i0, d: index, e: common_vendor.o(($event) => toCommon(item.route), index) }; }), n: common_vendor.p({ name: "arrow-right", size: "16" }), o: common_vendor.o(showChange), p: common_vendor.p({ show: show.value }) }); }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f97bc692"], ["__file", "D:/project/学吧/learn_applet/pages/my/index.vue"]]); wx.createPage(MiniProgramPage);