From da199cebca29634cabeca149b66714fa9602b314 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Mon, 7 Sep 2026 11:15:34 +0800 Subject: [PATCH] 1 --- App.vue | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/App.vue b/App.vue index a63cfda..4119115 100644 --- a/App.vue +++ b/App.vue @@ -120,8 +120,12 @@ } }); jpushModule.addNotificationListener(result => { //极光推送的消息通知回调 - jpushModule.setBadge(0); - plus.runtime.setBadgeNumber(0); + if (jpushModule.setBadge) { + jpushModule.setBadge(0); + } + if (plus && plus.runtime && plus.runtime.setBadgeNumber) { + plus.runtime.setBadgeNumber(0); + } let notificationEventType = result.notificationEventType let woopId = result.extras && result.extras.dataType === 'woop' && result.extras.value; const content = result.content || '' @@ -178,12 +182,14 @@ } }); - jpushModule.isPushStopped(res => { - // code 0已停止推送 1未停止推送 - const { - code - } = res - }) + if (jpushModule.isPushStopped) { + jpushModule.isPushStopped(res => { + // code 0已停止推送 1未停止推送 + const { + code + } = res + }) + } //#endif @@ -377,6 +383,7 @@ }, getNotificationEnabled() { if (uni.getSystemInfoSync().platform == "ios") { + if (!jpushModule.requestNotificationAuthorization) return; jpushModule.requestNotificationAuthorization((result) => { let status = result.status if (status < 2) { @@ -384,6 +391,7 @@ } }) } else { + if (!jpushModule.isNotificationEnabled) return; jpushModule.isNotificationEnabled((result) => { if (result.code == 0) { this.noticMsgTool()