项目课程预览对接

This commit is contained in:
hbzgyjh 2021-12-25 15:28:13 +08:00
parent 78faa9ad49
commit 4fc3f27a8c
2 changed files with 38 additions and 13 deletions

View File

@ -1,14 +1,14 @@
<template> <template>
<a-card :bordered="false" title="课件信息"> <a-card :bordered="false" title="课件列表">
<template slot="extra"> <template v-if="!!!courseId" slot="extra">
<a-button size="small" @click="goback">返回</a-button> <a-button size="small" @click="goback">返回</a-button>
</template> </template>
<div class="button" style="width: 100%; height: 32px; margin-bottom: 8px; margin-right: 10%;"> <div v-if="!!!courseId" class="button" style="width: 100%; height: 32px; margin-bottom: 8px; margin-right: 10%;">
<!-- <a-button type="primary" @click="goback">返回</a-button> --> <!-- <a-button type="primary" @click="goback">返回</a-button> -->
<a-button type="primary" @click="coursewareAdd">上传课件</a-button> <a-button type="primary" @click="coursewareAdd">上传课件</a-button>
</div> </div>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData"> <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData">
<template slot="action" slot-scope="text, record"> <template v-if="!!!courseId" slot="action" slot-scope="text, record">
<a href="javascript:;" @click="detail(record)">预览</a> <a href="javascript:;" @click="detail(record)">预览</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a href="javascript:;" @click="edit(record)">重新上传</a> <a href="javascript:;" @click="edit(record)">重新上传</a>
@ -19,23 +19,40 @@
<a-divider type="vertical" /> <a-divider type="vertical" />
<a href="javascript:;" @click="courseQuestion(record)">抽考题</a> <a href="javascript:;" @click="courseQuestion(record)">抽考题</a>
</template> </template>
<template v-if="courseId" slot="action" slot-scope="text, record">
<a href="javascript:;" @click="openDrawer(record)">预览</a>
</template>
</s-table> </s-table>
<a-drawer title="课件预览" :destroyOnClose="true" placement="right" width="1200" :closable="true" :visible="coursewareVisible" @close="() => this.coursewareVisible = false">
<courseware-preview :coursewareId="selectCoursewareId"/>
</a-drawer>
</a-card> </a-card>
</template> </template>
<script> <script>
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components'
import { getCoursewareListByCourseId } from '@/api/course/course' import { getCoursewareListByCourseId } from '@/api/course/course'
import { deleteCourseware } from '@/api/course/courseware' import { deleteCourseware } from '@/api/course/courseware'
import CoursewarePreview from './CoursewarePreview.vue'
export default { export default {
components: { components: {
STable, STable,
SearchCom, SearchCom,
CoursewarePreview,
},
props: {
courseId: {
type: Number,
}
},
watch: {
}, },
data() { data() {
return { return {
queryParam: { id: this.$route.query.id }, selectCoursewareId: '',
coursewareVisible: false,
queryParam: { id: this.$route.query.id || this.courseId },
loadData: (parameter) => { loadData: (parameter) => {
return getCoursewareListByCourseId(Object.assign(parameter, this.queryParam)).then((res) => { return getCoursewareListByCourseId(Object.assign(parameter, this.queryParam)).then((res) => {
return res return res
@ -57,6 +74,10 @@ export default {
} }
}, },
methods: { methods: {
openDrawer(record){
this.coursewareVisible = true;
this.selectCoursewareId = record.id;
},
// //
coursewareAdd() { coursewareAdd() {
this.$router.push({ path: '/course/CoursewareAddOrUpdate', query: { courseId: this.$route.query.id } }) this.$router.push({ path: '/course/CoursewareAddOrUpdate', query: { courseId: this.$route.query.id } })
@ -64,7 +85,7 @@ export default {
// //
edit(record) { edit(record) {
this.$router.push({ path: '/course/CoursewareAddOrUpdate', query: { coursewareId: record.id,courseId: this.$route.query.id,type: record.type } }) this.$router.push({ path: '/course/CoursewareAddOrUpdate', query: { coursewareId: record.id, courseId: this.$route.query.id, type: record.type } })
}, },
// //
@ -93,9 +114,11 @@ export default {
// //
detail(record) { detail(record) {
let preview = false
if (!this.courseId) preview = true
this.$router.push({ this.$router.push({
path: '/course/CoursewarePreview', path: '/course/CoursewarePreview',
query: { coursewareId: record.id, courseId: this.$route.query.id }, query: { coursewareId: record.id, courseId: this.$route.query.id || this.courseId },
}) })
}, },
}, },

View File

@ -26,7 +26,7 @@
<a-menu-item> <a-menu-item>
<a href="javascript:;" @click="openVisible('question',record)">题库预览</a> <a href="javascript:;" @click="openVisible('question',record)">题库预览</a>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item v-if="form.id" >
<a href="javascript:;" @click="openVisible('topic',record)">必选题设置</a> <a href="javascript:;" @click="openVisible('topic',record)">必选题设置</a>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
@ -45,13 +45,13 @@
<a-button type="primary" size="default" @click="toPrep" style="margin-right: 8px;">上一步</a-button> <a-button type="primary" size="default" @click="toPrep" style="margin-right: 8px;">上一步</a-button>
<a-button type="primary" size="default" @click="toNext">下一步</a-button> <a-button type="primary" size="default" @click="toNext">下一步</a-button>
</a-col> </a-col>
<a-drawer title="课程预览" placement="right" width="1200" :closable="true" :visible="courseVisible" @close="drawerClose"> <a-drawer title="课程预览" :destroyOnClose="true" placement="right" width="1200" :closable="true" :visible="courseVisible" @close="drawerClose">
<p>课程预览</p> <courseware-list :courseId="selectCourseId"></courseware-list>
</a-drawer> </a-drawer>
<a-drawer title="题库预览" placement="right" width="1200" :closable="true" :visible="questionVisible" @close="drawerClose"> <a-drawer title="题库预览" :destroyOnClose="true" placement="right" width="1200" :closable="true" :visible="questionVisible" @close="drawerClose">
<question-list :courseId="selectCourseId"></question-list> <question-list :courseId="selectCourseId"></question-list>
</a-drawer> </a-drawer>
<a-drawer title="必选题设置" placement="right" width="1200" :closable="true" :visible="requiredTopicVisible" @close="drawerClose"> <a-drawer title="必选题设置" :destroyOnClose="true" placement="right" width="1200" :closable="true" :visible="requiredTopicVisible" @close="drawerClose">
<p>必选题设置</p> <p>必选题设置</p>
</a-drawer> </a-drawer>
</a-card> </a-card>
@ -64,12 +64,14 @@ import { STable } from '@/components'
import ProjectCourseSelect from './ProjectCourseSelect.vue' import ProjectCourseSelect from './ProjectCourseSelect.vue'
import { getCourseList, getCourseListByCourseIds } from '@/api/project/projectCourse' import { getCourseList, getCourseListByCourseIds } from '@/api/project/projectCourse'
import QuestionList from '@/views/course/question/QuestionList.vue' import QuestionList from '@/views/course/question/QuestionList.vue'
import CoursewareList from '@/views/course/CoursewareList.vue'
export default { export default {
//import使 //import使
components: { components: {
STable, STable,
QuestionList, QuestionList,
CoursewareList,
ProjectCourseSelect, ProjectCourseSelect,
QuestionList, QuestionList,
}, },