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.
		
		
		
		
		
			
		
			
				
					
					
						
							82 lines
						
					
					
						
							2.0 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							82 lines
						
					
					
						
							2.0 KiB
						
					
					
				
								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') {
							 | 
						|
								      console.log(this.projectlist)
							 | 
						|
								      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
							 | 
						|
								    }
							 | 
						|
								  }
							 | 
						|
								})
							 |