锦水居民端小程序
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.
 

151 lines
5.4 KiB

const api = require('../../../../utils/understandJs')
Page({
/**
* 页面的初始数据
*/
data: {
pageIndex: 1,
pageSize: 10,
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
isLoadMore: false, //是否显示load-more组件
modulelist: [],
pid: '', //主页获取一键服务pid
// moduleCategory: 'module_type_service', //module_type_jmjs (解码锦水) //module_type_service (一键服务)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.modulelist()
this.setData({
pid: options.pid
})
wx.setNavigationBarTitle({
title: options.title
})
this.getModuleCategory()
},
// modulelist() {
// let that = this;
// api.modulelist(that.data.moduleCategory).then(function (res) {
// that.setData({
// modulelist: res.data,
// })
// console.log(that.data.modulelist)
// })
// },
getModuleCategory() {
let params = {
pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize,
pid: this.data.pid
}
api.moduleCategory(params).then(res => {
console.log(res.data)
this.setData({
modulelist: this.data.modulelist.concat(res.data),
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === this.data.pageSize ? false : true
})
if (this.data.modulelist.length == 0) {//没有值
this.setData({
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
}
}).catch(err => {
this.setData({
modulelist: [],
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
console.log(err)
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === 'loading') {
this.setData({
pageIndex: this.data.pageIndex + 1,
pageSize: this.data.pageSize,
})
this.getModuleCategory()
}
},
//政策、通知 /subpages/home/pages/noticeNew/noticeNew
goDetails(e) {//模块编码(政策,通知,档案,警事,一键直通)
if (e.currentTarget.dataset.modulestyle == '4') {
wx.navigateTo({
url: `../noticeDetail/noticeDetail?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}&commentFlag=${e.currentTarget.dataset.commentflag}`
})
} else {
if (e.currentTarget.dataset.categorycode == 'module_hardcore') {
wx.navigateTo({
url: `../directTo/directTo?modulecode=${e.currentTarget.dataset.categorycode}`
})
} else if (e.currentTarget.dataset.categorycode == 'module_file') {
wx.navigateTo({
url: '../archives/archives'
})
} else {
wx.navigateTo({
url: `../moduleList/moduleList?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}&commentFlag=${e.currentTarget.dataset.commentflag}`
})
}
}
// if (e.currentTarget.dataset.modulecode == 'notice_navigation_hot') {
// wx.navigateTo({
// url: `../policyList/policyList?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'notice_navigation_new') {
// wx.navigateTo({
// url: `../policyList/policyList?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'module_file') {
// wx.navigateTo({
// url: '../archives/archives'
// })
// } else if (e.currentTarget.dataset.modulecode == 'notice_warning') {
// wx.navigateTo({
// url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'module_hardcore') {
// wx.navigateTo({
// url: `../directTo/directTo?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'notice_zcwsc') {
// wx.navigateTo({
// url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'notice_aq') {
// wx.navigateTo({
// url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'notice_cgjj') {
// wx.navigateTo({
// url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'notice_jwgk') {
// wx.navigateTo({
// url: `../laobingzaixian/laobingzaixian?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// } else if (e.currentTarget.dataset.modulecode == 'notice_yjfu_lbzx') {
// wx.navigateTo({
// url: `../laobingzaixian/laobingzaixian?modulecode=${e.currentTarget.dataset.modulecode}`
// })
// }
}
})