zhouwenxuan
2023-10-26 e7b81924e3fa4d7c5a52484f465efa6733e8c402
App.vue
@@ -3,72 +3,72 @@
var jpushModule = uni.requireNativePlugin("JG-JPush")
   export default {
         onLaunch: function() {
            // console.log('App Launch',jpushModule)
            // jpushModule.initJPushService();
            // jpushModule.setLoggerEnable(true);
            // jpushModule.addConnectEventListener(result=>{
            //    let connectEnable = result.connectEnable
            //    uni.$emit('connectStatusChange',connectEnable)
            // });
            // //消息回调——点击通知栏消息 跳转指定页面
            // jpushModule.addNotificationListener(result=>{
            //    if (result.notificationEventType == "notificationOpened") {
            //       //判断是否登录
            //       if (uni.getStorageSync('tk')) {
            //          //工作通知——工作人员工作通知页
            //          if (result.title.includes('工作通知')){
            //             uni.switchTab({
            //                url: '/pages/tabBar/notice/notice',
            //             })
            //          //信息审核——领导审核页
            //          }else if(result.title == '您有新的信息需要审批'){
            //             uni.switchTab({
            //                url: '/pages/tabBar/examine/examine',
            //             })
            //          //审核结果——首页(后续加pc端信息发布页)
            //          }else if(result.title.includes('信息审核')){
            //             uni.switchTab({
            //                url: '/pages/tabBar/information/information',
            //             })
            //          }
            //       }else {
            //          console.log("未登录")
            //          //未登录跳转首页
            //          uni.navigateTo({
            //             url: '/pages/index/index',
            //             complete(res) {
            //                console.log(res);
            //             }
            //          })
            //          uni.showToast({
            //             icon: 'none',
            //             title: '请先登录',
            //             duration: 3000
            //          })
            //       }
            //    }
            // });
            // jpushModule.addCustomMessageListener(result=>{
            //    let type = result.type
            //    let messageType = result.messageType
            //    let content = result.content
            //    uni.showToast({
            //       icon: 'none',
            //       title: JSON.stringify(result),
            //       duration: 3000
            //    })
            // });
            // jpushModule.addLocalNotificationListener(result=>{
            //    let messageID = result.messageID
            //    let title = result.title
            //    let content = result.content
            //    let extras = result.extras
            //    uni.showToast({
            //       icon: 'none',
            //       title: JSON.stringify(result),
            //       duration: 3000
            //    })
            // })
            console.log('App Launch',jpushModule)
            jpushModule.initJPushService();
            jpushModule.setLoggerEnable(true);
            jpushModule.addConnectEventListener(result=>{
               let connectEnable = result.connectEnable
               uni.$emit('connectStatusChange',connectEnable)
            });
            //消息回调——点击通知栏消息 跳转指定页面
            jpushModule.addNotificationListener(result=>{
               if (result.notificationEventType == "notificationOpened") {
                  //判断是否登录
                  if (uni.getStorageSync('tk')) {
                     //工作通知——工作人员工作通知页
                     if (result.title.includes('工作通知')){
                        uni.switchTab({
                           url: '/pages/tabBar/notice/notice',
                        })
                     //信息审核——领导审核页
                     }else if(result.title == '您有新的信息需要审批'){
                        uni.switchTab({
                           url: '/pages/tabBar/examine/examine',
                        })
                     //审核结果——首页(后续加pc端信息发布页)
                     }else if(result.title.includes('信息审核')){
                        uni.switchTab({
                           url: '/pages/tabBar/information/information',
                        })
                     }
                  }else {
                     console.log("未登录")
                     //未登录跳转首页
                     uni.navigateTo({
                        url: '/pages/index/index',
                        complete(res) {
                           console.log(res);
                        }
                     })
                     uni.showToast({
                        icon: 'none',
                        title: '请先登录',
                        duration: 3000
                     })
                  }
               }
            });
            jpushModule.addCustomMessageListener(result=>{
               let type = result.type
               let messageType = result.messageType
               let content = result.content
               uni.showToast({
                  icon: 'none',
                  title: JSON.stringify(result),
                  duration: 3000
               })
            });
            jpushModule.addLocalNotificationListener(result=>{
               let messageID = result.messageID
               let title = result.title
               let content = result.content
               let extras = result.extras
               uni.showToast({
                  icon: 'none',
                  title: JSON.stringify(result),
                  duration: 3000
               })
            })