案例565修改

This commit is contained in:
zhangsir
2024-03-20 14:43:55 +08:00
parent 230e3c7a21
commit 150f832c8a

View File

@@ -621,6 +621,7 @@ export default {
}
dataList(allData[random])
})()
this.pageScroll = JSON.parse(sessionStorage.getItem("pagesScroll"))
},
mounted() {
let $this = this;
@@ -699,7 +700,10 @@ 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);
@@ -789,6 +793,12 @@ 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");
@@ -1290,6 +1300,16 @@ export default {
// 给所有的赋值
this.caseList.count = res.result.count;
this.caseList.showPagCount = res.result.count;
this.$nextTick(() => {
if(JSON.parse(sessionStorage.getItem("pagesScroll"))){
window.scrollTo({
left: 0,
top: JSON.parse(sessionStorage.getItem("pagesScroll")).scrollTop,
behavior: 'smooth'
})
sessionStorage.removeItem("pagesScroll")
}
});
} else {
this.$message.error(res.message);
}