From 258de92737d32a5e2f7d20b67203eefb96c6f787 Mon Sep 17 00:00:00 2001 From: GoCo Date: Fri, 25 Jul 2025 17:03:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=AB=A0=E8=8A=82=20=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/lessonSection/index.ts | 42 ++++++ web/src/views/lessonSection/edit.vue | 148 +++++++++++++++++++ web/src/views/lessonSection/index.vue | 199 ++++++++++++++++++++++++++ web/src/views/lessonSection/model.ts | 129 +++++++++++++++++ web/src/views/lessonSection/view.vue | 96 +++++++++++++ 5 files changed, 614 insertions(+) create mode 100644 web/src/api/lessonSection/index.ts create mode 100644 web/src/views/lessonSection/edit.vue create mode 100644 web/src/views/lessonSection/index.vue create mode 100644 web/src/views/lessonSection/model.ts create mode 100644 web/src/views/lessonSection/view.vue diff --git a/web/src/api/lessonSection/index.ts b/web/src/api/lessonSection/index.ts new file mode 100644 index 0000000..e1f0ae6 --- /dev/null +++ b/web/src/api/lessonSection/index.ts @@ -0,0 +1,42 @@ +import { http, jumpExport } from '@/utils/http/axios'; + +// 获取课程章节列表 +export function List(params) { + return http.request({ + url: '/lessonSection/list', + method: 'get', + params, + }); +} + +// 删除/批量删除课程章节 +export function Delete(params) { + return http.request({ + url: '/lessonSection/delete', + method: 'POST', + params, + }); +} + +// 添加/编辑课程章节 +export function Edit(params) { + return http.request({ + url: '/lessonSection/edit', + method: 'POST', + params, + }); +} + +// 获取课程章节指定详情 +export function View(params) { + return http.request({ + url: '/lessonSection/view', + method: 'GET', + params, + }); +} + +// 导出课程章节 +export function Export(params) { + jumpExport('/lessonSection/export', params); +} \ No newline at end of file diff --git a/web/src/views/lessonSection/edit.vue b/web/src/views/lessonSection/edit.vue new file mode 100644 index 0000000..5849d8c --- /dev/null +++ b/web/src/views/lessonSection/edit.vue @@ -0,0 +1,148 @@ + + + + + \ No newline at end of file diff --git a/web/src/views/lessonSection/index.vue b/web/src/views/lessonSection/index.vue new file mode 100644 index 0000000..c425628 --- /dev/null +++ b/web/src/views/lessonSection/index.vue @@ -0,0 +1,199 @@ + + + + + \ No newline at end of file diff --git a/web/src/views/lessonSection/model.ts b/web/src/views/lessonSection/model.ts new file mode 100644 index 0000000..e39bc73 --- /dev/null +++ b/web/src/views/lessonSection/model.ts @@ -0,0 +1,129 @@ +import { h, ref } from 'vue'; +import { cloneDeep } from 'lodash-es'; +import { FormSchema } from '@/components/Form'; +import { renderOptionTag, renderPopoverMemberSumma, MemberSumma } from '@/utils'; +import { useDictStore } from '@/store/modules/dict'; + +const dict = useDictStore(); + +export class State { + public id = 0; // id + public lessonId = null; // 课程id + public videoUrl = ''; // 视频url + public name = ''; // 章节名 + public sortOrder = 0; // 排序号 + public parentId = 0; // 父章节id + public level = 0; // 章节层级 + public revision = 0; // 乐观锁 + public createdBy = 0; // 创建人 + public createdBySumma?: null | MemberSumma = null; // 创建人摘要信息 + public createdTime = ''; // 创建时间 + public updatedBy = 0; // 更新人 + public updatedBySumma?: null | MemberSumma = null; // 更新人摘要信息 + public updatedTime = ''; // 更新时间 + + constructor(state?: Partial) { + if (state) { + Object.assign(this, state); + } + } +} + +export function newState(state: State | Record | null): State { + if (state !== null) { + if (state instanceof State) { + return cloneDeep(state); + } + return new State(state); + } + return new State(); +} + +// 表单验证规则 + +// 表格搜索表单 +export const schemas = ref([ + { + field: 'id', + component: 'NInputNumber', + label: 'id', + componentProps: { + placeholder: '请输入id', + onUpdateValue: (e: any) => { + console.log(e); + }, + }, + }, +]); + +// 表格列 +export const columns = [ + { + title: 'id', + key: 'id', + align: 'left', + width: -1, + }, + { + title: '课程id', + key: 'lessonId', + align: 'left', + width: -1, + render(row: State) { + return renderOptionTag('lessonOption', row.lessonId); + }, + }, + { + title: '视频url', + key: 'videoUrl', + align: 'left', + width: -1, + }, + { + title: '章节名', + key: 'name', + align: 'left', + width: -1, + }, + { + title: '排序号', + key: 'sortOrder', + align: 'left', + width: -1, + }, + { + title: '父章节id', + key: 'parentId', + align: 'left', + width: -1, + }, + { + title: '章节层级', + key: 'level', + align: 'left', + width: -1, + }, + { + title: '创建人', + key: 'createdBy', + align: 'left', + width: -1, + render(row: State) { + return renderPopoverMemberSumma(row.createdBySumma); + }, + }, + { + title: '更新人', + key: 'updatedBy', + align: 'left', + width: -1, + render(row: State) { + return renderPopoverMemberSumma(row.updatedBySumma); + }, + }, +]; + +// 加载字典数据选项 +export function loadOptions() { + dict.loadOptions(['lessonOption']); +} \ No newline at end of file diff --git a/web/src/views/lessonSection/view.vue b/web/src/views/lessonSection/view.vue new file mode 100644 index 0000000..1ffea1c --- /dev/null +++ b/web/src/views/lessonSection/view.vue @@ -0,0 +1,96 @@ + + + + + \ No newline at end of file