Browse Source

合并李文轩分支

liwenxuan_v2
超级管理员 2 years ago
parent
commit
373932a443
  1. 8
      src/api/knowledge/scroll.js
  2. 2
      src/layout/components/AppMain.vue
  3. 6
      src/views/knowledge/knowledge/components/KnowledgeContent.vue
  4. 7
      src/views/knowledge/knowledge/components/Navili.vue
  5. 127
      src/views/knowledge/knowledge/index.vue
  6. 125
      src/views/knowledge/news/index.vue

8
src/api/knowledge/scroll.js

@ -13,7 +13,9 @@ export function onScroll() {
offsetTopArr.push(item.offsetTop) offsetTopArr.push(item.offsetTop)
}) })
// 获取当前文档流的 scrollTop // 获取当前文档流的 scrollTop
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop //const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
const scrollTop = document.querySelector('.app-container').scrollTop || document.body.scrollTop
// 定义当前点亮的导航下标 // 定义当前点亮的导航下标
let navIndex = 0 let navIndex = 0
for (let n = 0; n < offsetTopArr.length; n++) { for (let n = 0; n < offsetTopArr.length; n++) {
@ -32,7 +34,7 @@ export function onScroll() {
} }
// 跳转到指定索引的元素 // 跳转到指定索引的元素
export function scrollTo(index) { /* export function scrollTo(index) {
// 获取目标的 offsetTop // 获取目标的 offsetTop
@ -80,7 +82,7 @@ export function onScroll() {
requestAnimationFrame(smoothUp) requestAnimationFrame(smoothUp)
} }
} }
} } */
export function formatDate(timestamp) { export function formatDate(timestamp) {
var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000

2
src/layout/components/AppMain.vue

@ -34,7 +34,7 @@ const tagsViewStore = useTagsViewStore();
.hasTagsView { .hasTagsView {
.app-main { .app-main {
/* 84 = navbar + tags-view = 50 + 34 */ /* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 84px); min-height: calc(100vh - 85px);
} }
.fixed-header + .app-main { .fixed-header + .app-main {

6
src/views/knowledge/knowledge/components/KnowledgeContent.vue

@ -1,5 +1,5 @@
<script setup lang='ts'> <script setup lang='ts'>
import { onScroll, scrollTo, formatDate } from '@/api/knowledge/scroll' import { formatDate } from '@/api/knowledge/scroll'
@ -49,11 +49,7 @@ watch(() => props.isShow, () => {
} }
}) })
onMounted(() => {
/* const gTestUrl = props.contentSource?.gTestUrl;
const gContent = props.contentSource?.gContent; */
});
</script> </script>

7
src/views/knowledge/knowledge/components/Navili.vue

@ -1,5 +1,8 @@
<script lang='ts' setup> <script lang='ts' setup>
<<<<<<< HEAD
import { scrollTo } from '@/api/knowledge/scroll' import { scrollTo } from '@/api/knowledge/scroll'
=======
>>>>>>> v3_liwenxuan
const showli = ref(true); const showli = ref(true);
@ -26,8 +29,12 @@ const liIndex = props.index + 1;
<template> <template>
<<<<<<< HEAD
<li :class="{ active: active === index }" @click="scrollTo(index)" v-if="showli"> <li :class="{ active: active === index }" @click="scrollTo(index)" v-if="showli">
=======
<li :class="{ active: active === index }" v-if="showli">
>>>>>>> v3_liwenxuan
{{ oneli?.atTitle }} {{ oneli?.atTitle }}
</li> </li>
</template> </template>

127
src/views/knowledge/knowledge/index.vue

@ -9,7 +9,7 @@ import Navili from './components/Navili.vue'
import KnowledgeContent from './components/KnowledgeContent.vue' import KnowledgeContent from './components/KnowledgeContent.vue'
import { UserQuery, UserDetail, NaviQuery, Navi, Graphicform, PageParam } from '@/api/knowledge/types' 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 { useRouter } from 'vue-router'
import errimg from '@/assets/404_images/imgNotFound.png' import errimg from '@/assets/404_images/imgNotFound.png'
@ -93,7 +93,26 @@ onBeforeMount(() => {
onMounted(() => { 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()
}, {
//falsetrue
passive: false,
}) //has-logo sidebar-container
document.querySelector('.sidebar-container')!.addEventListener('wheel', (e) => {
//
e.preventDefault()
}, {
//falsetrue
passive: false,
})
if (routerUrl.endsWith("index")) {// if (routerUrl.endsWith("index")) {//
naviQueryParam.atParentId = '16213848089876281' naviQueryParam.atParentId = '16213848089876281'
@ -105,6 +124,7 @@ onMounted(() => {
getZxxyNavis(naviQueryParam) getZxxyNavis(naviQueryParam)
.then(({ data }) => { .then(({ data }) => {
naviList.value = data naviList.value = data
<<<<<<< HEAD
//console.log(naviList.value) //console.log(naviList.value)
}).finally(() => { }).finally(() => {
@ -120,6 +140,11 @@ onMounted(() => {
fatherisReady.value = 100; fatherisReady.value = 100;
}) })
=======
}).finally(() => {
fatherisReady.value = 100;
})
>>>>>>> v3_liwenxuan
// //
getTuijian(pageParamTuijian) getTuijian(pageParamTuijian)
.then(({ data }) => { .then(({ data }) => {
@ -177,11 +202,40 @@ 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> </script>
<template> <template>
<div class="app-container"> <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"> <div class="content">
@ -236,10 +290,11 @@ v-if="pageParamTuijian.total > 0" v-model:current-page="pageParamTuijian.page"
</Archivestype> </Archivestype>
</div> </div>
<!-- 内容详情组件 -->
<KnowledgeContent v-model:isShow="showContentBox" :contentSource="cardContentSource"></KnowledgeContent>
<<<<<<< HEAD
<!-- 导航区域 --> <!-- 导航区域 -->
@ -257,6 +312,9 @@ v-if="pageParamTuijian.total > 0" v-model:current-page="pageParamTuijian.page"
</ul> </ul>
=======
>>>>>>> v3_liwenxuan
</div> </div>
</template> </template>
@ -264,6 +322,7 @@ v-if="pageParamTuijian.total > 0" v-model:current-page="pageParamTuijian.page"
<style scoped> <style scoped>
<<<<<<< HEAD
/* 内容区的样式 */ /* 内容区的样式 */
.content { .content {
@ -292,17 +351,40 @@ v-if="pageParamTuijian.total > 0" v-model:current-page="pageParamTuijian.page"
border-radius: 5px; border-radius: 5px;
} }
} }
=======
.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: 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;
}
/* 导航栏的样式 */ >>>>>>> v3_liwenxuan
.navs {
width: 192px; /* 导航栏的样式 */
.navs {
width: 142px;
position: fixed; position: fixed;
height: auto; height: auto;
<<<<<<< HEAD
top: 95px; top: 95px;
@ -322,17 +404,42 @@ v-if="pageParamTuijian.total > 0" v-model:current-page="pageParamTuijian.page"
color: #909399; color: #909399;
background-color: white; background-color: white;
margin-right: 15px; margin-right: 15px;
=======
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;
}
li {
padding-left: 12px;
text-align: left;
line-height: 2.7;
font-size: 15.5px;
color: #909399;
background-color: white;
>>>>>>> v3_liwenxuan
} }
.navs li:hover { li:hover {
cursor: pointer; cursor: pointer;
background-color: #F2F3F5;
color: #409EFF;
border-radius: 6px;
} }
/* 当导航被点亮后改变颜色 */ /* 当导航被点亮后改变颜色 */
.navs .active { .navs .active {
color: #409EFF; color: #409EFF;
background-color: #EAF2FF;
border-radius: 6px;
} }
.model-title { .model-title {

125
src/views/knowledge/news/index.vue

@ -15,7 +15,7 @@ import Archivestype from '@/views/knowledge/knowledge/components/archivestype.vu
import Navili from '@/views/knowledge/knowledge/components/Navili.vue' import Navili from '@/views/knowledge/knowledge/components/Navili.vue'
import KnowledgeContent from '@/views/knowledge/knowledge/components/KnowledgeContent.vue' import KnowledgeContent from '@/views/knowledge/knowledge/components/KnowledgeContent.vue'
import { UserQuery, UserDetail, NaviQuery, Navi, Graphicform, PageParam } from '@/api/knowledge/types' 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 { useRouter } from 'vue-router'
import errimg from '@/assets/404_images/imgNotFound.png' import errimg from '@/assets/404_images/imgNotFound.png'
@ -91,7 +91,26 @@ onBeforeMount(() => {
onMounted(() => { 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()
}, {
//falsetrue
passive: false,
}) //has-logo sidebar-container
document.querySelector('.sidebar-container')!.addEventListener('wheel', (e) => {
//
e.preventDefault()
}, {
//falsetrue
passive: false,
})
if (routerUrl.endsWith("index")) {// if (routerUrl.endsWith("index")) {//
naviQueryParam.atParentId = '16213848089876281' naviQueryParam.atParentId = '16213848089876281'
@ -149,10 +168,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> </script>
<template> <template>
<div class="app-container"> <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"> <div class="content">
@ -202,70 +250,82 @@ function showContentDialog(item: any) {
</template> </template>
</div> </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> </div>
</template> </template>
<style scoped> <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 { .content {
background-color: white; background-color: white;
width: 89.1%; width: auto;
margin-left: 190px; max-width: 87%;
padding-left: 9%;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
border-radius: 5px; border-radius: 5px;
} }
h3 {
margin-left: 10px;
}
/* 导航栏的样式 */ /* 导航栏的样式 */
.navs { .navs {
width: 142px;
width: 192px;
position: fixed; position: fixed;
height: auto; 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 { li {
padding-left: 12px;
text-align: center; text-align: left;
line-height: 3; line-height: 2.7;
font-size: 15.5px; font-size: 15.5px;
color: #909399; color: #909399;
background-color: white; background-color: white;
margin-right: 15px;
} }
.navs li:hover { li:hover {
cursor: pointer; cursor: pointer;
background-color: #F2F3F5;
color: #409EFF;
border-radius: 6px;
} }
/* 当导航被点亮后改变颜色 */ /* 当导航被点亮后改变颜色 */
.navs .active { .navs .active {
color: #409EFF; color: #409EFF;
background-color: #EAF2FF;
border-radius: 6px;
} }
.model-title { .model-title {
@ -301,6 +361,7 @@ function showContentDialog(item: any) {
border-radius: 15px; border-radius: 15px;
width: 480px; width: 480px;
height: 290px; height: 290px;
} }
.card-right { .card-right {

Loading…
Cancel
Save