13 changed files with 148 additions and 69 deletions
@ -1,14 +1,56 @@ |
|||
// const api = require('../../../../utils/home')
|
|||
// import util from '../../../../utils/util'
|
|||
// import { getTimestamp } from '../../../../utils/common'
|
|||
const api = require('../../utils/api') |
|||
import util from '../../../../utils/util' |
|||
Page({ |
|||
data: { |
|||
noticeObj: {} |
|||
pageIndex:1, |
|||
pageSize:10, |
|||
categoryName:'', |
|||
nodata: false, |
|||
noticeId: '', |
|||
noticeObj: {}, |
|||
noticeObjContent: "", |
|||
}, |
|||
onLoad (options) { |
|||
this.data.noticeObj = {...options} |
|||
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": { |
|||
"parser": "../../../../components/parser/parser" |
|||
"parser": "../../../../components/parser/parser", |
|||
"no-data": "../../../../components/nodata/nodata" |
|||
}, |
|||
"navigationBarTitleText": "通知详情" |
|||
} |
Loading…
Reference in new issue