日照项目的居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

139 lines
4.4 KiB

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var common_1 = require("../../../../utils/common");
var api = require("../../../../utils/api");
var app = getApp();
Page({
data: {
selectedTab: "tab0",
loadMoreVisible: false,
loadMoreType: "none",
pageNo: 1,
pageSize: 10,
signedList: [],
preloadVisible: true,
timer: "",
timestamp: common_1.getTimestamp()
},
onLoad: function () {
this.setData({
timestamp: common_1.getTimestamp(),
});
this.getSignedList();
},
onShow: function () {
this.pulldownRefresh();
if (!app.globalData.previewImage) {
console.log("过滤previewImage引起的onShow");
}
app.globalData.previewImage = false;
},
onReady: function () {
this.pullDownRefresh = this.selectComponent("#pulldown-refresh");
},
onPageScroll: function (e) {
this.pullDownRefresh.onPageScroll(e);
},
onReachBottom: function () {
this.setData({
loadMoreVisible: true
});
if (this.data.loadMoreType === "loading") {
this.setData({
pageNo: this.data.pageNo + 1
});
this.getSignedList();
}
},
pulldownRefresh: function () {
var _this = this;
this.setData({
pageNo: 1,
pageSize: 10,
loadMoreVisible: false,
loadMoreType: "none",
preloadVisible: true,
signedList: [],
timestamp: common_1.getTimestamp()
});
var para = {
pageIndex: this.data.pageNo,
pageSize: this.data.pageSize,
timestamp: this.data.timestamp,
actType: this.data.selectedTab.substr(3, 1)
};
api.getSignedList(para).then(function (res) {
_this.pullDownRefresh.stopRefresh();
console.log("已报名活动", res);
_this.setData({
signedList: __spreadArrays(res.data),
loadMoreType: res.data.length === 10 ? "loading" : "none",
preloadVisible: false
});
}).catch(function (err) {
_this.pullDownRefresh.stopRefresh();
_this.setData({
signedList: [],
loadMoreType: "none",
preloadVisible: false
});
console.log(err);
});
},
getSignedList: function () {
var _this = this;
var para = {
pageIndex: this.data.pageNo,
pageSize: this.data.pageSize,
timestamp: this.data.timestamp,
actType: this.data.selectedTab.substr(3, 1)
};
api.getSignedList(para).then(function (res) {
console.log("已报名活动", res);
_this.setData({
signedList: __spreadArrays(_this.data.signedList, res.data),
loadMoreType: res.data.length === 10 ? "loading" : "none",
preloadVisible: false
});
}).catch(function (err) {
_this.setData({
signedList: [],
loadMoreType: "none",
preloadVisible: false
});
console.log(err);
}).finally(function () {
_this.pullDownRefresh.stopRefresh();
});
},
tabBarChange: function (e) {
this.setData({
selectedTab: e.currentTarget.dataset.tab
});
this.pulldownRefresh();
},
toDetail: function (e) {
if (this.data.selectedTab === "tab4") {
wx.navigateTo({
url: "/subpages/heart/pages/refusedOrEndedDetail/refusedOrEndedDetail?id=" + e.detail.detailId
});
}
else if (e.detail.actCurrentState == 5) {
wx.navigateTo({
url: "/subpages/heart/pages/cancelDetail/cancelDetail?id=" + e.detail.detailId
});
}
else {
wx.navigateTo({
url: "/subpages/heart/pages/heartDetail/heartDetail?id=" + e.detail.detailId
});
}
}
});