<template>
|
<el-dialog
|
:visible.sync="dialogVisible"
|
:modal-append-to-body="false"
|
:close-on-click-modal="false"
|
width="600px"
|
:before-close="handleClose"
|
>
|
<div style="margin: 0 25px">
|
<div style="display: flex;flex-direction: column">
|
<div style="display: flex;align-items: center;justify-content: space-between">
|
<span style="font-size: 20px;font-weight: 550">课程大纲</span>
|
<span style="color: #1890ff;cursor: pointer;" @click="clickOpen">收起/展开</span>
|
</div>
|
<div :class="{'open':isClose}" style="overflow: hidden">
|
<div v-for="(item,index) in courseList" :key="index" style="font-size: 16px;margin: 20px 35px">
|
<span>{{item.chapterName}}</span>
|
<div v-if="item.children">
|
<div v-for="(child,index) in item.children" :key="index" style="font-size: 16px;margin: 20px 8px">
|
<span>{{child.chapterName}}</span>
|
</div>
|
</div>
|
|
</div>
|
</div>
|
|
</div>
|
<div style="display: flex;flex-direction: column">
|
<span style="font-size: 20px;font-weight: 550">课程章节资源</span>
|
<el-table
|
:data="courseTable"
|
style="width: 80%;margin: 20px 35px">
|
<el-table-column
|
prop="chapterCode"
|
label="章节UUID">
|
</el-table-column>
|
<el-table-column
|
prop="chapterName"
|
label="章节名称">
|
</el-table-column>
|
<el-table-column
|
label="资源类别"
|
prop="resourceType">
|
</el-table-column>
|
<el-table-column
|
label="章节学时"
|
prop="lessonNum">
|
</el-table-column>
|
<el-table-column label="预览" align="center" class-name="small-padding fixed-width">
|
<template #default="scope">
|
<el-button
|
size="mini"
|
type="text"
|
style="color: #1890ff"
|
@click="openUrl(scope.row.url)"
|
>预览课程</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
</div>
|
|
</div>
|
</el-dialog>
|
</template>
|
|
<script >
|
export default {
|
name: 'addUser',
|
components: {
|
},
|
data() {
|
return {
|
isClose:false,
|
dialogVisible: false,
|
dialogStatus: '',
|
dataForm: {},
|
courseTable: [],
|
courseList: []
|
}
|
},
|
created() {
|
},
|
methods: {
|
openDialog (data) {
|
this.dialogVisible = true;
|
this.courseList = data.outline
|
this.courseTable = this.recursion(data.outline)
|
console.log('courseTable',this.courseTable)
|
},
|
recursion (data) {
|
let tmp = []
|
if(data && data.length > 0){
|
for (let i = 0; i < data.length; i++) {
|
let item = data[i]
|
// children为空
|
if (item.children && item.children.length==0) {
|
// 有children
|
} else {
|
item.children.forEach(child => {
|
tmp.push({
|
chapterCode: child.chapterCode,
|
chapterName: child.chapterName,
|
resourceType: child.haveResource == 0 ? '视频' : '音频' ,
|
lessonNum: child.lessonNum,
|
url: child.url,
|
children: this.recursion(child.children)
|
})
|
})
|
}
|
}
|
}
|
return tmp;
|
},
|
openUrl(url) {
|
window.open(url,'_blank')
|
},
|
clickOpen() {
|
this.isClose = !this.isClose
|
},
|
handleClose() {
|
this.dialogVisible = false;
|
this.$emit("getList");
|
},
|
onSubmit() {
|
|
this.$emit("getList");
|
this.dialogVisible = false;
|
|
|
},
|
|
}
|
}
|
|
</script>
|
<style scoped>
|
.open{
|
height: 15px;
|
}
|
</style>
|