|
|
|
@ -141,7 +141,6 @@
|
|
|
|
|
:visibility-height="200"
|
|
|
|
|
:bottom="50"
|
|
|
|
|
:right="10"
|
|
|
|
|
title="返回顶部"
|
|
|
|
|
style="z-index: 1000; border: 1px solid #2b62f1"
|
|
|
|
|
>
|
|
|
|
|
</el-backtop>
|
|
|
|
@ -290,6 +289,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
projectRemarks: [],
|
|
|
|
|
loading: false,
|
|
|
|
|
scrollTimeout: null,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
@ -474,28 +474,34 @@ export default {
|
|
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
},
|
|
|
|
|
handleScroll() {
|
|
|
|
|
// 获取滚动容器
|
|
|
|
|
const container = document.querySelector(".containerbody");
|
|
|
|
|
if (!container) return;
|
|
|
|
|
|
|
|
|
|
// 获取容器的滚动位置
|
|
|
|
|
const scrollPosition = container.scrollTop; // 添加偏移量,让菜单提前高亮
|
|
|
|
|
|
|
|
|
|
// 从下往上检查各部分,找到第一个顶部位置小于等于滚动位置的部分
|
|
|
|
|
for (let i = this.sections.length - 1; i >= 0; i--) {
|
|
|
|
|
const element = document.getElementById(this.sections[i].id);
|
|
|
|
|
if (element) {
|
|
|
|
|
// 计算元素相对于滚动容器的位置
|
|
|
|
|
const elementPosition = element.offsetTop - container.offsetTop;
|
|
|
|
|
|
|
|
|
|
if (elementPosition <= scrollPosition) {
|
|
|
|
|
if (this.activeSection !== this.sections[i].id) {
|
|
|
|
|
this.activeSection = this.sections[i].id;
|
|
|
|
|
if (this.scrollTimeout) {
|
|
|
|
|
clearTimeout(this.scrollTimeout);
|
|
|
|
|
}
|
|
|
|
|
this.scrollTimeout = setTimeout(() => {
|
|
|
|
|
const scrollPosition = container.scrollTop;
|
|
|
|
|
if (scrollPosition > this.lastScrollTop) {
|
|
|
|
|
this.scrollDirection = 'down';
|
|
|
|
|
} else {
|
|
|
|
|
this.scrollDirection = 'up';
|
|
|
|
|
}
|
|
|
|
|
this.lastScrollTop = scrollPosition;
|
|
|
|
|
const offset = this.scrollDirection === 'down' ? 500 : 200;
|
|
|
|
|
const adjustedScrollPosition = scrollPosition + offset;
|
|
|
|
|
for (let i = this.sections.length - 1; i >= 0; i--) {
|
|
|
|
|
const element = document.getElementById(this.sections[i].id);
|
|
|
|
|
if (element) {
|
|
|
|
|
const elementPosition = element.offsetTop - container.offsetTop;
|
|
|
|
|
if (elementPosition <= adjustedScrollPosition) {
|
|
|
|
|
if (this.activeSection !== this.sections[i].id) {
|
|
|
|
|
this.activeSection = this.sections[i].id;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, 50);
|
|
|
|
|
},
|
|
|
|
|
handleMenuClick() {
|
|
|
|
|
if (this.$refs.menuRef) {
|
|
|
|
|