From 9ea649625463a4770dc6d9a521fb94041cd2666a Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 13 Dec 2024 14:23:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/main.css | 5 + src/assets/img/empty.svg | 1 + src/router/index.js | 14 +- src/views/course/content/index.vue | 1028 +++++++++++++++++ src/views/course/content/source.vue | 303 +++++ src/views/course/{Add.vue => detail.vue} | 63 +- src/views/course/{Curriculum.vue => list.vue} | 6 +- src/views/resourse/index.vue | 118 +- 8 files changed, 1413 insertions(+), 125 deletions(-) create mode 100644 src/assets/img/empty.svg create mode 100644 src/views/course/content/index.vue create mode 100644 src/views/course/content/source.vue rename src/views/course/{Add.vue => detail.vue} (96%) rename src/views/course/{Curriculum.vue => list.vue} (98%) diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 1bc4f51..705f82b 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -504,4 +504,9 @@ li { line-height: 1.8; cursor: pointer; } +} +.el-drawer__header > :first-child { + font-size: 16px; + font-weight: 600; + color: #333; } \ No newline at end of file diff --git a/src/assets/img/empty.svg b/src/assets/img/empty.svg new file mode 100644 index 0000000..01ac22e --- /dev/null +++ b/src/assets/img/empty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 3e3f6d9..0f6c045 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -79,19 +79,15 @@ let router = new Router({ }, { path: '/curriculum', - component: () => import('../views/course/Curriculum.vue'), + component: () => import('../views/course/list'), }, { - path: '/addcurriculum', - component: () => import('../views/course/AddCurriculum.vue'), + path: '/curriculum/detail', + component: () => import('../views/course/detail'), }, { - path: '/curriculum/add', - component: () => import('../views/course/Add'), - }, - { - path: '/contentSettings', - component: () => import('../views/course/contentSettings.vue'), + path: '/curriculum/content', + component: () => import('../views/course/content'), }, { path: '/data', diff --git a/src/views/course/content/index.vue b/src/views/course/content/index.vue new file mode 100644 index 0000000..b696554 --- /dev/null +++ b/src/views/course/content/index.vue @@ -0,0 +1,1028 @@ + + + + + \ No newline at end of file diff --git a/src/views/course/content/source.vue b/src/views/course/content/source.vue new file mode 100644 index 0000000..346a2b0 --- /dev/null +++ b/src/views/course/content/source.vue @@ -0,0 +1,303 @@ + + + + \ No newline at end of file diff --git a/src/views/course/Add.vue b/src/views/course/detail.vue similarity index 96% rename from src/views/course/Add.vue rename to src/views/course/detail.vue index c15d5eb..97fff1e 100644 --- a/src/views/course/Add.vue +++ b/src/views/course/detail.vue @@ -215,7 +215,7 @@
上一步 - 下一步 + 下一步 保存 返回
@@ -461,18 +461,8 @@ export default { getInfoData () { this.$post(`${this.api.curriculumDetail}?cid=${this.cid}`).then(({ data }) => { if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e) - if (data.categoryId) { - this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => { - this.ProfessionalClassList = res.list; - }).catch(res => { }); - } - if (data.professionalCategoryId) { - this.$get(this.api.courseProfessional, { professionalClassId: data.professionalCategoryId }).then(res => { - this.ProfessionalList = res.list; - }).catch(res => { }); - } + this.form = data this.$nextTick(() => { - this.form = data; const pList = data.practiceConfig const { systemsAll } = this pList.map(e => { @@ -486,11 +476,16 @@ export default { }) this.assessmentData = aList - const cList = data.competitionConfig - cList.map(e => { - if (!systemsAll.find(n => n.systemId == e.systemId)) e.disabled = true + + this.form.curriculumDisciplines.forEach(e => { + this.$set(e, 'professionalClassList', []) + this.$set(e, 'professionalList', []) + e.categoryId && this.getProfessionalClassData(e) + e.professionalCategoryId && this.getProfessionalData(e) + if (!e.categoryId) this.$set(e, 'categoryId', '') + if (!e.professionalCategoryId) this.$set(e, 'professionalCategoryId', '') + if (!e.professionalId) this.$set(e, 'professionalId', '') }) - this.matches = cList }); }).catch(err => { }); @@ -845,7 +840,7 @@ export default { this.step-- }, async save (next) { - const { step } = this + const { step, cid } = this // 第一步 if (step === 1) { this.$refs.form.validate(async (valid) => { @@ -861,27 +856,21 @@ export default { spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' }) - if (this.cid) { - this.$post(this.api.modifyCourse, form).then((res) => { - this.$message.success("编辑成功"); - }).catch((res) => { - this.submiting = false - this.loadIns.close() - }); - } else { - this.$post(this.api.createCurriculum, form).then(({ cid }) => { - this.loadIns.close() - if (next) { - this.step = 2 - this.cid = cid - this.$router.replace('add?cid=' + cid) - } else { - this.back() + try { + const res = await this.$post(this.api[cid ? 'modifyCourse' : 'createCurriculum'], form) + this.loadIns.close() + if (next) { + this.step = 2 + if (!cid) { + this.cid = res.cid + this.$router.replace('detail?cid=' + res.cid) } - }).catch((res) => { - this.submiting = false - this.loadIns.close() - }) + } else { + this.back() + } + } finally { + this.submiting = false + this.loadIns.close() } } }) diff --git a/src/views/course/Curriculum.vue b/src/views/course/list.vue similarity index 98% rename from src/views/course/Curriculum.vue rename to src/views/course/list.vue index 748003f..a35bc1c 100644 --- a/src/views/course/Curriculum.vue +++ b/src/views/course/list.vue @@ -218,17 +218,17 @@ export default { // 新建课程 addcourse () { this.setReferrer() - this.$router.push("/curriculum/add"); + this.$router.push("/curriculum/detail"); }, // 编辑 edit (row) { this.setReferrer() - this.$router.push(`/curriculum/add?cid=${row.cid}`); + this.$router.push(`/curriculum/detail?cid=${row.cid}`); }, // 内容设置 config (row) { this.setReferrer() - this.$router.push(`/contentSettings?cid=${row.cid}&name=${row.curriculumName}`); + this.$router.push(`/curriculum/content?cid=${row.cid}&name=${row.curriculumName}`); }, // 删除 handleDelete (row) { diff --git a/src/views/resourse/index.vue b/src/views/resourse/index.vue index 356295c..8ef2bb0 100644 --- a/src/views/resourse/index.vue +++ b/src/views/resourse/index.vue @@ -64,10 +64,10 @@ @@ -77,25 +77,16 @@ - - - - - - - - - - + + + + + + - 取 消 - 确 定 + 取消 + 确定 @@ -241,6 +232,12 @@ export default { }, loading: false, now: '', + + + sectionNameVisible: false, + sectionForm: { + sectionName: '' + }, }; }, watch: { @@ -309,14 +306,6 @@ export default { }) this.matchData = data.records - this.now = await Util.getNow() - clearInterval(this.timer) - this.handleBeganStage() - this.timer = setInterval(() => { - this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1)) - this.handleBeganStage() - }, 1000) - this.total = data.total this.$refs.table.clearSelection() this.loading = false @@ -338,28 +327,6 @@ export default { } }) }, - // 定时处理是否要显示修改结束时间按钮 - async handleBeganStage () { - this.matchData.map(e => { - if (!e.playingStages) { - this.$set(e, 'playingStages', []) - } else { - e.playingStages = [] - } - // 如果当前时间在竞赛开始结束时间之间 - if (this.now >= new Date(e.playStartTime) && this.now <= new Date(e.playEndTime)) { - // 遍历赛事阶段 - if (e.competitionStageList) { - for (const n of e.competitionStageList) { - // 判断是否有开始了的阶段 - if (this.now >= new Date(n.startTime) && this.now <= new Date(n.endTime)) { - e.playingStages.push(n) - } - } - } - } - }) - }, initData () { this.page = 1; this.getData(); @@ -372,6 +339,12 @@ export default { this.setReferrer() this.$router.push("/addMatch"); }, + edit (row, chapterId) { + this.chapterId = chapterId; + this.sectionId = row.id; + this.sectionForm.sectionName = row.name; + this.sectionNameVisible = true; + }, // 复制 copy (row) { this.$confirm('确定要复制吗', "提示", { @@ -382,30 +355,6 @@ export default { this.initData() }).catch(() => { }) }, - // 修改结束时间 - editEndTime (row) { - this.modifyVisible = true - row.newEndTime = '' - this.curRow = row - }, - // 修改结束时间提交 - modifySubmit () { - const row = this.curRow - const data = [] - row.competitionStageList.map(e => { - const stage = row.playingStages.find(n => n.contentId === e.contentId && n.newEndTime) - if (stage && stage.newEndTime) stage.endTime = this.formatDate('yyyy-MM-dd hh:mm:ss', stage.newEndTime) - data.push(stage || e) - }) - this.$post(this.api.editCompetitionContent, { - competitionContents: data - }).then(async res => { - await this.$post(`${this.api.refreshPageNotification}?content=1`) - Util.successMsg('修改成功') - this.modifyVisible = false - this.getData() - }).catch(err => { }) - }, // 管理 manage (row) { this.setReferrer() @@ -420,8 +369,8 @@ export default { sourceChange (val) { this.initData() }, - delData (row) { - this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { + del (row) { + this.$confirm("删除后用户将无法再查看和使用此资源,确定删除?", "提示", { type: "warning" }) .then(() => { @@ -476,6 +425,23 @@ export default { await this.$post(`${this.api.refreshPageNotification}?content=1`) }, + + sectionNameSubmit () { + if (!this.sectionForm.sectionName) return this.$message.warning("请填写资源名称"); + let data = { + id: this.sectionId, + cid: this.id, + chapterId: this.chapterId, + name: this.sectionForm.sectionName + }; + this.$put(this.api.editSubsection, data).then(res => { + this.$message.success("修改成功"); + this.sectionNameVisible = false; + this.getData(); + }) + .catch(err => { + }); + }, } };