"use strict";
const common_vendor = require("../../../common/vendor.js");
const request_api = require("../../../request/api.js");
const utils_util = require("../../../utils/util.js");
const common_assets = require("../../../common/assets.js");
const _sfc_main = {
  data() {
    return {
      navH: common_vendor.inject("navHeight"),
      myLikeList: [],
      page: 1,
      loadAll: false,
      getLocaleHourMinute: utils_util.getLocaleHourMinute
    };
  },
  onLoad() {
    this.getMyLikeListData();
  },
  onPullDownRefresh() {
    this.page = 1;
    this.getMyLikeListData();
  },
  onReachBottom() {
    if (!this.loadAll) {
      this.page++;
      this.getMyLikeListData();
    }
  },
  methods: {
    /**
     * 点赞评论
     */
    clickLikeComment(id, index) {
      request_api.likeEventComment(id).then((res) => {
        common_vendor.index.showToast({
          title: res.message
        });
        this.myLikeList.splice(index, 1);
      }).catch((error) => {
      });
    },
    /**
     * 获取我的点赞列表数据
     */
    getMyLikeListData() {
      let param = { page: this.page, type: "likes" };
      request_api.userActivityList(param).then((res) => {
        if (res.code == 200) {
          if (res.data.current_page == 1) {
            this.myLikeList = res.data.activities;
          } else
            this.myLikeList = this.myLikeList.concat(res.data.activities);
          if (res.data.current_page == res.data.pages) {
            this.loadAll = true;
          }
        } else
          common_vendor.index.showToast({
            title: res.message,
            icon: "none"
          });
      }).catch((error) => {
      });
    }
  }
};
if (!Array) {
  const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
  _easycom_navBar2();
}
const _easycom_navBar = () => "../../../components/navBar/navBar.js";
if (!Math) {
  _easycom_navBar();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: common_vendor.p({
      leftText: "我的点赞"
    }),
    b: common_assets._imports_0,
    c: common_vendor.f($data.myLikeList, (item, index, i0) => {
      return {
        a: item.author.avatar_url,
        b: common_vendor.t(item.author.nickname),
        c: item.post_content,
        d: common_vendor.t($data.getLocaleHourMinute(item.like_time)),
        e: common_vendor.o(($event) => $options.clickLikeComment(item.like_id, index), index),
        f: index
      };
    }),
    d: common_assets._imports_1$6,
    e: common_vendor.s("top:" + $data.navH + "px;")
  };
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/mine/myLike/myLike.js.map
