|
|
|
@ -7,7 +7,7 @@ import Archivestype from '@/views/knowledge/knowledge/components/archivestype.vu |
|
|
|
import Navili from '@/views/knowledge/knowledge/components/Navili.vue' |
|
|
|
import KnowledgeContent from '@/views/knowledge/knowledge/components/KnowledgeContent.vue' |
|
|
|
import { UserQuery, UserDetail, NaviQuery, Navi, Graphicform, PageParam } from '@/api/knowledge/types' |
|
|
|
import { onScroll, scrollTo, formatDate } from '@/api/knowledge/scroll' |
|
|
|
import { onScroll, formatDate } from '@/api/knowledge/scroll' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import errimg from '@/assets/404_images/imgNotFound.png' |
|
|
|
|
|
|
|
@ -83,7 +83,26 @@ onBeforeMount(() => { |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
// 监听滚动事件 |
|
|
|
window.addEventListener('scroll', jsScroll, false) |
|
|
|
//window.addEventListener('scroll', jsScroll, false) |
|
|
|
document.querySelector('.app-container')!.addEventListener('scroll', jsScroll, false) |
|
|
|
|
|
|
|
document.querySelector('.navs')!.addEventListener('wheel', (e) => { |
|
|
|
//阻止默认行为(页面的滚动行为) |
|
|
|
e.preventDefault() |
|
|
|
}, { |
|
|
|
//这里一定要显式设置为false,因为默认是true |
|
|
|
passive: false, |
|
|
|
}) //has-logo sidebar-container |
|
|
|
|
|
|
|
document.querySelector('.sidebar-container')!.addEventListener('wheel', (e) => { |
|
|
|
//阻止默认行为(页面的滚动行为) |
|
|
|
e.preventDefault() |
|
|
|
}, { |
|
|
|
//这里一定要显式设置为false,因为默认是true |
|
|
|
passive: false, |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (routerUrl.endsWith("index")) {//此时页面为知识库 |
|
|
|
naviQueryParam.atParentId = '16213848089876281' |
|
|
|
@ -141,10 +160,39 @@ function showContentDialog(item: any) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//跳转至相关内容 start |
|
|
|
function scrollTo(index: any) { |
|
|
|
nextTick(() => { |
|
|
|
//console.log(index) |
|
|
|
const ele = document?.querySelector<HTMLElement>(`.content .models:nth-child(${index + 1})`)! |
|
|
|
ele.scrollIntoView() |
|
|
|
active.value = index |
|
|
|
}) |
|
|
|
} |
|
|
|
//跳转至相关内容 end |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
<template> |
|
|
|
<div class="app-container"> |
|
|
|
<KnowledgeContent v-model:isShow="showContentBox" :contentSource="cardContentSource"></KnowledgeContent> |
|
|
|
|
|
|
|
<!-- 导航区域 --> |
|
|
|
|
|
|
|
<div class="uldiv"> |
|
|
|
<ul class="navs"> |
|
|
|
<li :class="{ active: active === 0 }" @click="scrollTo(0)"> |
|
|
|
推荐 |
|
|
|
</li> |
|
|
|
|
|
|
|
<template v-for="(item, index) in naviList"> |
|
|
|
<Navili :class="{ active: active === index+1 }" :oneli=item :index=(index+1) v-if="item.hasCard" :active=active |
|
|
|
@click="scrollTo(index + 1)"></Navili> |
|
|
|
</template> |
|
|
|
|
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 内容区域 --> |
|
|
|
<div class="content"> |
|
|
|
|
|
|
|
@ -194,70 +242,82 @@ function showContentDialog(item: any) { |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
<!-- 内容详情组件 --> |
|
|
|
<KnowledgeContent v-model:isShow="showContentBox" :contentSource="cardContentSource"></KnowledgeContent> |
|
|
|
|
|
|
|
<!-- 导航区域 --> |
|
|
|
|
|
|
|
<ul class="navs"> |
|
|
|
<li :class="{ active: active === 0 }" @click="scrollTo(0)"> |
|
|
|
推荐 |
|
|
|
</li> |
|
|
|
|
|
|
|
<template v-for="(item, index) in naviList"> |
|
|
|
<Navili :class="{ active: active === index+1 }" :oneli=item :index=(index+1) v-if="item.hasCard" :active=active |
|
|
|
@click="scrollTo(index + 1)"></Navili> |
|
|
|
</template> |
|
|
|
|
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
.app-container { |
|
|
|
height: calc(100vh - 125px); |
|
|
|
width: 100%; |
|
|
|
overflow: auto; |
|
|
|
padding: 0 10px 0 30px; |
|
|
|
display: grid; |
|
|
|
/* 声明了三列,宽度分别为 200px 100px 200px */ |
|
|
|
grid-template-columns: 200px auto; |
|
|
|
} |
|
|
|
|
|
|
|
.content { |
|
|
|
background-color: white; |
|
|
|
width: 89.1%; |
|
|
|
margin-left: 190px; |
|
|
|
width: auto; |
|
|
|
max-width: 87%; |
|
|
|
padding-left: 9%; |
|
|
|
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; |
|
|
|
border-radius: 5px; |
|
|
|
} |
|
|
|
|
|
|
|
h3 { |
|
|
|
margin-left: 10px; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 导航栏的样式 */ |
|
|
|
.navs { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
width: 192px; |
|
|
|
width: 142px; |
|
|
|
position: fixed; |
|
|
|
height: auto; |
|
|
|
top: 95px; |
|
|
|
|
|
|
|
top: 105px; |
|
|
|
text-align: center; |
|
|
|
line-height: 5; |
|
|
|
font-size: 11.5px; |
|
|
|
color: #909399; |
|
|
|
background-color: white; |
|
|
|
padding: 10px; |
|
|
|
border-radius: 9.5px; |
|
|
|
box-shadow: rgba(0, 0, 0, 0.04) 0px 2px 5px; |
|
|
|
} |
|
|
|
|
|
|
|
.navs li { |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
line-height: 3; |
|
|
|
li { |
|
|
|
padding-left: 12px; |
|
|
|
text-align: left; |
|
|
|
line-height: 2.7; |
|
|
|
font-size: 15.5px; |
|
|
|
color: #909399; |
|
|
|
background-color: white; |
|
|
|
margin-right: 15px; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.navs li:hover { |
|
|
|
li:hover { |
|
|
|
cursor: pointer; |
|
|
|
background-color: #F2F3F5; |
|
|
|
color: #409EFF; |
|
|
|
border-radius: 6px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 当导航被点亮后改变颜色 */ |
|
|
|
.navs .active { |
|
|
|
color: #409EFF; |
|
|
|
|
|
|
|
background-color: #EAF2FF; |
|
|
|
border-radius: 6px; |
|
|
|
} |
|
|
|
|
|
|
|
.model-title { |
|
|
|
@ -293,6 +353,7 @@ function showContentDialog(item: any) { |
|
|
|
border-radius: 15px; |
|
|
|
width: 480px; |
|
|
|
height: 290px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.card-right { |
|
|
|
|