From ae43feac8c6b2372f5a061ead68e71027e8877e1 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期四, 27 六月 2024 09:25:10 +0800 Subject: [PATCH] 修改 --- src/views/onlineEducation/courseSupervision/components/courseDialog.vue | 119 +++++++++++++++++++++++------------------------------------ 1 files changed, 46 insertions(+), 73 deletions(-) diff --git a/src/views/onlineEducation/courseSupervision/components/courseDialog.vue b/src/views/onlineEducation/courseSupervision/components/courseDialog.vue index a45dcb5..d533f9f 100644 --- a/src/views/onlineEducation/courseSupervision/components/courseDialog.vue +++ b/src/views/onlineEducation/courseSupervision/components/courseDialog.vue @@ -14,7 +14,13 @@ </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.name}}</span> + <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> @@ -25,11 +31,11 @@ :data="courseTable" style="width: 80%;margin: 20px 35px"> <el-table-column - prop="catalogCode" + prop="chapterCode" label="章节UUID"> </el-table-column> <el-table-column - prop="catalogName" + prop="chapterName" label="章节名称"> </el-table-column> <el-table-column @@ -46,6 +52,7 @@ size="mini" type="text" style="color: #1890ff" + @click="openUrl(scope.row.url)" >预览课程</el-button> </template> </el-table-column> @@ -68,41 +75,45 @@ dialogVisible: false, dialogStatus: '', dataForm: {}, - courseTable: [ - { - catalogCode: '1', - catalogName: '测试', - resourceType: '视频', - lessonNum: '2h' - }, - { - catalogCode: '1', - catalogName: '测试3', - resourceType: '音频', - lessonNum: '45min' - } - ], - courseList: [ - { - name: '1.1 ……' - }, - { - name: '1.2 ……' - }, - { - name: '1.3 ……' - } - - ] + courseTable: [], + courseList: [] } }, created() { }, methods: { - openDialog (type, data) { - this.resetDataForm(); + openDialog (data) { this.dialogVisible = true; - this.dialogStatus = type; + 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 @@ -112,51 +123,13 @@ this.$emit("getList"); }, onSubmit() { - this.$refs["dataForm"].validate( async valid => { - if (valid) { - if(this.dialogStatus == 'add'){ - // this.dataForm.isCm = 1; - // console.log("this.dataForm",this.dataForm) - // const res = await addExam(this.dataForm); - // if(res.code == 200) { + this.$emit("getList"); this.dialogVisible = false; - // this.$message({ - // type:'success', - // message: '新增成功' - // }) - // }else{ - // this.$message({ - // type:'warning', - // message: res.msg - // }) - // } - }else { - // this.dataForm.isCm = 1; - // console.log("this.dataForm",this.dataForm) - // const res = await updateExam(this.dataForm); - // if(res.code == 200) { - this.$emit("getList"); - this.dialogVisible = false; - // this.$message({ - // type:'success', - // message: '编辑成功' - // }) - // }else{ - // this.$message({ - // type:'warning', - // message: res.msg - // }) - // } - } - } - }) + }, - resetDataForm() { - this.dataForm = { - } - }, + } } -- Gitblit v1.9.2