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

bug fixes

上级 bf03f0ee
...@@ -83,7 +83,7 @@ onMounted(() => { ...@@ -83,7 +83,7 @@ onMounted(() => {
> >
<el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="80px"> <el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="80px">
<el-form-item label="章-名称:" prop="name"> <el-form-item label="章-名称:" prop="name">
<el-input v-model="form.name" maxlength="25"></el-input> <el-input v-model="form.name" maxlength="25" onkeydown="if (event.keyCode===13){return false;}"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
......
...@@ -27,6 +27,7 @@ const props = defineProps({ ...@@ -27,6 +27,7 @@ const props = defineProps({
type: String, type: String,
required: true required: true
}, },
chapterID: { chapterID: {
type: String, type: String,
required: true required: true
...@@ -83,7 +84,7 @@ onMounted(() => { ...@@ -83,7 +84,7 @@ onMounted(() => {
<p>{{ chapterName }}</p> <p>{{ chapterName }}</p>
</el-form-item> </el-form-item>
<el-form-item label="节-名称:" prop="name"> <el-form-item label="节-名称:" prop="name">
<el-input v-model="form.name" maxlength="25"></el-input> <el-input v-model="form.name" maxlength="25" onkeydown="if (event.keyCode===13){return false;}"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
......
...@@ -4,6 +4,7 @@ import CardListItem from './CardListItem.vue' ...@@ -4,6 +4,7 @@ import CardListItem from './CardListItem.vue'
import { useGetCategoryList } from '@/composables/useGetCategoryList' import { useGetCategoryList } from '@/composables/useGetCategoryList'
const appList = ref() const appList = ref()
const currentResource: any = $ref({})
// 资源出处 tab触发 // 资源出处 tab触发
const tabValue = ref('1') const tabValue = ref('1')
const path = ref('') const path = ref('')
...@@ -69,11 +70,10 @@ const listOptions = computed(() => { ...@@ -69,11 +70,10 @@ const listOptions = computed(() => {
httpRequest: getHttpRequest, httpRequest: getHttpRequest,
callback(data: any) { callback(data: any) {
data.list.forEach((item: any) => (item.check_status = false)) data.list.forEach((item: any) => (item.check_status = false))
data.list.filter((item: any) => item.status_name === '失效')
tableData = data tableData = data
return { list: data.list.filter((item: any) => item.status_name === '有效'), total: data.total } return { list: data.list, total: data.total }
}, },
params: { tab: tabValue, status: '', authorized: '', name: '', course_id: props.course_id } params: { tab: tabValue, status: '1', authorized: '', name: '', course_id: props.course_id }
}, },
filters: [ filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' }, { prop: 'classification', label: '类别:', slots: 'filter-type' },
...@@ -93,14 +93,12 @@ const handleCancel = () => { ...@@ -93,14 +93,12 @@ const handleCancel = () => {
} }
// 保存 添加 // 保存 添加
const handleSave = () => { const handleSave = () => {
const name = tableData.list.filter((item: any) => item.check_status === true)[0].name
const resource_id = tableData.list.filter((item: any) => item.check_status === true)[0].id
const params: any = { const params: any = {
name: name, name: currentResource.name,
course_id: props.course_id, course_id: props.course_id,
resource_type: props.btnInfo.resource_type, resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID, parent_id: props.chapterID,
resource_id: resource_id resource_id: currentResource.id
} }
createCharacter(params).then(() => { createCharacter(params).then(() => {
...@@ -147,13 +145,18 @@ if (props.btnInfo.resource_type === '2') { ...@@ -147,13 +145,18 @@ if (props.btnInfo.resource_type === '2') {
<template #body="{ data }"> <template #body="{ data }">
<div class="card-list" v-if="data.length"> <div class="card-list" v-if="data.length">
<div class="card-list-con"> <div class="card-list-con">
<div style="position: relative" v-for="(item, index) in data" :key="index"> <el-radio-group v-model="currentResource">
<el-checkbox <div style="position: relative" v-for="(item, index) in data" :key="index">
v-model="item.check_status" <el-radio
style="position: absolute; right: 40px; bottom: 22px" v-model="item.check_status"
></el-checkbox> :label="item"
<CardListItem :tabIndex="tabValue" :data="item" :path="path"> </CardListItem> style="position: absolute; right: 40px; bottom: 22px"
</div> >
{{ '' }}</el-radio
>
<CardListItem :tabIndex="tabValue" :data="item" :path="path"> </CardListItem>
</div>
</el-radio-group>
</div> </div>
</div> </div>
<el-empty v-else description="暂无数据" /> <el-empty v-else description="暂无数据" />
......
...@@ -20,6 +20,7 @@ const isShowAddDialog = ref(false) ...@@ -20,6 +20,7 @@ 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)
...@@ -54,7 +55,6 @@ const btnList = [ ...@@ -54,7 +55,6 @@ const btnList = [
resource_type: '6' resource_type: '6'
} }
] ]
// const fileType = ['doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'mp3', 'mp4', 'png', 'jpeg', 'jpg']
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
...@@ -67,6 +67,13 @@ onMounted(() => { ...@@ -67,6 +67,13 @@ onMounted(() => {
const handleChapterList = () => { const handleChapterList = () => {
getCharacter({ course_id: id, type: 'tree' }).then((res: any) => { getCharacter({ course_id: id, type: 'tree' }).then((res: any) => {
dataSource.value = res.data[0]?.children dataSource.value = res.data[0]?.children
dataSource.value.forEach((item: any) => {
if (item.children.length) {
item.children.forEach((it: any) => {
it.parent_name = item.name
})
}
})
}) })
} }
...@@ -83,19 +90,20 @@ const handleFresh = () => { ...@@ -83,19 +90,20 @@ 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
} }
//编辑章节 //编辑章节
const handleEdit = (node: any) => { const handleEdit = (node: any) => {
console.log(node, '0000node')
chapterID.value = node.key chapterID.value = node.key
isEdit.value = true isEdit.value = true
chapterName.value = node.label
chapterID.value = node.key chapterID.value = node.key
if (node.level === 1) { if (node.level === 1) {
isShowDialog.value = true isShowDialog.value = true
chapterName.value = node.label
} else { } else {
chapterName.value = node.data.parent_name
isShowSectionDialog.value = true isShowSectionDialog.value = true
} }
} }
...@@ -252,13 +260,14 @@ const nodeType = (node: any) => { ...@@ -252,13 +260,14 @@ const nodeType = (node: any) => {
draggable draggable
:data="dataSource" :data="dataSource"
node-key="id" node-key="id"
default-expand-all
:expand-on-click-node="false"
:props="defaultProps" :props="defaultProps"
:allow-drop="allowDrop" :allow-drop="allowDrop"
@node-drop="handleDrop" @node-drop="handleDrop"
style="min-width: 100%" style="min-width: 100%"
accordion
default-expand-all
> >
<!-- -->
<template #default="{ node, data }"> <template #default="{ node, data }">
<span class="custom-tree-node"> <span class="custom-tree-node">
<span> <span>
...@@ -332,6 +341,7 @@ const nodeType = (node: any) => { ...@@ -332,6 +341,7 @@ const nodeType = (node: any) => {
:chapterID="chapterID" :chapterID="chapterID"
:course_id="id" :course_id="id"
:isEdit="isEdit" :isEdit="isEdit"
:parentName="parentName"
/> />
<!-- 添加直播 --> <!-- 添加直播 -->
<AddLiveDialog <AddLiveDialog
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论