修复首页未获取到zlm消息时发送错误消息的bug

pull/353/head^2
648540858 2022-08-01 09:32:39 +08:00
parent e05d0aa0a9
commit 2a5c12746b
1 changed files with 58 additions and 44 deletions

View File

@ -324,7 +324,7 @@ export default {
*/ */
getThreadsLoad: function () { getThreadsLoad: function () {
let that = this; let that = this;
if (that.mediaServerChoose != null) { if (!!that.mediaServerChoose) {
this.$axios({ this.$axios({
method: 'get', method: 'get',
url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad' url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad'
@ -375,7 +375,7 @@ export default {
}, },
getLoadCount: function () { getLoadCount: function () {
let that = this; let that = this;
if (that.mediaServerChoose != null) { if (!!that.mediaServerChoose) {
that.mediaServer.getMediaServer(that.mediaServerChoose, (data) => { that.mediaServer.getMediaServer(that.mediaServerChoose, (data) => {
if (data.code == 0) { if (data.code == 0) {
that.loadCount = data.data.count that.loadCount = data.data.count
@ -473,12 +473,12 @@ export default {
}, },
getAllSession: function () { getAllSession: function () {
let that = this; this.allSessionData = [];
that.allSessionData = []; if (!!this.mediaServerChoose) {
this.$axios({ this.$axios({
method: 'get', method: 'get',
url: '/zlm/' + that.mediaServerChoose + '/index/api/getAllSession' url: '/zlm/' + this.mediaServerChoose + '/index/api/getAllSession'
}).then(function (res) { }).then((res)=> {
res.data.data.forEach(item => { res.data.data.forEach(item => {
let data = { let data = {
peer_ip: item.peer_ip, peer_ip: item.peer_ip,
@ -486,16 +486,18 @@ export default {
typeid: item.typeid, typeid: item.typeid,
id: item.id id: item.id
}; };
that.allSessionData.push(data); this.allSessionData.push(data);
}); });
}); });
}
}, },
getServerConfig: function () { getServerConfig: function () {
let that = this; if (!!this.mediaServerChoose) {
this.$axios({ this.$axios({
method: 'get', method: 'get',
url: '/zlm/' + that.mediaServerChoose + '/index/api/getServerConfig' url: '/zlm/' + that.mediaServerChoose + '/index/api/getServerConfig'
}).then(function (res) { }).then((res)=> {
let info = res.data.data[0]; let info = res.data.data[0];
let serverInfo = {} let serverInfo = {}
for (let i = 0; i < Object.keys(info).length; i++) { for (let i = 0; i < Object.keys(info).length; i++) {
@ -506,9 +508,11 @@ export default {
serverInfo[group][itemKey] = info[key] serverInfo[group][itemKey] = info[key]
} }
that.serverConfig = serverInfo; this.serverConfig = serverInfo;
that.visible = true; this.visible = true;
}); });
}
}, },
getWVPServerConfig: function () { getWVPServerConfig: function () {
let that = this; let that = this;
@ -531,6 +535,14 @@ export default {
}, },
reStartServer: function () { reStartServer: function () {
let that = this; let that = this;
if (!!!this.mediaServerChoose) {
this.$message({
type: 'info',
message: '未选择节点'
});
return;
}
this.$confirm('此操作将重启媒体服务器, 是否继续?', '提示', { this.$confirm('此操作将重启媒体服务器, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@ -571,17 +583,19 @@ export default {
console.log(JSON.stringify(tabledata[index])); console.log(JSON.stringify(tabledata[index]));
}, },
deleteSession: function (id) { deleteSession: function (id) {
let that = this; if (!!this.mediaServerChoose) {
this.$axios({ this.$axios({
method: 'get', method: 'get',
url: '/zlm/' + that.mediaServerChoose + '/index/api/kick_session?id=' + id url: '/zlm/' + this.mediaServerChoose + '/index/api/kick_session?id=' + id
}).then(function (res) { }).then((res)=>{
that.getAllSession(); this.getAllSession();
that.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}); });
}); });
}
}, },
getNameFromKey: function (key) { getNameFromKey: function (key) {
let nameData = { let nameData = {