提交 a2e96242 authored 作者: matian's avatar matian

bug fixes

上级 10b8cc8d
...@@ -27,7 +27,10 @@ const props = defineProps({ ...@@ -27,7 +27,10 @@ const props = defineProps({
type: String, type: String,
required: true required: true
}, },
sectionName: {
type: String,
required: true
},
chapterID: { chapterID: {
type: String, type: String,
required: true required: true
...@@ -67,7 +70,7 @@ const handleConfirm = () => { ...@@ -67,7 +70,7 @@ const handleConfirm = () => {
} }
onMounted(() => { onMounted(() => {
if (props.isEdit) { if (props.isEdit) {
form.name = props.chapterName form.name = props.sectionName
} }
}) })
</script> </script>
......
...@@ -20,11 +20,13 @@ const isShowAddDialog = ref(false) ...@@ -20,11 +20,13 @@ const isShowAddDialog = ref(false)
const isShowExamDialog = ref(false) const isShowExamDialog = ref(false)
const isShowVideoPlayDialog = ref(false) const isShowVideoPlayDialog = ref(false)
const chapterName = ref('') const chapterName = ref('')
const parentName = ref('')
const chapterID = ref('') const chapterID = ref('')
const btnInfo = ref({}) // 按钮信息 const btnInfo = ref({}) // 按钮信息
const isEdit = ref(false) const isEdit = ref(false)
const videoUrl = ref('') const videoUrl = ref('')
const sectionName = ref('')
const defaultExpandedKeys: any = ref([])
const btnList = [ const btnList = [
{ {
btn_name: '视频', btn_name: '视频',
...@@ -55,7 +57,6 @@ const btnList = [ ...@@ -55,7 +57,6 @@ const btnList = [
resource_type: '6' resource_type: '6'
} }
] ]
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'name' label: 'name'
...@@ -70,7 +71,7 @@ const handleChapterList = () => { ...@@ -70,7 +71,7 @@ const handleChapterList = () => {
dataSource.value.forEach((item: any) => { dataSource.value.forEach((item: any) => {
if (item.children.length) { if (item.children.length) {
item.children.forEach((it: any) => { item.children.forEach((it: any) => {
it.parent_name = item.name it.parent_id = item.id
}) })
} }
}) })
...@@ -90,7 +91,6 @@ const handleFresh = () => { ...@@ -90,7 +91,6 @@ const handleFresh = () => {
const handleAddSection = (node: any) => { const handleAddSection = (node: any) => {
chapterName.value = node.label chapterName.value = node.label
chapterID.value = node.key chapterID.value = node.key
isShowSectionDialog.value = true isShowSectionDialog.value = true
isEdit.value = false isEdit.value = false
} }
...@@ -103,14 +103,15 @@ const handleEdit = (node: any) => { ...@@ -103,14 +103,15 @@ const handleEdit = (node: any) => {
isShowDialog.value = true isShowDialog.value = true
chapterName.value = node.label chapterName.value = node.label
} else { } else {
console.log(node.data.label)
chapterName.value = node.data.parent_name chapterName.value = node.data.parent_name
sectionName.value = node.label
isShowSectionDialog.value = true isShowSectionDialog.value = true
} }
} }
// 删除章节 // 删除章节
const handleDel = (node: any) => { const handleDel = (node: any) => {
console.log(node, 'node1222') console.log(node, 'node1222')
ElMessageBox.confirm('确定要删除吗?', '提示').then(() => { ElMessageBox.confirm('确定要删除吗?', '提示').then(() => {
const params = { id: node.key, course_id: id } const params = { id: node.key, course_id: id }
delCharacter(params).then(() => { delCharacter(params).then(() => {
...@@ -168,8 +169,7 @@ const allowDrop = (draggingNode: any, dropNode: any, type: any) => { ...@@ -168,8 +169,7 @@ const allowDrop = (draggingNode: any, dropNode: any, type: any) => {
} }
} }
//拖拽列表 //拖拽列表
const handleDrop = (startNode: any, endNode: any, position: any, event: any) => { const handleDrop = (startNode: any, endNode: any, position: any) => {
console.log(startNode, '-----', endNode, '-----', position, '-----', event)
const params = { const params = {
course_id: id, course_id: id,
id: startNode.data.id, id: startNode.data.id,
...@@ -247,6 +247,12 @@ const nodeType = (node: any) => { ...@@ -247,6 +247,12 @@ const nodeType = (node: any) => {
return '教案' return '教案'
} }
} }
const handleNodeExpand = (data: any) => {
defaultExpandedKeys.value = [data.id]
}
const handleNodeCollapse = () => {
defaultExpandedKeys.value = []
}
</script> </script>
<template> <template>
<AppCard :title="isEditCourse === '1' ? '编辑课程' : '新建课程'"> <AppCard :title="isEditCourse === '1' ? '编辑课程' : '新建课程'">
...@@ -257,16 +263,20 @@ const nodeType = (node: any) => { ...@@ -257,16 +263,20 @@ const nodeType = (node: any) => {
</div> </div>
</el-row> </el-row>
<el-tree <el-tree
ref="treeRef"
draggable draggable
:data="dataSource" :data="dataSource"
node-key="id" node-key="id"
:accordion="true"
:props="defaultProps" :props="defaultProps"
:allow-drop="allowDrop" :allow-drop="allowDrop"
:default-expanded-keys="defaultExpandedKeys"
:expand-on-click-node="false"
@node-drop="handleDrop" @node-drop="handleDrop"
@node-expand="handleNodeExpand"
@node-collapse="handleNodeCollapse"
style="min-width: 100%" style="min-width: 100%"
:expand-on-click-node="false"
> >
<!-- -->
<template #default="{ node, data }"> <template #default="{ node, data }">
<span class="custom-tree-node"> <span class="custom-tree-node">
<span> <span>
...@@ -346,7 +356,7 @@ const nodeType = (node: any) => { ...@@ -346,7 +356,7 @@ const nodeType = (node: any) => {
:chapterID="chapterID" :chapterID="chapterID"
:course_id="id" :course_id="id"
:isEdit="isEdit" :isEdit="isEdit"
:parentName="parentName" :sectionName="sectionName"
/> />
<!-- 添加直播 --> <!-- 添加直播 -->
<AddLiveDialog <AddLiveDialog
......
...@@ -142,7 +142,7 @@ const createResources = (params: any) => { ...@@ -142,7 +142,7 @@ const createResources = (params: any) => {
// 协议 // 协议
const protocol = ref(false) const protocol = ref(false)
const changeProtocol = (data:any) => { const changeProtocol = (data: any) => {
protocol.value = data.value protocol.value = data.value
} }
</script> </script>
...@@ -162,7 +162,9 @@ const changeProtocol = (data:any) => { ...@@ -162,7 +162,9 @@ const changeProtocol = (data:any) => {
<div class="upload-btn">本地文件</div> <div class="upload-btn">本地文件</div>
</div> </div>
</div> </div>
<div class="tips">文件支持格式包含:doc docx xls xlsx pdf ppt pptx mp3 mp4 png jpeg jpg,大小不超过200M</div> <div class="tips">
文件支持格式包含:doc docx xls xlsx pdf ppt pptx mp3 mp4 png jpeg jpg rar,大小不超过200M
</div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="资料名称:" prop="name"> <el-form-item label="资料名称:" prop="name">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论