From 10f7b6b5751b63df9822ecd8a075cc8747c3b07e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 25 Mar 2021 09:55:54 +0800
Subject: [PATCH] 还原
---
src/page/index/logo.vue | 64 +++++++++++---------------------
1 files changed, 22 insertions(+), 42 deletions(-)
diff --git a/src/page/index/logo.vue b/src/page/index/logo.vue
index 18b89eb..4451528 100644
--- a/src/page/index/logo.vue
+++ b/src/page/index/logo.vue
@@ -261,7 +261,7 @@
</div>
</div>
</template>
-
+
<script>
import { mapGetters } from "vuex";
import axios from "axios";
@@ -276,8 +276,6 @@
videoConversationReal: false,
oldVideoSatart: false,
deviceId: null,
- userId: null,
- socket: null,
form: {},
itemOption: {
menuBtn: false,
@@ -340,10 +338,6 @@
};
},
created() {
- this.userId = JSON.parse(
- window.localStorage.getItem("物联网安保云服务平台-userInfo")
- ).content.user_id;
-
this.getData();
},
computed: {
@@ -353,46 +347,33 @@
getData() {
var that = this;
- if (!window.WebSocket) {
- window.WebSocket = window.MozWebSocket;
- }
-
- if (window.WebSocket) {
- window.socket = new WebSocket("ws://36.134.81.48:9034/websocket");
- window.socket.onmessage = function (event) {
- };
-
- window.socket.onopen = function (event) {
- };
-
- window.socket.onclose = function (event) {
- };
- } else {
- console.log("WebSocket连接没有建立成功!!");
- }
-
- setTimeout(function () {
- if(!window.WebSocket){
- return;
- }
- if(window.socket.readyState == WebSocket.OPEN){
- window.socket.send(that.userId);
- }else{
- console.log("WebSocket连接没有建立成功!!");
- }
- }, 2000);
-
-
- setTimeout(function () {
+ axios({
+ url: "/api/blade-jfpts/alarm/alarm/getLimit",
+ method: "get",
+ }).then(function (response) {
+ that.deviceId = response.data.data[0].id;
+ //获得最新ID,开启实时报警循环
+ that.layerRealtime();
+ });
+ },
+ layerRealtime() {
+ var that = this;
+ window.clearTimeout(window.realTimeQuery);
+ // that.deviceId = 334; // 测试用
+ window.realTimeQuery = setInterval(function () {
axios({
url: "/api/blade-jfpts/alarm/alarm/selecttx?id=" + that.deviceId,
method: "post",
}).then(function (response) {
+ var userId = JSON.parse(
+ window.localStorage.getItem("物联网安保云服务平台-userInfo")
+ ).content.user_id;
+
if (response.data.data.length > 0) {
that.deviceId = response.data.data[0].id;
if (
response.data.data[0].waringType == "紧急求救" &&
- response.data.data[0].alarmId == that.userId
+ response.data.data[0].alarmId == userId
) {
response.data.data[0].waringType = "一键求助";
that.form = response.data.data[0];
@@ -405,7 +386,6 @@
that.peoplePhone = that.form.onePhone;
that.dialogTableVisible = true;
Recorder.getPermiRecorderssion().then(() => {});
-
that.ofX = null;
that.ofY = null;
@@ -786,7 +766,7 @@
},
};
</script>
-
+
<style lang="scss">
.fade-leave-active {
transition: opacity 0.2s;
@@ -903,4 +883,4 @@
height: calc(100% - 44px);
box-sizing: border-box;
}
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.3