Browse Source

提交

master
zhaoyongnian 5 years ago
parent
commit
d08c284e6f
  1. 1
      app.json
  2. 2
      pages/indexNew/indexNew.js
  3. BIN
      subpages/home/images/ic_zhengce.png
  4. 140
      subpages/home/pages/noticeNew/noticeNew.js
  5. 7
      subpages/home/pages/noticeNew/noticeNew.json
  6. 25
      subpages/home/pages/noticeNew/noticeNew.wxml
  7. 95
      subpages/home/pages/noticeNew/noticeNew.wxss
  8. 12
      subpages/understandJs/pages/impression/impression.js
  9. 4
      subpages/understandJs/pages/impression/impression.wxml
  10. 25
      subpages/understandJs/pages/impression/impression.wxss

1
app.json

@ -25,6 +25,7 @@
"pages/webview/webview", "pages/webview/webview",
"pages/agreement/agreement", "pages/agreement/agreement",
"pages/notice/notice", "pages/notice/notice",
"pages/noticeNew/noticeNew",
"pages/info/info", "pages/info/info",
"pages/noticeDetail/noticeDetail", "pages/noticeDetail/noticeDetail",
"pages/newsDetail/newsDetail", "pages/newsDetail/newsDetail",

2
pages/indexNew/indexNew.js

@ -363,7 +363,7 @@ Page({
// 点击-更多,跳转通知列表 // 点击-更多,跳转通知列表
moreNotice() { moreNotice() {
wx.navigateTo({ wx.navigateTo({
url: '/subpages/home/pages/notice/notice' url: '/subpages/home/pages/noticeNew/noticeNew'
}) })
// wx.miniProgram.navigateTo({ url: '/pages/detail/detail?weburl=' + encodeURIComponent(global.baseURL + 'notice?departmentName=' + sessionStorage.getItem('departmentName')) }) // wx.miniProgram.navigateTo({ url: '/pages/detail/detail?weburl=' + encodeURIComponent(global.baseURL + 'notice?departmentName=' + sessionStorage.getItem('departmentName')) })
}, },

BIN
subpages/home/images/ic_zhengce.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

140
subpages/home/pages/noticeNew/noticeNew.js

@ -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 })
}
})

7
subpages/home/pages/noticeNew/noticeNew.json

@ -0,0 +1,7 @@
{
"usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data":"../../../../components/nodata/nodata"
},
"navigationBarTitleText": "政策导航"
}

25
subpages/home/pages/noticeNew/noticeNew.wxml

@ -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>

95
subpages/home/pages/noticeNew/noticeNew.wxss

@ -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);
}

12
subpages/understandJs/pages/impression/impression.js

@ -13,6 +13,7 @@ Page({
loadMoreType: 'none', loadMoreType: 'none',
loadMoreVisible: false, loadMoreVisible: false,
noticeCategory: '1',//模块编码(0-政策导航,1-印象,2-味道) noticeCategory: '1',//模块编码(0-政策导航,1-印象,2-味道)
noticeContentNew:'',
}, },
/** /**
@ -29,9 +30,16 @@ Page({
noticeCategory: that.data.noticeCategory noticeCategory: that.data.noticeCategory
} }
api.noticelist(params).then(function (res) { //了解锦水-模块管理接口 api.noticelist(params).then(function (res) { //了解锦水-模块管理接口
console.log(JSON.stringify(res)) let noticelistObj = {}
let noticelistItem = []
for(var i = 0; i < res.data.length; i++){
noticelistObj= res.data[i]
noticelistObj.noticeContentNew = res.data[i].noticeContent.replace(/<img/gi, '<img style="display:none" ');
noticelistItem.push(noticelistObj)
}
console.log(JSON.stringify(noticelistItem))
that.setData({ that.setData({
noticelist: that.data.noticelist.concat(res.data), noticelist: that.data.noticelist.concat(noticelistItem),
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === that.data.pageSize ? false : true loadMoreVisible: res.data.length === that.data.pageSize ? false : true
}) })

4
subpages/understandJs/pages/impression/impression.wxml

@ -7,7 +7,9 @@
bindtap="toDetail" bindtap="toDetail"
data-id="{{item.id}}"> data-id="{{item.id}}">
<view class="name">{{item.noticeTitle}}</view> <view class="name">{{item.noticeTitle}}</view>
<view class="info">我们城市建设在转变城市功能的同时,更加关注于群众的生活质量的提升,给予百姓以更多的关心和方便我们城市建设在转变城市功能的同时,更加关注于群众的生活质量的提升,给予百姓以更多的关心和方便</view> <view class="info">
<rich-text space="nbsp" nodes="{{item.noticeContentNew}}"></rich-text>
</view>
</view> </view>

25
subpages/understandJs/pages/impression/impression.wxss

@ -7,10 +7,11 @@ page {
padding: 40rpx 28rpx; padding: 40rpx 28rpx;
margin-top: 16rpx; margin-top: 16rpx;
background: #fff; background: #fff;
box-sizing: border-box;
} }
.list-item .name { .list-item .name {
width: calc(100% - 56rpx); /* width: calc(100% - 56rpx); */
font-size: 34rpx; font-size: 34rpx;
font-weight: 500; font-weight: 500;
color: rgba(51, 51, 51, 1); color: rgba(51, 51, 51, 1);
@ -18,7 +19,7 @@ page {
} }
.list-item .info { .list-item .info {
margin-top: 15rpx; /* margin-top: 15rpx;
width: calc(100% - 56rpx); width: calc(100% - 56rpx);
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
@ -27,5 +28,25 @@ page {
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
overflow: hidden; */
margin-top: 15rpx;
/* width: calc(100% - 56rpx); */
height: 75rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(153, 153, 153, 1);
}
.list-item .info rich-text {
/* width:100%; */
line-height: 44rpx;
display: -webkit-box;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
} }
Loading…
Cancel
Save