From f2279859b367fda6108a5ea22c572d38d89d338d Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期六, 26 十二月 2020 16:44:27 +0800
Subject: [PATCH] 增加对水星IPC的兼容 增加对SIP错误的订阅,刷新通道或点播或回放出现sip错误时及时返回给页面 优化UI,增加按钮loading

---
 web_src/src/components/videoList.vue |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/web_src/src/components/videoList.vue b/web_src/src/components/videoList.vue
index ad2f701..50767cc 100644
--- a/web_src/src/components/videoList.vue
+++ b/web_src/src/components/videoList.vue
@@ -8,7 +8,7 @@
 				<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
 					<span style="font-size: 1rem; font-weight: bold;">璁惧鍒楄〃</span>
 					<div style="position: absolute; right: 1rem; top: 0.3rem;">
-						<el-button icon="el-icon-refresh-right" circle size="mini" @click="getDeviceList()"></el-button>
+						<el-button icon="el-icon-refresh-right" circle size="mini" :loading="getDeviceListLoading" @click="getDeviceList()"></el-button>
 					</div>
 				</div>
 				<devicePlayer ref="devicePlayer"></devicePlayer>
@@ -51,7 +51,7 @@
 
 					<el-table-column label="鎿嶄綔" width="240" align="center" fixed="right">
 						<template slot-scope="scope">
-							<el-button size="mini" icon="el-icon-refresh"  @click="refDevice(scope.row)">鍒锋柊閫氶亾</el-button>
+							<el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " icon="el-icon-refresh"  @click="refDevice(scope.row)">鍒锋柊閫氶亾</el-button>
 							<el-button size="mini" icon="el-icon-s-open"  type="primary" @click="showChannelList(scope.row)">鏌ョ湅閫氶亾</el-button>
 						</template>
 					</el-table-column>
@@ -90,7 +90,8 @@
 				winHeight: window.innerHeight - 200,
 				currentPage:1,
 				count:15,
-				total:0
+				total:0,
+				getDeviceListLoading: false
 			};
 		},
 		computed: {
@@ -130,7 +131,7 @@
 			},
 			getDeviceList: function() {
 				let that = this;
-
+				this.getDeviceListLoading = true;
 				this.$axios.get(`/api/devices`,{
 					params: {
 						page: that.currentPage - 1,
@@ -141,9 +142,11 @@
 					console.log(res);
 					that.total = res.data.total;
 					that.deviceList = res.data.data;
+					that.getDeviceListLoading = false;
 				})
 				.catch(function (error) {
 					console.log(error);
+					that.getDeviceListLoading = false;
 				});
 
 			},
@@ -158,17 +161,30 @@
 			refDevice: function(itemData) {
 				///api/devices/{deviceId}/sync
 				console.log("鍒锋柊瀵瑰簲璁惧:" + itemData.deviceId);
+				var that = this;
+				that.$refs[itemData.deviceId + 'refbtn' ].loading = true;
 				this.$axios({
 					method: 'post',
 					url: '/api/devices/' + itemData.deviceId + '/sync'
 				}).then(function(res) {
-					// console.log("鍒锋柊璁惧缁撴灉锛�"+JSON.stringify(res));
+					console.log("鍒锋柊璁惧缁撴灉锛�"+JSON.stringify(res));
+					if (!res.data.deviceId) {
+						that.$message({
+							showClose: true,
+							message: res.data,
+							type: 'error'
+						});
+					}else{
+						that.$message({
+							showClose: true,
+							message: '璇锋眰鎴愬姛',
+							type: 'success'
+						});
+					}
+					that.$refs[itemData.deviceId + 'refbtn' ].loading = false;
 				}).catch(function(e) {
-					that.$message({
-						showClose: true,
-						message: '璇锋眰鎴愬姛',
-						type: 'success'
-					});
+					console.error(e)
+					that.$refs[itemData.deviceId + 'refbtn' ].loading = false;
 				});;
 			},
 			//閫氱煡璁惧涓婁紶濯掍綋娴�

--
Gitblit v1.8.0