import { AboutSlint } from "std-widgets.slint"; 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: #e4e4e1; } component DayBlock inherits HorizontalLayout { in property day; spacing: 0; Rectangle { width: 2px; background: day.problem ? #161616 : transparent; } VerticalLayout { padding-left: 18px; padding-right: 20px; padding-top: 16px; padding-bottom: 16px; spacing: 6px; alignment: start; HorizontalLayout { spacing: 10px; alignment: center; Text { text: day.date; font-size: 15px; font-weight: 600; color: #161616; } if day.mark != "": Text { text: day.mark; font-size: 12px; color: #8a8a8a; vertical-alignment: center; } Rectangle { horizontal-stretch: 1; } Text { text: day.time; font-size: 12px; color: #6e6e6e; vertical-alignment: center; } Text { text: day.hours; font-size: 12px; color: #6e6e6e; vertical-alignment: center; } Text { text: day.status; font-size: 12px; color: #161616; vertical-alignment: center; } } if day.site != "": Text { text: day.site; wrap: word-wrap; font-size: 12px; color: #8a8a8a; } if day.memo != "": Text { text: day.memo; wrap: word-wrap; font-size: 14px; color: #161616; } } } export component MainWindow inherits Window { in property <[DayRow]> days; in property range; in property error; in-out property about: false; callback refresh(); title: "打卡"; preferred-width: 920px; preferred-height: 680px; background: #f7f7f5; default-font-family: "Segoe UI"; VerticalLayout { spacing: 0; Rectangle { height: 52px; HorizontalLayout { padding-left: 20px; padding-right: 20px; spacing: 16px; alignment: center; Text { text: "打卡"; font-size: 16px; font-weight: 600; color: #161616; } Text { text: root.range; font-size: 12px; color: #8a8a8a; vertical-alignment: center; } Rectangle { horizontal-stretch: 1; } Text { text: "刷新"; font-size: 12px; color: #161616; vertical-alignment: center; TouchArea { clicked => { root.refresh(); } } } Text { text: "关于"; font-size: 12px; color: #161616; vertical-alignment: center; TouchArea { clicked => { root.about = !root.about; } } } } } Hairline {} if root.error != "": VerticalLayout { padding: 20px; Text { text: root.error; wrap: word-wrap; font-size: 13px; color: #161616; } } if root.about: VerticalLayout { padding: 24px; spacing: 16px; alignment: start; Text { text: "关于"; font-size: 15px; font-weight: 600; color: #161616; } AboutSlint {} Text { text: "返回"; font-size: 12px; color: #161616; TouchArea { clicked => { root.about = false; } } } } if !root.about && root.error == "" && root.days.length == 0: VerticalLayout { padding: 20px; Text { text: "这一周没有打卡记录。"; font-size: 13px; color: #8a8a8a; } } if !root.about && root.error == "" && root.days.length > 0: Flickable { vertical-stretch: 1; content-height: list.preferred-height; list := VerticalLayout { width: parent.width; for day in root.days: VerticalLayout { DayBlock { day: day; } Hairline {} } } } } }