feat:路径适配前后端分离部署

This commit is contained in:
wangwenrui
2021-04-09 18:58:35 +08:00
parent d4c7160636
commit 7ccd2c790a

View File

@@ -154,6 +154,7 @@ import { promServer } from '@/components/common/js/constants'
import nzDataList from '@/components/common/table/nzDataList'
import tableMixin from '@/components/common/mixin/table'
import axios from 'axios'
import Vue from 'vue'
export default {
name: 'promServer',
components: {
@@ -275,7 +276,14 @@ export default {
this.showAgentDownload = true
this.token = sessionStorage.getItem('nz-token')
const reg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
this.ipAddr = reg.exec(window.location.href)[0]
const configUrl = 'static/config.json?Timestamp=' + new Date().getTime()
Vue.http.get(configUrl).then(res => {
if(reg.test(res.body.baseUrl)){
this.ipAddr = reg.exec(res.body.baseUrl)[0]
}else{
this.ipAddr = reg.exec(window.location.href)[0]
}
})
},
closeDialog: function () {
this.showAgentDownload = false