|
|
@@ -137,6 +137,8 @@
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="dialogConfig.visible = false; cleanNewAssignmentInfo()">取消</el-button>
|
|
|
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
|
|
+ <!-- TODO:有点问题 总是删除失败 -->
|
|
|
+ <!-- <el-button type="danger" @click="confirmDelete()">删除作业</el-button> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
@@ -153,6 +155,7 @@ import {defineProps, inject, onMounted, reactive, ref} from 'vue';
|
|
|
import {
|
|
|
ElMessage,
|
|
|
ElNotification,
|
|
|
+ ElMessageBox,
|
|
|
type UploadFile,
|
|
|
type UploadFiles,
|
|
|
type UploadProps,
|
|
|
@@ -162,6 +165,7 @@ import {defineProps, inject, onMounted, reactive, ref} from 'vue';
|
|
|
import ViewsWordEditor from "@/components/ViewsWordEditor/ViewsWordEditor.vue";
|
|
|
import {useStore} from "@/store";
|
|
|
import {Search, Edit, UploadFilled, Plus} from "@element-plus/icons-vue"
|
|
|
+import { userInfo } from 'os';
|
|
|
|
|
|
const props = defineProps<{
|
|
|
tableData: IAssignmentTableItem[],
|
|
|
@@ -423,7 +427,9 @@ const openEditor = (url: string, title: string) => {
|
|
|
ElNotification({
|
|
|
title: '新增成功',
|
|
|
type: 'success',
|
|
|
- })
|
|
|
+ });
|
|
|
+ //TODO: 新建作业后自动刷新页面 但是怎么跳转回作业列表页面?
|
|
|
+ location.reload();
|
|
|
}else {
|
|
|
ElNotification({
|
|
|
title: '新增失败',
|
|
|
@@ -464,6 +470,46 @@ const openEditor = (url: string, title: string) => {
|
|
|
}
|
|
|
doRefresh();
|
|
|
}
|
|
|
+//传teacherId:number, assignmentId:number
|
|
|
+ const confirmDelete = () => {
|
|
|
+ ElMessageBox.confirm('确定要删除这个作业吗?', '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ deleteAssignment();
|
|
|
+ }).catch(() => {
|
|
|
+ // 用户选择取消,什么都不做
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const deleteAssignment = () => {
|
|
|
+ //TODO:teacherId,assignmentId
|
|
|
+ apis.deleteById(store.user.id,IAssignmentId.value)
|
|
|
+
|
|
|
+ .then((res: any) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ ElMessage({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ // 这里可以调用刷新数据的方法
|
|
|
+ doRefresh();
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '删除失败!'+res.data.message
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '请求出错!'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
const isDisabled = (teacherId: string, endDate: string) => {
|
|
|
if(props.role == 'teachers'){// 是教师且不是作业发布人则禁用
|