export struct DayRow { date: string, mark: string, time: string, hours: string, status: string, site: string, memo: string, problem: bool, } component Hairline inherits Rectangle { height: 1px; background: #e6e6e3; } component DayBlock inherits VerticalLayout { in property day; width: 100%; padding-left: 24px; padding-right: 24px; padding-top: 16px; padding-bottom: 16px; spacing: 8px; alignment: start; HorizontalLayout { width: 100%; spacing: 16px; alignment: start; Text { text: day.date; width: 56px; font-size: 15px; font-weight: 600; color: #1a1a1a; horizontal-alignment: left; vertical-alignment: center; } Text { text: day.time; width: 112px; font-size: 13px; color: #6a6a6a; horizontal-alignment: left; vertical-alignment: center; } Text { text: day.hours; width: 48px; font-size: 13px; color: #6a6a6a; horizontal-alignment: left; vertical-alignment: center; } if day.mark != "": Text { text: day.mark; font-size: 13px; color: #6a6a6a; horizontal-alignment: left; vertical-alignment: center; } Rectangle { horizontal-stretch: 1; min-width: 0px; } Text { text: day.status; min-width: 96px; font-size: 13px; color: day.problem ? #1a1a1a : #6a6a6a; horizontal-alignment: right; vertical-alignment: center; } } if day.site != "": Text { text: day.site; width: 100%; wrap: word-wrap; font-size: 12px; color: #8a8a8a; horizontal-alignment: left; } if day.memo != "": Text { text: day.memo; width: 100%; wrap: word-wrap; font-size: 14px; color: #1a1a1a; horizontal-alignment: left; } } export component MainWindow inherits Window { in property <[DayRow]> days; in property range; in property error; callback refresh(); title: "打卡"; preferred-width: 880px; preferred-height: 720px; background: #f7f7f5; default-font-family: "Segoe UI"; VerticalLayout { width: 100%; height: 100%; spacing: 0; alignment: start; HorizontalLayout { width: 100%; height: 52px; padding-left: 24px; padding-right: 24px; spacing: 16px; alignment: start; Text { text: "打卡"; font-size: 16px; font-weight: 600; color: #1a1a1a; horizontal-alignment: left; vertical-alignment: center; } Text { text: root.range; font-size: 13px; color: #8a8a8a; horizontal-alignment: left; vertical-alignment: center; } Rectangle { horizontal-stretch: 1; min-width: 0px; } Text { text: "刷新"; font-size: 13px; color: #1a1a1a; horizontal-alignment: right; vertical-alignment: center; TouchArea { clicked => { root.refresh(); } } } } Hairline {} if root.error != "": VerticalLayout { width: 100%; padding: 24px; alignment: start; Text { text: root.error; width: 100%; wrap: word-wrap; font-size: 14px; color: #1a1a1a; horizontal-alignment: left; } } if root.error == "" && root.days.length == 0: VerticalLayout { width: 100%; padding: 24px; alignment: start; Text { text: "这一周没有打卡记录。"; font-size: 14px; color: #8a8a8a; horizontal-alignment: left; } } if root.error == "" && root.days.length > 0: Flickable { width: 100%; vertical-stretch: 1; content-height: list.preferred-height; list := VerticalLayout { width: 100%; alignment: start; spacing: 0; for day in root.days: VerticalLayout { width: 100%; spacing: 0; alignment: start; DayBlock { day: day; } Hairline {} } } } } }