From 3c52a16e5fcf9a1f20b3ef06220e021b712337b6 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 18 十月 2022 17:02:05 +0800 Subject: [PATCH] 支持手动添加,为设备设置单独的密码 --- web_src/src/components/control.vue | 112 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 62 insertions(+), 50 deletions(-) diff --git a/web_src/src/components/control.vue b/web_src/src/components/control.vue index a0b2834..722245b 100644 --- a/web_src/src/components/control.vue +++ b/web_src/src/components/control.vue @@ -235,10 +235,8 @@ <el-table-column prop="local_ip" label="鏈湴"></el-table-column> <el-table-column prop="typeid" label="绫诲瀷"></el-table-column> <el-table-column align="right"> - <template slot="header" slot-scope="scope"> - <el-button icon="el-icon-refresh-right" circle @click="getAllSession()"></el-button> - </template> - <template slot-scope="scope"> + <template v-slot:default="scope"> + <el-button size="mini" icon="el-icon-refresh-right" circle @click="getAllSession()"></el-button> <el-button @click.native.prevent="deleteRow(scope.$index, allSessionData)" type="text" size="small">绉婚櫎 </el-button> </template> @@ -326,12 +324,12 @@ */ getThreadsLoad: function () { let that = this; - if (that.mediaServerChoose != null) { + if (!!that.mediaServerChoose) { this.$axios({ method: 'get', url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad' }).then(function (res) { - if (res.data.code == 0) { + if (res.data.code === 0) { that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', { hour12: false })); @@ -377,7 +375,7 @@ }, getLoadCount: function () { let that = this; - if (that.mediaServerChoose != null) { + if (!!that.mediaServerChoose) { that.mediaServer.getMediaServer(that.mediaServerChoose, (data) => { if (data.code == 0) { that.loadCount = data.data.count @@ -475,42 +473,46 @@ }, getAllSession: function () { - let that = this; - that.allSessionData = []; - this.$axios({ - method: 'get', - url: '/zlm/' + that.mediaServerChoose + '/index/api/getAllSession' - }).then(function (res) { - res.data.data.forEach(item => { - let data = { - peer_ip: item.peer_ip, - local_ip: item.local_ip, - typeid: item.typeid, - id: item.id - }; - that.allSessionData.push(data); + this.allSessionData = []; + if (!!this.mediaServerChoose) { + this.$axios({ + method: 'get', + url: '/zlm/' + this.mediaServerChoose + '/index/api/getAllSession' + }).then((res)=> { + res.data.data.forEach(item => { + let data = { + peer_ip: item.peer_ip, + local_ip: item.local_ip, + typeid: item.typeid, + id: item.id + }; + this.allSessionData.push(data); + }); }); - }); + } + }, getServerConfig: function () { - let that = this; - this.$axios({ - method: 'get', - url: '/zlm/' + that.mediaServerChoose + '/index/api/getServerConfig' - }).then(function (res) { - let info = res.data.data[0]; - let serverInfo = {} - for (let i = 0; i < Object.keys(info).length; i++) { - let key = Object.keys(info)[i]; - let group = key.substring(0, key.indexOf(".")) - let itemKey = key.substring(key.indexOf(".") + 1) - if (!serverInfo[group]) serverInfo[group] = {} - serverInfo[group][itemKey] = info[key] - } + if (!!this.mediaServerChoose) { + this.$axios({ + method: 'get', + url: '/zlm/' + this.mediaServerChoose + '/index/api/getServerConfig' + }).then((res)=> { + let info = res.data.data[0]; + let serverInfo = {} + for (let i = 0; i < Object.keys(info).length; i++) { + let key = Object.keys(info)[i]; + let group = key.substring(0, key.indexOf(".")) + let itemKey = key.substring(key.indexOf(".") + 1) + if (!serverInfo[group]) serverInfo[group] = {} + serverInfo[group][itemKey] = info[key] + } - that.serverConfig = serverInfo; - that.visible = true; - }); + this.serverConfig = serverInfo; + this.visible = true; + }); + } + }, getWVPServerConfig: function () { let that = this; @@ -533,6 +535,14 @@ }, reStartServer: function () { let that = this; + if (!!!this.mediaServerChoose) { + this.$message({ + type: 'info', + message: '鏈�夋嫨鑺傜偣' + }); + return; + } + this.$confirm('姝ゆ搷浣滃皢閲嶅惎濯掍綋鏈嶅姟鍣�, 鏄惁缁х画?', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', @@ -544,7 +554,7 @@ url: '/zlm/' + that.mediaServerChoose + '/index/api/restartServer' }).then(function (res) { that.getAllSession(); - if (res.data.code == 0) { + if (res.data.code === 0) { that.$message({ type: 'success', message: '鎿嶄綔瀹屾垚' @@ -573,17 +583,19 @@ console.log(JSON.stringify(tabledata[index])); }, deleteSession: function (id) { - let that = this; - this.$axios({ - method: 'get', - url: '/zlm/' + that.mediaServerChoose + '/index/api/kick_session&id=' + id - }).then(function (res) { - that.getAllSession(); - that.$message({ - type: 'success', - message: '鍒犻櫎鎴愬姛!' + if (!!this.mediaServerChoose) { + this.$axios({ + method: 'get', + url: '/zlm/' + this.mediaServerChoose + '/index/api/kick_session?id=' + id + }).then((res)=>{ + this.getAllSession(); + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); }); - }); + } + }, getNameFromKey: function (key) { let nameData = { -- Gitblit v1.8.0