add:章节节点添加; #398

Merged
yangws merged 1 commits from yangws into main 2024-11-12 09:50:02 +08:00
2 changed files with 73 additions and 1 deletions
Showing only changes of commit 0a080bd1f0 - Show all commits

View File

@ -0,0 +1,59 @@
<template>
<div style="padding: 10px;">
<el-dialog
v-model="dialogVisible"
width="30%"
append-to-body
>
<div style="display: flex;justify-content: center;">
<ChooseTextbook @node-click="nodeClick" />
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click.stop="save">确定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref, defineExpose } from 'vue'
import ChooseTextbook from '@/components/choose-textbook/index.vue'
const dialogVisible = ref(false)
const getNodeInfo = ref([])
const openDialog = () => {
dialogVisible.value = true
}
const getFullObj = (node) => {
const obj = []
const recursive = (currentNode) => {
//
if (currentNode.parentNode) {
obj.unshift(Object.assign({curentId: currentNode.id,title:currentNode.itemtitle}, currentNode.parentNode))
recursive(currentNode.parentNode)
} else {
obj.unshift({id: currentNode.id,title:currentNode.itemtitle})
}
}
recursive(node)
return obj
}
const nodeClick = (data) => {
getNodeInfo.value = getFullObj(data.node)
console.log(getNodeInfo.value, 'getNodeInfo.value')
}
const save = () => {
dialogVisible.value = false
}
defineExpose({
openDialog
})
</script>

View File

@ -2,6 +2,7 @@
<div v-loading="isLoading" class="page-resource flex"> <div v-loading="isLoading" class="page-resource flex">
<ChooseTextbook @node-click="nodeClick" /> <ChooseTextbook @node-click="nodeClick" />
<div class="page-center-wrap"> <div class="page-center-wrap">
<el-button @click="openChapter" type="primary">打开章节</el-button>
<el-tabs v-model="activeAptTab" style="height: 100%;"> <el-tabs v-model="activeAptTab" style="height: 100%;">
<el-tab-pane label="教学课件" name="教学课件" class="prepare-center-jxkj"> <el-tab-pane label="教学课件" name="教学课件" class="prepare-center-jxkj">
<div class="prepare-center-header"> <div class="prepare-center-header">
@ -140,6 +141,8 @@
<!-- 上课配置 --> <!-- 上课配置 -->
<class-start ref="calssRef" @close="closeChange"/> <class-start ref="calssRef" @close="closeChange"/>
<PptDialog @add-success="addAiPPT" :currentNode="currentNode" :uploadData="uploadData" v-model="pptDialog"/> <PptDialog @add-success="addAiPPT" :currentNode="currentNode" :uploadData="uploadData" v-model="pptDialog"/>
<!-- 章节弹窗 -->
<TreeLog ref="treelogRef"/>
<!-- <button @click="test">test</button> --> <!-- <button @click="test">test</button> -->
</template> </template>
<script setup> <script setup>
@ -178,6 +181,7 @@ import ClassReserv from '@/views/classManage/classReserv.vue'
import classStart from './container/class-start.vue' // import classStart from './container/class-start.vue' //
import MsgEnum from '@/plugins/imChat/msgEnum' // im import MsgEnum from '@/plugins/imChat/msgEnum' // im
import Chat from '@/utils/chat' // im import Chat from '@/utils/chat' // im
import TreeLog from './components/treeLog.vue'
if (!Chat.imChat) Chat.init() if (!Chat.imChat) Chat.init()
const toolStore = useToolState() const toolStore = useToolState()
@ -235,7 +239,9 @@ export default {
isOpenHomework: false, isOpenHomework: false,
// //
activeClass: null, activeClass: null,
pptDialog: false pptDialog: false,
//
treelogRef:null
} }
}, },
computed: { computed: {
@ -630,6 +636,8 @@ export default {
}) })
}, },
async nodeClick(data) { async nodeClick(data) {
console.log(data,'data');
if (this.currentNode.id === data.node.id) return if (this.currentNode.id === data.node.id) return
this.curBookImg = data.textBook.curBookImg this.curBookImg = data.textBook.curBookImg
this.curBookPath = data.textBook.curBookPath this.curBookPath = data.textBook.curBookPath
@ -788,6 +796,11 @@ export default {
'&reservId=' + '&reservId=' +
id id
}) })
},
//
openChapter(){
//
this.$refs.treelogRef.openDialog()
} }
} }
} }