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

81 lines
1.9 KiB

2 years ago
const app = getApp()
Page({
data: {
discussionType: 'issue',
completeInfoDialogVisible: false,
infoCompleted: 0,
gridName: ''
},
onLoad () {
this.setData({
infoCompleted: app.globalData.infoCompleted
})
const gridName = wx.getStorageSync('topGridName')
this.setData({
gridName
})
},
onTabItemTap () {
if (this.data.discussionType === 'issue') {
this.issuelist.getIssueList()
} else if (this.data.discussionType === 'project') {
this.projectlist.getProjectList()
}
},
onPageScroll (e) {
if (this.data.discussionType === 'issue') {
this.issuelist.onPageScroll(e)
} else if (this.data.discussionType === 'project') {
this.projectlist.onPageScroll(e)
}
},
// 议题、项目切换
changeDiscussionType (e) {
if (e.currentTarget.dataset.type === 'issue') {
this.setData({
discussionType: 'issue'
})
} else if (e.currentTarget.dataset.type === 'project') {
this.setData({
discussionType: 'project'
})
}
},
// 触底函数
onReachBottom () {
if (this.data.discussionType === 'issue') {
this.issuelist.onReachBottom()
} else if (this.data.discussionType === 'project') {
this.projectlist.onReachBottom()
}
},
// 跳转 我要报事
addIssue () {
if (this.verifyCompleteInfo()) {
return false
}
wx.navigateTo({
url: '/subpages/discussion/pages/addIssue/addIssue'
})
},
// 获取 项目组件实例
getProjectComponent () {
this.projectlist = this.selectComponent('#projectlist')
},
// 获取 议题组件实例
getIssueComponent () {
this.issuelist = this.selectComponent('#issuelist')
},
// 检查 是否完善信息
verifyCompleteInfo () {
if (this.data.infoCompleted == 0) {
this.setData({
completeInfoDialogVisible: !this.data.completeInfoDialogVisible
})
return true
} else {
return false
}
}
})