28 changed files with 443 additions and 48 deletions
@ -1,5 +1,5 @@ |
|||||
{ |
{ |
||||
"usingComponents": { |
"usingComponents": { |
||||
}, |
}, |
||||
"navigationBarTitleText": "政策法规" |
"navigationBarTitleText": "通知公告" |
||||
} |
} |
@ -1,5 +1,5 @@ |
|||||
{ |
{ |
||||
"usingComponents": { |
"usingComponents": { |
||||
}, |
}, |
||||
"navigationBarTitleText": "政策法规详情" |
"navigationBarTitleText": "通知公告详情" |
||||
} |
} |
@ -1,13 +1,13 @@ |
|||||
<wxs src="../../../../utils/filter.wxs" module="filters"></wxs> |
<wxs src="../../../../utils/filter.wxs" module="filters"></wxs> |
||||
<view class="sudoku"> |
<view class="sudoku"> |
||||
<view class="content"> |
<view class="content"> |
||||
<view class="item" hover-stay-time="150" hover-class="hover-sudoku" bindtap="showMyPolice"> |
<view class="item" hover-stay-time="150" bindtap="showMyPolice"> |
||||
<image src="../../images/minjing.png" /> |
<image src="../../images/minjing.png" /> |
||||
</view> |
</view> |
||||
<view class="item" hover-stay-time="150" hover-class="hover-sudoku" bindtap="showPrecaution"> |
<view class="item" hover-stay-time="150" bindtap="showPrecaution"> |
||||
<image src="../../images/pingan.png" /> |
<image src="../../images/pingan.png" /> |
||||
</view> |
</view> |
||||
<view class="item" hover-stay-time="150" hover-class="hover-sudoku" bindtap="showAnnouncement"> |
<view class="item" hover-stay-time="150" bindtap="showAnnouncement"> |
||||
<image src="../../images/tongbao.png" /> |
<image src="../../images/tongbao.png" /> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
|
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 7.0 KiB |
@ -0,0 +1,140 @@ |
|||||
|
const api = require('../../../../utils/home') |
||||
|
import { getTimestamp } from '../../../../utils/common' |
||||
|
import util from '../../../../utils/util' |
||||
|
const app = getApp() |
||||
|
Page({ |
||||
|
data: { |
||||
|
detailId: '', |
||||
|
supportStatus: 'support', |
||||
|
dispportStatus: 'dispport', |
||||
|
noticeObj: {}, |
||||
|
infoCompleted: 0, |
||||
|
noticeObjContent: '' |
||||
|
}, |
||||
|
onLoad (options) { |
||||
|
this.setData({ |
||||
|
detailId: options.id, |
||||
|
infoCompleted: app.globalData.infoCompleted |
||||
|
}) |
||||
|
this.getNewsDetail(options.id) |
||||
|
this.browseNews(options.id) |
||||
|
}, |
||||
|
getNewsDetail (id) { |
||||
|
let that = this |
||||
|
api.getNewsDetail(id).then(res => { |
||||
|
that.setData({ |
||||
|
noticeObj: res.data, |
||||
|
noticeObjContent: util.formatRichText(res.data.newsContent) |
||||
|
}) |
||||
|
if (that.data.noticeObj.likeFlag == '1') { |
||||
|
that.setData({ |
||||
|
supportStatus: 'supported' |
||||
|
}) |
||||
|
} |
||||
|
if (that.data.noticeObj.unLikeFlag == '1') { |
||||
|
that.setData({ |
||||
|
dispportStatus: 'dispported' |
||||
|
}) |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
browseNews (id) { |
||||
|
let para = { |
||||
|
newsId: id |
||||
|
} |
||||
|
api.browseNews(para).then(res => { |
||||
|
|
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
// 检查 是否完善信息
|
||||
|
verifyCompleteInfo () { |
||||
|
if (this.data.infoCompleted == 0) { |
||||
|
this.setData({ |
||||
|
completeInfoDialogVisible: !this.data.completeInfoDialogVisible |
||||
|
}) |
||||
|
return true |
||||
|
} else { |
||||
|
return false |
||||
|
} |
||||
|
}, |
||||
|
newsPosition (e) { |
||||
|
// newsPosition (attitude, bySelf = false) {
|
||||
|
if (this.verifyCompleteInfo()) { |
||||
|
return false |
||||
|
} |
||||
|
console.log(e) |
||||
|
let attitude = e.currentTarget.dataset.state, |
||||
|
bySelf = e.currentTarget.dataset.byself |
||||
|
if (bySelf=='true') { |
||||
|
let attitudeState = '' |
||||
|
if (attitude === '0') { |
||||
|
if (this.data.dispportStatus === 'dispported') { |
||||
|
// this.dispportStatus = 'dispport'
|
||||
|
// this.newsObj.unlikeNumber -= 1
|
||||
|
this.setData({ |
||||
|
dispportStatus: 'dispport', |
||||
|
['noticeObj.unlikeNumber']: this.data.noticeObj.unlikeNumber - 1 |
||||
|
}) |
||||
|
} |
||||
|
if (this.data.supportStatus === 'support') { |
||||
|
attitudeState = '0' |
||||
|
// this.supportStatus = 'supported'
|
||||
|
// this.newsObj.likeNumber += 1
|
||||
|
this.setData({ |
||||
|
supportStatus: 'supported', |
||||
|
['noticeObj.likeNumber']: this.data.noticeObj.likeNumber + 1 |
||||
|
}) |
||||
|
} else if (this.data.supportStatus === 'supported') { |
||||
|
attitudeState = '2' |
||||
|
// this.supportStatus = 'support'
|
||||
|
// this.newsObj.likeNumber -= 1
|
||||
|
this.setData({ |
||||
|
supportStatus: 'support', |
||||
|
['noticeObj.likeNumber']: this.data.noticeObj.likeNumber - 1 |
||||
|
}) |
||||
|
} |
||||
|
} else if (attitude === '1') { |
||||
|
if (this.data.supportStatus === 'supported') { |
||||
|
// this.supportStatus = 'support'
|
||||
|
// this.newsObj.likeNumber -= 1
|
||||
|
this.setData({ |
||||
|
supportStatus: 'support', |
||||
|
['noticeObj.likeNumber']: this.data.noticeObj.likeNumber - 1 |
||||
|
}) |
||||
|
} |
||||
|
if (this.data.dispportStatus === 'dispport') { |
||||
|
attitudeState = '1' |
||||
|
// this.dispportStatus = 'dispported'
|
||||
|
// this.newsObj.unlikeNumber += 1
|
||||
|
this.setData({ |
||||
|
dispportStatus: 'dispported', |
||||
|
['noticeObj.unlikeNumber']: this.data.noticeObj.unlikeNumber + 1 |
||||
|
}) |
||||
|
} else if (this.data.dispportStatus === 'dispported') { |
||||
|
attitudeState = '3' |
||||
|
// this.dispportStatus = 'dispport'
|
||||
|
// this.newsObj.unlikeNumber -= 1
|
||||
|
this.setData({ |
||||
|
dispportStatus: 'dispport', |
||||
|
['noticeObj.unlikeNumber']: this.data.noticeObj.unlikeNumber - 1 |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
const para = { |
||||
|
newsId: this.data.detailId, |
||||
|
attitude: attitudeState |
||||
|
} |
||||
|
// const res = await newsPosition(para)
|
||||
|
// console.log('新闻表态', res)
|
||||
|
api.newsPosition(para).then(res => { |
||||
|
|
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
@ -0,0 +1,6 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"completeInfo-dialog": "../../../../../components/completeInfoDialog/completeInfoDialog" |
||||
|
}, |
||||
|
"navigationBarTitleText": "平安榆山" |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
<wxs module="filter" src="../../../../utils/filter.wxs"></wxs> |
||||
|
<view class="notice-detail"> |
||||
|
<view class="selfContent"> |
||||
|
<view class="detail-title">{{noticeObj.newsTitle}}</view> |
||||
|
<view class="detail-subtitle"> |
||||
|
<view class="left"> |
||||
|
<span>{{noticeObj.deptName}}</span> |
||||
|
<span>{{filter.formatTime(noticeObj.newsStartTime, 'yyyy-MM-dd')}}</span> |
||||
|
</view> |
||||
|
<view class="right"> |
||||
|
<view class="readNum"> |
||||
|
<image src="../../images/ic_yueduliang.png" /> |
||||
|
</view> |
||||
|
<view class="num">{{noticeObj.readingAmount}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="richContent"> |
||||
|
<rich-text space="nbsp" nodes="{{noticeObjContent}}"></rich-text> |
||||
|
</view> |
||||
|
<view class="operation"> |
||||
|
<view class="button {{supportStatus == 'supported' ? 'active' : ''}}" data-state="0" data-byself="true" bindtap="newsPosition"> |
||||
|
<view> |
||||
|
<image src="{{supportStatus == 'supported' ? '../../images/zanliang.png' : '../../images/zanbuliang.png'}}" /> |
||||
|
</view> |
||||
|
<span>支持{{noticeObj.likeNumber}}</span> |
||||
|
</view> |
||||
|
<view class="button {{dispportStatus == 'dispported' ? 'active' : ''}}" data-state="1" data-byself="true" bindtap="newsPosition"> |
||||
|
<view> |
||||
|
<image src="{{dispportStatus == 'dispported' ? '../../images/cailiang.png' : '../../images/caibuliang.png'}}" /> |
||||
|
</view> |
||||
|
<span>不支持{{noticeObj.unlikeNumber}}</span> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<completeInfo-dialog |
||||
|
completeInfoDialogVisible="{{completeInfoDialogVisible}}"> |
||||
|
</completeInfo-dialog> |
@ -0,0 +1,126 @@ |
|||||
|
.notice-detail { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
box-sizing: border-box; |
||||
|
padding: 20rpx; |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
.richContent img{ |
||||
|
width: 100%!important; |
||||
|
height: auto; |
||||
|
} |
||||
|
.selfContent { |
||||
|
width: 100%; |
||||
|
display: table; |
||||
|
background: #ffffff; |
||||
|
border-radius: 16rpx; |
||||
|
box-sizing: border-box; |
||||
|
padding: 0 25rpx 38rpx; |
||||
|
} |
||||
|
.detail-title { |
||||
|
font-family: PingFang-SC-Bold; |
||||
|
font-size: 48rpx; |
||||
|
font-weight: bold; |
||||
|
line-height: 68rpx; |
||||
|
color: #333333; |
||||
|
padding-top: 40rpx; |
||||
|
} |
||||
|
.detail-subtitle { |
||||
|
display: flex; |
||||
|
width: 100%; |
||||
|
justify-content: space-between; |
||||
|
font-size: 22rpx; |
||||
|
color: #999999; |
||||
|
margin-top:45rpx; |
||||
|
} |
||||
|
.detail-subtitle .left span:nth-child(1){ |
||||
|
margin-right: 32rpx; |
||||
|
} |
||||
|
.detail-subtitle .right{ |
||||
|
display: flex; |
||||
|
height: 32rpx; |
||||
|
line-height: 32rpx; |
||||
|
} |
||||
|
.detail-subtitle .right .readNum { |
||||
|
/* display: inline-block; */ |
||||
|
width: 32rpx; |
||||
|
height: 32rpx; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
.detail-subtitle .right .readNum image{ |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
float:left; |
||||
|
object-fit: cover; |
||||
|
} |
||||
|
.banner { |
||||
|
width: 100%; |
||||
|
height: 400rpx; |
||||
|
margin: 39rpx 0 19rpx 0; |
||||
|
} |
||||
|
.banner image{ |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
float:left; |
||||
|
object-fit: cover; |
||||
|
border-radius: 16rpx; |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
.paragraph { |
||||
|
font-size: 38rpx; |
||||
|
line-height: 58rpx; |
||||
|
color: #333333; |
||||
|
text-indent: 76rpx; |
||||
|
margin-top:22rpx; |
||||
|
} |
||||
|
|
||||
|
.operation { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
margin-top: 47rpx; |
||||
|
} |
||||
|
.operation .button { |
||||
|
width: 300rpx; |
||||
|
height: 84rpx; |
||||
|
line-height: 84rpx; |
||||
|
border-radius: 42rpx; |
||||
|
display:flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
border: 1px solid #b8b8b8; |
||||
|
} |
||||
|
.operation .button:nth-child(1) { |
||||
|
margin-right: 33rpx; |
||||
|
} |
||||
|
.operation .button view { |
||||
|
width: 40rpx; |
||||
|
height: 40rpx; |
||||
|
margin-right: 14rpx; |
||||
|
} |
||||
|
.operation .button view image{ |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
object-fit: cover; |
||||
|
float: left; |
||||
|
} |
||||
|
.operation .button span { |
||||
|
display: inline-block; |
||||
|
font-size: 24rpx; |
||||
|
position: relative; |
||||
|
top: 1px; |
||||
|
} |
||||
|
.default { |
||||
|
border: 1px solid #eaeaea; |
||||
|
} |
||||
|
.default span { |
||||
|
color: #999999; |
||||
|
} |
||||
|
.active { |
||||
|
border: 1px solid #ffab00; |
||||
|
} |
||||
|
.operation .button.active { |
||||
|
border: 1rpx solid #ffab00; |
||||
|
} |
||||
|
.active span { |
||||
|
color: #ffb700; |
||||
|
} |
Loading…
Reference in new issue