From 3ec3b88456cf9ac455d93baba40f339bb284dd77 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 14 十月 2020 14:39:10 +0800 Subject: [PATCH] 修复点播判断错误导致的15s超长延时 增加默认不关闭推流, 无人观看超时或点击停止按钮关闭流 修复点播其他bug --- web_src/src/components/channelList.vue | 70 ++++++++++++++++++++++++++++++---- 1 files changed, 61 insertions(+), 9 deletions(-) diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index 5cd108e..b3980c3 100644 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -31,15 +31,33 @@ <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" border style="width: 100%"> <el-table-column prop="channelId" label="閫氶亾缂栧彿" width="210"> </el-table-column> - <el-table-column prop="name" label="閫氶亾鍚嶇О" width="500"> + <el-table-column prop="name" label="閫氶亾鍚嶇О"> </el-table-column> <el-table-column prop="subCount" label="瀛愯妭鐐规暟"> </el-table-column> - <el-table-column prop="ptztypeText" label="浜戝彴绫诲瀷"> - </el-table-column> + <el-table-column label="寮�鍚煶棰�" align="center"> + <template slot-scope="scope"> + <el-switch + @change="updateChannel(scope.row)" + v-model="scope.row.hasAudio" + active-color="#409EFF"> + </el-switch> + </template> + </el-table-column> + <el-table-column label="鐘舵��" width="180" align="center"> + <template slot-scope="scope"> + <div slot="reference" class="name-wrapper"> + <el-tag size="medium" v-if="scope.row.status == 1">鍦ㄧ嚎</el-tag> + <el-tag size="medium" type="info" v-if="scope.row.status == 0">绂荤嚎</el-tag> + </div> + </template> + </el-table-column> + <el-table-column prop="ptztypeText" label="浜戝彴绫诲瀷"> + </el-table-column> <el-table-column label="鎿嶄綔" width="240" align="center" fixed="right"> <template slot-scope="scope"> - <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">棰勮瑙嗛</el-button> + <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">鎾斁</el-button> + <el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="scope.row.play" @click="stopDevicePush(scope.row)">鍋滄</el-button> <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.parental == 1" @click="changeSubchannel(scope.row)">鏌ョ湅瀛愮洰褰�</el-button> <!-- <el-button size="mini" @click="sendDevicePush(scope.row)">褰曞儚鏌ヨ</el-button> --> </template> @@ -58,17 +76,20 @@ </el-main> </el-container> + <Loading v-if="isLoging" marginTop="-50%"></Loading> </div> </template> <script> import devicePlayer from './gb28181/devicePlayer.vue' import uiHeader from './UiHeader.vue' + import Loading from './Loading.vue' export default { name: 'channelList', components: { devicePlayer, - uiHeader + uiHeader, + Loading }, data() { return { @@ -85,7 +106,8 @@ currentPage: parseInt(this.$route.params.page), count: parseInt(this.$route.params.count), total:0, - beforeUrl:"/videoList" + beforeUrl:"/videoList", + isLoging: false }; }, @@ -177,12 +199,13 @@ message: '璇锋眰鎴愬姛', type: 'success' }); - });; + }); }, //閫氱煡璁惧涓婁紶濯掍綋娴� sendDevicePush: function(itemData) { + console.log(itemData) let deviceId = this.deviceId; - + this.isLoging = true; let channelId = itemData.channelId; console.log("閫氱煡璁惧鎺ㄦ祦1锛�" + deviceId + " : " + channelId); let that = this; @@ -190,11 +213,30 @@ method: 'get', url: '/api/play/' + deviceId + '/' + channelId }).then(function(res) { + console.log(res.data) let ssrc = res.data.ssrc; - that.$refs.devicePlayer.play(res.data,deviceId,channelId); + that.isLoging = false + if (!!ssrc) { + that.$refs.devicePlayer.play(res.data,deviceId,channelId,itemData.hasAudio); + that.initData(); + }else { + that.$message.error(res.data); + } }).catch(function(e) { }); }, + stopDevicePush: function(itemData) { + console.log(itemData) + var that = this; + this.$axios({ + method: 'post', + url: '/api/play/' + itemData.ssrc + '/stop' + }).then(function(res) { + console.log(JSON.stringify(res)); + that.initData(); + }); + }, + showDevice: function(){ this.$router.push(this.beforeUrl).then(()=>{ this.initParam(); @@ -243,6 +285,16 @@ this.currentPage = 1; this.total = 0; this.initData(); + }, + updateChannel: function(row) { + console.log(row) + this.$axios({ + method: 'post', + url: `/api/channel/update/${this.deviceId}`, + params: row + }).then(function(res) { + console.log(JSON.stringify(res)); + }); } } -- Gitblit v1.8.0