fix: 打卡列表改为通栏左对齐并去掉关于页
This commit is contained in:
@@ -48,7 +48,7 @@ fn show(ui: &MainWindow, loaded: punchlog::Result<punchlog::WeekReport>) {
|
|||||||
hours: format!("{:.1}h", day.hours).into(),
|
hours: format!("{:.1}h", day.hours).into(),
|
||||||
status: day.status.label().into(),
|
status: day.status.label().into(),
|
||||||
site: site.into(),
|
site: site.into(),
|
||||||
memo: memo.into(),
|
memo: memo.replace(" / ", "\n").into(),
|
||||||
problem: day.status.is_problem(),
|
problem: day.status.is_problem(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+66
-82
@@ -1,5 +1,3 @@
|
|||||||
import { AboutSlint } from "std-widgets.slint";
|
|
||||||
|
|
||||||
export struct DayRow {
|
export struct DayRow {
|
||||||
date: string,
|
date: string,
|
||||||
mark: string,
|
mark: string,
|
||||||
@@ -13,75 +11,76 @@ export struct DayRow {
|
|||||||
|
|
||||||
component Hairline inherits Rectangle {
|
component Hairline inherits Rectangle {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background: #e4e4e1;
|
background: #e6e6e3;
|
||||||
}
|
}
|
||||||
|
|
||||||
component DayBlock inherits HorizontalLayout {
|
component DayBlock inherits VerticalLayout {
|
||||||
in property <DayRow> day;
|
in property <DayRow> day;
|
||||||
spacing: 0;
|
width: 100%;
|
||||||
|
padding-left: 28px;
|
||||||
Rectangle {
|
padding-right: 28px;
|
||||||
width: 2px;
|
padding-top: 18px;
|
||||||
background: day.problem ? #161616 : transparent;
|
padding-bottom: 18px;
|
||||||
}
|
spacing: 8px;
|
||||||
|
|
||||||
VerticalLayout {
|
|
||||||
padding-left: 18px;
|
|
||||||
padding-right: 20px;
|
|
||||||
padding-top: 16px;
|
|
||||||
padding-bottom: 16px;
|
|
||||||
spacing: 6px;
|
|
||||||
alignment: start;
|
alignment: start;
|
||||||
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
spacing: 10px;
|
width: 100%;
|
||||||
|
spacing: 20px;
|
||||||
alignment: center;
|
alignment: center;
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: day.date;
|
text: day.date;
|
||||||
|
width: 56px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #161616;
|
color: #1a1a1a;
|
||||||
}
|
}
|
||||||
if day.mark != "": Text {
|
|
||||||
text: day.mark;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #8a8a8a;
|
|
||||||
vertical-alignment: center;
|
|
||||||
}
|
|
||||||
Rectangle { horizontal-stretch: 1; }
|
|
||||||
Text {
|
Text {
|
||||||
text: day.time;
|
text: day.time;
|
||||||
font-size: 12px;
|
width: 112px;
|
||||||
color: #6e6e6e;
|
font-size: 13px;
|
||||||
|
color: #6a6a6a;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: day.hours;
|
text: day.hours;
|
||||||
font-size: 12px;
|
width: 48px;
|
||||||
color: #6e6e6e;
|
font-size: 13px;
|
||||||
|
color: #6a6a6a;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
|
if day.mark != "": Text {
|
||||||
|
text: day.mark;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #6a6a6a;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
Rectangle { horizontal-stretch: 1; }
|
||||||
Text {
|
Text {
|
||||||
text: day.status;
|
text: day.status;
|
||||||
font-size: 12px;
|
font-size: 13px;
|
||||||
color: #161616;
|
color: day.problem ? #1a1a1a : #6a6a6a;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if day.site != "": Text {
|
if day.site != "": Text {
|
||||||
text: day.site;
|
text: day.site;
|
||||||
|
width: 100%;
|
||||||
wrap: word-wrap;
|
wrap: word-wrap;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #8a8a8a;
|
color: #8a8a8a;
|
||||||
|
horizontal-alignment: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
if day.memo != "": Text {
|
if day.memo != "": Text {
|
||||||
text: day.memo;
|
text: day.memo;
|
||||||
|
width: 100%;
|
||||||
wrap: word-wrap;
|
wrap: word-wrap;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #161616;
|
color: #1a1a1a;
|
||||||
}
|
horizontal-alignment: left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,101 +88,86 @@ export component MainWindow inherits Window {
|
|||||||
in property <[DayRow]> days;
|
in property <[DayRow]> days;
|
||||||
in property <string> range;
|
in property <string> range;
|
||||||
in property <string> error;
|
in property <string> error;
|
||||||
in-out property <bool> about: false;
|
|
||||||
callback refresh();
|
callback refresh();
|
||||||
|
|
||||||
title: "打卡";
|
title: "打卡";
|
||||||
preferred-width: 920px;
|
preferred-width: 880px;
|
||||||
preferred-height: 680px;
|
preferred-height: 720px;
|
||||||
background: #f7f7f5;
|
background: #f7f7f5;
|
||||||
default-font-family: "Segoe UI";
|
default-font-family: "Segoe UI";
|
||||||
|
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
spacing: 0;
|
spacing: 0;
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
height: 52px;
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
padding-left: 20px;
|
width: 100%;
|
||||||
padding-right: 20px;
|
height: 56px;
|
||||||
spacing: 16px;
|
padding-left: 28px;
|
||||||
|
padding-right: 28px;
|
||||||
|
spacing: 20px;
|
||||||
alignment: center;
|
alignment: center;
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "打卡";
|
text: "打卡";
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #161616;
|
color: #1a1a1a;
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: root.range;
|
text: root.range;
|
||||||
font-size: 12px;
|
font-size: 13px;
|
||||||
color: #8a8a8a;
|
color: #8a8a8a;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
Rectangle { horizontal-stretch: 1; }
|
Rectangle { horizontal-stretch: 1; }
|
||||||
Text {
|
Text {
|
||||||
text: "刷新";
|
text: "刷新";
|
||||||
font-size: 12px;
|
font-size: 13px;
|
||||||
color: #161616;
|
color: #1a1a1a;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
TouchArea { clicked => { root.refresh(); } }
|
TouchArea { clicked => { root.refresh(); } }
|
||||||
}
|
}
|
||||||
Text {
|
|
||||||
text: "关于";
|
|
||||||
font-size: 12px;
|
|
||||||
color: #161616;
|
|
||||||
vertical-alignment: center;
|
|
||||||
TouchArea { clicked => { root.about = !root.about; } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Hairline {}
|
Hairline {}
|
||||||
|
|
||||||
if root.error != "": VerticalLayout {
|
if root.error != "": VerticalLayout {
|
||||||
padding: 20px;
|
width: 100%;
|
||||||
Text {
|
padding: 28px;
|
||||||
text: root.error;
|
|
||||||
wrap: word-wrap;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #161616;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if root.about: VerticalLayout {
|
|
||||||
padding: 24px;
|
|
||||||
spacing: 16px;
|
|
||||||
alignment: start;
|
alignment: start;
|
||||||
Text {
|
Text {
|
||||||
text: "关于";
|
text: root.error;
|
||||||
font-size: 15px;
|
width: 100%;
|
||||||
font-weight: 600;
|
wrap: word-wrap;
|
||||||
color: #161616;
|
font-size: 14px;
|
||||||
}
|
color: #1a1a1a;
|
||||||
AboutSlint {}
|
horizontal-alignment: left;
|
||||||
Text {
|
|
||||||
text: "返回";
|
|
||||||
font-size: 12px;
|
|
||||||
color: #161616;
|
|
||||||
TouchArea { clicked => { root.about = false; } }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !root.about && root.error == "" && root.days.length == 0: VerticalLayout {
|
if root.error == "" && root.days.length == 0: VerticalLayout {
|
||||||
padding: 20px;
|
width: 100%;
|
||||||
|
padding: 28px;
|
||||||
|
alignment: start;
|
||||||
Text {
|
Text {
|
||||||
text: "这一周没有打卡记录。";
|
text: "这一周没有打卡记录。";
|
||||||
font-size: 13px;
|
font-size: 14px;
|
||||||
color: #8a8a8a;
|
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;
|
vertical-stretch: 1;
|
||||||
content-height: list.preferred-height;
|
content-height: list.preferred-height;
|
||||||
list := VerticalLayout {
|
list := VerticalLayout {
|
||||||
width: parent.width;
|
width: 100%;
|
||||||
|
alignment: start;
|
||||||
for day in root.days: VerticalLayout {
|
for day in root.days: VerticalLayout {
|
||||||
|
width: 100%;
|
||||||
|
spacing: 0;
|
||||||
DayBlock { day: day; }
|
DayBlock { day: day; }
|
||||||
Hairline {}
|
Hairline {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user