fix:指导手册

This commit is contained in:
guoyue 2022-07-13 15:04:12 +08:00
parent 8acde6c897
commit dfbdbb5a46
3 changed files with 140 additions and 198 deletions

View File

@ -1,19 +1,22 @@
<template> <template>
<div class="list-box"> <div class="list-box">
<div class="list-item" v-for="(item, i) in newDataList" :key="i" @click.stop="showChildren(item)"> <div class="list-item" v-for="(item, i) in newDataList" :key="i" @click.stop="showChildren(item)">
<div :class="[selectName === item.title ? 'select' : '', level === 1 ? 'parent' : '']" class="list-text"> <div :class="[clickData.title === item.title ? 'select' : '', level === 1 ? 'parent' : '']"
{{ item.title }}{{ item.show }} class="list-text">
{{ item.title }}
<DownOutlined v-show="!item.show && item.children && item.children.length > 0" /> <DownOutlined v-show="!item.show && item.children && item.children.length > 0" />
<UpOutlined v-show="item.show && item.children && item.children.length > 0" /> <UpOutlined v-show="item.show && item.children && item.children.length > 0" />
</div> </div>
<div style="margin-left:10px" v-if="item.children && item.children.length > 0 && item.show"> <div style="margin-left:10px" v-if="item.children && item.children.length > 0 && item.show">
<showList :dataList="item.children" @tree-click="handleTreeItem" :level="newLevel + 1"></showList> <abilityDocTree :dataList="item.children" @tree-click="handleTreeItem" :clickData="clickData"
:level="newLevel + 1">
</abilityDocTree>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { defineComponent, onMounted, ref, watch, defineProps, nextTick, emit } from 'vue'; import { defineComponent, onMounted, ref, watch, defineProps, nextTick } from 'vue';
import { getDevelopDocTree } from '@/api/home' import { getDevelopDocTree } from '@/api/home'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { UpOutlined, DownOutlined } from '@ant-design/icons-vue' import { UpOutlined, DownOutlined } from '@ant-design/icons-vue'
@ -31,14 +34,16 @@ const props = defineProps({
type: Number, type: Number,
default: 1 default: 1
}, },
// level clickData: {
type: Object,
default: () => { title: '' }
},
}) })
// props.dataList.map(v => v.show = false)
//
const newDataList = ref(props.dataList) const newDataList = ref(props.dataList)
// //
const newLevel = ref(props.level) const newLevel = ref(props.level)
const newSelectName = ref(props.selectName)
const getBgColor = (item, level) => { const getBgColor = (item, level) => {
// if(level === 1) { // if(level === 1) {
@ -50,44 +55,33 @@ const getBgColor = (item, level) => {
// } // }
} }
nextTick(() => {
console.log('props.dataList------------>', props.dataList);
console.log('props.selectName------------>', props.selectName);
})
const showChildren = (item) => { const showChildren = (item) => {
console.log('item------------>', item); console.log('item------------>', item);
if (!item.children) { if (!item.children) {
if (newSelectName.value !== item.title) { if (props.clickData.title !== '') {
newSelectName.value = item.title; handleTreeItem(item)
}else { }else {
newSelectName.value = '' handleTreeItem({title: ''})
} }
} }
if (item.children && item.children.length > 0) {
item.show = !item.show; item.show = !item.show;
nextTick(() => { }
console.log('newSelectName.value------------>', newSelectName.value);
})
} }
// const handleSelelct = (item) => { // watch(
// if(item.children) { // () => props.dataList,
// (val) => {
// if (val) {
// props.dataList = val;
// newDataList.value = val
// } // }
// } // }
// )
watch( const emit = defineEmits(['treeClick'])
() => props.dataList,
(val) => {
if (val) {
props.dataList = val;
newDataList.value = val
}
}
)
const handleTreeItem = (item) => { const handleTreeItem = (item) => {
emit('tree-click', item); emit('tree-click', item);
} }
@ -98,6 +92,13 @@ const handleTreeItem = (item) => {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
padding: 10px 0; padding: 10px 0;
cursor: pointer;
padding-left: 10px;
border-bottom: 1px solid #ccc;
&:hover {
color: #0058e1;
}
} }
.select { .select {
@ -110,6 +111,13 @@ const handleTreeItem = (item) => {
} }
.parent { .parent {
background: #0058e1; margin-bottom: 10px;
// background: #0058e1;
// color: #fff;
// margin-bottom: 10px;
// &:hover {
// color: #fff;
// }
} }
</style> </style>

View File

@ -1,149 +0,0 @@
<template>
<div class="doc-tree-box">
<!-- <div class="name-text primaryNode" v-for="(item, i) in treeData" :key="i" @click.stop="showBottom(item)"
:class="selectId === item.title ? 'select' : ''">
{{ item.title }}
<DownOutlined v-show="!item.show && item.children && item.children.length > 0" />
<UpOutlined v-show="item.show && item.children && item.children.length > 0" />
<div style="margin-left:20px" v-if="item.show && item.children && item.children.length > 0">
<div class="name-text" v-for="(val, j) in item.children" :key="j" @click.stop="showBottom(val)"
@click="showDown(item, val), onSelect(item, val)" :class="selectId === val.key ? 'select' : ''">
{{
val.title
}}
<DownOutlined v-show="!val.show && val.children && val.children.length > 0" />
<UpOutlined v-show="val.show && val.children && val.children.length > 0" />
<div style="margin-left:20px" v-if="val.show && val.children && val.children.length > 0">
<div class="name-text" v-for="(v, k) in val.children" :key="k" @click.stop="onSelect(item, val, v)"
:class="selectId == v.key ? 'select2' : ''">
{{
v.title
}}
<DownOutlined v-show="!v.show && v.children && v.children.length > 0" />
<UpOutlined v-show="v.show && v.children && v.children.length > 0" />
</div>
</div>
</div>
</div>
</div> -->
<showList :dataList="treeArray" @treeClick="treeClick"></showList>
</div>
</template>
<script setup>
import { defineComponent, onMounted, ref, watch, nextTick, defineEmits } from 'vue';
import { getDevelopDocTree } from '@/api/home'
import { message } from 'ant-design-vue'
import showList from './showList'
import { UpOutlined, DownOutlined } from '@ant-design/icons-vue'
let typeList = ['组件服务', '应用资源', '基础设施', '数据资源', '知识库'];
const treeData = ref([]);
const treeArray = ref([])
const getTreeData = () => {
getDevelopDocTree({}).then((res) => {
console.log('res------------>', res);
if (res.data.code !== 0) {
return message.error(res.data.msg)
}
treeArray.value = res.data.data || [];
treeData.value = [];
(res.data.data || []).map(val => {
let obj = {
title: val.title,
show: typeList.find(v => v === val.title) ? true : false,
select: false,
key: val.title,
children: []
}
formData(val.children, obj)
treeData.value.push(obj)
})
nextTick(() => {
console.log('treeData.value------------>', treeData.value);
})
}).catch((err) => {
console.log('err------------>', err);
message.error(err)
});
}
const formData = (children = [], dataItem) => {
children.map(item => {
let _obj = {
title: item.title,
show: false,
select: false,
key: item.title,
children: [],
}
if (item.children && item.children.length > 0) {
formData(item.children, _obj)
}
dataItem.children.push(_obj)
})
}
const emit = defineEmits(['treeClick'])
const selectId = ref('')
const showBottom = (item) => {
console.log('item------------>', item);
if (!item.children) {
if (selectId.value !== item.title) {
selectId.value = item.title;
} else {
selectId.value = ''
}
}
item.show = !item.show;
nextTick(() => {
console.log('selectId.value------------>', selectId.value);
if (selectId.value !== '') {
emit('treeClick', item)
}
})
}
// const showBottom = (item) => {
// item.show = !item.show
// }
const showDown = (item, val) => {
console.log('showDown', val)
if (item.title === '区级') {
val.show = !val.show
}
}
onMounted(() => {
getTreeData()
})
</script>
<style lang="less" scoped>
.doc-tree-box {
margin-left: 20px;
}
.name-text {
font-size: 16px;
color: #333;
padding: 10px 0;
cursor: pointer;
}
.select {
color: #0058e1;
font-weight: 600;
}
.normal {
color: #333;
}
</style>

View File

@ -3,9 +3,12 @@
<home-header></home-header> <home-header></home-header>
<div id="container" class="content"> <div id="container" class="content">
<div class="left"> <div class="left">
<h2 class="title-text" @click="showManual" :style="{ color: showManualFlag ? '#0058e1' : '' }">新手指引</h2> <div class="first-title-text" @click="showManual" :style="{ color: showManualFlag ? '#0058e1' : '' }">新手指引</div>
<h2 class="title-text" @click="showManual" :style="{ color: !showManualFlag ? '#0058e1' : '' }">技术文档</h2> <div class="first-title-text" @click="showManual" :style="{ color: !showManualFlag ? '#0058e1' : '' }">技术文档
<abilityTree @treeClick="treeClick"></abilityTree> </div>
<abilityDocTree :dataList="treeArray" @treeClick="treeClick" :clickData="clickData"></abilityDocTree>
<abilityDocTree :dataList="tempData" @treeClick="treeClick" :clickData="clickData"></abilityDocTree>
<!-- tempData -->
</div> </div>
<div class="right"> <div class="right">
<div v-if="showManualFlag">新手指引</div> <div v-if="showManualFlag">新手指引</div>
@ -19,34 +22,113 @@
</template> </template>
<script setup> <script setup>
import HomeHeader from '@/views/home/components/header' import HomeHeader from '@/views/home/components/header'
import abilityTree from './components/abilityTree'
import docsifyView from './components/docsifyView' import docsifyView from './components/docsifyView'
import abilityDocTree from './components/abilityDocTree'
import { getMyProcessInstancePage, wodepage } from '@/api/personalCenter' import { getMyProcessInstancePage, wodepage } from '@/api/personalCenter'
import { selectOne } from '@/api/home' import { selectOne } from '@/api/home'
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted, nextTick } from 'vue'
import { useStore } from 'vuex' import { useStore } from 'vuex'
import { useRouter } from 'vue-router' import { Empty, message } from 'ant-design-vue'
import { pinyin } from 'pinyin-pro' import { getDevelopDocTree } from '@/api/home'
import { Empty } from 'ant-design-vue'
const showManualFlag = ref(true) const showManualFlag = ref(true)
const showManual = () => { const showManual = () => {
showManualFlag.value = !showManualFlag.value showManualFlag.value = !showManualFlag.value
} }
const clickData = ref({})
const treeClick = (item) => { const treeClick = (item) => {
console.log('item---treeClick--------->', item); console.log('item---treeClick--------->', item);
clickData.value = item;
} }
let typeList = ['组件服务', '应用资源', '基础设施', '数据资源', '知识库'];
const tempData = ref([
{
title: '应用资源--假数据',
children: [
{
title: '能力11--假数据',
},
{
title: '能力1122',
},
{
title: '能力1133',
},
{
title: '能力1144',
},
]
}, {
title: '组件服务--假数据',
children: [
{
title: '算法优势--假数据',
children: [
{
title: '算法优势11',
},
{
title: '算法优势1122',
},
{
title: '算法优势1133',
},
{
title: '算法优势1144',
},
]
},
{
title: '社会治安'
},
],
}
])
const treeData = ref([]);
// const treeArray = ref(data)
const treeArray = ref([])
const getTreeData = () => {
getDevelopDocTree({}).then((res) => {
console.log('res------文档树------>', res);
if (res.data.code !== 0) {
console.log('222------------>', 222);
treeArray.value = tempData;
nextTick(() => {
console.log('treeArray.value------------>', treeArray.value);
})
return message.error(res.data.msg)
}
treeArray.value = res.data.data || [];
}).catch((err) => {
console.log('err------------>', err);
message.error(err)
});
}
onMounted(() => {
getTreeData()
})
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.father { .father {
// overflow: hidden; // overflow: hidden;
height: 100%; height: 100%;
} }
.title-text { .first-title-text {
cursor: pointer; cursor: pointer;
font-size: 16px; font-size: 18px;
color: #333; color: #333;
padding-bottom: 10px;
&:hover { &:hover {
color: #0058e1; color: #0058e1;
@ -63,13 +145,14 @@ const treeClick = (item) => {
.left { .left {
width: 240px; width: 240px;
height: 400px; padding: 20px;
height: 600px;
margin-right: 20px; margin-right: 20px;
background: rgba(244, 245, 248, 0.8); background: rgba(244, 245, 248, 0.8);
overflow-y: auto;
} }
.right { .right {
width: 880px; width: 880px;
// height: calc(100vh - 84px);
} }
</style> </style>