diff --git a/.github/ISSUE_TEMPLATE/BugReport.yml b/.github/ISSUE_TEMPLATE/BugReport.yml index ac402bf..dfaa5d1 100644 --- a/.github/ISSUE_TEMPLATE/BugReport.yml +++ b/.github/ISSUE_TEMPLATE/BugReport.yml @@ -1,7 +1,7 @@ name: Bug 反馈 description: 在使用考试看板 Next 的过程中遇到了 Bug。 title: (在这里输入你的标题) -labels: ['Bug','未阅读'] +labels: ['Bug', '未阅读'] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/FeatureRequest.yml b/.github/ISSUE_TEMPLATE/FeatureRequest.yml index a39c430..5c865b3 100644 --- a/.github/ISSUE_TEMPLATE/FeatureRequest.yml +++ b/.github/ISSUE_TEMPLATE/FeatureRequest.yml @@ -1,7 +1,7 @@ name: 功能请求 description: 提出一项新的功能。 title: (在这里输入你的标题) -labels: ['新功能','未阅读'] +labels: ['新功能', '未阅读'] body: - type: markdown attributes: diff --git a/src/renderer/src/components/ExamList.vue b/src/renderer/src/components/ExamList.vue index 5af47d3..67fb235 100644 --- a/src/renderer/src/components/ExamList.vue +++ b/src/renderer/src/components/ExamList.vue @@ -14,16 +14,11 @@ - {{ item.date }}{{ item.period }} + {{ item.date }}{{ item.period }} - {{ item.name }} + {{ item.name }} {{ formatTime(item.start) }} {{ formatTime(item.end) }} - - - {{ getStatusText(item) }} - - @@ -38,9 +33,6 @@ 结束 - - 状态 - @@ -75,10 +67,13 @@ const groupedExams = computed(() => { let currentPeriod = ''; sortedExams.value.forEach((exam, index) => { - const examDate = new Date(exam.start).toLocaleDateString('zh-CN', { - month: 'numeric', - day: 'numeric' - }).replace('/', '月') + '日'; + const examDate = + new Date(exam.start) + .toLocaleDateString('zh-CN', { + month: 'numeric', + day: 'numeric' + }) + .replace('/', '月') + '日'; const period = formatPeriod(exam.start); const showDate = examDate !== currentDate || period !== currentPeriod; @@ -87,9 +82,13 @@ const groupedExams = computed(() => { currentDate = examDate; currentPeriod = period; - const rowspan = sortedExams.value.filter(e => - new Date(e.start).toLocaleDateString('zh-CN', { month: 'numeric', day: 'numeric' }).replace('/', '月') + '日' === currentDate && - formatPeriod(e.start) === currentPeriod + const rowspan = sortedExams.value.filter( + (e) => + new Date(e.start) + .toLocaleDateString('zh-CN', { month: 'numeric', day: 'numeric' }) + .replace('/', '月') + + '日' === + currentDate && formatPeriod(e.start) === currentPeriod ).length; grouped.push({ ...exam, date: examDate, period, showDate, rowspan }); @@ -105,8 +104,7 @@ const headers = [ { text: '日期', value: 'date', sortable: false, align: 'center' }, { text: '科目', value: 'name', align: 'center' }, { text: '开始', value: 'start', sortable: false, align: 'center' }, - { text: '结束', value: 'end', sortable: false, align: 'center' }, - { text: '状态', value: 'status', sortable: false, align: 'center' } + { text: '结束', value: 'end', sortable: false, align: 'center' } ]; const formatTime = (isoString: string) => { @@ -114,28 +112,14 @@ const formatTime = (isoString: string) => { return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`; }; -function getStatusColor(item: any): string { +function getStatusClass(item: any): string { const now = new Date(); const startTime = new Date(item.start); const endTime = new Date(item.end); - if (now < startTime) return 'orange'; - else if (now >= startTime && now <= endTime) return 'green'; - else return 'red'; -} - -function getStatusText(item: any): string { - const now = new Date(); - const startTime = new Date(item.start); - const endTime = new Date(item.end); - - if (now < startTime) { - return '未开始'; - } else if (now >= startTime && now <= endTime) { - return '进行中'; - } else { - return '已结束'; - } + if (now < startTime) return 'status-upcoming'; + else if (now >= startTime && now <= endTime) return 'status-ongoing'; + else return 'status-ended'; } const sortedExams = computed(() => { @@ -146,7 +130,7 @@ onMounted(() => { const interval = setInterval(() => { state.exams = state.exams.map((exam) => ({ ...exam, - status: getStatusText(exam) + status: getStatusClass(exam) })); }, 1000); @@ -166,11 +150,6 @@ onMounted(() => { font-weight: bold; } -.exam-status-chip { - font-size: 1.5rem !important; - text-align: center; -} - .v-card { overflow-x: auto; max-width: 100%; /* 防止表格超出边界 */ @@ -180,8 +159,7 @@ onMounted(() => { /* 列样式 */ .date-column, .subject-column, -.time-column, -.status-column { +.time-column { white-space: nowrap; text-align: center; padding-left: 4px; @@ -200,7 +178,16 @@ onMounted(() => { width: 80px; } -.status-column { - width: 90px; +/* 状态样式 */ +.status-upcoming { + color: orange; } - \ No newline at end of file + +.status-ongoing { + color: green; +} + +.status-ended { + color: red; +} +