| | |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | |
| | | <script> |
| | | import { mapGetters } from "vuex"; |
| | | import axios from "axios"; |
| | |
| | | videoConversationReal: false, |
| | | oldVideoSatart: false, |
| | | deviceId: null, |
| | | userId: null, |
| | | socket: null, |
| | | form: {}, |
| | | itemOption: { |
| | | menuBtn: false, |
| | |
| | | }; |
| | | }, |
| | | created() { |
| | | this.userId = JSON.parse( |
| | | window.localStorage.getItem("物联网安保云服务平台-userInfo") |
| | | ).content.user_id; |
| | | |
| | | this.getData(); |
| | | }, |
| | | computed: { |
| | |
| | | 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]; |
| | |
| | | that.peoplePhone = that.form.onePhone; |
| | | that.dialogTableVisible = true; |
| | | Recorder.getPermiRecorderssion().then(() => {}); |
| | | |
| | | that.ofX = null; |
| | | that.ofY = null; |
| | | |
| | |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | |
| | | <style lang="scss"> |
| | | .fade-leave-active { |
| | | transition: opacity 0.2s; |
| | |
| | | height: calc(100% - 44px); |
| | | box-sizing: border-box; |
| | | } |
| | | </style> |
| | | </style> |