3***@qq.com
3***@qq.com
  • 发布:2025-11-20 11:12
  • 更新:2025-11-20 11:12
  • 阅读:9

【报Bug】个推-推送消息没有图标

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 10.0.19045 暂缺 Build 19045

HBuilderX类型: 正式

HBuilderX版本号: 4.76

手机系统: Android

手机系统版本号: Android 10

手机厂商: vivo

手机机型: V2034A

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

//发送消息
if (guid != null && guid != "") {
let datas = {
"request_id": "",
// "cids": uniClientId,
"getui_alias": guid,
"title": user.title ? user.title : user.userreal,
"content": content,
"settings": {
//消息有效期设置,单位毫秒,-1表示不设离线。默认是 2 小时,取值范围:-1 ~ 3 24 3600 * 1000(3天)之间 ,"strategy":{"default":2}
"ttl": 86400000
},
"options": {
"HW": {
// 值为int 类型。1 表示华为测试消息,华为每个应用每日可发送该测试消息500条。此 target_user_type 参数请勿发布至线上。
"/message/android/category": "IM",
"/message/android/notification/badge/class": "io.dcloud.PandoraEntry",
//add_num 为离线推送时,设置的华为角标,1表示在当前的角标数上+1
"/message/android/notification/badge/add_num": 1
},
"HO": {
//值为int 类型。1 表示测试推送,不填默认为0。荣耀每个应用每日可发送该测试消息1000条。此测试参数请勿发布至线上。
//"/android/targetUserType": 1
"/android/notification/importance": "NORMAL", //importance字段值为LOW:资讯营销类消息 ;importance字段值为NORMAL:服务与通讯类消息
"/android/notification/badge/addNum": 1,
//add_num 为离线推送时,设置的荣耀角标,1表示在当前的角标数上+1
"/android/notification/badge/badgeClass": "io.dcloud.PandoraEntry"
},
"MZ": {
//魅族消息分类 公信消息对于单用户单应用单日接收条数有限制,私信消息不限。公信消息和私信消息都无需申请,可以直接使用
"/noticeMsgType": 1 //请填写整数类型的消息分类(0:公信;1:私信)
},
"VV": {
//值为int 类型。0 表示正式推送;1 表示测试推送,不填默认为0。此 pushMode 参数请勿发布至线上。
//"/pushMode": 1
"/category": "IM" //二级分类
},
"XM": {
//新小米消息分类下,私信公信id都必须要传,否则请求小米厂商接口会被拦截
"/extra.channel_id": "填写小米平台申请的渠道id"
}
},
"category": {
//HarmonyOS NEXT系统(纯血鸿蒙、非安卓鸿蒙)的消息分类,要给鸿蒙设备推送时才必传
"harmony": "MARKETING"
},
//payload是点击通知栏消息后,传给客户端click回调的自定义参数
"payload": {
"data1": 1,
"data2": 2
// "index": this.listIndex,
// "name": this.friendName,
// "userGuid": this.friendGuid,
// "roomId": this.roomId,
// "avatar": this.friendAvatar,
// "recipient": this.recipientId,
// "tel": this.friendTel
}
}
console.log("33333333333333", datas)
uni.request({
url: "",//云空间
data: datas,
method: "POST",
success: async (res) => {
console.info("打印信息", res);
console.info("打印信息", res.data.data);
// let result = JSON.stringify(res.data.data).indexOf(
// "successed_online") !== -1;
// if (!result && status) {
if (res.data.data == undefined && status) {
console.info("消息推送失败", res);
this.getuniClientId(uniClientId, user, content, staffId, status, guid)

                }  
                // uni.showToast({  
                //  icon: 'none',  
                //  title: "success:"+JSON.stringify(res),  
                //  duration: 5000  
                // })  
            },  
            fail: (res) => {  
                console.info("33333");  
            },  
            complete: (res) => {  
                // console.info("哈哈哈哈哈1111");  
            }  
        })  
    }  

预期结果:

//uni 个推 客户端监听推送消息
uni.onPushMessage((res) => {
console.log("接收到的消息内容111", res);
// 监听【在线、离线】通知栏消息的点击
if (res.type == 'click') {
uni.reLaunch({
url: 'pages/index/messageIndex'
});
// 如果需要跳转app内指定页面,则自己实现下方的跳转代码。
// uni.navigateTo({
// //页面路径示例值:/pages/pushinfo/pushinfo pages/message/message
// url: 'pages/index/messageIndex'
// })
}
// 监听【在线】消息到达。若云函数设置了 "force_notification":true,则不会触发此 receive。
if (res.type == 'receive') {
console.log("接收到的消息内容", res.payload, res);
// //#ifdef APP-PLUS
//个推 自定义通知推送
const manager = uni.getChannelManager()
manager.setPushChannel({
channelId: "zhl",
channelDesc: "智汇览通知渠道",
importance: 4
})
uni.createPushMessage({
title: res.data.title, //推送消息的标题,在系统消息中心显示的通知消息标题,默认值为程序的名称。
content: res.data
.content, //消息显示的内容,在系统通知中心中显示的文本内容。_www/static/images/logo.png
icon: "https://xxxxx/static/images/logo48x48.png", //推送消息的图标../../static/images/logo.png
channelId: "zhl",
success(ress) {
util.getRedCount();
console.log("通知成功", ress)
},
fail(ress) {
console.log("调用失败", ress)
},
complete(ress) {
console.log("调用失败", ress)
}
})
// //#endif
}
})

实际结果:

接收现在没有图标,效果需要有图标

bug描述:

个推-在线没有横幅;图标为白色

2025-11-20 11:12 负责人:无 分享
已邀请:

要回复问题请先登录注册