city_card/pages/neighbor/help/helpList.js

63 lines
1.7 KiB
JavaScript
Raw Normal View History

2023-07-18 16:54:17 +08:00
var t = getApp();
2023-07-15 14:25:28 +08:00
Page({
2023-07-18 16:54:17 +08:00
data: {
token: t.globalData.token,
helpList: [],
page: {
page: 1,
rows: 10,
communityId: ""
2023-07-15 14:25:28 +08:00
},
2023-07-18 16:54:17 +08:00
haveMore: !0,
serviceUrl: t.baseUrls.serviceUrl,
baseImgUrl: t.baseUrls.baseImgUrl
},
getHelpList: function () {
var a = this;
t.restAjax.get(t.restAjax.path(t.apis.getHelpList, [t.baseUrls.requestUrl]), a.data.page, {
headers: {
token: t.globalData.token
}
}, function (t, o) {
for (var s = 0; s < o.rows.length; s++) o.rows[s].photo && (o.rows[s].photo = o.rows[s].photo.split(","));
if (1 == a.data.page.page) a.setData({
helpList: o.rows
}); else if (o.rows.length > 0) {
for (var n = a.data.helpList, r = 0; r < o.rows.length; r++) n.push(o.rows[r]);
a.setData({
helpList: n
2023-07-15 14:25:28 +08:00
});
2023-07-18 16:54:17 +08:00
} else wx.showToast({
title: "暂无更多",
icon: "none"
}), a.setData(e({}, "page.page", a.data.page.page - 1));
o.rows.length < 10 && a.setData({
haveMore: !1
});
}, function (e, t) {
console.log(t);
});
},
checkHelpDetail: function (e) {
var t = e.currentTarget.dataset.id;
wx.navigateTo({
url: "./helpDetail?neighborId=" + t
});
},
loadMore: function () {
this.setData(e({}, "page.page", this.data.page.page + 1)), this.getHelpList();
},
onLoad: function (a) {
var o;
this.setData((e(o = {}, "page.communityId", a.communityId), e(o, "token", t.globalData.token),
o)), this.getHelpList();
},
onReady: function () { },
onShow: function () { },
onHide: function () { },
onUnload: function () { },
onPullDownRefresh: function () { },
onReachBottom: function () { },
onShareAppMessage: function () { }
2023-07-15 14:25:28 +08:00
});