"use strict";
const common_vendor = require("../../common/vendor.js");
const store_index = require("../../store/index.js");
const utils_index = require("../../utils/index.js");
require("../../api/index.js");
require("../../api/request.js");
require("../../config/index.js");
if (!Array) {
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  _easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
  _easycom_uni_icons();
}
const _sfc_main = {
  __name: "index",
  setup(__props) {
    store_index.useStore();
    common_vendor.onShow(() => {
      is_login.value = utils_index.custom.checkLogin();
      if (is_login.value) {
        userinfo.value = common_vendor.index.getStorageSync("userInfo");
        avatar.value = common_vendor.index.getStorageSync("avatarUrl");
        userinfo.value = JSON.parse(userinfo.value);
      }
    });
    const avatar = common_vendor.ref("");
    common_vendor.ref(null);
    const is_login = common_vendor.ref(null);
    const userinfo = common_vendor.ref(null);
    function toLogin() {
      common_vendor.index.navigateTo({
        url: "/pages/login/login"
      });
    }
    function toDetail(type) {
      let url = "";
      switch (type) {
        case 1:
          url = " ";
          break;
        case 2:
          url = "./star";
          break;
        case 3:
          url = "./setting";
          break;
        case 4:
          url = "./feedback";
          break;
        default:
          url = " ";
          break;
      }
      common_vendor.index.navigateTo({
        url
      });
    }
    function toUserInfo() {
      common_vendor.index.navigateTo({
        url: "/pages/user/userInfo"
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: is_login.value ? avatar.value : "../../static/avatar.png",
        b: common_vendor.t(is_login.value ? userinfo.value.nickname : "未登录"),
        c: is_login.value
      }, is_login.value ? {
        d: common_vendor.p({
          type: "forward",
          color: "white",
          size: "20"
        })
      } : {}, {
        e: common_vendor.o(toUserInfo),
        f: !is_login.value
      }, !is_login.value ? {
        g: common_vendor.o(toLogin)
      } : {
        h: common_vendor.p({
          type: "calendar",
          color: "gray",
          size: "30"
        }),
        i: common_vendor.p({
          type: "notification",
          color: "gray",
          size: "30"
        }),
        j: common_vendor.o(($event) => toDetail(1)),
        k: common_vendor.p({
          type: "star",
          color: "gray",
          size: "30"
        }),
        l: common_vendor.p({
          type: "forward",
          color: "gray",
          size: "20"
        }),
        m: common_vendor.o(($event) => toDetail(2)),
        n: common_vendor.p({
          type: "gear",
          color: "gray",
          size: "30"
        }),
        o: common_vendor.p({
          type: "forward",
          color: "gray",
          size: "20"
        }),
        p: common_vendor.o(($event) => toDetail(3)),
        q: common_vendor.p({
          type: "chatbubble",
          color: "gray",
          size: "30"
        }),
        r: common_vendor.p({
          type: "forward",
          color: "gray",
          size: "20"
        }),
        s: common_vendor.o(($event) => toDetail(4))
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-79e6a490"], ["__file", "F:/项目2023/视力表/vision-record/pages/user/index.vue"]]);
wx.createPage(MiniProgramPage);
