diff --git a/src/api/index.js b/src/api/index.js
index fa374ea..4096ae7 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -520,6 +520,8 @@ export default {
curriculumList: `nakadai/nakadai/curriculum/curriculumList`,
createCurriculum: `nakadai/nakadai/curriculum/createCurriculum`,
modifyCourse: `nakadai/nakadai/curriculum/modifyCourse`,
+ schoolCourseProject: `nakadai/nakadai/curriculum/schoolCourseProject`,
+ // schoolCourseProject: `nakadai/nakadai/curriculum/schoolCourseProject`,
// 教师评语
addComment: `evaluation/cevaluation/comment/addComment`,
diff --git a/src/assets/img/drag.svg b/src/assets/img/drag.svg
new file mode 100644
index 0000000..3fba973
--- /dev/null
+++ b/src/assets/img/drag.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/pages/lesson/content/index.vue b/src/pages/lesson/content/index.vue
index 9c18a0d..8fcfd73 100644
--- a/src/pages/lesson/content/index.vue
+++ b/src/pages/lesson/content/index.vue
@@ -1,6 +1,6 @@
-
@@ -198,14 +201,13 @@ import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
import Util from '@/libs/util'
import Source from './source'
+import Draggable from 'vuedraggable'
export default {
+ components: { Pdf, Upload, Source, Draggable },
data () {
return {
name: this.$route.query.name,
- headers: {
- token: sessionStorage.getItem('token')
- },
id: this.$route.query.cid,
originChapters: [],
chapters: [],
@@ -273,10 +275,13 @@ export default {
sort: 'bottom'
},
sourceVisible: false,
- sections: []
+ sections: [],
+
+ dragGroup: {
+ pull: false,
+ },
};
},
- components: { Pdf, Upload, Source },
mounted () {
this.insertScript();
this.id && this.getData();
@@ -291,7 +296,7 @@ export default {
},
methods: {
getData () {
- this.$get(`${this.api.queryChaptersAndSubsections}/${this.id}`).then(res => {
+ this.$get(`${this.api.curriculumChapter}/${this.id}`).then(res => {
const list = res.chapterList
if (list.length) {
list.forEach(e => {
@@ -449,6 +454,24 @@ export default {
this.getData()
}).catch(() => { })
},
+ // 拖拽后回调
+ async updateSort (e) {
+ e.preventDefault()
+ console.log(33, this.sections)
+ const { chapters, sections, chapterId } = this
+ chapters.forEach((n, k) => {
+ n.sort = k + 1
+ if (n.id === chapterId) n.subsectionList = sections
+ n.subsectionList.forEach((j, i) => {
+ j.sort = i + 1
+ j.chapterId = n.id
+ })
+ })
+ await this.$post(this.api.reorder, {
+ chapterVOList: chapters
+ })
+ this.getData()
+ },
// 目标章节选择回调
chapterChange (id) {
const list = []
@@ -741,46 +764,45 @@ export default {
sortChapter (row, type, disabled, index) {
if (!disabled) {
if (type == "up") {
- let tempItem = this.chapters.splice(index - 1, 1)[0];
- this.chapters.splice(index, 0, tempItem);
+ let tempItem = this.chapters.splice(index - 1, 1)[0]
+ this.chapters.splice(index, 0, tempItem)
} else {
- let tempItem = this.chapters.splice(index + 1, 1)[0];
- this.chapters.splice(index, 0, tempItem);
+ let tempItem = this.chapters.splice(index + 1, 1)[0]
+ this.chapters.splice(index, 0, tempItem)
}
}
},
sectionNameSubmit () {
- if (!this.sectionForm.sectionName) return this.$message.warning("请填写小节名称");
- let data = {
+ if (!this.sectionForm.sectionName) return this.$message.warning("请填写小节名称")
+ this.$put(this.api.editSubsection, {
id: this.sectionId,
cid: this.id,
chapterId: this.chapterId,
name: this.sectionForm.sectionName
- };
- this.$put(this.api.editSubsection, data).then(res => {
+ }).then(res => {
this.$message.success("修改成功")
this.sectionNameVisible = false
- this.getData();
+ this.getData()
}).catch(err => { })
},
closePlayer () {
- this.playAuth = "";
- this.player.pause();
+ this.playAuth = ""
+ this.player.pause()
},
closeIframe () {
- this.iframeSrc = "";
+ this.iframeSrc = ""
this.videoSrc = ''
- this.showMask = false;
- this.showMask1 = false;
- this.showMask2 = false;
- this.previewing = false;
+ this.showMask = false
+ this.showMask1 = false
+ this.showMask2 = false
+ this.previewing = false
},
back () {
// 如果是预览则关闭预览
if (this.previewing) {
- this.closeIframe();
+ this.closeIframe()
} else {
- this.$router.push(this.$store.state.referrer || '/curriculum')
+ this.$router.push(this.$store.state.referrer || 'list')
}
},
}
@@ -977,6 +999,11 @@ export default {
background-color: #f9f9f9;
}
+ .drag {
+ margin-right: 10px;
+ cursor: pointer;
+ }
+
.section-left,
.section-right {
display: inline-flex;
diff --git a/src/pages/lesson/detail/index.vue b/src/pages/lesson/detail/index.vue
index 0c853d9..0a12313 100644
--- a/src/pages/lesson/detail/index.vue
+++ b/src/pages/lesson/detail/index.vue
@@ -2,7 +2,7 @@
-
-
-
-
-
-
- {{ section.name }}
-
+
+
+
+
+
+
+
+ {{ section.name }}
+