|
|
@ -10,15 +10,10 @@ Page({ |
|
|
|
statusHeight: 0, // 自定义头部状态栏高度
|
|
|
|
navigationHeight: 0, // 自定义头部导航栏高度
|
|
|
|
bannerList: [], // banner列表
|
|
|
|
newsList: [], // 新闻列表
|
|
|
|
projectList: [], // 项目列表
|
|
|
|
infoList: [], // 消息列表
|
|
|
|
noticeList: [], // 通知公告列表
|
|
|
|
unReadNum: 0, // 未读数量
|
|
|
|
loadMoreType: 'none', |
|
|
|
loadMoreVisible: false, |
|
|
|
pageNo: 1, // 新闻列表-分页页码
|
|
|
|
pageSize: 10, // 新闻列表-分页页长
|
|
|
|
timestamp: '', // 时间戳
|
|
|
|
sudokuState: { // 九宫格显隐状态
|
|
|
|
consultAvailable: '0', // 网格专员
|
|
|
@ -40,7 +35,15 @@ Page({ |
|
|
|
{ icon: 'https://epdc-yushan.elinkservice.cn/files-pro/20210914/b884f294e3634f66b7ff36be682046a2.png', tip: '社会组织', module: 'societyOrg' } |
|
|
|
], |
|
|
|
serviceImgUrl: '', |
|
|
|
servicePhone: '' |
|
|
|
servicePhone: '', |
|
|
|
tabList: [], |
|
|
|
currentTab: '', |
|
|
|
loadMoreType: 'none', |
|
|
|
loadMoreVisible: false, |
|
|
|
newsList: [], |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 10, |
|
|
|
currentView: 'item' |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
if (options.scene) { |
|
|
@ -82,7 +85,7 @@ Page({ |
|
|
|
}) |
|
|
|
if (this.data.loadMoreType === 'loading') { |
|
|
|
this.data.pageNo += 1 |
|
|
|
this.getNewsList() |
|
|
|
this.contentList() |
|
|
|
} |
|
|
|
}, |
|
|
|
swiperChange: function (e) { |
|
|
@ -158,28 +161,6 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取新闻列表
|
|
|
|
getNewsList() { |
|
|
|
let para = { |
|
|
|
pageIndex: this.data.pageNo, |
|
|
|
pageSize: this.data.pageSize, |
|
|
|
timestamp: this.data.timestamp, |
|
|
|
categoryCode: "" |
|
|
|
} |
|
|
|
api.newsList(para).then((res) => { |
|
|
|
console.log('首页新闻列表', res) |
|
|
|
this.setData({ |
|
|
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', |
|
|
|
newsList: this.data.newsList.concat(res.data) |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
console.log('首页新闻列表获取失败') |
|
|
|
this.setData({ |
|
|
|
loadMoreType: 'none', |
|
|
|
newsList: [] |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取项目列表
|
|
|
|
getProjectList() { |
|
|
|
const para = { |
|
|
@ -273,10 +254,10 @@ Page({ |
|
|
|
this.getInfoList() |
|
|
|
this.getNoticeList() |
|
|
|
this.getUnreadNum() |
|
|
|
this.getNewsList() |
|
|
|
this.gridmanList() |
|
|
|
this.contentList() |
|
|
|
this.getImgUrl() |
|
|
|
this.contentList() |
|
|
|
this.contentModuleList() |
|
|
|
}, |
|
|
|
// 切换网格,跳转到网格列表
|
|
|
|
changeGrid() { |
|
|
@ -452,5 +433,60 @@ Page({ |
|
|
|
wx.makePhoneCall({ |
|
|
|
phoneNumber: phone |
|
|
|
}) |
|
|
|
}, |
|
|
|
changeTab(e) { |
|
|
|
const { tab } = e.currentTarget.dataset |
|
|
|
this.setData({ |
|
|
|
currentTab: tab, |
|
|
|
loadMoreType: 'none', |
|
|
|
loadMoreVisible: false, |
|
|
|
newsList: [], |
|
|
|
currentView: `item${tab}` |
|
|
|
}) |
|
|
|
this.data.pageNo = 1 |
|
|
|
wx.showLoading({ |
|
|
|
title: '加载中...' |
|
|
|
}) |
|
|
|
this.contentList() |
|
|
|
}, |
|
|
|
// 获取资讯列表
|
|
|
|
contentList() { |
|
|
|
const params = { |
|
|
|
pageIndex: this.data.pageNo, |
|
|
|
pageSize: this.data.pageSize, |
|
|
|
typeId: this.data.currentTab |
|
|
|
} |
|
|
|
homeApi.contentList(params).then(res => { |
|
|
|
console.log('社区最新资讯', res) |
|
|
|
this.setData({ |
|
|
|
newsList: this.data.newsList.concat(res.data), |
|
|
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none' |
|
|
|
}) |
|
|
|
wx.hideLoading() |
|
|
|
}).catch(err => { |
|
|
|
console.error(err) |
|
|
|
wx.hideLoading() |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取栏目列表
|
|
|
|
contentModuleList() { |
|
|
|
homeApi.contentModuleList().then(res => { |
|
|
|
console.log('栏目列表', res) |
|
|
|
const tabList = [] |
|
|
|
res.data.forEach(item => { |
|
|
|
tabList.push({ label: item.typeName, value: item.id }) |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
tabList: [...[{ label: '最新资讯', value: '' }], ...tabList] |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
console.error('', err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
navigateToDetail(e) { |
|
|
|
const { id } = e.currentTarget.dataset |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/subpages/communityNews/pages/detail/detail?id=${id}` |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |