feat:优化判断环境是本地开发还是线上
This commit is contained in:
@@ -10,16 +10,22 @@
|
||||
export default {
|
||||
name: 'App',
|
||||
mounted() {
|
||||
// this.$http.get("config.json").then((result)=>{
|
||||
// this.$axios.defaults.baseURL = result.body.baseUrl;
|
||||
// const version=result.body.version;
|
||||
// if(version!==localStorage.getItem('nz-version')){
|
||||
// sessionStorage.clear();
|
||||
// localStorage.clear();
|
||||
// localStorage.setItem('nz-version',version);
|
||||
// }
|
||||
// });
|
||||
this.$axios.defaults.baseURL = 'http://192.168.40.42:8080/nz-admin';
|
||||
let development=process.env.NODE_ENV == 'development' ? true : false;//用于区分是本地开发还是线上环境
|
||||
console.log(process,development);
|
||||
if(development){
|
||||
this.$axios.defaults.baseURL = 'http://192.168.40.42:8080/nz-admin';
|
||||
} else{
|
||||
const Timestamp=new Date().getTime();
|
||||
this.$http.get("config.json?Timestamp="+Timestamp).then((result)=>{
|
||||
this.$axios.defaults.baseURL = result.body.baseUrl;
|
||||
const version=result.body.version;
|
||||
if(version!==localStorage.getItem('nz-version')){
|
||||
sessionStorage.clear();
|
||||
localStorage.clear();
|
||||
localStorage.setItem('nz-version',version);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -467,7 +467,6 @@
|
||||
|
||||
this.panelIdInner = panelId;
|
||||
this.data = chartItem;
|
||||
console.log(detail);
|
||||
this.detail = detail;
|
||||
if (this.detail[0] && this.detail[0].type && this.detail[0].type == "endpointInfo") { //endpointInfo的小图表
|
||||
this.$nextTick(() => {
|
||||
|
||||
@@ -16,14 +16,6 @@ axios.interceptors.request.use(config => {
|
||||
if (token) {
|
||||
config.headers['Authorization'] = token //请求头token
|
||||
}
|
||||
config.data={
|
||||
...(config.data||{}),
|
||||
_t:new Date().getTime(),
|
||||
};
|
||||
config.params={
|
||||
...(config.params||{}),
|
||||
_t:new Date().getTime(),
|
||||
};
|
||||
return config;
|
||||
},
|
||||
err => Promise.reject(err)
|
||||
|
||||
Reference in New Issue
Block a user