- Expanded CourseResourceType to include "resource" and "temp". - Renamed ICourseResource to IResource and updated its properties for consistency. - Introduced ICreateResource type for resource creation. - Modified ICourseSection and ICourseChapter interfaces to use the new IResource type and updated property names for camelCase. - Implemented uploadFile function in file API for handling file uploads. - Created ResourceUploader component for uploading resources with validation and feedback. - Developed Card component for displaying course class details and managing student enrollment. - Added AlertDialog components for consistent alert dialog UI. - Enhanced table components for better data presentation and management. - Implemented preview page for displaying various resource types based on file extension.
77 lines
1.5 KiB
TypeScript
77 lines
1.5 KiB
TypeScript
/**
|
|
* 课程资源类型
|
|
* @enum {string}
|
|
*/
|
|
export type CourseResourceType =
|
|
| "video"
|
|
| "image"
|
|
| "doc"
|
|
| "ppt"
|
|
| "resource"
|
|
| "temp";
|
|
|
|
/**
|
|
* 课程资源
|
|
* @interface
|
|
*/
|
|
export interface IResource {
|
|
id: number;
|
|
resourceName: string;
|
|
resourceSize: number;
|
|
resourceType: CourseResourceType;
|
|
resourceUrl: string;
|
|
allowDownload: boolean;
|
|
isRepo: boolean;
|
|
ownerId: number;
|
|
}
|
|
|
|
export type ICreateResource = Omit<IResource, "id">;
|
|
|
|
/**
|
|
* 课程小节
|
|
* @interface
|
|
* @property {string} id - 章节的唯一标识符
|
|
* @property {string} title - 章节的标题
|
|
* @property {ICourseResource[]} resources - 章节中的资源数组
|
|
*/
|
|
export interface ICourseSection {
|
|
id: number;
|
|
title: string;
|
|
resources: IResource[];
|
|
}
|
|
|
|
/**
|
|
* 课程章节
|
|
* @interface
|
|
* @property {string} id - 章节的唯一标识符
|
|
* @property {string} title - 章节的标题
|
|
* @property {boolean} is_published - 指示章节是否已发布
|
|
* @property {ICourseSection[]} sections - 章节中的小节数组
|
|
* @property {[]} [detections] - 待定。
|
|
*/
|
|
export interface ICourseChapter {
|
|
id: number;
|
|
title: string;
|
|
isPublished: boolean;
|
|
sections: ICourseSection[];
|
|
detections?: [];
|
|
}
|
|
|
|
/**
|
|
* 课程
|
|
* @interface
|
|
*/
|
|
export interface ICourse {
|
|
id: number;
|
|
courseName: string;
|
|
profile: string;
|
|
previewUrl: string | null;
|
|
schoolName: string;
|
|
teacherName: string;
|
|
semester: string;
|
|
status: number;
|
|
created_at: Date;
|
|
updated_at: Date;
|
|
remark: string | null;
|
|
}
|