重构作业结构:优化实体模型、DTO映射和前端界面
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 13s
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 13s
- 重构AppMainStruct、AssignmentQuestion、Question等实体模型 - 更新相关DTO以匹配新的数据结构 - 优化前端页面布局和组件 - 添加全局信息和笔记功能相关代码 - 更新数据库迁移和程序配置
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -34,9 +36,11 @@ namespace Entities.Contracts
|
||||
|
||||
public enum DifficultyLevel : byte
|
||||
{
|
||||
simple,
|
||||
easy,
|
||||
medium,
|
||||
hard
|
||||
hard,
|
||||
veryHard
|
||||
}
|
||||
|
||||
public enum QuestionType : byte
|
||||
@@ -55,47 +59,131 @@ namespace Entities.Contracts
|
||||
|
||||
public enum SubjectAreaEnum : byte
|
||||
{
|
||||
Unknown = 0,
|
||||
Mathematics, // 数学
|
||||
Physics, // 物理
|
||||
Chemistry, // 化学
|
||||
Biology, // 生物
|
||||
History, // 历史
|
||||
Geography, // 地理
|
||||
[Display(Name = "未知", Description = "未知")]
|
||||
Unknown = 0,
|
||||
|
||||
[Display(Name = "数学", Description = "数")]
|
||||
Mathematics, // 数学
|
||||
|
||||
[Display(Name = "物理", Description = "物")]
|
||||
Physics, // 物理
|
||||
|
||||
[Display(Name = "化学", Description = "化")]
|
||||
Chemistry, // 化学
|
||||
|
||||
[Display(Name = "生物", Description = "生")]
|
||||
Biology, // 生物
|
||||
|
||||
[Display(Name = "历史", Description = "史")]
|
||||
History, // 历史
|
||||
|
||||
[Display(Name = "地理", Description = "地")]
|
||||
Geography, // 地理
|
||||
|
||||
[Display(Name = "语文", Description = "语")]
|
||||
Literature, // 语文/文学
|
||||
English, // 英语
|
||||
ComputerScience, // 计算机科学
|
||||
|
||||
[Display(Name = "英语", Description = "英")]
|
||||
English, // 英语
|
||||
|
||||
[Display(Name = "计算机科学", Description = "计")]
|
||||
ComputerScience // 计算机科学
|
||||
}
|
||||
|
||||
public enum AssignmentStructType : byte
|
||||
{
|
||||
[Display(Name = "根节点", Description = "根")]
|
||||
Root,
|
||||
[Display(Name = "单个问题", Description = "问")]
|
||||
Question,
|
||||
[Display(Name = "问题组", Description = "组")]
|
||||
Group,
|
||||
[Display(Name = "结构", Description = "结")]
|
||||
Struct,
|
||||
[Display(Name = "子问题", Description = "子")]
|
||||
SubQuestion,
|
||||
[Display(Name = "选项", Description = "选")]
|
||||
Option
|
||||
}
|
||||
|
||||
|
||||
public enum ExamType : byte
|
||||
{
|
||||
MidtermExam, // 期中
|
||||
FinalExam, // 期末
|
||||
MonthlyExam, // 月考
|
||||
WeeklyExam, // 周考
|
||||
DailyTest, // 平时测试
|
||||
AITest, // AI测试
|
||||
}
|
||||
[Display(Name = "期中考试", Description = "中")]
|
||||
MidtermExam,
|
||||
|
||||
[Display(Name = "期末考试", Description = "末")]
|
||||
FinalExam,
|
||||
|
||||
[Display(Name = "月考", Description = "月")]
|
||||
MonthlyExam,
|
||||
|
||||
[Display(Name = "周考", Description = "周")]
|
||||
WeeklyExam,
|
||||
|
||||
[Display(Name = "平时测试", Description = "平")]
|
||||
DailyTest,
|
||||
|
||||
[Display(Name = "AI测试", Description = "AI")]
|
||||
AITest,
|
||||
}
|
||||
|
||||
public enum SubmissionStatus
|
||||
{
|
||||
Pending, // 待提交/未开始
|
||||
Submitted, // 已提交
|
||||
Graded, // 已批改
|
||||
Resubmission, // 待重新提交 (如果允许)
|
||||
Late, // 迟交
|
||||
Draft, // 草稿
|
||||
[Display(Name = "待提交/未开始", Description = "待")]
|
||||
Pending,
|
||||
|
||||
[Display(Name = "已提交", Description = "提")]
|
||||
Submitted,
|
||||
|
||||
[Display(Name = "已批改", Description = "批")]
|
||||
Graded,
|
||||
|
||||
[Display(Name = "待重新提交", Description = "重")]
|
||||
Resubmission,
|
||||
|
||||
[Display(Name = "迟交", Description = "迟")]
|
||||
Late,
|
||||
|
||||
[Display(Name = "草稿", Description = "草")]
|
||||
Draft,
|
||||
}
|
||||
|
||||
public static class EnumExtensions
|
||||
{
|
||||
public static string GetDisplayName(this Enum enumValue)
|
||||
{
|
||||
var fieldInfo = enumValue.GetType().GetField(enumValue.ToString());
|
||||
|
||||
if (fieldInfo == null)
|
||||
{
|
||||
return enumValue.ToString();
|
||||
}
|
||||
|
||||
var displayAttribute = fieldInfo.GetCustomAttribute<DisplayAttribute>();
|
||||
|
||||
if (displayAttribute != null)
|
||||
{
|
||||
return displayAttribute.Name;
|
||||
}
|
||||
|
||||
return enumValue.ToString();
|
||||
}
|
||||
|
||||
public static string GetShortName(this Enum enumValue)
|
||||
{
|
||||
var memberInfo = enumValue.GetType().GetMember(enumValue.ToString()).FirstOrDefault();
|
||||
|
||||
if (memberInfo != null)
|
||||
{
|
||||
var displayAttribute = memberInfo.GetCustomAttribute<DisplayAttribute>();
|
||||
|
||||
if (displayAttribute != null && !string.IsNullOrEmpty(displayAttribute.Description))
|
||||
{
|
||||
return displayAttribute.Description;
|
||||
}
|
||||
}
|
||||
|
||||
return enumValue.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user