From 01c338b09f930dde72671b8e40ce0cd662abc415 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 22 Oct 2020 16:45:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BC=98=E5=8C=96=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E7=8E=AF=E5=A2=83=E6=98=AF=E6=9C=AC=E5=9C=B0=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E8=BF=98=E6=98=AF=E7=BA=BF=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/App.vue | 26 ++++++++++++------- .../src/components/charts/chart-detail.vue | 1 - nezha-fronted/src/http.js | 8 ------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/nezha-fronted/src/App.vue b/nezha-fronted/src/App.vue index b2e79f0d6..ed29502f4 100644 --- a/nezha-fronted/src/App.vue +++ b/nezha-fronted/src/App.vue @@ -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); + } + }); + } } } diff --git a/nezha-fronted/src/components/charts/chart-detail.vue b/nezha-fronted/src/components/charts/chart-detail.vue index 322eff91a..1c8710714 100644 --- a/nezha-fronted/src/components/charts/chart-detail.vue +++ b/nezha-fronted/src/components/charts/chart-detail.vue @@ -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(() => { diff --git a/nezha-fronted/src/http.js b/nezha-fronted/src/http.js index d1a698980..a54060f20 100644 --- a/nezha-fronted/src/http.js +++ b/nezha-fronted/src/http.js @@ -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)