Merge pull request 'add:章节节点添加;' (#398) from yangws into main

Reviewed-on: #398
This commit is contained in:
yangws 2024-11-12 09:50:00 +08:00
commit f0fcbed61e
2 changed files with 73 additions and 1 deletions

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