diff --git a/src/api/index.js b/src/api/index.js index c1717c1..8288b4a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -83,6 +83,8 @@ export default { reportDetail: `occupationlab/occupationlab/achievement/reportDetail`, // 查看实验报告 schoolCourseByAchievement: `nakadai/nakadai/curriculum/schoolCourseByAchievement`, // 获取学校购买订单后的课程 spliceClass: `occupationlab/occupationlab/achievement/spliceClass`, + exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`, + exportBankExperimentReport: `occupationlab/occupationlab/achievement/exportBankExperimentReport`, // 项目管理 getSystemIdBySchool: `occupationlab/occupationlab/projectManage/getSystemIdBySchool`, // 获取学校下拥有的系统 @@ -158,20 +160,20 @@ export default { articleSort: `${host2}occupationlab/occupationlab/information/article/articleSort`, // 课程管理 - queryCourseByCondition: `occupationlab/occupationlab/management/edu/course/queryCourseByCondition`, // 课程列表分页条件查询 - addCourse: `occupationlab/occupationlab/management/edu/course/addCourse`, // 添加课程 - deleteCourse: `occupationlab/occupationlab/management/edu/course/deleteCourse`, // 根据id删除课程 - deleteCourses: `occupationlab/occupationlab/management/edu/course/deleteCourses`, // 批量删除课程 - editCourse: `occupationlab/occupationlab/management/edu/course/editCourse`, // 修改课程 - enableCourse: `occupationlab/occupationlab/management/schoolCourse/enableGlCourse`, // 是否启用管理端课程 - getCourse: `occupationlab/occupationlab/management/edu/course/getCourse`, // 根据id查询课程 + delTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/batchDeletion`, + findTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/findById`, + listTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/pageConditionalQueryCourse`, + saveTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/save`, + updateTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/update`, + disabledTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/disabledEvents`, + checkRepeatTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/checkRepeat`, // 分类管理 - checkRepeat: `occupationlab/theoreticalCourseClassification/checkRepeat`, - delClassification: `occupationlab/theoreticalCourseClassification/delete`, - findClassification: `occupationlab/theoreticalCourseClassification/findById`, - listClassification: `occupationlab/theoreticalCourseClassification/pagingQuery`, - saveClassification: `occupationlab/theoreticalCourseClassification/save`, - updateClassification: `occupationlab/theoreticalCourseClassification/update`, + checkRepeat: `occupationlab/occupationlab/theoreticalCourseClassification/checkRepeat`, + delClassification: `occupationlab/occupationlab/theoreticalCourseClassification/delete`, + findClassification: `occupationlab/occupationlab/theoreticalCourseClassification/findById`, + listClassification: `occupationlab/occupationlab/theoreticalCourseClassification/pagingQuery`, + saveClassification: `occupationlab/occupationlab/theoreticalCourseClassification/save`, + updateClassification: `occupationlab/occupationlab/theoreticalCourseClassification/update`, // 课程章节管理 addChapter: `occupationlab/occupationlab/management/edu/courseChapter/addChapter`, chapterReorder: `occupationlab/occupationlab/management/edu/courseChapter/chapterReorder`, diff --git a/src/components/menuTree/index.vue b/src/components/menuTree/index.vue new file mode 100644 index 0000000..648e2f8 --- /dev/null +++ b/src/components/menuTree/index.vue @@ -0,0 +1,35 @@ + + + + diff --git a/src/pages/achievement/show/index.vue b/src/pages/achievement/show/index.vue index f89492a..cc25d04 100644 --- a/src/pages/achievement/show/index.vue +++ b/src/pages/achievement/show/index.vue @@ -5,6 +5,9 @@
+
+ 导出报告 +
标准实验报告
@@ -131,6 +134,7 @@ diff --git a/src/pages/course/add/index.vue b/src/pages/course/add/index.vue index 6eb88d9..bd546bc 100644 --- a/src/pages/course/add/index.vue +++ b/src/pages/course/add/index.vue @@ -7,39 +7,43 @@ - - + +
- +
- +
- - + + +
-
- 本校 -
+
+ 全平台 +
+
+ 仅本校 +
- +
- - + +
- +
- - + +
- + - + - {{ form.id ? "更新" : "创建" }} + {{ form.id ? "更新" : "创建" }}
@@ -82,25 +86,116 @@ import Setting from "@/setting"; import quill from "@/components/quill"; export default { - name: "courseAddEdit", data() { + const that = this return { headers: { - token: util.local.get(Setting.tokenKey) + token: util.local.get(Setting.tokenKey) }, isDetail: Boolean(this.$route.query.show), form: { id: this.$route.query.id, - classificationId: '', + courseIntroduction: '', + courseName: '', + courseType: 0, coverUrl: '', - name: '', - description: '', - distinguish: 1 + platformSource: Setting.platformSource, + platformClassificationIds: [], + schoolClassificationsIds: [], + visibleRange: 1 + }, + rules: { + courseName: [ + { required: true, message: '请输入课程名称', trigger: 'blur' } + ], + // platformClassificationIds: [ + // { required: true, message: '请选择课程分类', trigger: 'change' } + // ], + coverUrl: [ + { required: true, message: '请选择课程封面', trigger: 'change' } + ] }, + platformClassificationList: [], classificationList: [], uploadList: [], submiting: false, - updateTime: 0 + updateTime: 0, + + rangeVisible: false, + range: [], + rangeInit: [], + rangeName: '', + rangeChecked: [], + schools: [], + rangeList: [], + rangeTimer: null, + // 选择区域懒加载 + props: { + multiple: true, + checkStrictly: true, + lazy: true, + lazyLoad (node, resolve) { + // 如果是在模糊搜索中,则不再用懒加载请求数据 + const input = document.querySelector('.el-cascader__search-input') + const checked = that.rangeChecked + + if (input && input.value.trim()) { + const val = input.value.trim() + return that.schools.filter(e => e.label.includes(val)) + } + + const { level, value } = node + // 省份 + if (!level) { + that.$get(that.api.queryProvince).then(({ list }) => { + const data = [] + list.map(e => { + e.value = e.provinceId + e.label = e.provinceName + e.children = [] + e.disabled = !!checked.find(n => n.provinceId == e.provinceId && !n.cityId) + data.push(e) + }) + resolve(data) + }).catch(res => {}) + } else if (level === 1) { + // 城市 + that.$get(that.api.queryCity, { + provinceId: value + }).then(({ list }) => { + const data = [] + list.map(e => { + e.value = e.cityId + e.label = e.cityName + e.children = [] + e.disabled = !!checked.find(n => n.cityId == e.cityId && n.provinceId == e.provinceId && !n.schoolId) + data.push(e) + }) + resolve(data) + }).catch(res => {}) + } else if (level === 2) { + // 学校 + that.$get(that.api.getSchoolsByProvince, { + provinceId: node.data.provinceId, + cityId: value, + schoolName: '' + }).then(({ list }) => { + const data = [] + list.map(e => { + e.value = e.schoolId + e.label = e.schoolName + e.leaf = true + e.disabled = !!checked.find(n => n.schoolId == e.schoolId && n.cityId == e.cityId && n.provinceId == e.provinceId) + data.push(e) + }) + resolve(data) + }).catch(res => {}) + } else { + resolve([]) + } + } + }, + nameRepeat: false }; }, watch: { @@ -113,58 +208,96 @@ export default { } }, mounted() { - this.getClassification(); - this.form.id && this.getData(); + this.getClassification() + this.form.id && this.getData() }, components: { quill }, methods: { - getClassification() { - this.$get(this.api.queryGlClassification).then(res => { - this.classificationList = res.classificationList; - }).catch(res => {}); - }, - getData() { - this.$get(`${this.api.getCourse}/${this.form.id}`).then(({ course }) => { - this.form = course - this.uploadList.push({ - name: "cover.jpg", - url: course.coverUrl - }) - }).catch(err => {}) - }, - handleExceed(files, fileList) { // 上传文件 - util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); - }, - uploadSuccess(res, file, fileList) { - this.form.coverUrl = res.data.filesResult.fileUrl - }, - uploadError(err, file, fileList) { - this.$message({ - message: "上传出错,请重试!", - type: "error", - center: true - }); - }, - beforeRemove(file, fileList) { - return this.$confirm(`确定移除 ${file.name}?`); - }, - handleRemove(file, fileList) { - let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', ""); - this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { - this.form.coverUrl = '' - }).catch(res => {}); - }, - save() { + // 分类 + getClassification() { + // 中台分类 + this.$post(this.api.listClassification, { + pageNum: 1, + pageSize: 1000, + platformSource: 0 + }).then(({ page }) => { + this.platformClassificationList = page.records + }).catch(res => {}) + + // 教师端分类 + this.$post(this.api.listClassification, { + pageNum: 1, + pageSize: 1000, + platformSource: Setting.platformSource + }).then(({ page }) => { + this.classificationList = page.records + }).catch(res => {}) + }, + getData() { + this.$post(`${this.api.findTheoreticalCourse}?id=${this.form.id}`).then(({ data }) => { + // 分类id处理 + if (data.platformClassificationList) { + data.platformClassificationIds = data.platformClassificationList.map(e => e.classificationId) + delete data.platformClassificationList + } + if (data.schoolClassificationsList) { + data.schoolClassificationsIds = data.schoolClassificationsList.map(e => e.classificationId) + delete data.schoolClassificationsList + } + this.form = data + this.uploadList.push({ + name: "cover.jpg", + url: data.coverUrl + }) + }).catch(err => {}) + }, + // 名称判重 + nameChange(val) { + this.$post(this.api.checkRepeatTheoreticalCourse, { + id: this.form.id, + courseName: val, + platformSource: Setting.platformSource + }).then(res => { + this.nameRepeat = false + }).catch(err => { + this.nameRepeat = true + }) + }, + handleExceed(files, fileList) { // 上传文件 + util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); + }, + uploadSuccess(res, file, fileList) { + this.form.coverUrl = res.data.filesResult.fileUrl + }, + uploadError(err, file, fileList) { + this.$message({ + message: "上传出错,请重试!", + type: "error", + center: true + }); + }, + beforeRemove(file, fileList) { + return this.$confirm(`确定移除 ${file.name}?`); + }, + handleRemove(file, fileList) { + let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', ""); + this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { + this.form.coverUrl = '' + }).catch(res => {}); + }, + save() { + this.$refs.form.validate((valid) => { + if (valid) { + if (this.nameRepeat) return util.errorMsg('当前课程名已存在!') if (this.submiting) return false const { form } = this - if (!form.name) return util.warningMsg("请填写课程名称") - if (!form.classificationId) return util.warningMsg("请选择课程分类") - if (!form.coverUrl) return util.warningMsg("请上传课程封面") this.submiting = true if (form.id) { - this.$put(this.api.editCourse, form).then(res => { + form.courseId = form.id + form.platformSource = Setting.platformSource + this.$post(this.api.updateTheoreticalCourse, form).then(res => { this.submiting = false; util.successMsg("修改成功"); this.$router.back(); @@ -172,14 +305,14 @@ export default { this.submiting = false; }); } else { - this.$post(this.api.addCourse, form).then(res => { + this.$post(this.api.saveTheoreticalCourse, form).then(res => { this.submiting = false; this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", { type: "success", confirmButtonText: "马上设置", cancelButtonText: "稍后操作" }).then(() => { - this.$router.push(`/course/contentSettings?id=${res.courseId}`); + this.$router.push(`/setTheoreticalCourse?id=${res.id}`); }).catch(() => { this.$router.back(); }); @@ -187,27 +320,29 @@ export default { this.submiting = false; }); } - }, - // 返回上一页 - backPage() { - this.$router.back() - }, - back() { - const { id } = this.form - const updateTime = this.updateTime - // 更改了信息才需要提示 - if ((id && updateTime > 2) || (!id && updateTime)) { - this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { - type: 'warning' - }).then(() => { - this.save() - }).catch(() => { - this.backPage() - }) - } else { - this.backPage() } + }) + }, + // 返回上一页 + backPage() { + this.$router.back() + }, + back() { + const { id } = this.form + const updateTime = this.updateTime + // 更改了信息才需要提示 + if ((id && updateTime > 2) || (!id && updateTime)) { + this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.save() + }).catch(() => { + this.backPage() + }) + } else { + this.backPage() } + } } }; @@ -279,4 +414,13 @@ $avatar-width: 104px; width: 100%; } } +.range-check { + display: inline-block; + margin: 0 0 10px 10px; +} +/deep/.range-cas { + .el-tag { + display: none; + } +} \ No newline at end of file diff --git a/src/pages/course/list/courseManagement/index.vue b/src/pages/course/list/courseManagement/index.vue index 9c3352f..1396ce4 100644 --- a/src/pages/course/list/courseManagement/index.vue +++ b/src/pages/course/list/courseManagement/index.vue @@ -5,9 +5,9 @@
  • - + - +
  • @@ -21,26 +21,21 @@
- + - + - + - + - - -