import { updateReadState } from '../../../../../services/notice/fetchNotice'; Component({ options: { addGlobalClass: true, }, /** * 组件的属性列表 */ properties: { loadStatus: { type: Number, }, values: { type: Array, }, emptyText: { type: String, value: '暂无数据', }, }, /** * 组件的初始数据 */ data: { showNoticeDetail: false, showTitle: '', showContent: '', confirmBtn: { content: '知道了', variant: 'base' }, }, /** * 组件的方法列表 */ methods: { retry() { this.triggerEvent('retry'); }, showDialog(e) { const { index } = e.currentTarget.dataset; const notice = this.data.values[index]; this.setData({ showNoticeDetail: true, showTitle: notice.title, showContent: notice.content, }); if (!notice.hasRead) { const readState = [{ noticeId: notice.id, hasRead: true, hasSigned: true }]; updateReadState(readState).then(res => { notice.hasRead = true; this.setData({ [`values[${index}]`]: notice, }); this.triggerEvent('readNotice'); }); } }, closeDialog() { this.setData({ showNoticeDetail: false }); }, }, });