"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");
    common_vendor.inject("$config");
    const config$1 = common_vendor.ref({ logo: [], icon: [], file: [] });
    const show = common_vendor.ref(false);
    const user = common_vendor.computed(() => {
      return common_vendor.index.getStorageSync("user");
    });
    const genderList = common_vendor.ref([]);
    common_vendor.onShow(async () => {
      await searchConfig();
      await searchOther();
      await search();
      if (!user.value)
        show.value = true;
    });
    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;
    };
    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: common_vendor.unref(user) && common_vendor.unref(user)._id
      }, common_vendor.unref(user) && common_vendor.unref(user)._id ? common_vendor.e({
        b: common_vendor.unref(user).icon && common_vendor.unref(user).icon.length > 0
      }, common_vendor.unref(user).icon && common_vendor.unref(user).icon.length > 0 ? {
        c: common_vendor.unref(user).icon[0].url
      } : {
        d: config$1.value.icon[0].url
      }, {
        e: common_vendor.t(common_vendor.unref(user).nick_name || "暂无昵称"),
        f: common_vendor.t(getGender(common_vendor.unref(user).gender))
      }) : {
        g: config$1.value.icon[0].url,
        h: common_vendor.o(($event) => show.value = true)
      }, {
        i: common_vendor.p({
          name: "arrow-right",
          size: "16"
        }),
        j: common_vendor.o(($event) => toCommon(`pagesMy/order/index?status=${"-1"}`)),
        k: 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)
          };
        }),
        l: common_vendor.f(common_vendor.unref(config.configInfo).menuList, (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)
          };
        }),
        m: common_vendor.p({
          name: "arrow-right",
          size: "16"
        }),
        n: common_vendor.o(showChange),
        o: 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);
