From 0ba717de6eb0ffa591d9e2a51338674d8d049d68 Mon Sep 17 00:00:00 2001 From: lyc Date: Fri, 2 Aug 2024 10:32:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/api/teaching/classwork.js | 8 ++++++++ .../views/prepare/container/file-list-item.vue | 10 +++++++--- src/renderer/src/views/prepare/index.vue | 17 +++++++++++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/api/teaching/classwork.js b/src/renderer/src/api/teaching/classwork.js index db353f3..9412901 100644 --- a/src/renderer/src/api/teaching/classwork.js +++ b/src/renderer/src/api/teaching/classwork.js @@ -25,4 +25,12 @@ export function saveByClassWorkArray(data) { method: 'post', data: data }) +} + +// 删除classwork 作业 +export function delClasswork(id) { + return request({ + url: '/education/classwork/' + id, + method: 'delete' + }) } \ No newline at end of file diff --git a/src/renderer/src/views/prepare/container/file-list-item.vue b/src/renderer/src/views/prepare/container/file-list-item.vue index 07e3489..51a98f2 100644 --- a/src/renderer/src/views/prepare/container/file-list-item.vue +++ b/src/renderer/src/views/prepare/container/file-list-item.vue @@ -70,7 +70,7 @@
- + 删除 @@ -142,7 +142,7 @@ export default { } } }, - emits: { 'on-move': null, 'on-delete': null, 'on-set': null }, + emits: { 'on-move': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null }, data() { return { listenList: [], @@ -228,9 +228,13 @@ export default { }) }) }, - //布置 + // 打开布置作业窗口 setHomeWork(item){ this.$emit('on-set', item) + }, + // 删除作业 + deleteHomework(item){ + this.$emit('on-delhomework', item) } } } diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index e4a9fee..86093b6 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -65,6 +65,7 @@ @on-move="onMoveSingleFile" @on-delete="deleteTalk" @on-set="openSet" + @on-delhomework="delhomework" > @@ -106,6 +107,7 @@ import SetHomework from './container/set-homework.vue' import outLink from '@/utils/linkConfig' import { createWindow } from '@/utils/tool' import { uniqBy, cloneDeep } from 'lodash' +import { delClasswork } from '@/api/teaching/classwork' const { ipcRenderer } = window.electron || {} @@ -340,7 +342,7 @@ export default { pageSize: 500 }) }, - // + // 清除查询作业列表定时器 createTimer() { this.timerId = setInterval(() => { this.getHomeWorkList() @@ -408,7 +410,6 @@ export default { } // 去重 let ary = uniqBy([...this.currentFileList, ...list], 'id') - console.log(ary,1000) // 深度克隆 this.currentFileList = cloneDeep(ary) }) @@ -418,6 +419,18 @@ export default { this.row = row this.setDialog = true }, + // 删除作业 + delhomework(item){ + this.isLoading = true + delClasswork(item.id).then( async res =>{ + ElMessage.success('操作成功') + this.isLoading = false + await this.asyncAllFile() + this.getHomeWorkList() + }).catch(()=>{ + this.isLoading = false + }) + }, closeHomework() { this.setDialog = false },