|
|
|
@ -86,7 +86,7 @@ |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="添加小节" :visible.sync="sectionVisible" width="540px" @close="closeSection" |
|
|
|
|
<el-dialog title="本地上传资源" :visible.sync="sectionVisible" width="540px" @close="closeSection" |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<el-form ref="form" :model="sectionForm" label-width="80px" @submit.native.prevent> |
|
|
|
|
<el-form-item label="资源添加"> |
|
|
|
@ -199,6 +199,13 @@ |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="更换内容资源" :visible.sync="switchTypeVisible" width="400px"> |
|
|
|
|
<ul class="source-list"> |
|
|
|
|
<li @click="sourceVisible = true">系统资源</li> |
|
|
|
|
<li @click="editSection">本地上传</li> |
|
|
|
|
</ul> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<Source :visible.sync="sourceVisible" /> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
@ -225,11 +232,11 @@ export default { |
|
|
|
|
uploading: false, |
|
|
|
|
uploadList: [], |
|
|
|
|
chapterVisible: false, |
|
|
|
|
chapterId: "", |
|
|
|
|
chapterName: "", |
|
|
|
|
chapterId: '', |
|
|
|
|
chapterName: '', |
|
|
|
|
sectionVisible: false, |
|
|
|
|
sectionName: "", |
|
|
|
|
sectionId: "", |
|
|
|
|
sectionName: '', |
|
|
|
|
sectionId: '', |
|
|
|
|
switchVisible: false, |
|
|
|
|
sectionNameVisible: false, |
|
|
|
|
|
|
|
|
@ -243,17 +250,18 @@ export default { |
|
|
|
|
}, |
|
|
|
|
keyword: '', |
|
|
|
|
searchTimer: null, |
|
|
|
|
fileId: "", |
|
|
|
|
fileName: "", |
|
|
|
|
fileUrl: "", |
|
|
|
|
originalFileName: "", |
|
|
|
|
fileType: "", |
|
|
|
|
fileId: '', |
|
|
|
|
fileName: '', |
|
|
|
|
fileUrl: '', |
|
|
|
|
originalFileName: '', |
|
|
|
|
fileType: '', |
|
|
|
|
videoSrc: '', |
|
|
|
|
playAuth: "", |
|
|
|
|
playAuth: '', |
|
|
|
|
player: null, |
|
|
|
|
previewImg: "", |
|
|
|
|
iframeSrc: "", |
|
|
|
|
previewImg: '', |
|
|
|
|
iframeSrc: '', |
|
|
|
|
curFile: {}, |
|
|
|
|
curSection: {}, |
|
|
|
|
isAddSection: false, |
|
|
|
|
isWord: false, |
|
|
|
|
isPPT: false, |
|
|
|
@ -263,7 +271,7 @@ export default { |
|
|
|
|
showMask2: false, |
|
|
|
|
loadIns: null, |
|
|
|
|
pdfVisible: false, |
|
|
|
|
pdfSrc: "", |
|
|
|
|
pdfSrc: '', |
|
|
|
|
previewing: false, |
|
|
|
|
showProgress: false, |
|
|
|
|
progressPercent: 0, |
|
|
|
@ -285,6 +293,8 @@ export default { |
|
|
|
|
}, |
|
|
|
|
sourceVisible: false, |
|
|
|
|
sections: [], |
|
|
|
|
|
|
|
|
|
switchTypeVisible: false, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
@ -444,7 +454,7 @@ export default { |
|
|
|
|
// 批量移除小节 |
|
|
|
|
batchDelSection () { |
|
|
|
|
const list = this.sections.filter(e => e.check) |
|
|
|
|
this.$confirm(list.length ? '此删除操作不可逆,是否确认删除选中项?' : '此删除操作不可逆,是否确认全部资源?', "提示", { |
|
|
|
|
this.$confirm(list.length ? '此删除操作不可逆,是否确认删除选中项?' : '此删除操作不可逆,是否确认删除全部资源?', "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(async () => { |
|
|
|
|
await this.$post(this.api.deleteSubsectionBatch, { |
|
|
|
@ -563,9 +573,11 @@ export default { |
|
|
|
|
|
|
|
|
|
// 添加系统资源 |
|
|
|
|
showSource () { |
|
|
|
|
this.curSection = {} |
|
|
|
|
this.sourceVisible = true |
|
|
|
|
}, |
|
|
|
|
addSection (id) { |
|
|
|
|
// 本地上传新增资源 |
|
|
|
|
addSection () { |
|
|
|
|
this.sectionForm.sectionName = '' |
|
|
|
|
this.fileUrl = '' |
|
|
|
|
this.uploadList = [] |
|
|
|
@ -573,34 +585,40 @@ export default { |
|
|
|
|
this.isAddSection = true |
|
|
|
|
this.sectionVisible = true |
|
|
|
|
}, |
|
|
|
|
// 本地上传编辑资源 |
|
|
|
|
editSection () { |
|
|
|
|
this.sectionForm.sectionName = this.curSection.name |
|
|
|
|
this.fileUrl = '' |
|
|
|
|
this.uploadList = [] |
|
|
|
|
this.isAddSection = false |
|
|
|
|
this.sectionVisible = true |
|
|
|
|
}, |
|
|
|
|
chapterSubmit () { |
|
|
|
|
if (!this.chapterName) return this.$message.warning("请填写章节名称"); |
|
|
|
|
let data = { |
|
|
|
|
if (!this.chapterName) return this.$message.warning("请填写章节名称") |
|
|
|
|
const data = { |
|
|
|
|
cid: this.id, |
|
|
|
|
name: this.chapterName |
|
|
|
|
}; |
|
|
|
|
if (this.chapterId) { |
|
|
|
|
data.id = this.chapterId; |
|
|
|
|
data.id = this.chapterId |
|
|
|
|
this.$put(this.api.editChapterCurriculm, data).then(res => { |
|
|
|
|
this.$message.success("修改成功"); |
|
|
|
|
this.chapterVisible = false; |
|
|
|
|
this.getData(); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
this.$message.success("修改成功") |
|
|
|
|
this.chapterVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.addChapterCurriculm, data).then(res => { |
|
|
|
|
this.$message.success("添加成功"); |
|
|
|
|
this.chapterVisible = false; |
|
|
|
|
this.getData(); |
|
|
|
|
this.$message.success("添加成功") |
|
|
|
|
this.chapterVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
sectionSubmit (e) { |
|
|
|
|
if (!this.sectionForm.sectionName) return this.$message.warning("请填写小节名称"); |
|
|
|
|
if (this.uploading) return this.$message.warning("资源正在上传中,请稍候"); |
|
|
|
|
if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源"); |
|
|
|
|
let data = { |
|
|
|
|
async sectionSubmit (e) { |
|
|
|
|
if (!this.sectionForm.sectionName) return this.$message.warning('请填写小节名称') |
|
|
|
|
if (this.uploading) return this.$message.warning('资源正在上传中,请稍候') |
|
|
|
|
if (!this.fileUrl && !this.fileId) return this.$message.warning('请上传资源') |
|
|
|
|
const data = { |
|
|
|
|
id: this.sectionId, |
|
|
|
|
cid: this.id, |
|
|
|
|
chapterId: this.chapterId, |
|
|
|
@ -610,21 +628,24 @@ export default { |
|
|
|
|
fileName: this.fileName, |
|
|
|
|
fileType: this.fileType, |
|
|
|
|
originalFileName: this.originalFileName |
|
|
|
|
}; |
|
|
|
|
this.$post(this.api.addSubsectionCurriculm, data).then(res => { |
|
|
|
|
this.$message.success("添加成功"); |
|
|
|
|
this.sectionVisible = false; |
|
|
|
|
this.getData(); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
if (this.sectionId) { |
|
|
|
|
await this.$put(this.api.editSubsectionCurriculm, data) |
|
|
|
|
} else { |
|
|
|
|
await this.$post(this.api.addSubsectionCurriculm, data) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.$message.success('添加成功') |
|
|
|
|
this.sectionVisible = false |
|
|
|
|
this.switchTypeVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
closeSwitch () { |
|
|
|
|
this.fileId = ""; |
|
|
|
|
this.fileName = ""; |
|
|
|
|
this.fileType = ""; |
|
|
|
|
this.fileUrl = ""; |
|
|
|
|
this.sectionId = ""; |
|
|
|
|
this.fileId = '' |
|
|
|
|
this.fileName = '' |
|
|
|
|
this.fileType = '' |
|
|
|
|
this.fileUrl = '' |
|
|
|
|
this.sectionId = '' |
|
|
|
|
this.progressPercent = 0 |
|
|
|
|
}, |
|
|
|
|
// 下载资源 |
|
|
|
@ -679,7 +700,7 @@ export default { |
|
|
|
|
this.pdfSrc = row.fileUrl; |
|
|
|
|
this.pdfVisible = true; |
|
|
|
|
} else { |
|
|
|
|
this.$get(`${this.api.getSubsection}/${row.id}`).then(res => { |
|
|
|
|
this.$get(`${this.api.curriculumGetSubsection}/${row.id}`).then(res => { |
|
|
|
|
this.previewing = true; |
|
|
|
|
this.loadIns = Loading.service(); |
|
|
|
|
this.$route.fullPath.includes("#file") || history.pushState({ file: true }, "文件预览", "#" + this.$route.fullPath + "#file"); |
|
|
|
@ -715,20 +736,12 @@ export default { |
|
|
|
|
this.sectionNameVisible = true; |
|
|
|
|
}, |
|
|
|
|
switchFile (row) { |
|
|
|
|
this.uploadList = [] |
|
|
|
|
this.curFile = { |
|
|
|
|
fileId: row.fileId, |
|
|
|
|
fileName: row.fileName, |
|
|
|
|
fileType: row.fileType, |
|
|
|
|
fileUrl: row.fileUrl |
|
|
|
|
} |
|
|
|
|
this.curSection = row |
|
|
|
|
this.sectionId = row.id |
|
|
|
|
this.sectionForm.sectionName = row.sectionName |
|
|
|
|
|
|
|
|
|
this.switchVisible = true; |
|
|
|
|
this.switchTypeVisible = true |
|
|
|
|
}, |
|
|
|
|
switchSubmitFile () { |
|
|
|
|
let data = { |
|
|
|
|
this.$put(this.api.editSubsectionCurriculm, { |
|
|
|
|
id: this.sectionId, |
|
|
|
|
cid: this.id, |
|
|
|
|
chapterId: this.chapterId, |
|
|
|
@ -738,29 +751,27 @@ export default { |
|
|
|
|
fileType: this.fileType, |
|
|
|
|
fileUrl: this.fileUrl, |
|
|
|
|
originalFileName: this.originalFileName |
|
|
|
|
}; |
|
|
|
|
this.$put(this.api.editSubsectionCurriculm, data).then(res => { |
|
|
|
|
this.$message.success("更换成功"); |
|
|
|
|
this.switchVisible = false; |
|
|
|
|
this.getData(); |
|
|
|
|
}).then(res => { |
|
|
|
|
this.$message.success("更换成功") |
|
|
|
|
this.switchVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
switchSubmit () { |
|
|
|
|
if (this.uploading) return this.$message.warning("资源正在上传中,请稍候"); |
|
|
|
|
if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源"); |
|
|
|
|
this.switchSubmitFile(); |
|
|
|
|
if (this.uploading) return this.$message.warning("资源正在上传中,请稍候") |
|
|
|
|
if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源") |
|
|
|
|
this.switchSubmitFile() |
|
|
|
|
}, |
|
|
|
|
delSection (row) { |
|
|
|
|
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.$del(`${this.api.deleteSubsectionCurriculm}/${row.id}`).then(res => { |
|
|
|
|
row.fileUrl && Oss.del(row.fileUrl) |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$del(`${this.api.deleteSubsectionCurriculm}/${row.id}`).then(res => { |
|
|
|
|
row.fileUrl && Oss.del(row.fileUrl) |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}, |
|
|
|
|
sortChapter (row, type, disabled, index) { |
|
|
|
|
if (!disabled) { |
|
|
|
@ -803,7 +814,7 @@ export default { |
|
|
|
|
if (this.previewing) { |
|
|
|
|
this.closeIframe() |
|
|
|
|
} else { |
|
|
|
|
this.$router.push(this.$store.state.referrer || 'list') |
|
|
|
|
this.$router.push(this.$store.state.lesson.referrer || 'list') |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
@ -1026,4 +1037,25 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/deep/.source-list { |
|
|
|
|
display: flex; |
|
|
|
|
gap: 10px; |
|
|
|
|
|
|
|
|
|
li { |
|
|
|
|
flex: 1; |
|
|
|
|
line-height: 80px; |
|
|
|
|
font-size: 16px; |
|
|
|
|
text-align: center; |
|
|
|
|
color: #333; |
|
|
|
|
border-radius: 8px; |
|
|
|
|
background-color: #f6f8fa; |
|
|
|
|
border: 1px solid transparent; |
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
|
|
&:hover { |
|
|
|
|
border-color: #062c87; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |