wwf
3 天以前 23fa268f56dcd99c8dcd46f50f3ffcaa4cdcbc49
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { router } from '@kit.ArkUI'
 
class MessageItem {
  icon: string | Resource = ''
  title: string = ''
  desc: string = ''
  time: string = ''
  isRead: boolean = false
}
 
@Entry
@Component
struct MessagePushPage {
  @State messagePushFlag: boolean = false
  @State autoUpdateFlag: boolean = false
  @State messageList: MessageItem[] = [
    { icon: $r('app.media.message_note'), title: '课程提醒', desc: '您报名的《全栈开发:前后端打通实战》', time: '09-01 12:55', isRead: false },
    { icon: $r('app.media.message_gift'), title: '福袋派送官', desc: '您获得了一张价值100元的课程抵扣券,您可以从', time: '09-01 10:55', isRead: true },
    { icon: $r('app.media.message_pencil'), title: '官方通知', desc: '本平台将于09-01 00 对平台进行维护,请各位用户', time: '08-31 10:55', isRead: true }
  ]
  build() {
    Column() {
      Row() {
        Image($r('app.media.left_icon'))
          .width(20)
          .height(20)
          .onClick(() => {
            router.back()
          })
        Text('消息通知')
          .fontSize(18)
          .fontWeight(700)
        Row()
      }
      .width('100%')
      .padding(10)
      .justifyContent(FlexAlign.SpaceBetween)
 
      Divider()
 
      Column() {
        List({ space: 10, initialIndex: 0 }){
          ForEach(this.messageList, (item: MessageItem) => {
            ListItem() {
              Row() {
                Image(item.icon)
                  .width(40)
                  .height(40)
                Column({ space: 10 }) {
                  Row() {
                    Text(item.title)
                      .fontSize(14)
                      .fontWeight(500)
                      .fontColor(Color.Black)
                    Text(item.time)
                      .fontSize(12)
                      .fontWeight(500)
                      .margin({ left: 10 })
                      .fontColor('#666666')
                  }
                  .width('100%')
 
                  Text(item.desc)
                    .width('100%')
                    .fontSize(12)
                    .maxLines(1)
                    .fontColor('#666666')
                    .textOverflow({ overflow: TextOverflow.Ellipsis })
                }
                .width(260)
                .margin({ left: 10 })
 
                if (!item.isRead) {
                  Image($r('app.media.message_circle'))
                    .width(10)
                    .height(10)
                }
              }
              .width('100%')
              .height(80)
              .padding({ left: 16,right: 16, top: 4, bottom: 4 })
              .borderRadius(10)
              .backgroundColor(Color.White)
              .onClick(() => {
              })
            }
          })
        }
        .listDirection(Axis.Vertical) // 排列方向
        .scrollBar(BarState.Off)
        .friction(0.6)
        .edgeEffect(EdgeEffect.Spring)
        .width('100%')
        .divider({strokeWidth: 1,color: '#f0f0f0'})
      }
      .padding({ top: 10 })
      .backgroundColor('#f5f5f7')
      .width('100%')
      .height('100%')
    }
  }
}