diff --git a/public/js/xyDemoCommon.js b/public/js/xyDemoCommon.js index 33c24de..5e023b5 100644 --- a/public/js/xyDemoCommon.js +++ b/public/js/xyDemoCommon.js @@ -134,7 +134,6 @@ function onForceLoginClick() { function mylog(msg) { msg = getNowFormatDate() + " : " + msg + "\r\n"; console.log("msg ====>", msg); - $("output").value = msg + $("output").value; } function getNowFormatDate() { diff --git a/src/App.vue b/src/App.vue index fe29a8b..c5e5208 100644 --- a/src/App.vue +++ b/src/App.vue @@ -47,6 +47,8 @@ export default { window.addEventListener('beforeunload', e => this.closeWebSocket(e)); }, mounted() { + // // 添加socket通知监听 + // window.addEventListener('onmessageWS', this.getSocketData); // this.initWebSocket('pc'); }, beforeDestroy() { @@ -54,8 +56,8 @@ export default { methods: { initWebSocket(supplierId) { // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https - // let wsUrl = `ws://192.168.3.32:81/websocket/${supplierId}`; - let wsUrl = `ws://171.16.8.51:81/websocket/${supplierId}`// + let wsUrl = `ws://192.168.3.32:81/websocket/${supplierId}`; + // let wsUrl = `ws://171.16.8.51:81/websocket/${supplierId}`// this.websocket = new WebSocket(wsUrl); this.websocket.onopen = this.websocketonopen; this.websocket.onerror = this.websocketonerror; @@ -98,7 +100,7 @@ export default { }, 5000) }, async setOnmessageMessage(event) { - // console.log(event.data, '获得消息'); + console.log(event.data, '获得消息'); this.reset(); // 自定义全局监听事件 window.dispatchEvent(new CustomEvent('onmessageWS', { diff --git a/src/api/alarm/alarm.js b/src/api/alarm/alarm.js index 1667493..308ec70 100644 --- a/src/api/alarm/alarm.js +++ b/src/api/alarm/alarm.js @@ -1,42 +1,50 @@ -import request from '@/router/axios'; +import request from "@/router/axios"; export const getList = (current, size, params) => { return request({ - url: '/api/alarmInformation/list', - method: 'get', + url: "/api/alarmInformation/list", + method: "get", params: { ...params, current, size, - } - }) -} + }, + }); +}; export const getDetail = (code) => { return request({ - url: '/api/blade-system/region/detail', - method: 'get', + url: "/api/blade-system/region/detail", + method: "get", params: { - code - } - }) -} + code, + }, + }); +}; export const remove = (id) => { return request({ - url: '/api/blade-system/region/remove', - method: 'post', + url: "/api/blade-system/region/remove", + method: "post", params: { id, - } - }) -} + }, + }); +}; export const submit = (row) => { return request({ - url: '/api/blade-system/region/submit', - method: 'post', - data: row - }) -} + url: "/api/blade-system/region/submit", + method: "post", + data: row, + }); +}; +// 测试接口 +export const getAlarm = (query) => { + return request({ + url: "/api/appData/test001", + method: "get", + params: query, + }); +}; diff --git a/src/assets/audio/alarm.mp3 b/src/assets/audio/alarm.mp3 new file mode 100644 index 0000000..a25d1c3 Binary files /dev/null and b/src/assets/audio/alarm.mp3 differ diff --git a/src/page/index/index.vue b/src/page/index/index.vue index 42caf7c..e2edf4e 100644 --- a/src/page/index/index.vue +++ b/src/page/index/index.vue @@ -1,5 +1,8 @@