diff --git a/web/src/features/home/HomeView.vue b/web/src/features/home/HomeView.vue index c0965b0..456f92c 100644 --- a/web/src/features/home/HomeView.vue +++ b/web/src/features/home/HomeView.vue @@ -104,36 +104,45 @@ const studyLabel = computed(() => { const message = studyControl.value.message.trim(); if (studyControl.value.hours_met) return "本月目标已达到"; if (studyFailed.value) return message || state; - if (state === "排队中") return "排队中"; + if (state === "排队中") return "排队中,马上开始"; if (state === "准备") return "正在连接学习平台"; if (studyingWorkers.value.length || state === "学习中") return "任务已开启"; - if (studyControl.value.active || studyControl.value.started) return "正在启动学习任务"; + if (studyControl.value.active || studyControl.value.started) return "正在准备课程"; if (state === "已停止" || studyControl.value.paused) return "任务已停止"; - if (state === "已学完") return "课程已学完"; - if (!studyControl.value.schedule_enabled) return "未开启定时自动学习"; - if (!studyControl.value.window_open) return "未到开始时间"; + if (state === "已学完") return "课程已全部学完"; + if (!studyControl.value.schedule_enabled) return "未开始"; + if (!studyControl.value.window_open) return "等待定时启动"; return "等待启动"; }); const startBlocked = computed(() => { if (!scheduleReady.value) return "正在读取配置"; const target = monthlyTarget.value ?? 0; - if (target <= 0) return "请先把每月目标设为大于 0"; - if (monthProgress.value.current >= target) return "本月学时已达到目标,把目标改大后可以再开始"; + if (target <= 0) return "先把每月目标设为大于 0"; + if (monthProgress.value.current >= target) return "本月学时已达到目标,把每月目标调高后可以再开始"; return ""; }); const studyHint = computed(() => { - if (studyingWorkers.value.length) return ""; - if (progressTarget.value <= 0) return "请先设置每月目标。"; - if (studyControl.value.hours_met) return "达到本月目标后不能再开始。改大目标并保存后才会再启动。"; - if (studyFailed.value) return "点立即开始或保存定时配置会再启动。"; - if (studyControl.value.started || studyControl.value.active) return "开始后会列出正在学的课。"; - if (studyControl.value.state === "已停止" || studyControl.value.paused) { - return "本月已停止,下月定时照常;点立即开始可恢复。"; + if (studyingWorkers.value.length || !targetLoaded.value) return ""; + const control = studyControl.value; + if (progressTarget.value <= 0) return "每月目标为 0 时不会学习。先把每月目标设为大于 0。"; + if (control.hours_met) return "本月学时已达到目标。想继续学,把每月目标调高后点「立即开始」。"; + if (control.state === "会话失效") return "登录已失效。请退出后重新登录,登录后会接着学。"; + if (studyFailed.value && control.message.includes("没有可用的课程")) { + return "课程清单还没有准备好。请稍后再试,或联系管理员加载课程清单。"; } - if (!studyControl.value.schedule_enabled) return "关闭定时后,只能点立即开始。"; - return "到点后会自动开始。保存定时配置时,若已过点且未达标也会立刻启动。"; + if (studyFailed.value) return "稍后会自动重试,也可以点「立即开始」马上重试。"; + if (control.started || control.active) return "正在准备,稍后这里会列出正在学的课程。"; + if (control.state === "已学完") return "课程清单里的课程已全部学完。"; + if (control.state === "已停止" || control.paused) { + return control.schedule_enabled + ? "本月已手动停止。点「立即开始」可以继续;下个月到开始时刻会自动恢复。" + : "已手动停止。点「立即开始」可以继续。"; + } + if (!control.schedule_enabled) return "定时启动已关闭。需要学习时点「立即开始」。"; + if (!control.window_open) return "到开始时刻会自动开始学习,也可以点「立即开始」马上开始。"; + return "点「立即开始」开始学习。"; }); function amount(value: string | number | null | undefined) { @@ -234,9 +243,9 @@ function showHeartbeat(row: StudyWorker) { return row.interval > 0 && (row.heartbeat_in > 0 || row.heartbeat_at > 0); } -function workerCount(row: StudyWorker) { - if (row.total > 0) return `${row.sent}/${row.total}`; - if (row.sent > 0) return `${row.sent}/—`; +function workerMinutes(row: StudyWorker) { + if (row.total > 0) return `${row.sent} / ${row.total}`; + if (row.sent > 0) return `${row.sent} / —`; return "—"; } @@ -989,8 +998,39 @@ onUnmounted(() => {
-
+

自动学习

+
+ + {{ studyLabel }} + 页面学时刷新倒计时: {{ hoursRefreshLeft() }}s +
+ + + {{ startBlocked || "按当前配置立刻开始,同时保存配置" }} + + + + 停止 +
{{ studyError }} @@ -1015,11 +1055,16 @@ onUnmounted(() => { - - -
- + + { size="small" :actions="null" :disabled="!scheduleEnabled" + aria-label="开始时刻" />
@@ -1045,67 +1091,35 @@ onUnmounted(() => { 推荐:自动获取 - + +
+ + + +
+
+

+ 间隔越短,发送越频繁。设为 0 时连续发送,课程列表不显示倒计时。 +

+ 保存配置 代理 - 保存定时配置 - - - {{ startBlocked || "按左边当前的配置立刻开始,并保存这份配置" }} - - - - 停止 -
-
- - {{ studyLabel }} - 页面学时刷新倒计时: {{ hoursRefreshLeft() }}s -
本月进度 @@ -1114,18 +1128,28 @@ onUnmounted(() => {
-
    -
  • - {{ workerTitle(row) }} -
    - -
    - {{ workerPercentText(row) }} - {{ workerCount(row) }} - {{ heartbeatLeft(row) }} - -
  • -
+
+ +
    +
  • + {{ workerTitle(row) }} +
    + +
    + {{ workerPercentText(row) }} + {{ workerMinutes(row) }} + {{ showHeartbeat(row) ? heartbeatLeft(row) : "" }} + +
  • +
+

{{ studyHint }}

diff --git a/web/src/styles.css b/web/src/styles.css index 0215e56..c86f785 100644 --- a/web/src/styles.css +++ b/web/src/styles.css @@ -491,21 +491,6 @@ select { color: var(--muted); } -.panel-card-head h3 { - margin: 0; - font-size: 13px; - font-weight: 650; - color: var(--muted); -} - -.panel-card-head { - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; - margin-bottom: 4px; -} - .compact-nform { display: flex; flex-direction: column; @@ -651,12 +636,16 @@ select { .start-control .day-select, .start-control .start-time { - flex: 1 1 8.5rem; + flex: 1 1 7rem; width: auto; min-width: 0; max-width: 100%; } +.start-control .n-switch { + flex: none; +} + .start-control .start-time .n-input { width: 100%; } @@ -670,6 +659,34 @@ select { flex-wrap: wrap; } +.pace-fields { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 8px; + min-width: 0; +} + +.pace-field { + display: inline-flex; + align-items: center; + gap: 6px; + font-size: 13px; + color: var(--muted); +} + +.pace-field .n-input-number { + width: 52px; +} + +.study-config-hint { + margin: 6px 0 0 132px; + max-width: 22rem; + font-size: 12px; + line-height: 1.5; + color: var(--muted); +} + .study-start-wrap { display: inline-flex; } @@ -679,7 +696,7 @@ select { flex-wrap: wrap; align-items: center; gap: 8px; - margin-top: 12px; + margin-top: 16px; } .day-warn { @@ -688,15 +705,34 @@ select { } .target-unit { + flex: none; color: var(--muted); font-size: 13px; + white-space: nowrap; } -.study-live-status { +.study-head { display: flex; + flex-wrap: wrap; align-items: center; - gap: 8px; - min-height: 32px; + gap: 8px 16px; + min-height: 28px; +} + +.study-head h3 { + margin: 0; + font-size: 13px; + font-weight: 650; + color: var(--muted); +} + +.study-state { + flex: 1 1 12rem; + min-width: 0; + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 4px 8px; } .study-indicator { @@ -730,6 +766,7 @@ select { min-height: 0; display: flex; flex-direction: column; + gap: 12px; } .study-card.is-busy { @@ -742,7 +779,8 @@ select { grid-template-columns: minmax(0, 30rem) minmax(0, 1fr); gap: 16px 32px; align-items: start; - padding-top: 12px; + padding-top: 16px; + border-top: 1px solid var(--line); } .study-card.is-busy .study-card-body { @@ -765,7 +803,7 @@ select { min-width: 0; display: flex; flex-direction: column; - gap: 12px; + gap: 20px; padding-left: 24px; border-left: 1px solid var(--line); } @@ -778,7 +816,6 @@ select { display: flex; flex-direction: column; gap: 8px; - max-width: 28rem; } .study-progress-meta { @@ -802,6 +839,40 @@ select { color: var(--muted); } +.study-courses { + --course-cols: minmax(7rem, 1.4fr) minmax(4rem, 1fr) 56px 88px 56px 8px; + flex: 1; + min-height: 0; + display: flex; + flex-direction: column; + gap: 10px; +} + +.study-courses.no-countdown { + --course-cols: minmax(7rem, 1.4fr) minmax(4rem, 1fr) 56px 88px 8px; +} + +.study-course-head, +.study-worker { + display: grid; + grid-template-columns: var(--course-cols); + align-items: center; + column-gap: 12px; + min-width: 0; +} + +.study-course-head { + padding-bottom: 8px; + border-bottom: 1px solid var(--line); + font-size: 12px; + color: var(--muted); + white-space: nowrap; +} + +.study-course-head .num { + text-align: right; +} + .study-workers { list-style: none; margin: 0; @@ -814,15 +885,7 @@ select { gap: 10px; } -.study-worker { - display: flex; - align-items: center; - gap: 10px; - min-width: 0; -} - .study-worker-title { - flex: 1 1 9rem; min-width: 0; font-size: 13px; overflow: hidden; @@ -831,8 +894,7 @@ select { } .study-worker-bar { - flex: 1 1 10rem; - min-width: 72px; + min-width: 0; } .study-worker-bar .n-progress { @@ -840,28 +902,16 @@ select { } .study-worker-pct, -.study-worker-count { - flex: none; - text-align: right; - font-variant-numeric: tabular-nums; - font-size: 12px; -} - -.study-worker-pct { - width: 4.6em; -} - -.study-worker-count { - min-width: 3.75em; - color: var(--muted); -} - +.study-worker-count, .study-heartbeat { - flex: none; - width: 2.75em; text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; + white-space: nowrap; +} + +.study-worker-count, +.study-heartbeat { color: var(--muted); } @@ -869,7 +919,6 @@ select { width: 8px; height: 8px; border-radius: 50%; - flex: none; } .study-dot.up { @@ -1305,11 +1354,73 @@ select { .study-live { padding-left: 0; border-left: 0; - padding-top: 12px; + padding-top: 16px; border-top: 1px solid var(--line); } } +@media (max-width: 560px) { + .study-config .compact-nform .n-form-item { + grid-template-areas: + "label" + "blank" + "feedback"; + grid-template-columns: minmax(0, 1fr); + } + + .study-config .compact-nform .n-form-item .n-form-item-label { + min-height: 0; + padding: 0 0 4px; + } + + .study-config .target-control { + flex-wrap: nowrap; + } + + .study-config .heartbeat-control { + flex-wrap: wrap; + } + + .study-config .target-control .n-input-number, + .study-config .worker-select { + flex: none; + width: 132px; + } + + .study-config-hint { + margin-left: 0; + } + + .study-courses { + --course-cols: minmax(0, 1fr) 52px 76px 52px 8px; + } + + .study-courses.no-countdown { + --course-cols: minmax(0, 1fr) 52px 76px 8px; + } + + .study-course-head, + .study-worker { + column-gap: 8px; + } + + .study-worker { + row-gap: 2px; + } + + .study-worker-title { + grid-column: 1 / -1; + } + + .study-worker-bar { + visibility: hidden; + } + + .study-course-head span:nth-child(2) { + display: none; + } +} + @media (max-width: 800px) { .page { padding: 16px 12px;