dev_202412
yujialong 2 months ago
parent 28cce9dc63
commit 0e6e54bd81
  1. 1
      src/assets/img/drag.svg
  2. 172
      src/views/course/content/index.vue
  3. 46
      src/views/course/content/source.vue
  4. 39
      src/views/course/detail.vue
  5. 4
      src/views/course/list.vue

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1734423793915" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7651" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M362.666667 192m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="#666666" p-id="7652"></path><path d="M661.333333 192m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="#666666" p-id="7653"></path><path d="M362.666667 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="#666666" p-id="7654"></path><path d="M661.333333 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="#666666" p-id="7655"></path><path d="M362.666667 832m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="#666666" p-id="7656"></path><path d="M661.333333 832m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="#666666" p-id="7657"></path></svg>

After

Width:  |  Height:  |  Size: 946 B

@ -13,11 +13,17 @@
<el-button type="primary" size="mini" @click="addChapter" v-auth="'/curriculum:内容设置:添加章节'">新增章节</el-button> <el-button type="primary" size="mini" @click="addChapter" v-auth="'/curriculum:内容设置:添加章节'">新增章节</el-button>
</div> </div>
<ul class="chapters"> <ul class="chapters">
<li v-for="(chapter, i) in chapters" :key="i" :class="{ active: chapterId === chapter.id }"> <draggable v-model="chapters" :disabled="false" :group="{
<span class="name ellipsis" @click="chapterClick(chapter)">{{ chapter.name }}</span> name: 'sec',
<el-link :underline="false" type="primary" @click="editChapter(chapter)">修改名称</el-link> pull: false,
<el-link v-if="i" class="del" :underline="false" type="primary" @click="delChapter(chapter.id)">删除</el-link> }" animation="1000" @end="updateSort">
</li> <li v-for="(chapter, i) in chapters" :key="i" :class="{ active: chapterId === chapter.id }">
<span class="name ellipsis" @click="chapterClick(chapter)">{{ chapter.name }}</span>
<el-link :underline="false" type="primary" @click="editChapter(chapter)">修改名称</el-link>
<el-link v-if="i" class="del" :underline="false" type="primary"
@click="delChapter(chapter.id)">删除</el-link>
</li>
</draggable>
</ul> </ul>
</div> </div>
<div class="right"> <div class="right">
@ -33,30 +39,36 @@
</div> </div>
<ul class="sections"> <ul class="sections">
<li v-for="(section, i) in sections" :key="i"> <draggable v-model="sections" :group="{
<div class="section-left"> name: 'sec',
<el-checkbox v-model="section.check"></el-checkbox> pull: false,
<span class="serial">{{ i + 1 }}.</span> }" handle=".drag" animation="1000" @end="updateSort">
<img v-if="section.fileType === 'pptx'" src="@/assets/img/exts/ppt.png" alt=""> <li v-for="(section, i) in sections" :key="i">
<img v-else-if="section.fileType === 'mp4'" src="@/assets/img/exts/video.png" alt=""> <div class="section-left">
<img v-else-if="section.fileType === 'doc' || section.fileType === 'docx'" <img class="drag" src="@/assets/img/drag.svg" alt="">
src="@/assets/img/exts/word.png" alt=""> <el-checkbox v-model="section.check"></el-checkbox>
<img v-else-if="section.fileType === 'xlsx' || section.fileType === 'xls'" <span class="serial">{{ i + 1 }}.</span>
src="@/assets/img/exts/excel.png" alt=""> <img v-if="section.fileType === 'pptx'" src="@/assets/img/exts/ppt.png" alt="">
<img v-else-if="section.fileType === 'txt'" src="@/assets/img/exts/txt.png" alt=""> <img v-else-if="section.fileType === 'mp4'" src="@/assets/img/exts/video.png" alt="">
<img v-else-if="section.fileType === 'pdf'" src="@/assets/img/exts/pdf.png" alt=""> <img v-else-if="section.fileType === 'doc' || section.fileType === 'docx'"
<img v-else src="@/assets/img/exts/pic.png" alt=""> src="@/assets/img/exts/word.png" alt="">
<span class="name">{{ section.name }}</span> <img v-else-if="section.fileType === 'xlsx' || section.fileType === 'xls'"
</div> src="@/assets/img/exts/excel.png" alt="">
<div class="section-actions"> <img v-else-if="section.fileType === 'txt'" src="@/assets/img/exts/txt.png" alt="">
<el-button type="text" @click="download(section)" v-auth="'/curriculum:内容设置:下载'">下载</el-button> <img v-else-if="section.fileType === 'pdf'" src="@/assets/img/exts/pdf.png" alt="">
<el-button type="text" @click="preview(section)" v-auth="'/curriculum:内容设置:查看'">预览</el-button> <img v-else src="@/assets/img/exts/pic.png" alt="">
<el-button type="text" @click="editSectionName(section)" <span class="name">{{ section.name }}</span>
v-auth="'/curriculum:内容设置:修改小节名称'">修改资源名称</el-button> </div>
<el-button type="text" @click="switchFile(section)" v-auth="'/curriculum:内容设置:更换文件'">更换</el-button> <div class="section-actions">
<el-button type="text" @click="delSection(section)" v-auth="'/curriculum:内容设置:删除小节'">移除</el-button> <el-button type="text" @click="download(section)" v-auth="'/curriculum:内容设置:下载'">下载</el-button>
</div> <el-button type="text" @click="preview(section)" v-auth="'/curriculum:内容设置:查看'">预览</el-button>
</li> <el-button type="text" @click="editSectionName(section)"
v-auth="'/curriculum:内容设置:修改小节名称'">修改资源名称</el-button>
<el-button type="text" @click="switchFile(section)" v-auth="'/curriculum:内容设置:更换文件'">更换</el-button>
<el-button type="text" @click="delSection(section)" v-auth="'/curriculum:内容设置:删除小节'">移除</el-button>
</div>
</li>
</draggable>
</ul> </ul>
</div> </div>
</div> </div>
@ -198,14 +210,12 @@ import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js' import Oss from '@/components/upload/upload.js'
import Util from '@/libs/util' import Util from '@/libs/util'
import Source from './source' import Source from './source'
import Draggable from 'vuedraggable'
export default { export default {
components: { Pdf, Upload, Source, Draggable },
data () { data () {
return { return {
name: this.$route.query.name, name: this.$route.query.name,
headers: {
token: sessionStorage.getItem('token')
},
id: this.$route.query.cid, id: this.$route.query.cid,
originChapters: [], originChapters: [],
chapters: [], chapters: [],
@ -242,7 +252,7 @@ export default {
player: null, player: null,
previewImg: "", previewImg: "",
iframeSrc: "", iframeSrc: "",
curFile: {}, curSection: {},
isAddSection: false, isAddSection: false,
isWord: false, isWord: false,
isPPT: false, isPPT: false,
@ -273,10 +283,9 @@ export default {
sort: 'bottom' sort: 'bottom'
}, },
sourceVisible: false, sourceVisible: false,
sections: [] sections: [],
}; };
}, },
components: { Pdf, Upload, Source },
mounted () { mounted () {
this.insertScript(); this.insertScript();
this.id && this.getData(); this.id && this.getData();
@ -449,6 +458,23 @@ export default {
this.getData() this.getData()
}).catch(() => { }) }).catch(() => { })
}, },
//
async updateSort (e) {
e.preventDefault()
const { chapters, sections, chapterId } = this
chapters.forEach((n, k) => {
n.sort = k + 1
if (n.id === chapterId) n.subsectionList = sections
n.subsectionList && 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) { chapterChange (id) {
const list = [] const list = []
@ -536,6 +562,7 @@ export default {
// //
showSource () { showSource () {
this.curSection = {}
this.sourceVisible = true this.sourceVisible = true
}, },
addSection (id) { addSection (id) {
@ -551,30 +578,26 @@ export default {
let data = { let data = {
cid: this.id, cid: this.id,
name: this.chapterName name: this.chapterName
}; }
if (this.chapterId) { if (this.chapterId) {
data.id = this.chapterId; data.id = this.chapterId;
this.$put(this.api.editChapter, data).then(res => { this.$put(this.api.editChapter, data).then(res => {
this.$message.success("修改成功"); this.$message.success("修改成功")
this.chapterVisible = false; this.chapterVisible = false
this.getData(); this.getData()
}) }).catch(err => { })
.catch(err => {
});
} else { } else {
this.$post(this.api.addChapter, data).then(res => { this.$post(this.api.addChapter, data).then(res => {
this.$message.success("添加成功"); this.$message.success("添加成功")
this.chapterVisible = false; this.chapterVisible = false
this.getData(); this.getData()
}) }).catch(err => { })
.catch(err => {
});
} }
}, },
sectionSubmit (e) { sectionSubmit (e) {
if (!this.sectionForm.sectionName) return this.$message.warning("请填写小节名称"); if (!this.sectionForm.sectionName) return this.$message.warning("请填写小节名称")
if (this.uploading) return this.$message.warning("资源正在上传中,请稍候"); if (this.uploading) return this.$message.warning("资源正在上传中,请稍候")
if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源"); if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源")
let data = { let data = {
id: this.sectionId, id: this.sectionId,
cid: this.id, cid: this.id,
@ -585,21 +608,19 @@ export default {
fileName: this.fileName, fileName: this.fileName,
fileType: this.fileType, fileType: this.fileType,
originalFileName: this.originalFileName originalFileName: this.originalFileName
}; }
this.$post(this.api.addSubsection, data).then(res => { this.$post(this.api.addSubsection, data).then(res => {
this.$message.success("添加成功"); this.$message.success("添加成功")
this.sectionVisible = false; this.sectionVisible = false
this.getData(); this.getData()
}) }).catch(err => { })
.catch(err => {
})
}, },
closeSwitch () { closeSwitch () {
this.fileId = ""; this.fileId = ''
this.fileName = ""; this.fileName = ''
this.fileType = ""; this.fileType = ''
this.fileUrl = ""; this.fileUrl = ''
this.sectionId = ""; this.sectionId = ''
this.progressPercent = 0 this.progressPercent = 0
}, },
// //
@ -685,22 +706,14 @@ export default {
} }
}, },
editSectionName (row) { editSectionName (row) {
this.sectionId = row.id; this.sectionId = row.id
this.sectionForm.sectionName = row.name; this.sectionForm.sectionName = row.name
this.sectionNameVisible = true; this.sectionNameVisible = true
}, },
switchFile (row) { switchFile (row) {
this.uploadList = [] this.curSection = row
this.curFile = {
fileId: row.fileId,
fileName: row.fileName,
fileType: row.fileType,
fileUrl: row.fileUrl
}
this.sectionId = row.id this.sectionId = row.id
this.sectionForm.sectionName = row.sectionName this.sourceVisible = true
this.switchVisible = true;
}, },
switchSubmitFile () { switchSubmitFile () {
let data = { let data = {
@ -977,6 +990,11 @@ export default {
background-color: #f9f9f9; background-color: #f9f9f9;
} }
.drag {
margin-right: 10px;
cursor: move;
}
.section-left, .section-left,
.section-right { .section-right {
display: inline-flex; display: inline-flex;

@ -54,6 +54,10 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<div v-if="$parent.curSection.id" class="m-b-20">
<p class="total m-b-10">原资源共1个</p>
<div v-html="$parent.curSection.name"></div>
</div>
<template v-if="checked.length"> <template v-if="checked.length">
<div class="flex-between m-b-10"> <div class="flex-between m-b-10">
<p class="total">已选资源{{ checked.length }}</p> <p class="total">已选资源{{ checked.length }}</p>
@ -62,7 +66,7 @@
<el-input placeholder="请输入资源名称" prefix-icon="el-icon-search" v-model="checkedKeyword" clearable></el-input> <el-input placeholder="请输入资源名称" prefix-icon="el-icon-search" v-model="checkedKeyword" clearable></el-input>
<div :class="['lines']"> <div class="lines">
<template v-for="(item, i) in checked"> <template v-for="(item, i) in checked">
<div v-if="item.name.includes(checkedKeyword)" :key="i" class="line"> <div v-if="item.name.includes(checkedKeyword)" :key="i" class="line">
<div class="check-left"> <div class="check-left">
@ -135,6 +139,7 @@ export default {
// //
init () { init () {
this.getCourse() this.getCourse()
this.checked = []
}, },
// //
async getCourse () { async getCourse () {
@ -253,21 +258,25 @@ export default {
async submit () { async submit () {
try { try {
if (this.submiting) return false if (this.submiting) return false
this.submiting = true
const { checked } = this const { checked } = this
const { chapterId, id } = this.$parent if (checked.length) {
const result = checked.map(e => { this.submiting = true
return { const { chapterId, id } = this.$parent
chapterId, const result = checked.map(e => {
cid: id, return {
resourceId: e.id, chapterId,
type: e.cid ? 0 : 1, cid: id,
} resourceId: e.id,
}) type: e.cid ? 0 : 1,
const res = await this.$post(this.api.combinationResource, result) }
this.sourceVisible = false })
this.$parent.getData() await this.$post(this.api.combinationResource, result)
this.submiting = false this.sourceVisible = false
this.$parent.getData()
this.submiting = false
} else {
Util.warningMsg('请选择资源')
}
} catch (e) { } catch (e) {
this.submiting = false this.submiting = false
} }
@ -357,6 +366,7 @@ export default {
width: 100px; width: 100px;
max-height: 80px; max-height: 80px;
margin-right: 15px; margin-right: 15px;
border-radius: 6px;
} }
.course-name { .course-name {
@ -387,6 +397,12 @@ export default {
flex: 1; flex: 1;
padding: 15px; padding: 15px;
.total {
font-size: 15px;
color: #333;
font-weight: 600;
}
.lines { .lines {
height: calc(100vh - 228px); height: calc(100vh - 228px);
padding-right: 10px; padding-right: 10px;

@ -314,9 +314,6 @@ export default {
data () { data () {
return { return {
cid: this.$route.query.cid, cid: this.$route.query.cid,
headers: {
token: sessionStorage.getItem("token")
},
editorConfig, editorConfig,
step: 1, step: 1,
form: { form: {
@ -370,8 +367,6 @@ export default {
], ],
}, },
subjectList: [], subjectList: [],
ProfessionalClassList: [],
ProfessionalList: [],
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -385,9 +380,6 @@ export default {
practiceTotal: 0, practiceTotal: 0,
multiplePractice: [], multiplePractice: [],
matches: [],
matcheTotal: 0,
multipleMatch: [],
submiting: false, // submiting: false, //
loadIns: null, loadIns: null,
updateTime: 0, updateTime: 0,
@ -405,17 +397,6 @@ export default {
suppliers: [], suppliers: [],
mulSystem: this.$store.state.btns.includes('/curriculum:支持多系统组课'), // mulSystem: this.$store.state.btns.includes('/curriculum:支持多系统组课'), //
status: [
{
id: 0,
name: '正常'
}
],
practiceData: [],
practiceTotal: 0,
multiplePractice: [],
assessmentData: [], assessmentData: [],
assessmentTotal: 0, assessmentTotal: 0,
multipleAssessment: [], multipleAssessment: [],
@ -756,11 +737,11 @@ export default {
} }
} }
}, },
handleSelectionPractice (val) { // handleSelectionPractice (val) {
this.multiplePractice = val; this.multiplePractice = val
}, },
handleSelectionMatch (val) { // handleSelectionAssessment (val) {
this.multipleMatch = val; this.multipleAssessment = val
}, },
// //
@ -782,9 +763,6 @@ export default {
} else if (!type && !this.multiplePractice.length) { } else if (!type && !this.multiplePractice.length) {
this.$message.warning("请勾选练习项目!"); this.$message.warning("请勾选练习项目!");
return; return;
} else if (type == 2 && !this.multipleMatch.length) {
this.$message.warning("请勾选竞赛项目!");
return;
} }
this.$confirm("此操作将批量移除项目, 是否继续?", "提示", { this.$confirm("此操作将批量移除项目, 是否继续?", "提示", {
type: "warning" type: "warning"
@ -807,15 +785,6 @@ export default {
} }
} }
this.practiceData = tempArr; this.practiceData = tempArr;
} else {
let ids = this.multipleMatch.map(i => i.projectId);
let tempArr = [];
for (let i = 0; i < this.matches.length; i++) {
if (!ids.includes(this.matches[i].projectId)) {
tempArr.push(this.matches[i]);
}
}
this.matches = tempArr;
} }
this.$message.success("批量移除成功"); this.$message.success("批量移除成功");
}).catch(() => { }).catch(() => {

@ -106,6 +106,7 @@
</template> </template>
<script> <script>
import Setting from '@/setting'
import qs from 'qs' import qs from 'qs'
export default { export default {
data () { data () {
@ -157,7 +158,8 @@ export default {
...this.form, ...this.form,
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
supplierId: sid ? sid.supplierId : '' supplierId: sid ? sid.supplierId : '',
platformId: Setting.platformId
}; };
this.$post(this.api.curriculumList, data).then(res => { this.$post(this.api.curriculumList, data).then(res => {
this.courseData = res.page.records; this.courseData = res.page.records;

Loading…
Cancel
Save