|
|
|
@ -1,24 +1,24 @@ |
|
|
|
|
// 监听plusready事件
|
|
|
|
|
document.addEventListener("plusready", function() { |
|
|
|
|
//监听推送消息点击事件
|
|
|
|
|
plus.push.addEventListener("click", function(msg) { |
|
|
|
|
//解析数据
|
|
|
|
|
var jsonPayload = getPayload('click', msg); |
|
|
|
|
//业务逻辑
|
|
|
|
|
openWindowByPushType(jsonPayload); |
|
|
|
|
}); |
|
|
|
|
// //监听推送消息点击事件
|
|
|
|
|
// plus.push.addEventListener("click", function(msg) {
|
|
|
|
|
// //解析数据
|
|
|
|
|
// var jsonPayload = getPayload('click', msg);
|
|
|
|
|
// //业务逻辑
|
|
|
|
|
// openWindowByPushType(jsonPayload);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
//监听在线推送消息点击事件
|
|
|
|
|
plus.push.addEventListener("receive", function(msg) { |
|
|
|
|
//解析数据
|
|
|
|
|
var jsonPayload = getPayload('receive', msg); |
|
|
|
|
//如果是本地消息进行业务逻辑,否则创建本地消息
|
|
|
|
|
if(jsonPayload.msgType == 'LocalMSG') { |
|
|
|
|
//业务
|
|
|
|
|
} else { |
|
|
|
|
createLocalPushMsg(msg.content, jsonPayload); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// //监听在线推送消息点击事件
|
|
|
|
|
// plus.push.addEventListener("receive", function(msg) {
|
|
|
|
|
// //解析数据
|
|
|
|
|
// var jsonPayload = getPayload('receive', msg);
|
|
|
|
|
// //如果是本地消息进行业务逻辑,否则创建本地消息
|
|
|
|
|
// if(jsonPayload.msgType == 'LocalMSG') {
|
|
|
|
|
// //业务
|
|
|
|
|
// } else {
|
|
|
|
|
// createLocalPushMsg(msg.content, jsonPayload);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
@ -73,7 +73,7 @@ function getPayload(eventType, msg) { |
|
|
|
|
function createLocalPushMsg(content, payload) { |
|
|
|
|
//本地信息的标识
|
|
|
|
|
payload.msgType = 'LocalMSG'; |
|
|
|
|
plus.push.createMessage(content, JSON.stringify(payload), {}); |
|
|
|
|
// plus.push.createMessage(content, JSON.stringify(payload), {});
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function openWindowByPushType(payload) { |
|
|
|
|