From 20850ac8f5ec163cdcb15a0e52f125ee71e3e404 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Thu, 31 Mar 2022 08:55:17 +0800
Subject: [PATCH] +对接推送接口 websocket

---
 pages/home/home.vue |   14 +++++++++++---
 store/websocket.js  |   19 ++++++++++++-------
 store/mutations.js  |    1 +
 3 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/pages/home/home.vue b/pages/home/home.vue
index fcc4361..738f4e0 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -18,9 +18,10 @@
 			<!-- <button type="default" class="buts">点击进入</button> -->
 		</u-popup>
 		<!-- <u-button @click="">打开</u-button>
-		<u-button @click="ccc">打开</u-button> -->
-		<!--<u-button @click="aaa(0)">播放</u-button>
-		<u-button @click="bbb(0)">暂停</u-button>
+		<u-button @click="ccc">打开</u-button>
+		<u-button @click="aaa(1)">播放</u-button>
+		<u-button @click="ddd(1)">结束</u-button> -->
+		<!--<u-button @click="bbb(0)">暂停</u-button>
 		<u-button @click="ddd(0)">结束</u-button>
 		<u-button @click="eee(0)">销毁</u-button>
 		<u-button @click="aaa(1)">播放1</u-button>
@@ -229,6 +230,9 @@
 		computed: {
 			firstlogin() {
 				return this.$store.state.firstlogin;
+			},
+			changeTaksState() {
+				return this.$store.state.changeTaksState;
 			}
 		},
 		watch: {
@@ -240,6 +244,10 @@
 				},
 				immediate: true
 			},
+			changeTaksState() {
+				// 加载服务按钮数据
+				this.getNum();
+			},
 			showOnceLogin() {
 				if (!this.showOnceLogin) {
 					console.log("窗口已关闭")
diff --git a/store/mutations.js b/store/mutations.js
index 5ae5f42..ef122f5 100644
--- a/store/mutations.js
+++ b/store/mutations.js
@@ -41,6 +41,7 @@
 		state.gotuGrabOrders = !state.gotuGrabOrders;
 	},
 	controlAudio(state, data) {
+		// console.log(data,"开始的语音")
 		state.Audio[data.method](data.key);
 	},
 	...websocket.mutations,
diff --git a/store/websocket.js b/store/websocket.js
index f72ec01..df79044 100644
--- a/store/websocket.js
+++ b/store/websocket.js
@@ -149,13 +149,18 @@
 				};
 			} else if (type == "taks") {
 				// 角色辖区
-				// $store.state.Jurisdiction;
-				$store.commit("changeTaksMsg"); //任务状态更新
-				//语音提醒
-				$store.commit("controlAudio", {
-					key: 'keke',
-					method: '$pause'
-				})
+				if (state.UserData.jurisdiction == value.xqid) {
+					console.log("开始推送")
+					// $store.state.Jurisdiction;
+					$store.commit("changeTaksMsg"); //任务状态更新
+					//语音提醒
+					// console.log($store)
+					$store.commit("controlAudio", {
+						key: 'keke',
+						method: '$play'
+					})
+					// "1415621013200236545"
+				}
 			}
 		},
 		//本地建造数据传递

--
Gitblit v1.9.3