riku
2025-04-21 0746b7bbe6aa3d9f02e03654a2cd4fde2081c335
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 });
    },
  },
});