This commit is contained in:
2025-09-04 18:31:00 +08:00
parent 52c321ff57
commit 1064046016
79 changed files with 12873 additions and 7 deletions
+46
View File
@@ -197,6 +197,52 @@ func (i *initApi) InitializeData(ctx context.Context) (context.Context, error) {
{ApiGroup: "版本控制", Method: "POST", Path: "/sysVersion/importVersion", Description: "同步版本"},
{ApiGroup: "版本控制", Method: "DELETE", Path: "/sysVersion/deleteSysVersion", Description: "删除版本"},
{ApiGroup: "版本控制", Method: "DELETE", Path: "/sysVersion/deleteSysVersionByIds", Description: "批量删除版本"},
// 学习系统 - 课程管理
{ApiGroup: "课程管理", Method: "POST", Path: "/course/createCourse", Description: "创建课程"},
{ApiGroup: "课程管理", Method: "DELETE", Path: "/course/deleteCourse", Description: "删除课程"},
{ApiGroup: "课程管理", Method: "DELETE", Path: "/course/deleteCourseByIds", Description: "批量删除课程"},
{ApiGroup: "课程管理", Method: "PUT", Path: "/course/updateCourse", Description: "更新课程"},
{ApiGroup: "课程管理", Method: "GET", Path: "/course/findCourse", Description: "根据ID获取课程"},
{ApiGroup: "课程管理", Method: "GET", Path: "/course/getCourseList", Description: "获取课程列表"},
{ApiGroup: "课程管理", Method: "GET", Path: "/course/getPublishedCourses", Description: "获取已发布课程列表"},
// 学习系统 - 章节管理
{ApiGroup: "章节管理", Method: "POST", Path: "/chapter/createChapter", Description: "创建章节"},
{ApiGroup: "章节管理", Method: "DELETE", Path: "/chapter/deleteChapter", Description: "删除章节"},
{ApiGroup: "章节管理", Method: "DELETE", Path: "/chapter/deleteChapterByIds", Description: "批量删除章节"},
{ApiGroup: "章节管理", Method: "PUT", Path: "/chapter/updateChapter", Description: "更新章节"},
{ApiGroup: "章节管理", Method: "GET", Path: "/chapter/findChapter", Description: "根据ID获取章节"},
{ApiGroup: "章节管理", Method: "GET", Path: "/chapter/getChapterList", Description: "获取章节列表"},
{ApiGroup: "章节管理", Method: "GET", Path: "/chapter/getChaptersByCourse", Description: "根据课程获取章节列表"},
// 学习系统 - 知识点管理
{ApiGroup: "知识点管理", Method: "POST", Path: "/knowledgePoint/createKnowledgePoint", Description: "创建知识点"},
{ApiGroup: "知识点管理", Method: "DELETE", Path: "/knowledgePoint/deleteKnowledgePoint", Description: "删除知识点"},
{ApiGroup: "知识点管理", Method: "DELETE", Path: "/knowledgePoint/deleteKnowledgePointByIds", Description: "批量删除知识点"},
{ApiGroup: "知识点管理", Method: "PUT", Path: "/knowledgePoint/updateKnowledgePoint", Description: "更新知识点"},
{ApiGroup: "知识点管理", Method: "GET", Path: "/knowledgePoint/findKnowledgePoint", Description: "根据ID获取知识点"},
{ApiGroup: "知识点管理", Method: "GET", Path: "/knowledgePoint/getKnowledgePointList", Description: "获取知识点列表"},
{ApiGroup: "知识点管理", Method: "GET", Path: "/knowledgePoint/getKnowledgePointsByChapter", Description: "根据章节获取知识点列表"},
// 学习系统 - 题目管理
{ApiGroup: "题目管理", Method: "POST", Path: "/question/createQuestion", Description: "创建题目"},
{ApiGroup: "题目管理", Method: "DELETE", Path: "/question/deleteQuestion", Description: "删除题目"},
{ApiGroup: "题目管理", Method: "DELETE", Path: "/question/deleteQuestionByIds", Description: "批量删除题目"},
{ApiGroup: "题目管理", Method: "PUT", Path: "/question/updateQuestion", Description: "更新题目"},
{ApiGroup: "题目管理", Method: "GET", Path: "/question/findQuestion", Description: "根据ID获取题目"},
{ApiGroup: "题目管理", Method: "GET", Path: "/question/getQuestionList", Description: "获取题目列表"},
{ApiGroup: "题目管理", Method: "GET", Path: "/question/getQuestionsByKnowledgePoint", Description: "根据知识点获取题目列表"},
// 学习系统 - 学习记录管理
{ApiGroup: "学习记录管理", Method: "POST", Path: "/userLearning/createUserLearning", Description: "创建学习记录"},
{ApiGroup: "学习记录管理", Method: "DELETE", Path: "/userLearning/deleteUserLearning", Description: "删除学习记录"},
{ApiGroup: "学习记录管理", Method: "DELETE", Path: "/userLearning/deleteUserLearningByIds", Description: "批量删除学习记录"},
{ApiGroup: "学习记录管理", Method: "PUT", Path: "/userLearning/updateUserLearning", Description: "更新学习记录"},
{ApiGroup: "学习记录管理", Method: "GET", Path: "/userLearning/findUserLearning", Description: "根据ID获取学习记录"},
{ApiGroup: "学习记录管理", Method: "GET", Path: "/userLearning/getUserLearningList", Description: "获取学习记录列表"},
{ApiGroup: "学习记录管理", Method: "GET", Path: "/userLearning/getUserProgress", Description: "获取用户学习进度"},
{ApiGroup: "学习记录管理", Method: "GET", Path: "/userLearning/getLearningStatistics", Description: "获取用户学习统计"},
}
if err := db.Create(&entities).Error; err != nil {
return ctx, errors.Wrap(err, sysModel.SysApi{}.TableName()+"表数据初始化失败!")
+10
View File
@@ -50,6 +50,16 @@ func (i *initDict) InitializeData(ctx context.Context) (next context.Context, er
{Name: "数据库浮点型", Type: "float64", Status: &True, Desc: "数据库浮点型"},
{Name: "数据库字符串", Type: "string", Status: &True, Desc: "数据库字符串"},
{Name: "数据库bool类型", Type: "bool", Status: &True, Desc: "数据库bool类型"},
// 学习系统字典
{Name: "课程难度", Type: "course_difficulty", Status: &True, Desc: "课程难度等级字典"},
{Name: "课程状态", Type: "course_status", Status: &True, Desc: "课程状态字典"},
{Name: "章节状态", Type: "chapter_status", Status: &True, Desc: "章节状态字典"},
{Name: "知识点状态", Type: "knowledge_status", Status: &True, Desc: "知识点状态字典"},
{Name: "题目类型", Type: "question_type", Status: &True, Desc: "题目类型字典"},
{Name: "题目难度", Type: "question_difficulty", Status: &True, Desc: "题目难度等级字典"},
{Name: "学习状态", Type: "learning_status", Status: &True, Desc: "用户学习状态字典"},
{Name: "考试状态", Type: "exam_status", Status: &True, Desc: "考试状态字典"},
}
if err = db.Create(&entities).Error; err != nil {
+59
View File
@@ -98,6 +98,65 @@ func (i *initDictDetail) InitializeData(ctx context.Context) (context.Context, e
{Label: "tinyint", Value: "1", Extend: "mysql", Status: &True},
{Label: "bool", Value: "2", Extend: "pgsql", Status: &True},
}
// 课程难度字典详情
dicts[6].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "初级", Value: "beginner", Status: &True, Sort: 1},
{Label: "中级", Value: "intermediate", Status: &True, Sort: 2},
{Label: "高级", Value: "advanced", Status: &True, Sort: 3},
}
// 课程状态字典详情
dicts[7].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "草稿", Value: "draft", Status: &True, Sort: 1},
{Label: "已发布", Value: "published", Status: &True, Sort: 2},
{Label: "已下架", Value: "archived", Status: &True, Sort: 3},
}
// 章节状态字典详情
dicts[8].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "草稿", Value: "draft", Status: &True, Sort: 1},
{Label: "已发布", Value: "published", Status: &True, Sort: 2},
{Label: "隐藏", Value: "hidden", Status: &True, Sort: 3},
}
// 知识点状态字典详情
dicts[9].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "草稿", Value: "draft", Status: &True, Sort: 1},
{Label: "已发布", Value: "published", Status: &True, Sort: 2},
{Label: "隐藏", Value: "hidden", Status: &True, Sort: 3},
}
// 题目类型字典详情
dicts[10].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "单选题", Value: "single_choice", Status: &True, Sort: 1},
{Label: "多选题", Value: "multiple_choice", Status: &True, Sort: 2},
{Label: "判断题", Value: "true_false", Status: &True, Sort: 3},
{Label: "填空题", Value: "fill_blank", Status: &True, Sort: 4},
}
// 题目难度字典详情
dicts[11].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "简单", Value: "easy", Status: &True, Sort: 1},
{Label: "中等", Value: "medium", Status: &True, Sort: 2},
{Label: "困难", Value: "hard", Status: &True, Sort: 3},
}
// 学习状态字典详情
dicts[12].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "未开始", Value: "not_started", Status: &True, Sort: 1},
{Label: "学习中", Value: "learning", Status: &True, Sort: 2},
{Label: "已完成", Value: "completed", Status: &True, Sort: 3},
{Label: "已暂停", Value: "paused", Status: &True, Sort: 4},
}
// 考试状态字典详情
dicts[13].SysDictionaryDetails = []sysModel.SysDictionaryDetail{
{Label: "草稿", Value: "draft", Status: &True, Sort: 1},
{Label: "已发布", Value: "published", Status: &True, Sort: 2},
{Label: "已结束", Value: "ended", Status: &True, Sort: 3},
{Label: "已取消", Value: "cancelled", Status: &True, Sort: 4},
}
for _, dict := range dicts {
if err := db.Model(&dict).Association("SysDictionaryDetails").
Replace(dict.SysDictionaryDetails); err != nil {
+15
View File
@@ -62,6 +62,8 @@ func (i *initMenu) InitializeData(ctx context.Context) (next context.Context, er
{MenuLevel: 0, Hidden: false, ParentId: 0, Path: "https://www.gin-vue-admin.com", Name: "https://www.gin-vue-admin.com", Component: "/", Sort: 0, Meta: Meta{Title: "官方网站", Icon: "customer-gva"}},
{MenuLevel: 0, Hidden: false, ParentId: 0, Path: "state", Name: "state", Component: "view/system/state.vue", Sort: 8, Meta: Meta{Title: "服务器状态", Icon: "cloudy"}},
{MenuLevel: 0, Hidden: false, ParentId: 0, Path: "plugin", Name: "plugin", Component: "view/routerHolder.vue", Sort: 6, Meta: Meta{Title: "插件系统", Icon: "cherry"}},
{MenuLevel: 0, Hidden: false, ParentId: 0, Path: "learning", Name: "learning", Component: "view/routerHolder.vue", Sort: 3, Meta: Meta{Title: "教学管理", Icon: "management"}},
{MenuLevel: 0, Hidden: false, ParentId: 0, Path: "student", Name: "student", Component: "view/routerHolder.vue", Sort: 2, Meta: Meta{Title: "在线学习", Icon: "reading"}},
}
// 先创建父级菜单(ParentId = 0 的菜单)
@@ -109,6 +111,19 @@ func (i *initMenu) InitializeData(ctx context.Context) (next context.Context, er
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["plugin"], Path: "pubPlug", Name: "pubPlug", Component: "view/systemTools/pubPlug/pubPlug.vue", Sort: 3, Meta: Meta{Title: "打包插件", Icon: "files"}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["plugin"], Path: "plugin-email", Name: "plugin-email", Component: "plugin/email/view/index.vue", Sort: 4, Meta: Meta{Title: "邮件插件", Icon: "message"}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["plugin"], Path: "anInfo", Name: "anInfo", Component: "plugin/announcement/view/info.vue", Sort: 5, Meta: Meta{Title: "公告管理[示例]", Icon: "scaleToOriginal"}},
// learning子菜单(教学管理)
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["learning"], Path: "course", Name: "course", Component: "view/learning/admin/course/course.vue", Sort: 1, Meta: Meta{Title: "课程管理", Icon: "notebook", KeepAlive: true}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["learning"], Path: "chapter", Name: "chapter", Component: "view/learning/admin/chapter/chapter.vue", Sort: 2, Meta: Meta{Title: "章节管理", Icon: "collection", KeepAlive: true}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["learning"], Path: "knowledgePoint", Name: "knowledgePoint", Component: "view/learning/admin/knowledgePoint/knowledgePoint.vue", Sort: 3, Meta: Meta{Title: "知识点管理", Icon: "document", KeepAlive: true}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["learning"], Path: "question", Name: "question", Component: "view/learning/admin/question/question.vue", Sort: 4, Meta: Meta{Title: "题目管理", Icon: "edit", KeepAlive: true}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["learning"], Path: "learningRecords", Name: "learningRecords", Component: "view/learning/admin/records/learningRecords.vue", Sort: 5, Meta: Meta{Title: "学习记录", Icon: "histogram", KeepAlive: true}},
// student子菜单(在线学习)
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["student"], Path: "dashboard", Name: "dashboard", Component: "view/learning/student/dashboard/dashboard.vue", Sort: 1, Meta: Meta{Title: "学习首页", Icon: "house", KeepAlive: true}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["student"], Path: "myCourses", Name: "myCourses", Component: "view/learning/student/courses/myCourses.vue", Sort: 2, Meta: Meta{Title: "我的课程", Icon: "notebook", KeepAlive: true}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["student"], Path: "onlineExam", Name: "onlineExam", Component: "view/learning/student/exam/onlineExam.vue", Sort: 3, Meta: Meta{Title: "在线考试", Icon: "medal", KeepAlive: true}},
{MenuLevel: 1, Hidden: false, ParentId: menuNameMap["student"], Path: "wrongQuestions", Name: "wrongQuestions", Component: "view/learning/student/wrongQuestion/wrongQuestions.vue", Sort: 4, Meta: Meta{Title: "我的错题", Icon: "warning", KeepAlive: true}},
}
// 创建子菜单