This commit is contained in:
PQZ 2025-07-04 15:57:31 +08:00
parent 3d3564850c
commit 06effaee13
6 changed files with 11 additions and 3 deletions

View File

@ -9,3 +9,6 @@ VUE_APP_BASE_API = '/dev-api'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
# websocket
VUE_APP_WEBSOCKET = 'ws://localhost:8099/ws/asset/'

View File

@ -6,3 +6,6 @@ ENV = 'production'
# 通告快接管理后台/生产环境 # 通告快接管理后台/生产环境
VUE_APP_BASE_API = 'https://www.ddtg.site/noticeApi' VUE_APP_BASE_API = 'https://www.ddtg.site/noticeApi'
# websocket
VUE_APP_WEBSOCKET = 'ws://localhost:8099/ws/asset/'

View File

@ -10,3 +10,6 @@ ENV = 'staging'
# 成事达管理平台/测试环境 # 成事达管理平台/测试环境
VUE_APP_BASE_API = '/stage-api' VUE_APP_BASE_API = '/stage-api'
# websocket
VUE_APP_WEBSOCKET = 'ws://localhost:8099/ws/asset/'

View File

@ -22,7 +22,7 @@ export default {
}, },
created () { created () {
const username = Cookies.get('username') const username = Cookies.get('username')
this.$store.dispatch('websocket_init', "ws://localhost:8099/ws/asset/"+username) this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+username)
}, },
metaInfo() { metaInfo() {
return { return {

View File

@ -49,7 +49,6 @@ Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download Vue.prototype.download = download
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree
Vue.prototype.$websocket=websocket;
// 全局组件挂载 // 全局组件挂载
Vue.component('DictTag', DictTag) Vue.component('DictTag', DictTag)

View File

@ -189,7 +189,7 @@ export default {
Cookies.remove('rememberMe') Cookies.remove('rememberMe')
} }
this.$store.dispatch('Login', this.loginForm).then(() => { this.$store.dispatch('Login', this.loginForm).then(() => {
this.$store.dispatch('websocket_init', "ws://localhost:8099/ws/asset/"+this.loginForm.username) this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+this.loginForm.username)
listAllSite().then(response => { listAllSite().then(response => {
if (response.data && response.data.length > 0) { if (response.data && response.data.length > 0) {
response.data.map((item) => { response.data.map((item) => {