// #ifdef APP-PLUS
// 监听推送消息
plus.push.addEventListener('click', msg => {
this.handlePush(msg);
}, false);
//监听接收透传消息事件
plus.push.addEventListener('receive', msg => {
this.handlePush(msg);
}, false);
handlePush(msg){
console.log(msg);
const systemInfo = uni.getSystemInfoSync();
if(typeof msg.payload === 'string'){
msg.payload = JSON.parse(msg.payload);
}
let type = msg.payload.type || '';
let name = msg.payload.name || ''
uni.report(`click_push_${name}`,{
'brand':systemInfo.brand,
'model':systemInfo.model,
})
if(type){
switch(type){
case "express":
if(msg.payload.orderId)this.$common.navigateTo(`/pages/member/order/orderdetail?order_id=${msg.payload.orderId}`);
break;
case "all":
if(msg.payload.url)this.$common.navigateTo(msg.payload.url)
break;
case "seckill_coming_goods":
if(msg.payload.goodsId)this.$common.navigateTo(`/pages/goods/index/index?id=${msg.payload.goodsId}`)
break;
case "user_register_supplier_success":
this.$common.navigateTo(`/pages/apply/result/result?status=1`);
break;
case "user_register_supplier_failed":
if(msg.payload.shenhe_failed_reason){
this.$common.navigateTo(`/pages/apply/result/result`);
this.$store.dispatch("setReason",msg.payload.shenhe_failed_reason);
};
break;
}
}
}
w***@163.com
- 发布:2020-11-04 20:06
- 更新:2020-11-04 20:06
- 阅读:722
如果app未启动的时候,点击push页进入指定页面,这时候用户返回会出现白屏的情况
分类:uni-app
0 个回复