feat: 定时开始日改为每月5到25号,默认8号
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { NAlert, NButton, NForm, NFormItem, NIcon, NInputNumber, NModal, NProgress, NSelect, NSwitch, NTimePicker, NTooltip } from "naive-ui";
|
||||
import { GlobeOutline, PlayOutline, RefreshOutline, StopOutline, WarningOutline } from "@vicons/ionicons5";
|
||||
import { GlobeOutline, PlayOutline, RefreshOutline, StopOutline } from "@vicons/ionicons5";
|
||||
import ProxyFields from "../../shared/ProxyFields.vue";
|
||||
import { dayOptions, workerOptions } from "../../shared/studyFields";
|
||||
import { STUDY_DAY_DEFAULT, STUDY_DAY_MAX, STUDY_DAY_MIN, dayOptions, workerOptions } from "../../shared/studyFields";
|
||||
import { failureText } from "../../shared/text";
|
||||
|
||||
interface HomeSummary {
|
||||
@@ -285,7 +285,7 @@ async function loadTarget() {
|
||||
|
||||
const startLoaded = ref(false);
|
||||
const scheduleEnabled = ref(true);
|
||||
const startDay = ref<number | null>(1);
|
||||
const startDay = ref<number | null>(STUDY_DAY_DEFAULT);
|
||||
const startHour = ref<number | null>(0);
|
||||
const startMinute = ref<number | null>(0);
|
||||
const startSecond = ref<number | null>(0);
|
||||
@@ -309,7 +309,7 @@ async function loadStart() {
|
||||
const res = await fetch("/api/settings/study-start");
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
startDay.value = typeof data.day === "number" ? data.day : 1;
|
||||
startDay.value = typeof data.day === "number" ? data.day : STUDY_DAY_DEFAULT;
|
||||
startHour.value = typeof data.hour === "number" ? data.hour : 0;
|
||||
startMinute.value = typeof data.minute === "number" ? data.minute : 0;
|
||||
startSecond.value = typeof data.second === "number" ? data.second : 0;
|
||||
@@ -359,10 +359,15 @@ async function saveSchedule() {
|
||||
if (
|
||||
day == null || hour == null || minute == null || second == null
|
||||
|| !Number.isInteger(day) || !Number.isInteger(hour) || !Number.isInteger(minute) || !Number.isInteger(second)
|
||||
|| hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59
|
||||
) {
|
||||
scheduleError.value = "请填写完整的开始时刻";
|
||||
return;
|
||||
}
|
||||
if (day < STUDY_DAY_MIN || day > STUDY_DAY_MAX) {
|
||||
scheduleError.value = "每月开始日须为 5 到 25 的整数";
|
||||
return;
|
||||
}
|
||||
if (workers == null || !Number.isInteger(workers) || workers < 1 || workers > 8) {
|
||||
scheduleError.value = "同时学习课程数须为 1 到 8";
|
||||
return;
|
||||
@@ -826,14 +831,6 @@ onUnmounted(() => {
|
||||
<n-form-item v-if="startLoaded" label="开始时刻">
|
||||
<div class="start-control">
|
||||
<n-select v-model:value="startDay" size="small" :options="dayOptions" class="day-select" :disabled="!scheduleEnabled" />
|
||||
<n-tooltip v-if="scheduleEnabled && startDay === 1" placement="top">
|
||||
<template #trigger>
|
||||
<button type="button" class="hint-icon day-warn" aria-label="开始时刻说明">
|
||||
<n-icon><WarningOutline /></n-icon>
|
||||
</button>
|
||||
</template>
|
||||
公共代理不稳定,学习可能中断
|
||||
</n-tooltip>
|
||||
<n-time-picker
|
||||
class="start-time"
|
||||
v-model:formatted-value="startTime"
|
||||
|
||||
Reference in New Issue
Block a user