|
|
@@ -32,12 +32,13 @@
|
|
|
<!-- 课时列表 -->
|
|
|
<div v-for="(lesson, lessonIndex) in chapter.classHours" :key="lessonIndex" class="lesson">
|
|
|
<!-- 视频封面 -->
|
|
|
- <img src="@/assets/images/fileImg/gif.png" alt="Video Cover" class="video-cover" style="width: 140px; height: 90px"/>
|
|
|
+ <img src="@/assets/images/fileImg/gif.png" alt="Video Cover" class="video-cover"
|
|
|
+ style="width: 140px; height: 90px"/>
|
|
|
<!-- 课时信息 -->
|
|
|
<div style="display: flex; flex-direction: column; justify-content: space-between; height: 100% ">
|
|
|
<div>{{ lesson.name }}</div>
|
|
|
<div>
|
|
|
-<!-- <span>视频大小:{{ lesson.size }}MB</span>-->
|
|
|
+ <!-- <span>视频大小:{{ lesson.size }}MB</span>-->
|
|
|
<span>发布时间:{{ lesson.createTime }}</span>
|
|
|
<span>发布人:{{ lesson.createUserName }}</span>
|
|
|
</div>
|
|
|
@@ -52,15 +53,18 @@
|
|
|
</div>
|
|
|
<!-- 添加章节模态框 -->
|
|
|
<a-modal v-model:visible="modalVisible" :title="dialogTitle" @ok="handleOk" @cancel="handleCancel">
|
|
|
- <a-form :model="formState">
|
|
|
- <a-form-item label="章节名称">
|
|
|
+ <a-form :model="formState" ref="formRef" :rules="rules" :label-col="{ span: 7 }"
|
|
|
+ :wrapper-col="{ span: 12 }">
|
|
|
+ <a-form-item label="章节名称" name="chapterName">
|
|
|
<a-input v-model:value="formState.chapterName" placeholder="请输入章节名称"/>
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="章节名称">
|
|
|
- <a-select v-model:value="formState.knowledgeIds" placeholder="请选择状态" style="width: 120px; margin-right: 12px">
|
|
|
+ <a-form-item label="知识点" name="knowledgeIds">
|
|
|
+ <a-select mode="multiple" v-model:value="formState.knowledgeIds" placeholder="请选择知识点"
|
|
|
+ style="width: 220px; ">
|
|
|
<a-select-option v-for="(item, index) in knowledgeOptions" :key="index" :value="item.value">{{
|
|
|
item.label
|
|
|
- }}</a-select-option>
|
|
|
+ }}
|
|
|
+ </a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
@@ -75,13 +79,14 @@ import {ref, reactive, onMounted} from 'vue'
|
|
|
import addDialog from './addDialog.vue'
|
|
|
import courseProductionApi from '@/api/courseCenter/courseProduction.js'
|
|
|
import {useRoute, useRouter} from 'vue-router'
|
|
|
-import { del , edit as editApi } from '@/api/hour/index'
|
|
|
+import {del, edit as editApi} from '@/api/hour/index'
|
|
|
import tool from "@/utils/tool";
|
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
const popoverVisible = ref({})
|
|
|
+const formRef = ref(null)
|
|
|
const modeTag = ref('add')
|
|
|
const dialogTitle = ref('添加章节')
|
|
|
const knowledgeOptions = tool.dictList('knowledge')
|
|
|
@@ -103,9 +108,9 @@ const handleEdit = (item) => {
|
|
|
addDialogRef.value.edit(item)
|
|
|
}
|
|
|
const handleDel = (item) => {
|
|
|
- console.log('删除',item)
|
|
|
+ console.log('删除', item)
|
|
|
|
|
|
- del([{id : item.id}]).then(()=>{
|
|
|
+ del([{id: item.id}]).then(() => {
|
|
|
getList()
|
|
|
})
|
|
|
}
|
|
|
@@ -117,9 +122,13 @@ const addDialogRef = ref(null)
|
|
|
// 表单状态
|
|
|
const formState = reactive({
|
|
|
id: '',
|
|
|
- chapterName: '',
|
|
|
- knowledgeIds : []
|
|
|
+ chapterName: undefined,
|
|
|
+ knowledgeIds: []
|
|
|
})
|
|
|
+const rules = {
|
|
|
+ chapterName: [{required: true, message: '请输入章节名称', trigger: 'blur'}],
|
|
|
+ knowledgeIds: [{required: true, message: '请选择知识点', trigger: 'blur'}],
|
|
|
+}
|
|
|
const pagination = reactive({
|
|
|
pageSize: 10,
|
|
|
pageNum: 1,
|
|
|
@@ -131,48 +140,58 @@ const showModal = () => {
|
|
|
dialogTitle.value = '添加章节'
|
|
|
modeTag.value = 'add'
|
|
|
modalVisible.value = true
|
|
|
+
|
|
|
+
|
|
|
formState.chapterName = ''
|
|
|
formState.knowledgeIds = []
|
|
|
}
|
|
|
|
|
|
// 确认按钮点击事件
|
|
|
const handleOk = () => {
|
|
|
- let courseInfoId = props.courseInfoId
|
|
|
- if (formState.chapterName && modeTag.value == 'add') {
|
|
|
-
|
|
|
- courseProductionApi
|
|
|
- .add({
|
|
|
- courseId: courseInfoId,
|
|
|
- name: formState.chapterName
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- console.log(res, '章节添加')
|
|
|
- getList()
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
- formState.chapterName = '' // 清空表单
|
|
|
- modalVisible.value = false // 关闭模态框
|
|
|
- }
|
|
|
- if (formState.chapterName && modeTag.value == 'edit') {
|
|
|
-
|
|
|
- courseProductionApi
|
|
|
- .edit({
|
|
|
- id: formState.id,
|
|
|
- courseId: courseInfoId,
|
|
|
- name: formState.chapterName
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- console.log(res, '章节添加')
|
|
|
- getList()
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
- formState.chapterName = '' // 清空表单
|
|
|
- modalVisible.value = false // 关闭模态框
|
|
|
- }
|
|
|
+ formRef.value.validate().then(() => {
|
|
|
+
|
|
|
+
|
|
|
+ let courseInfoId = props.courseInfoId
|
|
|
+ if (formState.chapterName && modeTag.value == 'add') {
|
|
|
+
|
|
|
+ courseProductionApi
|
|
|
+ .add({
|
|
|
+ courseId: courseInfoId,
|
|
|
+ name: formState.chapterName,
|
|
|
+ knowledgeIds : formState.knowledgeIds
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res, '章节添加')
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ formState.chapterName = '' // 清空表单
|
|
|
+ modalVisible.value = false // 关闭模态框
|
|
|
+ }
|
|
|
+ if (formState.chapterName && modeTag.value == 'edit') {
|
|
|
+
|
|
|
+ courseProductionApi
|
|
|
+ .edit({
|
|
|
+ id: formState.id,
|
|
|
+ courseId: courseInfoId,
|
|
|
+ name: formState.chapterName,
|
|
|
+ knowledgeIds : formState.knowledgeIds
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res, '章节添加')
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ formState.chapterName = '' // 清空表单
|
|
|
+ modalVisible.value = false // 关闭模态框
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 取消按钮点击事件
|
|
|
@@ -187,8 +206,13 @@ const editChapter = (chapterIndex) => {
|
|
|
modalVisible.value = true
|
|
|
dialogTitle.value = '修改章节'
|
|
|
modeTag.value = 'edit'
|
|
|
+
|
|
|
+ formRef.value.resetFields()
|
|
|
+
|
|
|
+
|
|
|
formState.id = item.id
|
|
|
formState.chapterName = item.name
|
|
|
+ formState.knowledgeIds = item.knowledeges
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -247,7 +271,7 @@ const onAddChapter = () => {
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
console.log('有没有id呢', props.courseInfoId)
|
|
|
- console.log('有没有字典',knowledgeOptions)
|
|
|
+ console.log('有没有字典', knowledgeOptions)
|
|
|
getList()
|
|
|
|
|
|
|