删除作业

This commit is contained in:
lyc 2024-08-02 10:32:09 +08:00
parent 6e29229e95
commit 0ba717de6e
3 changed files with 30 additions and 5 deletions

View File

@ -25,4 +25,12 @@ export function saveByClassWorkArray(data) {
method: 'post', method: 'post',
data: data data: data
}) })
}
// 删除classwork 作业
export function delClasswork(id) {
return request({
url: '/education/classwork/' + id,
method: 'delete'
})
} }

View File

@ -70,7 +70,7 @@
</el-button> </el-button>
</div> </div>
<div class="item-popover-item"> <div class="item-popover-item">
<el-button text @click="deleteTalk(item)"> <el-button text @click="deleteHomework(item)">
<i class="iconfont icon-shanchu"></i> <i class="iconfont icon-shanchu"></i>
<span>删除</span> <span>删除</span>
</el-button> </el-button>
@ -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() { data() {
return { return {
listenList: [], listenList: [],
@ -228,9 +228,13 @@ export default {
}) })
}) })
}, },
// //
setHomeWork(item){ setHomeWork(item){
this.$emit('on-set', item) this.$emit('on-set', item)
},
//
deleteHomework(item){
this.$emit('on-delhomework', item)
} }
} }
} }

View File

@ -65,6 +65,7 @@
@on-move="onMoveSingleFile" @on-move="onMoveSingleFile"
@on-delete="deleteTalk" @on-delete="deleteTalk"
@on-set="openSet" @on-set="openSet"
@on-delhomework="delhomework"
> >
<el-checkbox label="" :value="item" /> <el-checkbox label="" :value="item" />
</file-list-item> </file-list-item>
@ -106,6 +107,7 @@ import SetHomework from './container/set-homework.vue'
import outLink from '@/utils/linkConfig' import outLink from '@/utils/linkConfig'
import { createWindow } from '@/utils/tool' import { createWindow } from '@/utils/tool'
import { uniqBy, cloneDeep } from 'lodash' import { uniqBy, cloneDeep } from 'lodash'
import { delClasswork } from '@/api/teaching/classwork'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
@ -340,7 +342,7 @@ export default {
pageSize: 500 pageSize: 500
}) })
}, },
// //
createTimer() { createTimer() {
this.timerId = setInterval(() => { this.timerId = setInterval(() => {
this.getHomeWorkList() this.getHomeWorkList()
@ -408,7 +410,6 @@ export default {
} }
// //
let ary = uniqBy([...this.currentFileList, ...list], 'id') let ary = uniqBy([...this.currentFileList, ...list], 'id')
console.log(ary,1000)
// //
this.currentFileList = cloneDeep(ary) this.currentFileList = cloneDeep(ary)
}) })
@ -418,6 +419,18 @@ export default {
this.row = row this.row = row
this.setDialog = true 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() { closeHomework() {
this.setDialog = false this.setDialog = false
}, },