From 72fbaed559506a78f1767f0d1e714234c4912199 Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Sat, 22 Jan 2022 00:57:57 +0800 Subject: [PATCH] 220 --- src/App.vue | 2 +- src/i18n/langs/cn.js | 47 +++++-- src/i18n/langs/en.js | 47 +++++-- src/router/index.js | 20 ++- src/views/Test.vue | 132 +----------------- src/views/anchor.vue | 21 ++- src/views/content/components/details.vue | 25 +++- src/views/content/components/list.vue | 5 +- src/views/content/index.vue | 32 +++-- src/views/footer/index.vue | 59 ++++++-- src/views/header/index.vue | 36 +++-- src/views/index/components/bottom.vue | 34 ++++- src/views/index/components/news_center.vue | 2 +- .../components/party_building_activities.vue | 8 +- .../components/scientific_research_trends.vue | 10 +- .../index/components/teaching_student.vue | 4 +- 16 files changed, 267 insertions(+), 217 deletions(-) diff --git a/src/App.vue b/src/App.vue index af2c698..fc2aa58 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,7 +12,7 @@ - + - diff --git a/src/views/anchor.vue b/src/views/anchor.vue index a45653e..b5d58f4 100644 --- a/src/views/anchor.vue +++ b/src/views/anchor.vue @@ -51,6 +51,18 @@ export default { document.onmousewheel = this.scrollFun; } }, + beforeDestroy() { //及时释放 + // 浏览器兼容 + if ((navigator.userAgent.toLowerCase().indexOf("firefox") != -1)) { + document.removeEventListener("DOMMouseScroll", this.scrollFun, false); + } else if (document.addEventListener) { + document.removeEventListener("mousewheel", this.scrollFun, false); + } else if (document.attachEvent) { + document.removeEventListener("onmousewheel", this.scrollFun); + } else { + document.onmousewheel = this.scrollFun; + } + }, methods: { scrollFun(event) { //console.log(this.main,this.page2.offsetTop,this.screenHeight) @@ -60,18 +72,19 @@ export default { let delta = event.detail || (-event.wheelDelta); console.log(delta) // 如果当前滚动开始时间和上次滚动结束时间的差值小于1.5s,则不执行翻页动作,这样做是为了实现类似节流的效果 - if ((this.startTime - this.endTime) > 1000) { - if (delta > 0 && window.pageYOffset < 937) { + if ((this.startTime - this.endTime) > 1) { + if (delta > 0 && window.pageYOffset < window.innerHeight) { // // 向下滚动 // this.index = 2; // this.toPage(this.index); - window.scrollTo({top: 937, behavior: 'smooth',}) - } else if (delta < 0 && parseInt(this.main.offsetTop) == 0) { + window.scrollTo({top: window.innerHeight+20, behavior: 'smooth',}) + } else if (delta < 0 && window.pageYOffset <= window.innerHeight+200) { // // 向上滚动 // // // // + window.scrollTo({top: 0, behavior: 'smooth',}) // this.index = 1; // this.toPage(this.index); } diff --git a/src/views/content/components/details.vue b/src/views/content/components/details.vue index e629a2a..5ad39cc 100644 --- a/src/views/content/components/details.vue +++ b/src/views/content/components/details.vue @@ -4,7 +4,13 @@ {{ value.title }} - 测试 + + + 来源: {{getSource()}} + 作者:{{value.publishUserName}} + 日期:{{value.publishTime}} + 点击数:{{value.viewCount}} + @@ -15,7 +21,7 @@