雪魄
雪魄
  • 发布:2021-05-08 14:47
  • 更新:2021-05-10 18:44
  • 阅读:1163

uniapp推送华为手机离线推送不跳转app内部页面。其他手机ios,小米都可以。

分类:uni-app

使用了unipush进行推送。华为在线推送没有问题,离线推送点击不跳转。其他手机小米,ios在线离线跳转都没问题。前端代码如下。// #ifdef APP-PLUS
const _self = this;
const _handlePush = function(message) {
/**

  • 通过 vuex 来同步页面的数据,仅做演示。
  • 实际开发中,这里可能是跳转到某个页面等操作,请根据自身业务需求编写。
    */
    setTimeout(() => {
    console.log("离线消息" + JSON.stringify(message));
    if (message.payload) {
    let type = message.payload.type;
    if (type == "notice") {
    uni.switchTab({
    url: "/pages/index/index" //通知
    })
    } else if (type == "msg") { //文章详情
    uni.navigateTo({
    url: "/pages/article/detail/detail?article_id=" + message.payload.needid
    })
    uni.setStorageSync("article_id",message.payload.needid)
    } else if (type == "order") { //订单
    uni.navigateTo({
    url: "/pages/order/list/list?status=2"
    })
    } else if (type == "log") { //物流
    uni.navigateTo({
    url: "/pages/order/logistics/logistics?order_id=" + message.payload.needid
    })
    }
    }
    }, 1500)
    };
    plus.push.addEventListener('click', function(message) {
    //plus.nativeUI.toast('push click');
    _handlePush(message);
    });
    plus.push.addEventListener('receive', function(message) {
    //plus.nativeUI.toast('push receive');
    _handlePush(message);
    });
    // #endif
2021-05-08 14:47 负责人:DCloud_Android_DQQ 分享
已邀请:
DCloud_Android_DQQ

DCloud_Android_DQQ

没看懂。。你的意思是说 click 事件里面的代码没执行吗

  • 雪魄 (作者)

    是的。

    2021-05-12 10:55

  • 7***@qq.com

    请问解决了吗

    2021-10-08 15:41

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