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": "通知详情" |
||||
} |
} |
Loading…
Reference in new issue