123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- var alog = uni.requireNativePlugin("AndroidLog")
- let speaker = uni.requireNativePlugin("SpeechPlug");
- const _handlePush = function(message) {
-
- try {
- alog.info({msg: '接收到推送信息:' + message.content});
- let content = JSON.parse(message.content);
- if (content.type === 1){
- deviceParkIn(content)
- }else if (content.type === 2){
- deviceParkOut(content)
- }
- } catch(e){
-
- }
-
- };
- function deviceParkIn(content){
- if(content.speakMsg){
- speaker.speakAction(content.speakMsg)
- }
- uni.showModal({
- title: '温馨提示',
- content: content.popNode,
- success: (res) => {
- if(res.confirm){
- uni.navigateTo({
- url: content.jumpTo
- });
- }
- }
- });
- }
- function deviceParkOut(content){
- if(content.speakMsg){
- speaker.speakAction(content.speakMsg)
- }
- }
- function pushreg(vue){
- alog.info({msg: '推送注册'});
-
- plus.push.addEventListener('click', _handlePush, false);
-
- plus.push.addEventListener('receive', _handlePush, false);
- }
- export default pushreg
|