fix: 开始后不再显示旧终态,目标为零时不能立即开始

This commit is contained in:
2026-11-16 17:49:10 +08:00
parent 2a3a23c3c9
commit 36b15cce7b
+9 -7
View File
@@ -100,27 +100,29 @@ const monthProgress = computed(() => {
const studyLabel = computed(() => {
const state = studyControl.value.state;
const message = studyControl.value.message.trim();
if (studyControl.value.hours_met || state === "已达标") return "本月目标已达到";
if (state === "已停止" || studyControl.value.paused) return "任务已停止";
if (state === "已学完") return "课程已学完";
if (studyControl.value.hours_met) return "本月目标已达到";
if (studyFailed.value) return message || state;
if (state === "排队中") return "排队中";
if (state === "准备") return "正在连接学习平台";
if (studyingWorkers.value.length) return studyControl.value.course || "学习中";
if (state === "学习中") return "正在领取课程";
if (studyControl.value.active || studyControl.value.started) return "正在启动学习任务";
if (state === "已停止" || studyControl.value.paused) return "任务已停止";
if (state === "已学完") return "课程已学完";
if (!studyControl.value.schedule_enabled) return "未开启定时自动学习";
return "未到开始时间";
if (!studyControl.value.window_open) 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 (studyControl.value.started || studyControl.value.active) return "开始后会列出正在学的课。";
if (!studyControl.value.schedule_enabled) return "关闭定时后,只能点立即开始。";
return "到点后会自动开始。保存定时配置时,若已过点且未达标也会立刻启动。";
});
@@ -891,7 +893,7 @@ onUnmounted(() => {
<n-tooltip v-if="!studyControl.started" placement="top">
<template #trigger>
<span class="study-start-wrap">
<n-button type="success" size="small" :disabled="studyControl.hours_met" :loading="studyBusy" @click="toggleStudy">
<n-button type="success" size="small" :disabled="studyControl.hours_met || progressTarget <= 0" :loading="studyBusy" @click="toggleStudy">
<template #icon>
<n-icon><PlayOutline /></n-icon>
</template>
@@ -899,7 +901,7 @@ onUnmounted(() => {
</n-button>
</span>
</template>
{{ studyControl.hours_met ? "本月目标已达到" : "会跳过设定的定时启动时间,立刻开始学习任务。" }}
{{ studyControl.hours_met ? "本月目标已达到" : progressTarget <= 0 ? "请先设置每月目标。" : "会跳过设定的定时启动时间,立刻开始学习任务。" }}
</n-tooltip>
<n-button v-else type="error" size="small" :loading="studyBusy" @click="toggleStudy">
<template #icon>