From a0e7a721454b71e6c62c16f78a175e12fbb6568c Mon Sep 17 00:00:00 2001 From: zhangsir Date: Wed, 10 Apr 2024 15:44:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 4 ++- src/views/portal/case/Index.vue | 46 ++++++++++++++------------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/App.vue b/src/App.vue index 7c606247..d3bdee6f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,8 @@ diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index 6e6bb935..69b30c86 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -385,7 +385,7 @@ import apiType from "@/api/modules/type.js"; import { cutFullName } from "@/utils/tools.js"; import apiPlace from "@/api/phase2/place.js" export default { - name: "index", + name: "case", components: { portalHeader, portalFooter, @@ -556,22 +556,26 @@ export default { return !this.speciData.some(item => item.fielclass); } }, + beforeRouteLeave (to, from, next) { + if(to.name !== 'caseDetail'){ + this.$destroy() + }else{ + sessionStorage.setItem('pagesScroll', JSON.stringify(window.pageYOffset)) + } + next() + }, + beforeRouteEnter(to, from, next) { + next(vm=>{ + vm.$nextTick(() => { + window.scrollTo({ + left: 0, + top: JSON.parse(sessionStorage.getItem("pagesScroll")), + }) + sessionStorage.removeItem("pagesScroll") + }); + }) + }, created() { - // this.pageScroll = JSON.parse(sessionStorage.getItem("pagesScroll")) - // if(this.pageScroll){ - // this.queryCondition.pageIndex = parseInt(this.pageScroll.pages) - // this.queryCondition.type = this.pageScroll.type - // this.$nextTick(() => { - // if(JSON.parse(sessionStorage.getItem("pagesScroll"))){ - // window.scrollTo({ - // left: 0, - // top: JSON.parse(sessionStorage.getItem("pagesScroll")).scrollTop, - // }) - // sessionStorage.removeItem("pagesScroll") - // } - // }); - // return - // } (() => { const allData = { 0: { @@ -714,10 +718,6 @@ export default { // window.addEventListener("scroll", this.handleScroll); // 获取年 this.getYears(); - // if(this.pageScroll){ - // this.queryCondition.pageIndex = parseInt(this.pageScroll.pages) - // this.queryCondition.type = this.pageScroll.type - // } }, beforeDestroy() { // window.removeEventListener("scroll", this.handleScroll); @@ -807,12 +807,6 @@ export default { apiCase.startReadTimer(refId) } this.$router.push({ path: '/case/detail', query: { id } }); - // this.pageScroll = { - // pages: this.queryCondition.pageIndex, - // scrollTop: window.pageYOffset, - // type: this.queryCondition.type, - // } - // sessionStorage.setItem('pagesScroll', JSON.stringify(this.pageScroll)) }, tylClick() { window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130");