0dc2efb3 by joe

10分钟缓存

1 parent 6075dcf6
...@@ -111,6 +111,10 @@ axios.interceptors.response.use( ...@@ -111,6 +111,10 @@ axios.interceptors.response.use(
111 } else { 111 } else {
112 if (response.data.code === 404) { 112 if (response.data.code === 404) {
113 SET_USER_INFO(state, null); 113 SET_USER_INFO(state, null);
114 for (let index = 0; index < sessionStorage.length; index++) {
115 let key = sessionStorage.key(index);
116 sessionStorage.removeItem(key);
117 }
114 } 118 }
115 // Toast(response.data.bizMsg); 119 // Toast(response.data.bizMsg);
116 return Promise.reject(response.data); 120 return Promise.reject(response.data);
......
...@@ -39,7 +39,8 @@ export default { ...@@ -39,7 +39,8 @@ export default {
39 // 可以理赔的客户信息 39 // 可以理赔的客户信息
40 customerList: [], 40 customerList: [],
41 modelType: "1", 41 modelType: "1",
42 modalVisiable: true 42 modalVisiable: true,
43 cacheCid: 10 * 60 * 1000
43 } 44 }
44 }, 45 },
45 components: { 46 components: {
...@@ -64,12 +65,21 @@ export default { ...@@ -64,12 +65,21 @@ export default {
64 // return; 65 // return;
65 if (this.userInfo && this.userInfo.name) { 66 if (this.userInfo && this.userInfo.name) {
66 this.loadCidIfLogin(); 67 this.loadCidIfLogin();
67 sessionStorage.removeItem("clarmsRequestCid") 68 sessionStorage.removeItem("clarmsRequestCid");
69 sessionStorage.removeItem("clarmsRequestCidExpireAt");
68 } else { 70 } else {
69 let cid = sessionStorage.getItem("clarmsRequestCid"); 71 let cid = sessionStorage.getItem("clarmsRequestCid");
72 let expireAt = sessionStorage.getItem("clarmsRequestCidExpireAt");
70 if (cid) { 73 if (cid) {
71 this.cid = cid; 74 if (expireAt && expireAt > new Date().getTime()) {
72 this.checkCid(); 75 sessionStorage.setItem("clarmsRequestCidExpireAt", (new Date().getTime() + this.cacheCid));
76 this.cid = cid;
77 this.checkCid();
78 } else {
79 sessionStorage.removeItem("clarmsRequestCid")
80 sessionStorage.removeItem("clarmsRequestCidExpireAt");
81 this.step = 1;
82 }
73 } else { 83 } else {
74 this.step = 1; 84 this.step = 1;
75 } 85 }
...@@ -126,6 +136,7 @@ export default { ...@@ -126,6 +136,7 @@ export default {
126 }, 136 },
127 handleInsuredInfo(data) { 137 handleInsuredInfo(data) {
128 this.cid = data.cid; 138 this.cid = data.cid;
139 sessionStorage.setItem("clarmsRequestCidExpireAt", (new Date().getTime() + this.cacheCid));
129 this.customerList = data.list; 140 this.customerList = data.list;
130 this.step = 2; 141 this.step = 2;
131 }, 142 },
...@@ -148,7 +159,7 @@ export default { ...@@ -148,7 +159,7 @@ export default {
148 } 159 }
149 }); 160 });
150 }, 161 },
151 cacheData(){ 162 cacheData() {
152 let m = this.$refs["material"]; 163 let m = this.$refs["material"];
153 // console.log("cacheData"); 164 // console.log("cacheData");
154 if (m) { 165 if (m) {
......