fix: 打卡列表改为通栏左对齐并去掉关于页

This commit is contained in:
2026-11-19 15:34:29 +08:00
parent 39cc19d261
commit 9aae3c8d58
2 changed files with 114 additions and 130 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ fn show(ui: &MainWindow, loaded: punchlog::Result<punchlog::WeekReport>) {
hours: format!("{:.1}h", day.hours).into(),
status: day.status.label().into(),
site: site.into(),
memo: memo.into(),
memo: memo.replace(" / ", "\n").into(),
problem: day.status.is_problem(),
}
})
+113 -129
View File
@@ -1,5 +1,3 @@
import { AboutSlint } from "std-widgets.slint";
export struct DayRow {
date: string,
mark: string,
@@ -13,75 +11,76 @@ export struct DayRow {
component Hairline inherits Rectangle {
height: 1px;
background: #e4e4e1;
background: #e6e6e3;
}
component DayBlock inherits HorizontalLayout {
component DayBlock inherits VerticalLayout {
in property <DayRow> day;
spacing: 0;
width: 100%;
padding-left: 28px;
padding-right: 28px;
padding-top: 18px;
padding-bottom: 18px;
spacing: 8px;
alignment: start;
Rectangle {
width: 2px;
background: day.problem ? #161616 : transparent;
HorizontalLayout {
width: 100%;
spacing: 20px;
alignment: center;
Text {
text: day.date;
width: 56px;
font-size: 15px;
font-weight: 600;
color: #1a1a1a;
}
Text {
text: day.time;
width: 112px;
font-size: 13px;
color: #6a6a6a;
vertical-alignment: center;
}
Text {
text: day.hours;
width: 48px;
font-size: 13px;
color: #6a6a6a;
vertical-alignment: center;
}
if day.mark != "": Text {
text: day.mark;
font-size: 13px;
color: #6a6a6a;
vertical-alignment: center;
}
Rectangle { horizontal-stretch: 1; }
Text {
text: day.status;
font-size: 13px;
color: day.problem ? #1a1a1a : #6a6a6a;
vertical-alignment: center;
}
}
VerticalLayout {
padding-left: 18px;
padding-right: 20px;
padding-top: 16px;
padding-bottom: 16px;
spacing: 6px;
alignment: start;
if day.site != "": Text {
text: day.site;
width: 100%;
wrap: word-wrap;
font-size: 12px;
color: #8a8a8a;
horizontal-alignment: left;
}
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;
}
if day.memo != "": Text {
text: day.memo;
width: 100%;
wrap: word-wrap;
font-size: 14px;
color: #1a1a1a;
horizontal-alignment: left;
}
}
@@ -89,101 +88,86 @@ export component MainWindow inherits Window {
in property <[DayRow]> days;
in property <string> range;
in property <string> error;
in-out property <bool> about: false;
callback refresh();
title: "打卡";
preferred-width: 920px;
preferred-height: 680px;
preferred-width: 880px;
preferred-height: 720px;
background: #f7f7f5;
default-font-family: "Segoe UI";
VerticalLayout {
width: 100%;
height: 100%;
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; } }
}
HorizontalLayout {
width: 100%;
height: 56px;
padding-left: 28px;
padding-right: 28px;
spacing: 20px;
alignment: center;
Text {
text: "打卡";
font-size: 16px;
font-weight: 600;
color: #1a1a1a;
}
Text {
text: root.range;
font-size: 13px;
color: #8a8a8a;
vertical-alignment: center;
}
Rectangle { horizontal-stretch: 1; }
Text {
text: "刷新";
font-size: 13px;
color: #1a1a1a;
vertical-alignment: center;
TouchArea { clicked => { root.refresh(); } }
}
}
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;
width: 100%;
padding: 28px;
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; } }
text: root.error;
width: 100%;
wrap: word-wrap;
font-size: 14px;
color: #1a1a1a;
horizontal-alignment: left;
}
}
if !root.about && root.error == "" && root.days.length == 0: VerticalLayout {
padding: 20px;
if root.error == "" && root.days.length == 0: VerticalLayout {
width: 100%;
padding: 28px;
alignment: start;
Text {
text: "这一周没有打卡记录。";
font-size: 13px;
font-size: 14px;
color: #8a8a8a;
}
}
if !root.about && root.error == "" && root.days.length > 0: Flickable {
if root.error == "" && root.days.length > 0: Flickable {
width: 100%;
vertical-stretch: 1;
content-height: list.preferred-height;
list := VerticalLayout {
width: parent.width;
width: 100%;
alignment: start;
for day in root.days: VerticalLayout {
width: 100%;
spacing: 0;
DayBlock { day: day; }
Hairline {}
}