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

bug fixes

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