0dc2efb3 by joe

10分钟缓存

1 parent 6075dcf6
......@@ -111,6 +111,10 @@ axios.interceptors.response.use(
} else {
if (response.data.code === 404) {
SET_USER_INFO(state, null);
for (let index = 0; index < sessionStorage.length; index++) {
let key = sessionStorage.key(index);
sessionStorage.removeItem(key);
}
}
// Toast(response.data.bizMsg);
return Promise.reject(response.data);
......
......@@ -39,7 +39,8 @@ export default {
// 可以理赔的客户信息
customerList: [],
modelType: "1",
modalVisiable: true
modalVisiable: true,
cacheCid: 10 * 60 * 1000
}
},
components: {
......@@ -64,12 +65,21 @@ export default {
// return;
if (this.userInfo && this.userInfo.name) {
this.loadCidIfLogin();
sessionStorage.removeItem("clarmsRequestCid")
sessionStorage.removeItem("clarmsRequestCid");
sessionStorage.removeItem("clarmsRequestCidExpireAt");
} else {
let cid = sessionStorage.getItem("clarmsRequestCid");
let expireAt = sessionStorage.getItem("clarmsRequestCidExpireAt");
if (cid) {
this.cid = cid;
this.checkCid();
if (expireAt && expireAt > new Date().getTime()) {
sessionStorage.setItem("clarmsRequestCidExpireAt", (new Date().getTime() + this.cacheCid));
this.cid = cid;
this.checkCid();
} else {
sessionStorage.removeItem("clarmsRequestCid")
sessionStorage.removeItem("clarmsRequestCidExpireAt");
this.step = 1;
}
} else {
this.step = 1;
}
......@@ -126,6 +136,7 @@ export default {
},
handleInsuredInfo(data) {
this.cid = data.cid;
sessionStorage.setItem("clarmsRequestCidExpireAt", (new Date().getTime() + this.cacheCid));
this.customerList = data.list;
this.step = 2;
},
......@@ -148,7 +159,7 @@ export default {
}
});
},
cacheData(){
cacheData() {
let m = this.$refs["material"];
// console.log("cacheData");
if (m) {
......