总览周几:工作日绿色、周末红色。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-03 18:54:53 +08:00
parent 6e68650d09
commit eefdaa714a
4 changed files with 19 additions and 9 deletions
+7 -1
View File
@@ -153,7 +153,13 @@ body.page-login .main {
background: rgba(56, 189, 248, 0.35); background: rgba(56, 189, 248, 0.35);
} }
.overview-bj-weekday { .overview-bj-weekday {
color: var(--text); font-weight: 650;
}
.overview-bj-weekday.is-weekday {
color: var(--ok);
}
.overview-bj-weekday.is-weekend {
color: var(--bad);
} }
.overview-bj-lunar { .overview-bj-lunar {
color: var(--muted); color: var(--muted);
+10 -6
View File
@@ -628,6 +628,7 @@
const y = Number(get("year")); const y = Number(get("year"));
const m = Number(get("month")); const m = Number(get("month"));
const d = Number(get("day")); const d = Number(get("day"));
const weekdayIndex = new Date(Date.UTC(y, m - 1, d)).getUTCDay();
return { return {
time: time:
get("year") + get("year") +
@@ -641,7 +642,8 @@
get("minute") + get("minute") +
":" + ":" +
get("second"), get("second"),
weekday: WEEKDAYS[new Date(Date.UTC(y, m - 1, d)).getUTCDay()] || "", weekdayIndex: weekdayIndex,
weekday: WEEKDAYS[weekdayIndex] || "",
lunar: solarToLunarText(y, m, d), lunar: solarToLunarText(y, m, d),
}; };
} catch (e) { } catch (e) {
@@ -667,6 +669,7 @@
p(bj.getMinutes()) + p(bj.getMinutes()) +
":" + ":" +
p(bj.getSeconds()), p(bj.getSeconds()),
weekdayIndex: bj.getDay(),
weekday: WEEKDAYS[bj.getDay()] || "", weekday: WEEKDAYS[bj.getDay()] || "",
lunar: solarToLunarText(y, m, d), lunar: solarToLunarText(y, m, d),
}; };
@@ -681,12 +684,13 @@
el.setAttribute("datetime", parts.time.replace(" ", "T") + "+08:00"); el.setAttribute("datetime", parts.time.replace(" ", "T") + "+08:00");
const meta = document.getElementById("overview-bj-meta"); const meta = document.getElementById("overview-bj-meta");
if (meta) { if (meta) {
const bits = [parts.weekday, parts.lunar].filter(Boolean); const weekend = parts.weekdayIndex === 0 || parts.weekdayIndex === 6;
const wdClass = weekend ? "is-weekend" : "is-weekday";
meta.innerHTML = meta.innerHTML =
'<span class="overview-bj-weekday">' + (parts.weekday
bits[0] + ? '<span class="overview-bj-weekday ' + wdClass + '">' + parts.weekday + "</span>"
"</span>" + : "") +
(bits[1] ? '<span class="overview-bj-lunar">' + bits[1] + "</span>" : ""); (parts.lunar ? '<span class="overview-bj-lunar">' + parts.lunar + "</span>" : "");
} }
} }
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}期权中控{% endblock %}</title> <title>{% block title %}期权中控{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=2"> <link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=3">
</head> </head>
<body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path.startswith('/stats') %}page-stats{% elif request.path == '/' %}page-dashboard{% endif %}"> <body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path.startswith('/stats') %}page-stats{% elif request.path == '/' %}page-dashboard{% endif %}">
{% if session.get('logged_in') %} {% if session.get('logged_in') %}
+1 -1
View File
@@ -15,6 +15,6 @@
<div id="overview-grid"></div> <div id="overview-grid"></div>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ url_for('static', filename='hub.js') }}?v=14"></script> <script src="{{ url_for('static', filename='hub.js') }}?v=15"></script>
<script>HubOverview.boot();</script> <script>HubOverview.boot();</script>
{% endblock %} {% endblock %}