|
@@ -6,7 +6,6 @@
|
|
|
import Vue from "vue";
|
|
|
import appUpdate from "common/util/appUpdate.js";
|
|
|
import configService from "@/common/service/config.service.js";
|
|
|
-import { connectWebSocket, sendWebSocketMessage, closeWebSocket } from '@/common/util/websocket'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -25,17 +24,14 @@ export default {
|
|
|
console.log(err)
|
|
|
}
|
|
|
});
|
|
|
- // plus.push.addEventListener('click', (msg) => {
|
|
|
- // console.log('点击消息内容:', msg);
|
|
|
-
|
|
|
- // });
|
|
|
- uni.onPushMessage((res) => {
|
|
|
- //客户端监听推送消息
|
|
|
- console.log("收到推送消息:", res) //监听推送消息
|
|
|
- if (res.data) {
|
|
|
- uni.createPushMessage(res.data) //收到消息推送,创建系统状态栏及锁屏通 知
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+ // uni.onPushMessage((res) => {
|
|
|
+ // //客户端监听推送消息
|
|
|
+ // console.log("收到推送消息:", res) //监听推送消息
|
|
|
+ // if (res.data) {
|
|
|
+ // uni.createPushMessage(res.data) //收到消息推送,创建系统状态栏及锁屏通 知
|
|
|
+ // }
|
|
|
+ // })
|
|
|
|
|
|
const savedIP = uni.getStorageSync("selectedIP");
|
|
|
if (configService.apiUrl !== "") {
|
|
@@ -307,52 +303,13 @@ export default {
|
|
|
},
|
|
|
onShow: function () {
|
|
|
console.log("App Show");
|
|
|
- // this.getConnect()
|
|
|
+
|
|
|
},
|
|
|
onHide: function () {
|
|
|
console.log("App Hide");
|
|
|
clearInterval(this.$store.state.timer); // 假设定时器存储在 Vuex 的状态管理中
|
|
|
},
|
|
|
- methods: {
|
|
|
- // //获取推送消息,标题
|
|
|
- // getInfoInit(title, message) {
|
|
|
- // uni.request({
|
|
|
- // url: 'https://fc-mp-2578c13f-eaaa-45e9-a01e-6a48b45fb7a0.next.bspapp.com/testPush', //云函数url
|
|
|
- // data: {
|
|
|
- // cid: uni.getStorageSync('push_cid'),
|
|
|
- // title: title, //可按需传入动态参数,在云函数index.js接收参数
|
|
|
- // content: message,
|
|
|
- // },
|
|
|
- // method: 'get',
|
|
|
- // success(result) {
|
|
|
- // console.log('发送通知', result);
|
|
|
- // },
|
|
|
- // fail({ errMsg }) {
|
|
|
- // console.log('request fail', errMsg)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
-
|
|
|
- //连接websocket
|
|
|
- // async getConnect() {
|
|
|
- // let that = this
|
|
|
- // try {
|
|
|
- // that.socketTask = await connectWebSocket();
|
|
|
- // that.socketTask.onMessage((res) => {
|
|
|
- // console.log('收到消息:websocket已连接 ', res)
|
|
|
- // // let message = JSON.parse(res.data)
|
|
|
- // // //报警信息推送
|
|
|
- // // if (message.warndata) {
|
|
|
- // // that.getInfoInit(message.msgTitle, message.warndata)
|
|
|
- // // }
|
|
|
- // that.getInfoInit('111', '2222')
|
|
|
- // });
|
|
|
- // } catch (err) {
|
|
|
- // console.log('连接失败: ' + err)
|
|
|
- // }
|
|
|
- // },
|
|
|
-
|
|
|
- }
|
|
|
+ methods: {}
|
|
|
};
|
|
|
</script>
|
|
|
|