"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = {
  data() {
    return {
      menuTop: common_vendor.inject("menuTop"),
      menuH: common_vendor.inject("menuHeight"),
      infoTop: "",
      userInfo: null,
      menuList: [
        {
          icon: "/static/icon/mine/aboutUs.png",
          title: "关于我们",
          url: "/pages/mine/web/web?type=1"
        },
        {
          icon: "/static/icon/mine/serviceTerm.png",
          title: "服务条款",
          url: "/pages/mine/web/web?type=2"
        },
        {
          icon: "/static/icon/mine/privacyProtocol.png",
          title: "隐私协议",
          url: "/pages/mine/web/web?type=3"
        },
        {
          icon: "/static/icon/mine/feedback.png",
          title: "意见反馈",
          url: "/pages/mine/feedback/feedback"
        },
        {
          icon: "/static/icon/mine/customerService.png",
          title: "联系客服"
        },
        {
          icon: "/static/icon/mine/logout.png",
          title: "退出登录"
        }
      ]
    };
  },
  onLoad() {
    this.infoTop = common_vendor.inject("navHeight") + 32 / 750 * common_vendor.inject("windowWidth");
  },
  onShow() {
    this.getUserInfoData();
  },
  methods: {
    /**
     * 点击查看个人信息
     */
    clickPersonalInfo() {
      common_vendor.index.navigateTo({
        url: "/pages/mine/basicInfo/basicInfo"
      });
    },
    /**
     * 点击vip
     */
    clickVip() {
      common_vendor.index.navigateTo({
        url: "/pagesMine/vip/vip"
      });
    },
    /**
     * 查看评论收藏点赞
     * @param {Object} index
     */
    clickNumItem(index) {
      if (index == 0) {
        common_vendor.index.navigateTo({
          url: "/pages/mine/commentReply/commentReply"
        });
      } else if (index == 1) {
        common_vendor.index.navigateTo({
          url: "/pages/mine/followCollect/followCollect"
        });
      } else
        common_vendor.index.navigateTo({
          url: "/pages/mine/myLike/myLike"
        });
    },
    clickMenuItem(url, index) {
      if (url) {
        common_vendor.index.navigateTo({
          url
        });
      } else if (index == this.menuList.length - 1) {
        common_vendor.index.showModal({
          title: "您确定要退出登录么",
          success(res) {
            if (res.confirm) {
              common_vendor.index.removeStorageSync("token");
              common_vendor.index.switchTab({
                url: "/pages/index/index"
              });
            }
          }
        });
      }
    },
    /**
     * 获取用户信息数据
     */
    getUserInfoData() {
      request_api.userInfo().then((res) => {
        if (res.code == 200) {
          this.userInfo = res.data;
        } else
          common_vendor.wx$1.showToast({
            title: res.message
          });
      }).catch((error) => {
      });
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: common_assets._imports_0,
    b: common_vendor.s("top:" + $data.menuTop + "px;line-height:" + $data.menuH + "px;"),
    c: $data.userInfo
  }, $data.userInfo ? {
    d: $data.userInfo.basic_info.avatar_url,
    e: common_vendor.t($data.userInfo.basic_info.username),
    f: common_vendor.t($data.userInfo.basic_info.phone),
    g: common_assets._imports_1$2,
    h: common_vendor.s("margin-top:" + $data.infoTop + "px;"),
    i: common_vendor.o(($event) => $options.clickPersonalInfo())
  } : {}, {
    j: $data.userInfo
  }, $data.userInfo ? {
    k: common_vendor.t($data.userInfo.statistics.total_comments),
    l: common_vendor.o(($event) => $options.clickNumItem(0)),
    m: common_vendor.t($data.userInfo.statistics.follows_count),
    n: common_vendor.o(($event) => $options.clickNumItem(1)),
    o: common_vendor.t($data.userInfo.statistics.likes_count),
    p: common_vendor.o(($event) => $options.clickNumItem(2))
  } : {}, {
    q: common_assets._imports_2$4,
    r: common_vendor.o(($event) => $options.clickVip()),
    s: common_vendor.f($data.menuList, (item, index, i0) => {
      return common_vendor.e({
        a: item.icon,
        b: common_vendor.t(item.title),
        c: index == $data.menuList.length - 2
      }, index == $data.menuList.length - 2 ? {} : {}, {
        d: index,
        e: common_vendor.o(($event) => $options.clickMenuItem(item.url, index), index)
      });
    }),
    t: common_assets._imports_3$3
  });
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/mine.js.map
