"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const utils_previewImage = require("../../utils/previewImage.js");
const _sfc_main = {
  __name: "myCenter",
  setup(__props) {
    const userInfo = common_vendor.ref({});
    const showChange = common_vendor.ref(false);
    common_vendor.onLoad(() => {
      userInfo.value = common_vendor.index.getStorageSync("userInfo");
      let length = common_vendor.index.getStorageSync("allData").user.length;
      if (length > 1) {
        showChange.value = true;
      }
    });
    const list = common_vendor.ref([
      {
        id: 1,
        title: "我的信息",
        url: "../../static/images/message.png",
        page: "/pages/myMsg/myMsg"
      },
      {
        id: 2,
        title: "消息提醒",
        url: "../../static/images/warn.png",
        page: "/pages/msgWarn/msgWarn"
      }
    ]);
    const goPage = (url) => {
      common_vendor.index.navigateTo({
        url
      });
    };
    const handleChange = () => {
      let info = encodeURIComponent(JSON.stringify(common_vendor.index.getStorageSync("allData")));
      common_vendor.index.navigateTo({
        url: `/pages/switch/switch?info=${info}`
      });
    };
    const handleLogout = () => {
      common_vendor.index.showModal({
        title: "提示",
        content: "确定退出登录吗？",
        success: (res) => {
          if (res.confirm) {
            common_vendor.index.clearStorageSync();
            common_vendor.index.reLaunch({
              url: "/pages/main/main"
            });
          } else if (res.cancel)
            ;
        }
      });
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: userInfo.value.headImage || "../../static/images/header.png",
        b: common_vendor.o(($event) => common_vendor.unref(utils_previewImage.previewImage)(userInfo.value.headImage || "../../static/images/header.png")),
        c: common_vendor.t(userInfo.value.name),
        d: common_vendor.t(userInfo.value.departmentName),
        e: showChange.value
      }, showChange.value ? {
        f: common_assets._imports_0$1,
        g: common_vendor.o(handleChange)
      } : {}, {
        h: common_vendor.f(list.value, (item, k0, i0) => {
          return {
            a: item.url,
            b: common_vendor.t(item.title),
            c: item.id,
            d: common_vendor.o(($event) => goPage(item.page), item.id)
          };
        }),
        i: common_vendor.o(handleLogout)
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-eea72321"], ["__file", "E:/workSpace/WanZai_School_app/pages/myCenter/myCenter.vue"]]);
wx.createPage(MiniProgramPage);
