116 lines
3.4 KiB
JavaScript
116 lines
3.4 KiB
JavaScript
"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"),
|
|
listTop: "",
|
|
tabList: ["评论我的", "我评论的"],
|
|
selectTab: 0,
|
|
commentList: [],
|
|
page: 1,
|
|
loadAll: false,
|
|
getLocaleDate: utils_util.getLocaleDate
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.listTop = this.navH + (75 + 10) / 750 * common_vendor.inject("windowWidth");
|
|
this.getCommentListData();
|
|
},
|
|
onPullDownRefresh() {
|
|
this.page = 1;
|
|
this.getCommentListData();
|
|
},
|
|
onReachBottom() {
|
|
if (!this.loadAll) {
|
|
this.page++;
|
|
this.getCommentListData();
|
|
}
|
|
},
|
|
methods: {
|
|
/**
|
|
* 点击选择对应分类
|
|
* @param {Object} index
|
|
*/
|
|
clickTabItem(index) {
|
|
if (this.selectTab != index) {
|
|
this.selectTab = index;
|
|
this.getCommentListData();
|
|
}
|
|
},
|
|
/**
|
|
* 获取评论列表数据
|
|
*/
|
|
getCommentListData() {
|
|
let param = { page: this.page, type: this.selectTab == 0 ? "commented" : "comments" };
|
|
request_api.userActivityList(param).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.data.current_page == 1) {
|
|
this.commentList = res.data.activities;
|
|
} else
|
|
this.commentList = this.followList.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 common_vendor.e({
|
|
a: common_vendor.p({
|
|
leftText: "评论回复"
|
|
}),
|
|
b: common_assets._imports_0,
|
|
c: common_vendor.f($data.tabList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item),
|
|
b: $data.selectTab == index
|
|
}, $data.selectTab == index ? {} : {}, {
|
|
c: common_vendor.n("item flex1 relative " + ($data.selectTab == index ? "select" : "")),
|
|
d: index,
|
|
e: common_vendor.o(($event) => $options.clickTabItem(index), index)
|
|
});
|
|
}),
|
|
d: common_vendor.s("top:" + $data.navH + "px;"),
|
|
e: $data.selectTab == 0
|
|
}, $data.selectTab == 0 ? {
|
|
f: common_vendor.f($data.commentList, (item, index, i0) => {
|
|
return {
|
|
a: index
|
|
};
|
|
})
|
|
} : {
|
|
g: common_vendor.f($data.commentList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t($data.getLocaleDate(item.created_at)),
|
|
b: common_vendor.t(item.content),
|
|
c: common_vendor.t(item.event_title),
|
|
d: index
|
|
};
|
|
})
|
|
}, {
|
|
h: common_vendor.s("top:" + $data.listTop + "px;")
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/mine/commentReply/commentReply.js.map
|