市北党建引领小程序初始化
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.
 

90 lines
2.9 KiB

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("../../api/index");
Page({
data: {
currentTab: "tab1",
loadMoreVisible: false,
loadMoreType: "none",
questionnaireList: [],
pageNo: 1,
pageSize: 10
},
onReachBottom: function () {
this.setData({
loadMoreVisible: true
});
if (this.data.loadMoreType === "loading") {
this.data.pageNo += 1;
this.loadMoreQuestionnaireList();
}
},
onLoad: function () {
this.getQuestionnaireList();
},
onChnageTab: function (e) {
var tab = e.currentTarget.dataset.tab;
this.setData({
currentTab: tab
});
this.setData({
loadMoreVisible: false,
loadMoreType: "none",
questionnaireList: [],
pageNo: 1,
pageSize: 10
});
this.getQuestionnaireList();
},
getQuestionnaireList: function () {
var _this = this;
var params = {
client: "resi",
orgId: wx.getStorageSync("gridId"),
orgType: "grid",
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
status: this.data.currentTab === "tab1" ? "2" : "3"
};
wx.showLoading({
title: "加载中..."
});
index_1.getQuestionnaireList(params).then(function (res) {
wx.hideLoading();
console.log("获取问卷调查列表", res);
_this.setData({
questionnaireList: res.data,
loadMoreType: res.data.length === _this.data.pageSize ? "loading" : "none"
});
}).catch(function (err) {
console.error("获取问卷调查列表", err);
});
},
loadMoreQuestionnaireList: function () {
var _this = this;
var params = {
client: "resi",
orgId: wx.getStorageSync("gridId"),
orgType: "grid",
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
status: this.data.currentTab === "tab1" ? "2" : "3"
};
index_1.getQuestionnaireList(params).then(function (res) {
console.log("获取问卷调查列表", res);
_this.setData({
questionnaireList: _this.data.questionnaireList.concat(res.data),
loadMoreType: res.data.length === _this.data.pageSize ? "loading" : "none"
});
}).catch(function (err) {
console.error("获取问卷调查列表", err);
});
},
handleTapItem: function (e) {
console.log(e.currentTarget.dataset);
var isFillQuestion = !e.currentTarget.dataset.isfillquestion ? 1 : 0;
wx.navigateTo({
url: "/subpages/questionnaire/pages/detail/detail?ki=" + e.currentTarget.dataset.key + "&filled=" + isFillQuestion
});
},
});