mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 19:06:43 +08:00
案例缓存
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<router-view />
|
<keep-alive :include="['case']">
|
||||||
|
<router-view />
|
||||||
|
</keep-alive>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ import apiType from "@/api/modules/type.js";
|
|||||||
import { cutFullName } from "@/utils/tools.js";
|
import { cutFullName } from "@/utils/tools.js";
|
||||||
import apiPlace from "@/api/phase2/place.js"
|
import apiPlace from "@/api/phase2/place.js"
|
||||||
export default {
|
export default {
|
||||||
name: "index",
|
name: "case",
|
||||||
components: {
|
components: {
|
||||||
portalHeader,
|
portalHeader,
|
||||||
portalFooter,
|
portalFooter,
|
||||||
@@ -556,22 +556,26 @@ export default {
|
|||||||
return !this.speciData.some(item => item.fielclass);
|
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() {
|
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 = {
|
const allData = {
|
||||||
0: {
|
0: {
|
||||||
@@ -714,10 +718,6 @@ export default {
|
|||||||
// window.addEventListener("scroll", this.handleScroll);
|
// window.addEventListener("scroll", this.handleScroll);
|
||||||
// 获取年
|
// 获取年
|
||||||
this.getYears();
|
this.getYears();
|
||||||
// if(this.pageScroll){
|
|
||||||
// this.queryCondition.pageIndex = parseInt(this.pageScroll.pages)
|
|
||||||
// this.queryCondition.type = this.pageScroll.type
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
// window.removeEventListener("scroll", this.handleScroll);
|
// window.removeEventListener("scroll", this.handleScroll);
|
||||||
@@ -807,12 +807,6 @@ export default {
|
|||||||
apiCase.startReadTimer(refId)
|
apiCase.startReadTimer(refId)
|
||||||
}
|
}
|
||||||
this.$router.push({ path: '/case/detail', query: { id } });
|
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() {
|
tylClick() {
|
||||||
window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130");
|
window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130");
|
||||||
|
|||||||
Reference in New Issue
Block a user