|
@@ -33,6 +33,7 @@ export default {
|
|
|
return {
|
|
|
arrBanner: [],
|
|
|
noticeArr: [],
|
|
|
+ noticeArrBridge: [], // 因为vue-router的keep-alive,swiper垂直滚动失效,缓存数据
|
|
|
arrProducttype: [0, 1], // 产品类型: 0明星产品1推荐产品
|
|
|
starProduct: [], // 明星产品
|
|
|
recommendedProduct: [] // 推荐贷款
|
|
@@ -40,11 +41,22 @@ export default {
|
|
|
},
|
|
|
activated () {
|
|
|
if (!this.$route.meta.isUseCache) {
|
|
|
+ this.arrBanner = []
|
|
|
+ this.noticeArr = []
|
|
|
+ this.noticeArrBridge = []
|
|
|
+ this.arrProducttype = [0, 1]
|
|
|
+ this.starProduct = []
|
|
|
+ this.recommendedProduct = []
|
|
|
this.fetchBanner()
|
|
|
this.fetchNotice()
|
|
|
this.arrProducttype.forEach(item => {
|
|
|
this.fetchProduct(item)
|
|
|
})
|
|
|
+ } else {
|
|
|
+ this.noticeArr = []
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.noticeArr = JSON.parse(JSON.stringify(this.noticeArrBridge))
|
|
|
+ })
|
|
|
}
|
|
|
this.$route.meta.isUseCache = false
|
|
|
},
|
|
@@ -68,7 +80,10 @@ export default {
|
|
|
fetchNotice () {
|
|
|
getNotice().then(res => {
|
|
|
if (res.status) {
|
|
|
- this.noticeArr = res.data
|
|
|
+ if (Object.prototype.toString.call(res.data) === '[object Array]') {
|
|
|
+ this.noticeArr = res.data
|
|
|
+ this.noticeArrBridge = JSON.parse(JSON.stringify(res.data))
|
|
|
+ }
|
|
|
} else {
|
|
|
Toast(res.msg)
|
|
|
}
|
|
@@ -98,7 +113,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
beforeRouteLeave (to, from, next) {
|
|
|
- if (['loanPrivacy', 'loanAgreement'].includes(to.name)) {
|
|
|
+ if (['loanMedia', 'loanExplain', 'loanCalculator', 'loanMine'].includes(to.name)) {
|
|
|
from.meta.isUseCache = true
|
|
|
}
|
|
|
next()
|