|
|
@@ -20,15 +20,19 @@
|
|
|
暂无课程
|
|
|
</template>
|
|
|
<el-table-column type="index"/>
|
|
|
- <el-table-column prop="courseName" label="课程名称" width="280"/>
|
|
|
- <el-table-column prop="description" label="描述" width="420"/>
|
|
|
+ <el-table-column prop="courseName" label="课程名称"/>
|
|
|
+ <!-- <el-table-column prop="description" label="描述" width="420"/> -->
|
|
|
<el-table-column prop="endTime" label="截止时间" sortable/>
|
|
|
<el-table-column label="操作">
|
|
|
<template #default="scope">
|
|
|
- <el-button @click="handleShowDetail(scope.row.courseId)" style="margin-right: 0; margin-left: 0;padding-left: 10px; padding-right: 10px" color="#597D3B">
|
|
|
+ <el-button @click="handleShowDetail(scope.row.courseId)" style="margin-right: 0; margin-left: 0;padding-left: 10px; padding-right: 10px" type="primary">
|
|
|
<el-icon style="margin-right: 3px" ><ZoomIn/></el-icon>
|
|
|
详情
|
|
|
</el-button>
|
|
|
+ <el-button @click="handleDelete(scope.row.courseId)" style="margin-right: 0; margin-left: 15px;padding-left: 10px; padding-right: 10px" type="danger">
|
|
|
+ <el-icon style="margin-right: 3px" ><DeleteFilled/></el-icon>
|
|
|
+ {{role == 'teachers' ? "删除" : "退课"}}
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -117,11 +121,12 @@
|
|
|
import {useStore} from "@/store";
|
|
|
import {inject, onMounted, reactive, ref} from "vue";
|
|
|
import type {CourseVO} from "@/types/vo";
|
|
|
- import {Refresh, Search, UploadFilled, ZoomIn} from "@element-plus/icons-vue";
|
|
|
+ import {Refresh, Search, UploadFilled, ZoomIn, DeleteFilled} from "@element-plus/icons-vue";
|
|
|
import router from "@/router";
|
|
|
import type {CourseDTO} from "@/types/dto";
|
|
|
import {
|
|
|
ElMessage,
|
|
|
+ ElMessageBox,
|
|
|
ElNotification,
|
|
|
type UploadFile,
|
|
|
type UploadFiles,
|
|
|
@@ -380,6 +385,36 @@
|
|
|
label: "未结课"
|
|
|
},
|
|
|
]
|
|
|
+
|
|
|
+ const handleDelete = (courseId : number)=>{
|
|
|
+ ElMessageBox.confirm('您确定要执行此操作吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ if(role == "teachers") {
|
|
|
+ apis.deleteCourse(courseId)
|
|
|
+ .then((res: any) => {
|
|
|
+ ElMessage.success("执行成功")
|
|
|
+ doRefresh()
|
|
|
+ })
|
|
|
+ .catch((err: any) => {
|
|
|
+ console.error(err);
|
|
|
+ })
|
|
|
+ .finally(() => {});
|
|
|
+ } else {
|
|
|
+ apis.dropCourse(courseId)
|
|
|
+ .then((res: any) => {
|
|
|
+ ElMessage.success("执行成功")
|
|
|
+ doRefresh()
|
|
|
+ })
|
|
|
+ .catch((err: any) => {
|
|
|
+ console.error(err);
|
|
|
+ })
|
|
|
+ .finally(() => {});
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<script lang="ts">
|