10 changed files with 305 additions and 6 deletions
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,140 @@ |
|||||
|
// subpages/home/pages/noticeNew/noticeNew.js
|
||||
|
const api = require('../../../../utils/understandJs') |
||||
|
Page({ |
||||
|
|
||||
|
/** |
||||
|
* 页面的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
pageIndex: 1, |
||||
|
pageSize: 10, |
||||
|
noticeCategory: '5',//模块编码(1-印象,2-味道,5-政策导航最新,6-政策导航最热)
|
||||
|
noticelist: [], |
||||
|
selectTab: 'tab1', |
||||
|
nodata: false, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}, |
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
this.noticelist(); |
||||
|
}, |
||||
|
|
||||
|
// 加载网格长管辖的网格列表
|
||||
|
noticelist() { |
||||
|
let that = this |
||||
|
let params = { |
||||
|
pageIndex: that.data.pageIndex, |
||||
|
pageSize: that.data.pageSize, |
||||
|
noticeCategory: that.data.noticeCategory |
||||
|
} |
||||
|
|
||||
|
api.noticelist(params).then(res => { |
||||
|
that.setData({ |
||||
|
noticelist: that.data.noticelist.concat(res.data), |
||||
|
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', |
||||
|
loadMoreVisible: res.data.length === that.data.pageSize ? false : true |
||||
|
}) |
||||
|
if (that.data.noticelist.length == 0) {//没有值
|
||||
|
that.setData({ |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
that.setData({ |
||||
|
noticelist: [], |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
// tab 切换
|
||||
|
onTabChange(e) { |
||||
|
if (e.currentTarget.dataset.tab == 'tab1') {//最新政策
|
||||
|
this.setData({//模块编码(1-印象,2-味道,5-政策导航最新,6-政策导航最热)
|
||||
|
noticeCategory: '5', |
||||
|
}) |
||||
|
} else {//最新通知
|
||||
|
this.setData({ |
||||
|
noticeCategory: '6', |
||||
|
}) |
||||
|
} |
||||
|
this.setData({ |
||||
|
selectTab: e.currentTarget.dataset.tab, |
||||
|
noticelist: [], |
||||
|
loadMoreType: 'loading', |
||||
|
loadMoreVisible: true, |
||||
|
}) |
||||
|
|
||||
|
this.noticelist(); |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面初次渲染完成 |
||||
|
*/ |
||||
|
onReady: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面显示 |
||||
|
*/ |
||||
|
onShow: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面隐藏 |
||||
|
*/ |
||||
|
onHide: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面卸载 |
||||
|
*/ |
||||
|
onUnload: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 页面相关事件处理函数--监听用户下拉动作 |
||||
|
*/ |
||||
|
onPullDownRefresh: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 页面上拉触底事件的处理函数 |
||||
|
*/ |
||||
|
onReachBottom: function () { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: true |
||||
|
}) |
||||
|
if (this.data.loadMoreType === 'loading') { |
||||
|
this.setData({ |
||||
|
pageIndex: this.data.pageIndex + 1, |
||||
|
pageSize: this.data.pageSize, |
||||
|
}) |
||||
|
this.deptinfolist(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 用户点击右上角分享 |
||||
|
*/ |
||||
|
onShareAppMessage: function () { |
||||
|
|
||||
|
}, |
||||
|
toDetail(e) { |
||||
|
console.log(e.currentTarget.dataset.id) |
||||
|
wx.navigateTo({ url: '/subpages/home/pages/noticeDetail/noticeDetail?id=' + e.currentTarget.dataset.id }) |
||||
|
} |
||||
|
}) |
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"load-more": "../../../../components/loadMore/loadMore", |
||||
|
"no-data":"../../../../components/nodata/nodata" |
||||
|
}, |
||||
|
"navigationBarTitleText": "政策导航" |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
<!-- tabbar --> |
||||
|
<view class="tab-bar"> |
||||
|
<view class="tab tab1 {{selectTab === 'tab1' ? 'select-tab' : ''}}" data-tab="tab1" bindtap="onTabChange">最新政策 |
||||
|
</view> |
||||
|
<view class="tab tab2 {{selectTab === 'tab2' ? 'select-tab' : ''}}" data-tab="tab2" bindtap="onTabChange">最新通知 |
||||
|
</view> |
||||
|
<view class="select-bar {{selectTab === 'tab1' ? 'tab1' : 'tab2'}}"></view> |
||||
|
</view> |
||||
|
<!-- 列表 --> |
||||
|
<view class="list-lu" wx:if="{{noticelist.length > 0}}"> |
||||
|
<view class="list-li" wx:for-index="index" wx:for-item="item" wx:key="index" wx:for="{{noticelist}}" |
||||
|
bindtap="toDetail" data-id="{{item.id}}"> |
||||
|
<view class="item-name">{{item.noticeTitle}}</view> |
||||
|
<view class="item-info"> |
||||
|
<image src="../../images/ic_zhengce.png" /> |
||||
|
<view class="street">{{item.deptName}}</view> |
||||
|
<view class="time">{{item.noticeTime}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<!--加载更多提示--> |
||||
|
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> |
||||
|
|
||||
|
<no-data isShow="{{nodata}}"></no-data> |
@ -0,0 +1,95 @@ |
|||||
|
page { |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
|
||||
|
.tab-bar { |
||||
|
width: 100%; |
||||
|
height: 80rpx; |
||||
|
background: #fff; |
||||
|
display: flex; |
||||
|
justify-content: space-around; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.tab-bar .tab { |
||||
|
flex: 1; |
||||
|
height: 80rpx; |
||||
|
line-height: 80rpx; |
||||
|
text-align: center; |
||||
|
width: 50%; |
||||
|
font-size: 32rpx; |
||||
|
font-weight: 500; |
||||
|
color: rgba(153, 153, 153, 1); |
||||
|
} |
||||
|
|
||||
|
.tab-bar .select-tab { |
||||
|
color: #b20004; |
||||
|
font-size: 32rpx; |
||||
|
font-weight: bold; |
||||
|
} |
||||
|
|
||||
|
.tab-bar .select-bar { |
||||
|
width: 40rpx; |
||||
|
height: 8rpx; |
||||
|
border-radius: 5rpx; |
||||
|
background: #b20004; |
||||
|
position: absolute; |
||||
|
bottom: 0rpx; |
||||
|
} |
||||
|
|
||||
|
.tab-bar .select-bar.tab1 { |
||||
|
left: calc(25% - 15rpx); |
||||
|
transition: left linear 0.4s; |
||||
|
} |
||||
|
|
||||
|
.tab-bar .select-bar.tab2 { |
||||
|
left: calc(75% - 15rpx); |
||||
|
transition: left linear 0.4s; |
||||
|
} |
||||
|
|
||||
|
/* 列表样式 */ |
||||
|
.list-lu .list-li:first-child { |
||||
|
margin-top: 27rpx; |
||||
|
} |
||||
|
|
||||
|
.list-li { |
||||
|
width: 100%; |
||||
|
background: #fff; |
||||
|
padding: 38rpx 30rpx; |
||||
|
margin-top: 16rpx; |
||||
|
} |
||||
|
|
||||
|
.list-li .item-name { |
||||
|
width: calc(100% - 60rpx); |
||||
|
font-size: 34rpx; |
||||
|
font-weight: 500; |
||||
|
color: rgba(51, 51, 51, 1); |
||||
|
line-height: 52rpx; |
||||
|
} |
||||
|
|
||||
|
.list-li .item-info { |
||||
|
width: calc(100% - 60rpx); |
||||
|
height: 28rpx; |
||||
|
margin-top: 30rpx; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.list-li .item-info image { |
||||
|
width: 28rpx; |
||||
|
height: 28rpx; |
||||
|
} |
||||
|
|
||||
|
.list-li .item-info .street { |
||||
|
margin-left: 11rpx; |
||||
|
font-size: 24rpx; |
||||
|
font-weight: 500; |
||||
|
color: rgba(153, 153, 153, 1); |
||||
|
} |
||||
|
|
||||
|
.list-li .item-info .time { |
||||
|
margin-left: 22rpx; |
||||
|
font-size: 24rpx; |
||||
|
font-weight: 500; |
||||
|
color: rgba(153, 153, 153, 1); |
||||
|
} |
Loading…
Reference in new issue