|
@@ -5,7 +5,10 @@ let speaker = uni.requireNativePlugin("SpeechPlug");
|
|
const _handlePush = function(message) {
|
|
const _handlePush = function(message) {
|
|
//{"message":{"__UUID__":"androidPushMsg222631973","appid":"__UNI__29ECCC8","content":"{\"type\":2,\"jumpTo\":\"pages/login/login\"}","payload":{"jumpTo":"pages/login/login","type":2},"title":"智慧停车PDA"}}
|
|
//{"message":{"__UUID__":"androidPushMsg222631973","appid":"__UNI__29ECCC8","content":"{\"type\":2,\"jumpTo\":\"pages/login/login\"}","payload":{"jumpTo":"pages/login/login","type":2},"title":"智慧停车PDA"}}
|
|
try {
|
|
try {
|
|
- alog.info({msg: '接收到推送信息:' + message.content});
|
|
|
|
|
|
+ const value = uni.getStorageSync('pushreg_switch');
|
|
|
|
+ if (value) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
let content = JSON.parse(message.content);
|
|
let content = JSON.parse(message.content);
|
|
if (content.type === 1){
|
|
if (content.type === 1){
|
|
deviceParkIn(content)
|
|
deviceParkIn(content)
|
|
@@ -28,6 +31,11 @@ function deviceParkIn(content){
|
|
if(content.speakMsg){
|
|
if(content.speakMsg){
|
|
speaker.speakAction(content.speakMsg)
|
|
speaker.speakAction(content.speakMsg)
|
|
}
|
|
}
|
|
|
|
+ const value = uni.getStorageSync('pushModel_switch');
|
|
|
|
+ if (value) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ uni.setStorageSync('pushModel_switch', '1');
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: '温馨提示',
|
|
title: '温馨提示',
|
|
content: content.popNode,
|
|
content: content.popNode,
|
|
@@ -37,7 +45,10 @@ function deviceParkIn(content){
|
|
url: content.jumpTo
|
|
url: content.jumpTo
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ } ,
|
|
|
|
+ complete:()=>{
|
|
|
|
+ uni.removeStorageSync('pushModel_switch');
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -48,7 +59,9 @@ function deviceParkOut(content){
|
|
}
|
|
}
|
|
|
|
|
|
function pushreg(vue){
|
|
function pushreg(vue){
|
|
- alog.info({msg: '推送注册'});
|
|
|
|
|
|
+
|
|
|
|
+ //添加推送开关
|
|
|
|
+ uni.setStorageSync('pushreg_switch', '1');
|
|
//监听系统通知栏消息点击事件
|
|
//监听系统通知栏消息点击事件
|
|
plus.push.addEventListener('click', _handlePush, false);
|
|
plus.push.addEventListener('click', _handlePush, false);
|
|
//监听接收透传消息事件
|
|
//监听接收透传消息事件
|