春色撩人
春色撩人
  • 发布:2016-03-09 15:15
  • 更新:2016-03-24 00:41
  • 阅读:2060

IOS平台,可以收到透传消息,可以启动应用程序,无法触发CLICK事件,不知道下面我的代码哪里的问题

分类:HTML5+

IOS平台,可以收到透传消息,可以启动应用程序,无法触发CLICK事件,无法跳转到其他新闻详细页

// 监听plusready事件    
        document.addEventListener("plusready", function() {  
            plus.push.addEventListener("click", function(msg) {  
                logoutPushMsg(msg);  
            }, false);  
            // 监听在线消息事件  
            plus.push.addEventListener("receive", function(msg) {  
                logoutPushMsg(msg);  
            }, false);  
        }, false);  

        function logoutPushMsg(msg) {  
            if (msg.payload) {  
                var payl = msg.payload;  
                var arr = payl.split('|');  
                if (arr[0] == 'article') {  
                    mui.openWindow({  
                        url: 'html/news_detail.html',  
                        id: 'news_detail2',  
                        extras: {  
                            nid: arr[1]  
                        },  
                        styles: {  
                            top: '0px',  
                            bottom: '0px'  
                        }  
                    });  
                }  
                if (arr[0] == 'business') {  
                    mui.openWindow({  
                        url: 'html/product.html',  
                        id: 'product2',  
                        extras: {  
                            ztid: arr[1]  
                        },  
                        styles: {  
                            top: '0px',  
                            bottom: '0px'  
                        }  
                    });  
                }  
                if (arr[0] == 'product') {  
                    mui.openWindow({  
                        url: 'html/product_detail.html',  
                        id: 'product_detail2',  
                        extras: {  
                            ztid: arr[1]  
                        },  
                        styles: {  
                            top: '0px',  
                            bottom: '0px'  
                        }  
                    });  
                }  
            }  
        }
2016-03-09 15:15 负责人:无 分享
已邀请:
magengshun

magengshun

APP在前台启动的时候会出发recieve事件,APP不在前台启动的时候,点击消息会先触发click事件,再出发receive事件,总结应用启动会接收所有消息,点击消息栏只会出发点击的消息。这是我测试的结果。权当参考。

  • 春色撩人 (作者)

    请教下我的问题出在哪里呢?我发送IOS透传信息的时候,点击消息启动应用,但只能在首页,无法自动到某个新闻详细页

    2016-03-09 15:35

  • magengshun

    var curView = plus.webview.currentWebview();

    curView.loadURL(“地址”);

    http://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.currentWebview

    2016-03-09 16:03

春色撩人

春色撩人 (作者)

有哪个管理员能帮我解决下这个问题啊

  • DCloud_IOS_XTY

    是使用的最新版本吗

    2016-03-23 17:09

  • 春色撩人 (作者)

    你说的是HBuilder吗? 是最新的呀

    2016-03-24 16:44

我勒个去

我勒个去

你payload数据有问题,应该是json字符串,转成对象后使用。

  • 春色撩人 (作者)

    我是用的这种格式:{title:"XXXX平台招聘启事",content:"XXX平台招聘启事",payload:"article|551"} 应该没错吧,Android都可以的

    2016-03-24 16:48

该问题目前已经被锁定, 无法添加新回复