From db752a36ebe41901835f86548a946a1995e58ba6 Mon Sep 17 00:00:00 2001 From: lijiaqi <1205620597@qq.com> Date: Mon, 29 Jul 2024 15:40:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user/crouse.js | 2 +- src/views/course/basicCourseInformation.vue | 2 +- .../components/KnowledgeGraphUi/FoldAdd.vue | 114 +-- .../KnowledgeGraphUi/foldInfoUi.vue | 122 +-- src/views/course/components/courseEdit.vue | 33 +- src/views/course/courseDetails.vue | 760 +----------------- 6 files changed, 210 insertions(+), 823 deletions(-) diff --git a/src/api/user/crouse.js b/src/api/user/crouse.js index 10b64ce..93de97c 100644 --- a/src/api/user/crouse.js +++ b/src/api/user/crouse.js @@ -14,7 +14,7 @@ export const addCourseApi = (data) => { return request.post(`/api/coursesteacher/addcourse`, data) } -// 获取课程详情 +// 根据id获取课程详情 export const getCourseDetailApi = (id) => { return request.get(`/api/coursesteacher/${id}`) } diff --git a/src/views/course/basicCourseInformation.vue b/src/views/course/basicCourseInformation.vue index 5486314..0169da5 100644 --- a/src/views/course/basicCourseInformation.vue +++ b/src/views/course/basicCourseInformation.vue @@ -34,7 +34,7 @@ const params = ref({ pageNo: 1, pageSize: 7, // username: 'qiuqiu', - username: userStore.userName, + userId: userStore.data.id, assessmenttype: '', category: '', nature: '', diff --git a/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue b/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue index e7d54ad..eb77aad 100644 --- a/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue +++ b/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue @@ -17,7 +17,7 @@ 提交 - 重置 + 重置 @@ -30,21 +30,33 @@ function comNum(n: number | undefined) { } import { ref, reactive, watch, computed, nextTick } from 'vue' const props = defineProps(['isD', 'data']) -const emits = defineEmits(['update:isD','submit']) +const emits = defineEmits(['update:isD', 'submit']) const loading = ref(false) -const updLoading = (boo:boolean) => loading.value = boo +const updLoading = (boo: boolean) => (loading.value = boo) const isDrawer = ref(props.isD) -watch(() => props.isD, newVal => isDrawer.value = newVal) -watch(()=>isDrawer.value,newVal=>emits('update:isD',newVal)) - +watch( + () => props.isD, + (newVal) => (isDrawer.value = newVal), +) +watch( + () => isDrawer.value, + (newVal) => emits('update:isD', newVal), +) const options1 = computed(() => { const arr = props.data.map((item: any, i: number) => { const obj = { ...item } - if (item.chapterSection) obj.chapterSection = item.chapterSection.map((chap: any) => ({ ...chap, disabled: true })) + if (item.chapterSection) + obj.chapterSection = item.chapterSection.map((chap: any) => ({ + ...chap, + disabled: true, + })) else obj.chapterSection = [] - obj.chapterSection.push({ name: `第${i + 1}章第${comNum(item.chapterSection?.length)}节`, pid: item.id }) + obj.chapterSection.push({ + name: `第${i + 1}章第${comNum(item.chapterSection?.length)}节`, + pid: item.id, + }) return obj }) arr.push({ name: `第${arr.length + 1}章`, pid: '' }) @@ -53,10 +65,9 @@ const options1 = computed(() => { const CascaderProps = { label: 'name', value: 'pid', - children: 'chapterSection' + children: 'chapterSection', } - import type { ComponentSize, FormInstance, FormRules } from 'element-plus' interface RuleForm { @@ -84,46 +95,46 @@ interface RuleForm { const formSize = ref('default') const ruleFormRef = ref() const ruleForm = reactive({ - "content": "", - "courseid": "2fa0fd63262230639d2c45a3acd9045c", - "courseobjectivesid": "", - "createBy": "", - "createTime": "", - "id": "", - "name": "", - "num": 0, - "numshow": "", - "onlinclasshours": "", - "pid": undefined, - "requirement": "", - "sysOrgCode": "", - "totalclasshours": "", - "updateBy": "", - "updateTime": "", - "zc": "", - "ziyuan": "", - "zywj": "" + content: '', + courseid: '2fa0fd63262230639d2c45a3acd9045c', + courseobjectivesid: '', + createBy: '', + createTime: '', + id: '', + name: '', + num: 0, + numshow: '', + onlinclasshours: '', + pid: undefined, + requirement: '', + sysOrgCode: '', + totalclasshours: '', + updateBy: '', + updateTime: '', + zc: '', + ziyuan: '', + zywj: '', }) // @ts-ignore const validateChapterOrSection = (rule, value, callback) => { - nextTick(()=>{ - const value =ruleForm.pid + nextTick(() => { + const value = ruleForm.pid if (!value && value !== '') callback(new Error('请选择新增的章或节')) else callback() }) -}; +} // 表单验证 const rules = reactive>({ pid: [ { required: true, validator: validateChapterOrSection, trigger: 'change' }, - ] + ], }) const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) return await formEl.validate((valid, fields) => { if (valid) { - emits('submit',ruleForm,updLoading) + emits('submit', ruleForm, updLoading) } else { console.log('error submit!', fields) } @@ -136,20 +147,25 @@ const resetForm = (formEl: FormInstance | undefined) => { activePidArr.value = undefined } const placeholder = ref('请输入章节名') -watch(() => ruleForm.pid, newVal => { - if (newVal === undefined) placeholder.value = '请输入章节名' - else if (newVal === '') placeholder.value = '请输入章名' - else placeholder.value = '请输入节名' -}) +watch( + () => ruleForm.pid, + (newVal) => { + if (newVal === undefined) placeholder.value = '请输入章节名' + else if (newVal === '') placeholder.value = '请输入章名' + else placeholder.value = '请输入节名' + }, +) const activePidArr = ref([]) -watch(() => activePidArr.value, newVal => {// 设置pid - if (newVal === undefined) { - ruleForm.pid = undefined - return - } - ruleForm.pid = newVal.slice(-1)[0] -}) - - +watch( + () => activePidArr.value, + (newVal) => { + // 设置pid + if (newVal === undefined) { + ruleForm.pid = undefined + return + } + ruleForm.pid = newVal.slice(-1)[0] + }, +) - \ No newline at end of file + diff --git a/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue b/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue index b45d81c..823b067 100644 --- a/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue +++ b/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue @@ -2,47 +2,63 @@
- + -
@@ -63,28 +78,35 @@ - \ No newline at end of file + diff --git a/src/views/course/components/courseEdit.vue b/src/views/course/components/courseEdit.vue index 09426be..032e7af 100644 --- a/src/views/course/components/courseEdit.vue +++ b/src/views/course/components/courseEdit.vue @@ -1,12 +1,13 @@ -