13 changed files with 148 additions and 69 deletions
@ -1,14 +1,56 @@ |
|||||
// const api = require('../../../../utils/home')
|
const api = require('../../utils/api') |
||||
// import util from '../../../../utils/util'
|
import util from '../../../../utils/util' |
||||
// import { getTimestamp } from '../../../../utils/common'
|
|
||||
Page({ |
Page({ |
||||
data: { |
data: { |
||||
noticeObj: {} |
pageIndex:1, |
||||
|
pageSize:10, |
||||
|
categoryName:'', |
||||
|
nodata: false, |
||||
|
noticeId: '', |
||||
|
noticeObj: {}, |
||||
|
noticeObjContent: "", |
||||
}, |
}, |
||||
onLoad (options) { |
onLoad (options) { |
||||
this.data.noticeObj = {...options} |
|
||||
this.setData({ |
this.setData({ |
||||
noticeObj:this.data.noticeObj |
categoryName:options.categorycode |
||||
}) |
}) |
||||
} |
wx.setNavigationBarTitle({ |
||||
|
title: options.categoryname |
||||
|
}) |
||||
|
this.noticelist() |
||||
|
}, |
||||
|
noticelist () { |
||||
|
let that = this; |
||||
|
let params = { |
||||
|
pageIndex: 1, |
||||
|
pageSize: 10, |
||||
|
noticeCategory: that.data.categoryName |
||||
|
} |
||||
|
api.noticelist(params).then(function (res) { |
||||
|
if (res.data.length == 0) { |
||||
|
that.setData({ |
||||
|
nodata: true |
||||
|
}) |
||||
|
} else { |
||||
|
that.setData({ |
||||
|
nodata: false, |
||||
|
noticeId: res.data[0].id |
||||
|
}) |
||||
|
that.noticeDetail(res.data[0].id) |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
noticeDetail (noticeId){ |
||||
|
let that = this; |
||||
|
api.noticeDetail(noticeId).then(function (res) { |
||||
|
that.setData({ |
||||
|
noticeObj: res.data, |
||||
|
noticeObjContent: util.formatRichText(res.data.noticeContent) |
||||
|
}) |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
}) |
}) |
@ -1,6 +1,7 @@ |
|||||
{ |
{ |
||||
"usingComponents": { |
"usingComponents": { |
||||
"parser": "../../../../components/parser/parser" |
"parser": "../../../../components/parser/parser", |
||||
|
"no-data": "../../../../components/nodata/nodata" |
||||
}, |
}, |
||||
"navigationBarTitleText": "通知详情" |
"navigationBarTitleText": "通知详情" |
||||
} |
} |
@ -1,23 +1,23 @@ |
|||||
<!-- <wxs module="filter" src="../../../../utils/filter.wxs"></wxs> --> |
<!-- <wxs module="filter" src="../../../../utils/filter.wxs"></wxs> --> |
||||
<view class="notice-detail"> |
<view class="notice-detail"> |
||||
<view class="selfContent"> |
<view class="selfContent" wx:if="{{!nodata}}"> |
||||
<view class="detail-title">{{noticeObj.title}}</view> |
<view class="detail-title">{{noticeObj.noticeTitle}}</view> |
||||
<!-- <view class="detail-subtitle"> |
<view class="detail-subtitle"> |
||||
<view class="left"> |
<view class="left"> |
||||
<span>{{noticeObj.deptName}}</span> |
<span>{{noticeObj.deptName}}</span> |
||||
<span>{{filter.formatTime(noticeObj.noticeTime, 'yyyy-MM-dd')}}</span> |
<span>{{filter.formatTime(noticeObj.noticeTime, 'yyyy-MM-dd')}}</span> |
||||
</view> |
</view> |
||||
<view class="right"> |
<view class="right"> |
||||
<view class="readNum"> |
<view class="readNum"> |
||||
<image src="../../images/ic_yueduliang.png" /> |
<image src="../../images/ic_yueduliang.png" /> |
||||
</view> |
</view> |
||||
<view class="num">{{noticeObj.readingAmount}}</view> |
<view class="num">{{noticeObj.readingAmount}}</view> |
||||
</view> |
</view> |
||||
</view> --> |
</view> |
||||
<view class="richContent"> |
<view class="richContent"> |
||||
<view class="content">{{noticeObj.content}}</view> |
<!-- <rich-text space="nbsp" nodes="{{noticeObjContent}}"></rich-text> --> |
||||
<!-- <rich-text nodes="{{noticeObjContent}}"></rich-text> --> |
<parser html="{{noticeObjContent}}"></parser> |
||||
<!-- <parser html="{{noticeObjContent}}"></parser> --> |
|
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
</view> |
<no-data isShow="{{nodata}}"></no-data> |
||||
|
</view> |
||||
|
Loading…
Reference in new issue