|
|
|
@ -273,40 +273,6 @@ class TPMIndex extends Component {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// this.tpmContentRequestInterceptor = axios.interceptors.request.use((config) => {
|
|
|
|
|
// let url = config.url;
|
|
|
|
|
// // console.log('tpmContentRequestInterceptor:', url)
|
|
|
|
|
// for ( let i = 0; i < interceptorUrlArray.length; i++ ) {
|
|
|
|
|
// if (url.indexOf(interceptorUrlArray[i]) != -1) {
|
|
|
|
|
// url = url.split('?')[0]
|
|
|
|
|
// console.log('loadingContent, url:', url)
|
|
|
|
|
//
|
|
|
|
|
// this.setState({ loadingContent: true })
|
|
|
|
|
//
|
|
|
|
|
// cacheInterceptorUrlMap[url] = true
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return config;
|
|
|
|
|
// }, function (error) {
|
|
|
|
|
// return Promise.reject(error);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// Add a response interceptor
|
|
|
|
|
this.tpmContentResponseInterceptor = axios.interceptors.response.use((response) => {
|
|
|
|
|
// console.log('loadingContent finished, url:', response.config.url)
|
|
|
|
|
// TODO 依赖了api这个前缀
|
|
|
|
|
let url = response.config.url.split('api')[1];
|
|
|
|
|
url = url.split('?')[0]
|
|
|
|
|
if (cacheInterceptorUrlMap[url]) {
|
|
|
|
|
|
|
|
|
|
this.setState({ loadingContent: false })
|
|
|
|
|
delete cacheInterceptorUrlMap[response.url]
|
|
|
|
|
}
|
|
|
|
|
return response;
|
|
|
|
|
}, function (error) {
|
|
|
|
|
// Do something with response error
|
|
|
|
|
return Promise.reject(error);
|
|
|
|
|
});
|
|
|
|
|
//右侧数据
|
|
|
|
|
let shixunsDetailsURL = `/shixuns/` + id + `/show_right.json`;
|
|
|
|
|
axios.get(shixunsDetailsURL).then((response) => {
|
|
|
|
@ -324,14 +290,6 @@ class TPMIndex extends Component {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount = () => {
|
|
|
|
|
axios.interceptors.request.eject(this.tpmContentRequestInterceptor);
|
|
|
|
|
this.tpmContentRequestInterceptor = null;
|
|
|
|
|
axios.interceptors.request.eject(this.tpmContentResponseInterceptor);
|
|
|
|
|
this.tpmContentResponseInterceptor = null;
|
|
|
|
|
// this.getnavdatas()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setLoadingContent = (isLoadingContent) => {
|
|
|
|
|
// this.setState({ loadingContent: isLoadingContent })
|
|
|
|
|
}
|
|
|
|
|