diff --git a/src/utils/api.js b/src/utils/api.js
index 9e9be42..ad9c761 100644
--- a/src/utils/api.js
+++ b/src/utils/api.js
@@ -166,6 +166,7 @@ export default {
getInternalProjectBySystemId: `occupationlab/occupationlab/projectManage/getInternalProjectBySystemId`, //根据系统id、项目权限获取系统内置项目
checkConfig: `nakadai/nakadai/curriculum/checkConfig`,
deleteCoursePrompt: `nakadai/nakadai/curriculum/deleteCoursePrompt`,
+ combinationResource: `nakadai/nakadai/curriculum/combinationResource`,
// 课程章节管理
addChapter: `nakadai/nakadai/curriculum/chapter/addChapter`, //添加章节
editChapter: `nakadai/nakadai/curriculum/chapter/editChapter`, //修改章节
@@ -209,6 +210,7 @@ export default {
deleteSubsectionTheoretical: `occupationlab/occupationlab/theoreticalCourseSubsection/deleteSubsection`, // 根据id删除小节
editSubsectionTheoretical: `occupationlab/occupationlab/theoreticalCourseSubsection/editSubsection`, // 修改小节
getSubsectionTheoretical: `occupationlab/occupationlab/theoreticalCourseSubsection/getSubsection`, // 根据小节id获取预览文件地址
+ deleteSubsectionBatch: `nakadai/nakadai/curriculum/subsection/deleteSubsectionBatch`,
// 栏目管理
addColumn: `occupationlab/occupationlab/information/column/addColumn`,
diff --git a/src/views/course/content/index.vue b/src/views/course/content/index.vue
index 56457dc..9c18a0d 100644
--- a/src/views/course/content/index.vue
+++ b/src/views/course/content/index.vue
@@ -28,7 +28,7 @@
添加系统资源
本地上传
批量移动
- 批量移除
+ 批量移除
@@ -294,6 +294,11 @@ export default {
this.$get(`${this.api.queryChaptersAndSubsections}/${this.id}`).then(res => {
const list = res.chapterList
if (list.length) {
+ list.forEach(e => {
+ e.subsectionList.forEach(n => {
+ n.check = false
+ })
+ })
if (this.chapterId) {
const cur = list.find(e => e.id === this.chapterId)
this.sections = cur ? cur.subsectionList : []
@@ -394,7 +399,7 @@ export default {
},
sort () {
this.originChapters = JSON.parse(JSON.stringify(this.chapters))
- this.sorting = true;
+ this.sorting = true
},
// 批量移动
move () {
@@ -426,6 +431,24 @@ export default {
this.$message.warning('请选择小节!')
}
},
+ // 批量移除小节
+ batchDelSection () {
+ const list = this.sections.filter(e => e.check)
+ this.$confirm(list.length ? '此删除操作不可逆,是否确认删除选中项?' : '此删除操作不可逆,是否确认全部资源?', "提示", {
+ type: "warning"
+ }).then(async () => {
+ await this.$post(this.api.deleteSubsectionBatch, {
+ chapterId: this.chapterId,
+ subsectionIds: list.map(e => e.id)
+ })
+ this.sections.forEach(e => {
+ e.check = false
+ })
+
+ this.$message.success("删除成功")
+ this.getData()
+ }).catch(() => { })
+ },
// 目标章节选择回调
chapterChange (id) {
const list = []
diff --git a/src/views/course/content/source.vue b/src/views/course/content/source.vue
index d638bc2..ab33339 100644
--- a/src/views/course/content/source.vue
+++ b/src/views/course/content/source.vue
@@ -252,17 +252,21 @@ export default {
// 提交
async submit () {
try {
- const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list)
- let invalid = 0
- let hasQues = 0
- list.map((e, i) => {
- if (+e.count !== res.list[i].questions.length) invalid = 1
- if (e.examQuestions.length) hasQues = 1
- e.score = 0
+ if (this.submiting) return false
+ this.submiting = true
+ const { checked } = this
+ const { chapterId, id } = this.$parent
+ const result = checked.map(e => {
+ return {
+ chapterId,
+ cid: id,
+ resourceId: e.id,
+ type: e.cid ? 0 : 1,
+ }
})
-
+ const res = await this.$post(this.api.combinationResource, result)
this.sourceVisible = false
- this.$parent.calcDifficult()
+ this.$parent.getData()
this.submiting = false
} catch (e) {
this.submiting = false
diff --git a/src/views/course/detail.vue b/src/views/course/detail.vue
index 97fff1e..7f3e156 100644
--- a/src/views/course/detail.vue
+++ b/src/views/course/detail.vue
@@ -302,6 +302,7 @@