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>
</div>
<ul class="chapters">
<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 v-model="chapters" :disabled="false" :group="{
name: 'sec',
pull: false,
}" animation="1000" @end="updateSort">
<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>
</div>
<div class="right">
@ -33,30 +39,36 @@
</div>
<ul class="sections">
<li v-for="(section, i) in sections" :key="i">
<div class="section-left">
<el-checkbox v-model="section.check"></el-checkbox>
<span class="serial">{{ i + 1 }}.</span>
<img v-if="section.fileType === 'pptx'" src="@/assets/img/exts/ppt.png" alt="">
<img v-else-if="section.fileType === 'mp4'" src="@/assets/img/exts/video.png" alt="">
<img v-else-if="section.fileType === 'doc' || section.fileType === 'docx'"
src="@/assets/img/exts/word.png" alt="">
<img v-else-if="section.fileType === 'xlsx' || section.fileType === 'xls'"
src="@/assets/img/exts/excel.png" alt="">
<img v-else-if="section.fileType === 'txt'" src="@/assets/img/exts/txt.png" alt="">
<img v-else-if="section.fileType === 'pdf'" src="@/assets/img/exts/pdf.png" alt="">
<img v-else src="@/assets/img/exts/pic.png" alt="">
<span class="name">{{ section.name }}</span>
</div>
<div class="section-actions">
<el-button type="text" @click="download(section)" v-auth="'/curriculum:内容设置:下载'">下载</el-button>
<el-button type="text" @click="preview(section)" v-auth="'/curriculum:内容设置:查看'">预览</el-button>
<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 v-model="sections" :group="{
name: 'sec',
pull: false,
}" handle=".drag" animation="1000" @end="updateSort">
<li v-for="(section, i) in sections" :key="i">
<div class="section-left">
<img class="drag" src="@/assets/img/drag.svg" alt="">
<el-checkbox v-model="section.check"></el-checkbox>
<span class="serial">{{ i + 1 }}.</span>
<img v-if="section.fileType === 'pptx'" src="@/assets/img/exts/ppt.png" alt="">
<img v-else-if="section.fileType === 'mp4'" src="@/assets/img/exts/video.png" alt="">
<img v-else-if="section.fileType === 'doc' || section.fileType === 'docx'"
src="@/assets/img/exts/word.png" alt="">
<img v-else-if="section.fileType === 'xlsx' || section.fileType === 'xls'"
src="@/assets/img/exts/excel.png" alt="">
<img v-else-if="section.fileType === 'txt'" src="@/assets/img/exts/txt.png" alt="">
<img v-else-if="section.fileType === 'pdf'" src="@/assets/img/exts/pdf.png" alt="">
<img v-else src="@/assets/img/exts/pic.png" alt="">
<span class="name">{{ section.name }}</span>
</div>
<div class="section-actions">
<el-button type="text" @click="download(section)" v-auth="'/curriculum:内容设置:下载'">下载</el-button>
<el-button type="text" @click="preview(section)" v-auth="'/curriculum:内容设置:查看'">预览</el-button>
<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>
</div>
</div>
@ -198,14 +210,12 @@ 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: [],
@ -242,7 +252,7 @@ export default {
player: null,
previewImg: "",
iframeSrc: "",
curFile: {},
curSection: {},
isAddSection: false,
isWord: false,
isPPT: false,
@ -273,10 +283,9 @@ export default {
sort: 'bottom'
},
sourceVisible: false,
sections: []
sections: [],
};
},
components: { Pdf, Upload, Source },
mounted () {
this.insertScript();
this.id && this.getData();
@ -449,6 +458,23 @@ export default {
this.getData()
}).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) {
const list = []
@ -536,6 +562,7 @@ export default {
//
showSource () {
this.curSection = {}
this.sourceVisible = true
},
addSection (id) {
@ -551,30 +578,26 @@ export default {
let data = {
cid: this.id,
name: this.chapterName
};
}
if (this.chapterId) {
data.id = this.chapterId;
this.$put(this.api.editChapter, 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.addChapter, data).then(res => {
this.$message.success("添加成功");
this.chapterVisible = false;
this.getData();
})
.catch(err => {
});
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("请上传资源");
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 = {
id: this.sectionId,
cid: this.id,
@ -585,21 +608,19 @@ export default {
fileName: this.fileName,
fileType: this.fileType,
originalFileName: this.originalFileName
};
}
this.$post(this.api.addSubsection, data).then(res => {
this.$message.success("添加成功");
this.sectionVisible = false;
this.getData();
})
.catch(err => {
})
this.$message.success("添加成功")
this.sectionVisible = false
this.getData()
}).catch(err => { })
},
closeSwitch () {
this.fileId = "";
this.fileName = "";
this.fileType = "";
this.fileUrl = "";
this.sectionId = "";
this.fileId = ''
this.fileName = ''
this.fileType = ''
this.fileUrl = ''
this.sectionId = ''
this.progressPercent = 0
},
//
@ -685,22 +706,14 @@ export default {
}
},
editSectionName (row) {
this.sectionId = row.id;
this.sectionForm.sectionName = row.name;
this.sectionNameVisible = true;
this.sectionId = row.id
this.sectionForm.sectionName = row.name
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.sourceVisible = true
},
switchSubmitFile () {
let data = {
@ -977,6 +990,11 @@ export default {
background-color: #f9f9f9;
}
.drag {
margin-right: 10px;
cursor: move;
}
.section-left,
.section-right {
display: inline-flex;

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

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

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

Loading…
Cancel
Save