diff --git a/reading-platform-frontend/src/api/school.ts b/reading-platform-frontend/src/api/school.ts index 2203858..d5f1b0b 100644 --- a/reading-platform-frontend/src/api/school.ts +++ b/reading-platform-frontend/src/api/school.ts @@ -431,12 +431,15 @@ export const getStudentClassHistory = (studentId: number) => // ==================== 排课管理 ==================== -// 课程类型枚举 -export type LessonType = 'INTRODUCTION' | 'COLLECTIVE' | 'LANGUAGE' | 'SOCIETY' | 'SCIENCE' | 'ART' | 'HEALTH'; +// 课程类型枚举(与后端 LessonTypeEnum 对齐) +export type LessonType = + | 'INTRODUCTION' | 'INTRO' | 'COLLECTIVE' + | 'LANGUAGE' | 'HEALTH' | 'SCIENCE' | 'SOCIAL' | 'SOCIETY' | 'ART' + | 'DOMAIN_HEALTH' | 'DOMAIN_LANGUAGE' | 'DOMAIN_SOCIAL' | 'DOMAIN_SCIENCE' | 'DOMAIN_ART'; // 课程类型信息 export interface LessonTypeInfo { - lessonType: LessonType; + lessonType: string; lessonTypeName: string; count: number; } @@ -446,6 +449,8 @@ export interface DayScheduleItem { id: number; className: string; coursePackageName: string; + courseName?: string; // 兼容 coursePackageName 的别名 + lessonType?: string; lessonTypeName: string; teacherName: string; scheduledTime: string; diff --git a/reading-platform-frontend/src/utils/tagMaps.ts b/reading-platform-frontend/src/utils/tagMaps.ts index c9b4512..78503e1 100644 --- a/reading-platform-frontend/src/utils/tagMaps.ts +++ b/reading-platform-frontend/src/utils/tagMaps.ts @@ -123,6 +123,65 @@ export const DOMAIN_TAG_COLORS: Record = { 数学: { bg: "#FFF8E1", text: "#F9A825" }, }; +// ==================== 课程环节类型映射(与课程列表 tag 一致) ==================== + +export const LESSON_TYPE_NAMES: Record = { + INTRODUCTION: "导入课", + INTRO: "导入课", + COLLECTIVE: "集体课", + LANGUAGE: "语言", + HEALTH: "健康", + SCIENCE: "科学", + SOCIAL: "社会", + ART: "艺术", + DOMAIN_HEALTH: "健康", + DOMAIN_LANGUAGE: "语言", + DOMAIN_SOCIAL: "社会", + DOMAIN_SCIENCE: "科学", + DOMAIN_ART: "艺术", +}; + +export const LESSON_TYPE_COLORS: Record = { + INTRODUCTION: { bg: "#E8F5E9", text: "#2E7D32" }, + INTRO: { bg: "#E8F5E9", text: "#2E7D32" }, + COLLECTIVE: { bg: "#E3F2FD", text: "#1565C0" }, + LANGUAGE: { bg: "#F3E5F5", text: "#7B1FA2" }, + HEALTH: { bg: "#FFEBEE", text: "#C62828" }, + SCIENCE: { bg: "#E8F5E9", text: "#388E3C" }, + SOCIAL: { bg: "#E0F7FA", text: "#00838F" }, + ART: { bg: "#FFF3E0", text: "#E65100" }, + DOMAIN_HEALTH: { bg: "#FFEBEE", text: "#C62828" }, + DOMAIN_LANGUAGE: { bg: "#F3E5F5", text: "#7B1FA2" }, + DOMAIN_SOCIAL: { bg: "#E0F7FA", text: "#00838F" }, + DOMAIN_SCIENCE: { bg: "#E8F5E9", text: "#388E3C" }, + DOMAIN_ART: { bg: "#FFF3E0", text: "#E65100" }, +}; + +/** + * 获取课程环节类型的中文名称 + */ +export function getLessonTypeName(type: string): string { + return LESSON_TYPE_NAMES[type] || type; +} + +/** + * 获取课程环节类型标签样式(与课程卡片 tag 一致) + */ +export function getLessonTagStyle(type: string): { + background: string; + color: string; + border: string; +} { + const colors = LESSON_TYPE_COLORS[type] || { bg: "#F5F5F5", text: "#666" }; + return { + background: colors.bg, + color: colors.text, + border: "none", + }; +} + +// ==================== 年级/领域 ==================== + /** * 转换年级标签为中文 */ diff --git a/reading-platform-frontend/src/views/school/courses/CourseListView.vue b/reading-platform-frontend/src/views/school/courses/CourseListView.vue index 462132c..719aba8 100644 --- a/reading-platform-frontend/src/views/school/courses/CourseListView.vue +++ b/reading-platform-frontend/src/views/school/courses/CourseListView.vue @@ -228,6 +228,8 @@ import { translateDomainTags, getGradeTagStyle, getDomainTagStyle, + getLessonTypeName, + getLessonTagStyle, } from '@/utils/tagMaps'; import { parseGradeLevels } from '@/api/collections'; import * as schoolApi from '@/api/school'; @@ -262,30 +264,6 @@ const DOMAIN_TO_CODE: Record = { 艺术: 'ART', }; -// 课程环节类型映射 -const LESSON_TYPE_NAMES: Record = { - INTRODUCTION: '导入课', INTRO: '导入课', COLLECTIVE: '集体课', - LANGUAGE: '语言', HEALTH: '健康', SCIENCE: '科学', SOCIAL: '社会', ART: '艺术', - DOMAIN_HEALTH: '健康', DOMAIN_LANGUAGE: '语言', DOMAIN_SOCIAL: '社会', - DOMAIN_SCIENCE: '科学', DOMAIN_ART: '艺术', -}; -const getLessonTypeName = (type: string) => LESSON_TYPE_NAMES[type] || type; - -const getLessonTagStyle = (type: string) => { - const colors: Record = { - INTRODUCTION: { background: '#E8F5E9', color: '#2E7D32' }, INTRO: { background: '#E8F5E9', color: '#2E7D32' }, - COLLECTIVE: { background: '#E3F2FD', color: '#1565C0' }, - LANGUAGE: { background: '#F3E5F5', color: '#7B1FA2' }, HEALTH: { background: '#FFEBEE', color: '#C62828' }, - SCIENCE: { background: '#E8F5E9', color: '#388E3C' }, SOCIAL: { background: '#E0F7FA', color: '#00838F' }, - ART: { background: '#FFF3E0', color: '#E65100' }, - DOMAIN_HEALTH: { background: '#FFEBEE', color: '#C62828' }, DOMAIN_LANGUAGE: { background: '#F3E5F5', color: '#7B1FA2' }, - DOMAIN_SOCIAL: { background: '#E0F7FA', color: '#00838F' }, DOMAIN_SCIENCE: { background: '#E8F5E9', color: '#388E3C' }, - DOMAIN_ART: { background: '#FFF3E0', color: '#E65100' }, - }; - const c = colors[type] || { background: '#F5F5F5', color: '#666' }; - return { background: c.background, color: c.color, border: 'none' }; -}; - const handleFilterChange = () => { loadCourses(); }; diff --git a/reading-platform-frontend/src/views/school/schedule/CalendarView.vue b/reading-platform-frontend/src/views/school/schedule/CalendarView.vue index 0e5587c..03509a8 100644 --- a/reading-platform-frontend/src/views/school/schedule/CalendarView.vue +++ b/reading-platform-frontend/src/views/school/schedule/CalendarView.vue @@ -83,7 +83,9 @@
{{ item.scheduledTime }}
{{ item.className }}
-
{{ item.courseName }}
+
{{ item.coursePackageName || item.courseName }}
+ {{ getLessonTypeName(item.lessonType) }}
无排课
@@ -109,7 +111,10 @@
{{ item.scheduledTime || '待定' }}
{{ item.className }}
-
{{ item.courseName }}
+
{{ item.coursePackageName || item.courseName }}
+ + {{ getLessonTypeName(item.lessonType) }} +
{{ item.teacherName || '未分配' }}
@@ -137,6 +142,7 @@ import { type CalendarViewResponse, type DayScheduleItem, } from '@/api/school'; +import { getLessonTypeName, getLessonTagStyle } from '@/utils/tagMaps'; const viewType = ref<'month' | 'week'>('month'); const selectedClassId = ref(); @@ -539,6 +545,10 @@ onMounted(() => { font-size: 11px; color: #999; } + + .schedule-lesson-type { + margin-top: 4px; + } } } diff --git a/reading-platform-frontend/src/views/school/schedule/ScheduleList.vue b/reading-platform-frontend/src/views/school/schedule/ScheduleList.vue index e448782..6b41bc1 100644 --- a/reading-platform-frontend/src/views/school/schedule/ScheduleList.vue +++ b/reading-platform-frontend/src/views/school/schedule/ScheduleList.vue @@ -37,7 +37,7 @@ @change="loadSchedules" > 有效 - 已取消 + 已取消
@@ -56,6 +56,12 @@ {{ formatDate(record.scheduledDate) }} {{ record.scheduledTime }} +