日照项目的居民端小程序
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.
 
 
 

176 lines
3.1 KiB

// subpages/work/pages/workguide/index.js
import { inputSync } from "@utils/tools";
import { wxRequestPost, wxNavigateTo } from "@utils/promise-wx-api";
// import authBehavior from "@mixins/operate-auth";
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
iniLoading: false, //初始化加载数据
showMask: false,
refresh: true,
noMore: false, //没有更多了
customerId: "",
agencyId: "",
agencyName: "",
statusIndex: 0,
issueType: "voting",
issueListType: "",
gridIdList: [],
gridShowName: "",
total: 0,
issueList: [],
guideList: [],
pageNo: 1,
pageSize: 20,
refresherIsTriggered: false,
},
// behaviors: [authBehavior],
/**
* 生命周期函数--监听页面加载
*/
async onLoad() {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: async function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: async function () {
await app.doAfterLogin();
this.setData({
pageNo: 1,
noMore: false
})
await this.getApiData();
this.setData({
iniLoading: true,
});
},
async getApiData() {
await this.getGuideList()
// this.bindFilterNew();
},
selectIssue(e) {
const {
currentTarget: {
dataset: { id, gid, aid },
},
} = e;
wxNavigateTo("/subpages/index/pages/workguide/detail", {
guideId: id
});
},
async getGuideList() {
let { pageNo, pageSize, noMore, guideList, total, refresh } = this.data
if (noMore) return
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(
"gov/voice/guide/collectionlist",
{
pageNo,
pageSize
},
{
// isMock: true,
// isQuiet: true
}
);
if (msg === "success" && code === 0) {
total = data.total;
if (pageNo == 1) {
guideList = data.list;
} else {
guideList = guideList.concat(data.list);
}
pageNo = pageNo + 1;
if (data.list.length < pageSize) {
noMore = true;
} else {
noMore = false;
}
if (refresh) {
refresh = false;
}
this.setData({
guideList,
pageSize,
pageNo,
total,
refresh,
noMore,
});
} else {
wx.showToast({
title: msg,
icon: 'none',
duration: 1500
})
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})