From 36cd31d69d451072e00ff1dd1928a61753aa5a97 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 19 十月 2020 14:25:41 +0800
Subject: [PATCH] 修复ui开启音频无法播放的bug 修复可能导致录象查看的bug 修复开启openRTPServer时的bug

---
 web_src/src/components/channelList.vue |   79 +++++++++++++++++++++++++++++++++------
 1 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue
index 5cd108e..8e6638a 100644
--- a/web_src/src/components/channelList.vue
+++ b/web_src/src/components/channelList.vue
@@ -31,17 +31,38 @@
 				<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="鎿嶄綔" width="240" align="center" fixed="right">
+          <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="280" 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-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> -->
+                <el-button-group>
+                  <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" icon="el-icon-video-camera" type="primary" >璁惧褰曡薄</el-button>-->
+                  <!-- <el-button size="mini" @click="sendDevicePush(scope.row)">褰曞儚鏌ヨ</el-button> -->
+                </el-button-group>
 							</template>
 						</el-table-column>
 				</el-table>
@@ -58,17 +79,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 +109,8 @@
 				currentPage: parseInt(this.$route.params.page),
 				count: parseInt(this.$route.params.count),
 				total:0,
-				beforeUrl:"/videoList"
+				beforeUrl:"/videoList",
+        isLoging: false
 			};
 		},
 
@@ -177,12 +202,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 +216,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 +288,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