|
@@ -175,9 +175,9 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import CourseCard from "@/components/CourseCard";
|
|
import CourseCard from "@/components/CourseCard";
|
|
|
-import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
|
|
|
+import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
import client from "@/utils/oss";
|
|
import client from "@/utils/oss";
|
|
|
-import { Back, Document } from "@element-plus/icons-vue";
|
|
|
|
|
|
|
+import {Back, Document} from "@element-plus/icons-vue";
|
|
|
import TestCard from "@/components/TestCard";
|
|
import TestCard from "@/components/TestCard";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -254,16 +254,16 @@ export default {
|
|
|
required: true, validator: validateName, trigger: "blur",
|
|
required: true, validator: validateName, trigger: "blur",
|
|
|
},
|
|
},
|
|
|
year: {
|
|
year: {
|
|
|
- required: true, message: "请选择年份", trigger: "change",
|
|
|
|
|
|
|
+ required: true, message: "请选择年份", trigger: "blur",
|
|
|
},
|
|
},
|
|
|
season: {
|
|
season: {
|
|
|
- required: true, message: "请选择季节", trigger: "change",
|
|
|
|
|
|
|
+ required: true, message: "请选择季节", trigger: "blur",
|
|
|
},
|
|
},
|
|
|
description: {
|
|
description: {
|
|
|
required: true, message: "请输入课程简介", trigger: "blur",
|
|
required: true, message: "请输入课程简介", trigger: "blur",
|
|
|
},
|
|
},
|
|
|
time: {
|
|
time: {
|
|
|
- required: true, validator: validateTime, trigger: "change",
|
|
|
|
|
|
|
+ required: true, validator: validateTime, trigger: "blur",
|
|
|
},
|
|
},
|
|
|
invitationCode: {
|
|
invitationCode: {
|
|
|
required: true, validator: validateCode, trigger: "blur",
|
|
required: true, validator: validateCode, trigger: "blur",
|
|
@@ -277,19 +277,19 @@ export default {
|
|
|
myCourseList: [],
|
|
myCourseList: [],
|
|
|
courseType: "all",
|
|
courseType: "all",
|
|
|
courseTypeOptions: [
|
|
courseTypeOptions: [
|
|
|
- { value: "all", label: "全部课程" },
|
|
|
|
|
- { value: "pending", label: "未开始" },
|
|
|
|
|
- { value: "start", label: "正在进行" },
|
|
|
|
|
- { value: "end", label: "已结束" },
|
|
|
|
|
|
|
+ {value: "all", label: "全部课程"},
|
|
|
|
|
+ {value: "pending", label: "未开始"},
|
|
|
|
|
+ {value: "start", label: "正在进行"},
|
|
|
|
|
+ {value: "end", label: "已结束"},
|
|
|
],
|
|
],
|
|
|
evalExamList: [],
|
|
evalExamList: [],
|
|
|
coderExamList: [],
|
|
coderExamList: [],
|
|
|
examType: "all",
|
|
examType: "all",
|
|
|
examTypeOptions: [
|
|
examTypeOptions: [
|
|
|
- { value: "all", label: "全部测试" },
|
|
|
|
|
- { value: "pending", label: "未开始" },
|
|
|
|
|
- { value: "start", label: "正在进行" },
|
|
|
|
|
- { value: "end", label: "已结束" },
|
|
|
|
|
|
|
+ {value: "all", label: "全部测试"},
|
|
|
|
|
+ {value: "pending", label: "未开始"},
|
|
|
|
|
+ {value: "start", label: "正在进行"},
|
|
|
|
|
+ {value: "end", label: "已结束"},
|
|
|
],
|
|
],
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
@@ -311,10 +311,10 @@ export default {
|
|
|
this.$router.push("portal");
|
|
this.$router.push("portal");
|
|
|
}
|
|
}
|
|
|
if (index === "1") {
|
|
if (index === "1") {
|
|
|
- document.getElementById("app").scrollIntoView({ behavior: "smooth" });
|
|
|
|
|
|
|
+ document.getElementById("app").scrollIntoView({behavior: "smooth"});
|
|
|
}
|
|
}
|
|
|
if (index === "2") {
|
|
if (index === "2") {
|
|
|
- document.querySelector("#manage-page-divider").scrollIntoView({ behavior: "smooth" });
|
|
|
|
|
|
|
+ document.querySelector("#manage-page-divider").scrollIntoView({behavior: "smooth"});
|
|
|
}
|
|
}
|
|
|
this.activeIndex = index;
|
|
this.activeIndex = index;
|
|
|
},
|
|
},
|
|
@@ -345,6 +345,7 @@ export default {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function createOrUpdateCourse() {
|
|
function createOrUpdateCourse() {
|
|
|
|
|
+ console.log(_this.form);
|
|
|
if (_this.form.id === null) {
|
|
if (_this.form.id === null) {
|
|
|
_this.$apis.createCourse({
|
|
_this.$apis.createCourse({
|
|
|
name: _this.form.name,
|
|
name: _this.form.name,
|
|
@@ -366,11 +367,7 @@ export default {
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
_this.myCourseList.push(res.data.data);
|
|
_this.myCourseList.push(res.data.data);
|
|
|
_this.dialogVisible = false;
|
|
_this.dialogVisible = false;
|
|
|
- _this.$refs.formRef.resetFields();
|
|
|
|
|
- _this.form.courseTime = [null, null];
|
|
|
|
|
- _this.form.fileList = [];
|
|
|
|
|
- _this.form.coderLink = false;
|
|
|
|
|
- _this.form.evalLink = false;
|
|
|
|
|
|
|
+ _this.clearForm();
|
|
|
ElMessage.success("新建课程成功");
|
|
ElMessage.success("新建课程成功");
|
|
|
})
|
|
})
|
|
|
.catch(err => {
|
|
.catch(err => {
|
|
@@ -397,11 +394,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
_this.$refs["courseCard" + _this.form.id][0].$props.courseVO = res.data.data;
|
|
_this.$refs["courseCard" + _this.form.id][0].$props.courseVO = res.data.data;
|
|
|
_this.dialogVisible = false;
|
|
_this.dialogVisible = false;
|
|
|
- _this.$refs.formRef.resetFields();
|
|
|
|
|
- _this.form.courseTime = [null, null];
|
|
|
|
|
- _this.form.fileList = [];
|
|
|
|
|
- _this.form.coderLink = false;
|
|
|
|
|
- _this.form.evalLink = false;
|
|
|
|
|
|
|
+ _this.clearForm();
|
|
|
ElMessage.success("更新课程成功");
|
|
ElMessage.success("更新课程成功");
|
|
|
})
|
|
})
|
|
|
.catch(err => {
|
|
.catch(err => {
|
|
@@ -420,16 +413,29 @@ export default {
|
|
|
})
|
|
})
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
this.dialogVisible = false;
|
|
this.dialogVisible = false;
|
|
|
- this.$refs.formRef.resetFields();
|
|
|
|
|
- this.form.courseTime = [null, null];
|
|
|
|
|
- this.form.fileList = [];
|
|
|
|
|
- this.form.coderLink = false;
|
|
|
|
|
- this.form.evalLink = false;
|
|
|
|
|
|
|
+ this.clearForm();
|
|
|
})
|
|
})
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
|
console.log(err);
|
|
console.log(err);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ clearForm() {
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ id: null,
|
|
|
|
|
+ name: "",
|
|
|
|
|
+ year: "",
|
|
|
|
|
+ season: "",
|
|
|
|
|
+ description: "",
|
|
|
|
|
+ courseTime: [null, null],
|
|
|
|
|
+ invitationCode: "",
|
|
|
|
|
+ price: "0",//input均会将Number类型转化成为字符串类型
|
|
|
|
|
+ moocUrl: null,
|
|
|
|
|
+ fileList: [],
|
|
|
|
|
+ imageUrl: null,
|
|
|
|
|
+ coderLink: false,
|
|
|
|
|
+ evalLink: false,
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
// el-upload相关的方法
|
|
// el-upload相关的方法
|
|
|
handleChange(file, fileList) {
|
|
handleChange(file, fileList) {
|
|
|
this.form.fileList = fileList;
|
|
this.form.fileList = fileList;
|
|
@@ -478,17 +484,32 @@ export default {
|
|
|
if (item.state === "EXAMPLE") {
|
|
if (item.state === "EXAMPLE") {
|
|
|
ElMessage.error("无法删除示例课程");
|
|
ElMessage.error("无法删除示例课程");
|
|
|
} else {
|
|
} else {
|
|
|
- this.$apis.deleteCourse(item.id)
|
|
|
|
|
- .then(res => {
|
|
|
|
|
- for (let i = 0; i < this.myCourseList.length; i++) {
|
|
|
|
|
- if (this.myCourseList[i].id === item.id) {
|
|
|
|
|
- this.myCourseList.splice(i, 1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- ElMessage.success(res.data.data);
|
|
|
|
|
|
|
+ ElMessageBox.confirm(
|
|
|
|
|
+ "确定删除课程",
|
|
|
|
|
+ "Warning",
|
|
|
|
|
+ {
|
|
|
|
|
+ confirmButtonText: "立即删除",
|
|
|
|
|
+ cancelButtonText: "让我想想",
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ center: true,
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.$apis.deleteCourse(item.id)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ for (let i = 0; i < this.myCourseList.length; i++) {
|
|
|
|
|
+ if (this.myCourseList[i].id === item.id) {
|
|
|
|
|
+ this.myCourseList.splice(i, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ElMessage.success(res.data.data);
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
- .catch(err => {
|
|
|
|
|
- ElMessage.error(err);
|
|
|
|
|
|
|
+ .catch(() => {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ type: "info",
|
|
|
|
|
+ message: "取消删除",
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|