Commit 2a5c12746b9095a65dde5e421c82ce66436db562
1 parent
e05d0aa0
修复首页未获取到zlm消息时发送错误消息的bug
Showing
1 changed file
with
58 additions
and
44 deletions
web_src/src/components/control.vue
| @@ -324,7 +324,7 @@ export default { | @@ -324,7 +324,7 @@ export default { | ||
| 324 | */ | 324 | */ |
| 325 | getThreadsLoad: function () { | 325 | getThreadsLoad: function () { |
| 326 | let that = this; | 326 | let that = this; |
| 327 | - if (that.mediaServerChoose != null) { | 327 | + if (!!that.mediaServerChoose) { |
| 328 | this.$axios({ | 328 | this.$axios({ |
| 329 | method: 'get', | 329 | method: 'get', |
| 330 | url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad' | 330 | url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad' |
| @@ -375,7 +375,7 @@ export default { | @@ -375,7 +375,7 @@ export default { | ||
| 375 | }, | 375 | }, |
| 376 | getLoadCount: function () { | 376 | getLoadCount: function () { |
| 377 | let that = this; | 377 | let that = this; |
| 378 | - if (that.mediaServerChoose != null) { | 378 | + if (!!that.mediaServerChoose) { |
| 379 | that.mediaServer.getMediaServer(that.mediaServerChoose, (data) => { | 379 | that.mediaServer.getMediaServer(that.mediaServerChoose, (data) => { |
| 380 | if (data.code == 0) { | 380 | if (data.code == 0) { |
| 381 | that.loadCount = data.data.count | 381 | that.loadCount = data.data.count |
| @@ -473,42 +473,46 @@ export default { | @@ -473,42 +473,46 @@ export default { | ||
| 473 | }, | 473 | }, |
| 474 | 474 | ||
| 475 | getAllSession: function () { | 475 | getAllSession: function () { |
| 476 | - let that = this; | ||
| 477 | - that.allSessionData = []; | ||
| 478 | - this.$axios({ | ||
| 479 | - method: 'get', | ||
| 480 | - url: '/zlm/' + that.mediaServerChoose + '/index/api/getAllSession' | ||
| 481 | - }).then(function (res) { | ||
| 482 | - res.data.data.forEach(item => { | ||
| 483 | - let data = { | ||
| 484 | - peer_ip: item.peer_ip, | ||
| 485 | - local_ip: item.local_ip, | ||
| 486 | - typeid: item.typeid, | ||
| 487 | - id: item.id | ||
| 488 | - }; | ||
| 489 | - that.allSessionData.push(data); | 476 | + this.allSessionData = []; |
| 477 | + if (!!this.mediaServerChoose) { | ||
| 478 | + this.$axios({ | ||
| 479 | + method: 'get', | ||
| 480 | + url: '/zlm/' + this.mediaServerChoose + '/index/api/getAllSession' | ||
| 481 | + }).then((res)=> { | ||
| 482 | + res.data.data.forEach(item => { | ||
| 483 | + let data = { | ||
| 484 | + peer_ip: item.peer_ip, | ||
| 485 | + local_ip: item.local_ip, | ||
| 486 | + typeid: item.typeid, | ||
| 487 | + id: item.id | ||
| 488 | + }; | ||
| 489 | + this.allSessionData.push(data); | ||
| 490 | + }); | ||
| 490 | }); | 491 | }); |
| 491 | - }); | 492 | + } |
| 493 | + | ||
| 492 | }, | 494 | }, |
| 493 | getServerConfig: function () { | 495 | getServerConfig: function () { |
| 494 | - let that = this; | ||
| 495 | - this.$axios({ | ||
| 496 | - method: 'get', | ||
| 497 | - url: '/zlm/' + that.mediaServerChoose + '/index/api/getServerConfig' | ||
| 498 | - }).then(function (res) { | ||
| 499 | - let info = res.data.data[0]; | ||
| 500 | - let serverInfo = {} | ||
| 501 | - for (let i = 0; i < Object.keys(info).length; i++) { | ||
| 502 | - let key = Object.keys(info)[i]; | ||
| 503 | - let group = key.substring(0, key.indexOf(".")) | ||
| 504 | - let itemKey = key.substring(key.indexOf(".") + 1) | ||
| 505 | - if (!serverInfo[group]) serverInfo[group] = {} | ||
| 506 | - serverInfo[group][itemKey] = info[key] | ||
| 507 | - } | 496 | + if (!!this.mediaServerChoose) { |
| 497 | + this.$axios({ | ||
| 498 | + method: 'get', | ||
| 499 | + url: '/zlm/' + that.mediaServerChoose + '/index/api/getServerConfig' | ||
| 500 | + }).then((res)=> { | ||
| 501 | + let info = res.data.data[0]; | ||
| 502 | + let serverInfo = {} | ||
| 503 | + for (let i = 0; i < Object.keys(info).length; i++) { | ||
| 504 | + let key = Object.keys(info)[i]; | ||
| 505 | + let group = key.substring(0, key.indexOf(".")) | ||
| 506 | + let itemKey = key.substring(key.indexOf(".") + 1) | ||
| 507 | + if (!serverInfo[group]) serverInfo[group] = {} | ||
| 508 | + serverInfo[group][itemKey] = info[key] | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + this.serverConfig = serverInfo; | ||
| 512 | + this.visible = true; | ||
| 513 | + }); | ||
| 514 | + } | ||
| 508 | 515 | ||
| 509 | - that.serverConfig = serverInfo; | ||
| 510 | - that.visible = true; | ||
| 511 | - }); | ||
| 512 | }, | 516 | }, |
| 513 | getWVPServerConfig: function () { | 517 | getWVPServerConfig: function () { |
| 514 | let that = this; | 518 | let that = this; |
| @@ -531,6 +535,14 @@ export default { | @@ -531,6 +535,14 @@ export default { | ||
| 531 | }, | 535 | }, |
| 532 | reStartServer: function () { | 536 | reStartServer: function () { |
| 533 | let that = this; | 537 | let that = this; |
| 538 | + if (!!!this.mediaServerChoose) { | ||
| 539 | + this.$message({ | ||
| 540 | + type: 'info', | ||
| 541 | + message: '未选择节点' | ||
| 542 | + }); | ||
| 543 | + return; | ||
| 544 | + } | ||
| 545 | + | ||
| 534 | this.$confirm('此操作将重启媒体服务器, 是否继续?', '提示', { | 546 | this.$confirm('此操作将重启媒体服务器, 是否继续?', '提示', { |
| 535 | confirmButtonText: '确定', | 547 | confirmButtonText: '确定', |
| 536 | cancelButtonText: '取消', | 548 | cancelButtonText: '取消', |
| @@ -571,17 +583,19 @@ export default { | @@ -571,17 +583,19 @@ export default { | ||
| 571 | console.log(JSON.stringify(tabledata[index])); | 583 | console.log(JSON.stringify(tabledata[index])); |
| 572 | }, | 584 | }, |
| 573 | deleteSession: function (id) { | 585 | deleteSession: function (id) { |
| 574 | - let that = this; | ||
| 575 | - this.$axios({ | ||
| 576 | - method: 'get', | ||
| 577 | - url: '/zlm/' + that.mediaServerChoose + '/index/api/kick_session?id=' + id | ||
| 578 | - }).then(function (res) { | ||
| 579 | - that.getAllSession(); | ||
| 580 | - that.$message({ | ||
| 581 | - type: 'success', | ||
| 582 | - message: '删除成功!' | 586 | + if (!!this.mediaServerChoose) { |
| 587 | + this.$axios({ | ||
| 588 | + method: 'get', | ||
| 589 | + url: '/zlm/' + this.mediaServerChoose + '/index/api/kick_session?id=' + id | ||
| 590 | + }).then((res)=>{ | ||
| 591 | + this.getAllSession(); | ||
| 592 | + this.$message({ | ||
| 593 | + type: 'success', | ||
| 594 | + message: '删除成功!' | ||
| 595 | + }); | ||
| 583 | }); | 596 | }); |
| 584 | - }); | 597 | + } |
| 598 | + | ||
| 585 | }, | 599 | }, |
| 586 | getNameFromKey: function (key) { | 600 | getNameFromKey: function (key) { |
| 587 | let nameData = { | 601 | let nameData = { |