持续开发习题管理模块,新增ckeditor5富文本组件

This commit is contained in:
2023-02-18 21:59:58 +08:00
parent cbe10214f5
commit 40f5e10da7
13 changed files with 10423 additions and 24 deletions

View File

@@ -19,7 +19,8 @@ const router = useRouter()
const route = useRoute()
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
import exercisesCom from '../components/mediaPool.vue'
import mediaCom from '../components/mediaPool.vue'
import exercisesCom from '../components/exercisesPool.vue'
const props = defineProps(['course_id','chapter_info'])
const emit = defineEmits(['reload'])
import UploadCommon from '@/components/upload/common.vue'
@@ -34,7 +35,8 @@ const chapter_data = ref([])
const dialogChapterChildVisible = ref(false)
const chapterChildForm = ref({})
const chapterChildRules = ref({
name: [{ required: true, message: '请输入章节名称', trigger: 'blur' }]
name: [{ required: true, message: '请输入章节名称', trigger: 'blur' }],
price: [{ required: true, message: '请输入章节价格', trigger: 'blur' }]
})
const dialogChapterTitle = ref('')
const dialogChapterChildTitle = ref('')
@@ -118,7 +120,8 @@ async function enterChapterDialog() { // 提交大章节
function addChapterchildFunc(item) { // 打开新增子章节窗口
dialogChapterChildTitle.value = '新增子章节'
// current_chapter.value = item
chapterChildForm.value = {pid:item.id}
console.log(item.course_chapter_id)
chapterChildForm.value = {pid:item.course_chapter_id}
dialogChapterChildVisible.value = true
}
function editChapterChildFunc(item,main_index) { // 打开编辑子章节窗口
@@ -203,20 +206,22 @@ function openExercisesWinFunc() { // 打开媒体库
</div>
<!--表格数据-->
<div class="lb-table-part" style="margin-bottom: 20px">
<el-table :data="item.children" >
<el-table-column align="left" label="id" width="60" prop="id" />
<el-table :data="item.course_sub" >
<el-table-column align="left" label="ID" width="60" prop="course_chapter_id" />
<el-table-column align="left" label="子章节名称" min-width="60" prop="name" />
<el-table-column align="left" label="课件名称" min-width="60" prop="url_name" />
<el-table-column align="left" label="章节习题" min-width="60" prop="is_contain_exercise">
<template #default="scope">
{{scope.row.is_contain_exercise === 0?'未添加习题':scope.row.is_contain_exercise}}
</template>
</el-table-column>
<el-table-column align="left" label="是否免费" min-width="60">
<template #default="scope">
{{scope.row.is_free === 1? '是':'否'}}
</template>
</el-table-column>
<el-table-column align="left" label="章节价格" min-width="60" prop="price" />
<!-- <el-table-column align="left" label="是否免费" min-width="60">-->
<!-- <template #default="scope">-->
<!-- {{scope.row.is_free === 1? '是':'否'}}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="left" label="是否展示" min-width="60">
<template #default="scope">
{{scope.row.is_show === 1? '是':'否'}}
@@ -280,11 +285,15 @@ function openExercisesWinFunc() { // 打开媒体库
<!-- class="upload-btn"-->
<!-- @on-success="getFilePath"-->
<!-- />-->
<exercises-com @on-success="getFilePath" :url_name="chapterChildForm.url_name" />
<media-com @on-success="getFilePath" :url_name="chapterChildForm.url_name" />
<!-- <el-button size="small" type="primary" @click="openExercisesWinFunc">点击上传</el-button>-->
</el-form-item>
<el-form-item label="习题管理">
<el-button size="small" @click="chooseChapterChildExercises">添加习题</el-button>
<!-- <el-button size="small" @click="chooseChapterChildExercises">添加习题</el-button>-->
<exercises-com @on-success="getFilePath" :url_name="chapterChildForm.url_name" />
</el-form-item>
<el-form-item label="章节价格" prop="price">
<el-input type="number" v-model="chapterChildForm.price" placeholder="输入章节价格" autocomplete="off" />
</el-form-item>
<el-form-item label="章节排序" prop="sort">
<el-input v-model="chapterChildForm.sort" placeholder="输入整数,排序越小越靠前展示" autocomplete="off" />

View File

@@ -0,0 +1,103 @@
<script setup>
// 引入依赖
// import api from '@/api/course'
// import com_api from '@/api/common'
// import custom from '@/utils/custom'
// import WarningBar from '@/components/warningBar/warningBar.vue'
import {ref,onMounted,watch,inject } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
// import chapterCom from '../components/chapter.vue'
const props = defineProps(['url_name'])
const emit = defineEmits(['on-success'])
import { clients, getNowDate } from '@/utils'
import custom from '@/utils/custom'
// import { getToken } from '@/utils/auth'
// 变量
// const headers = ref({ Authorization: 'Bearer ' + getToken() })
const drawer = ref(false)
const queryParams =ref({
pageIndex:1,
pageSize:10,
content:'',
subject:'',
subject_type:''
})
const typeList = custom.getExercisesTypeList()
// 生命周期
const subjectList = inject('subjectList')
const current_subject = inject('current_subject')
onMounted(() => {
// console.log(headers.value)
})
// 方法
function chooseChapterChildExercises() {
drawer.value = true
}
function onSubmit() {
}
function onReset() {
queryParams.value = {
pageIndex:1,
pageSize:10,
name:''
}
}
</script>
<template>
<div>
<el-button size="small" @click="chooseChapterChildExercises">添加习题</el-button>
<div v-if="url_name">{{url_name}}</div>
<el-drawer v-model="drawer" title="媒体库" size="60%">
<div class="drawer-section">
<!-- 搜索框-->
<div class="search-box">
<el-form ref="searchForm" :inline="true" :model="queryParams">
<el-form-item label="题目">
<el-input v-model="queryParams.content" placeholder="请输入" />
</el-form-item>
<el-form-item label="课程分类">
<el-select v-model="queryParams.subject" clearable placeholder="请选择">
<el-option
v-for="item in subjectList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="题目类型">
<el-select v-model="queryParams.subject_type" clearable placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
<el-button size="small" icon="refresh" @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 数据列表-->
<div class="list-box">
</div>
</div>
</el-drawer>
</div>
</template>
<style scoped>
.drawer-section{
padding: 10px;
}
</style>