zhouwenxuan
2023-12-15 277d6652893fcc10fb6827b62ef16fe2910a525c
App.vue
@@ -3,6 +3,13 @@
var jpushModule = uni.requireNativePlugin("JG-JPush")
   export default {
         onLaunch: function() {
             //#ifdef APP-PLUS
              plus.runtime.getProperty(plus.runtime.appid, wgtinfo => {
                   uni.setStorageSync('version', wgtinfo.version)
                 console.log("version",wgtinfo.version)
                 })
              //#endif
            console.log('App Launch',jpushModule)
            jpushModule.initJPushService();
            jpushModule.setLoggerEnable(true);
@@ -12,36 +19,27 @@
            });
            //消息回调——点击通知栏消息 跳转指定页面
            jpushModule.addNotificationListener(result=>{
               console.log(result)
               if (result.notificationEventType == "notificationOpened") {
                  //判断是否登录
                  if (uni.getStorageSync('tk')) {
                     //工作通知——工作人员工作通知页
                     if (result.title.includes('工作通知')){
                        uni.navigateTo({
                        uni.switchTab({
                           url: '/pages/tabBar/notice/notice',
                           complete(res) {
                              console.log(res);
                           }
                        })   
                     //信息审核——领导审核页
                     }else if(result.title == '您有新的信息需要审批'){
                        uni.navigateTo({
                        uni.switchTab({
                           url: '/pages/tabBar/examine/examine',
                           complete(res) {
                              console.log(res);
                           }
                        })
                     //审核结果——首页(后续加pc端信息发布页)
                     }else if(result.title.includes('信息审核')){
                        uni.navigateTo({
                        uni.switchTab({
                           url: '/pages/tabBar/information/information',
                           complete(res) {
                              console.log(res);
                           }
                        })
                     }   
                  }else {
                     console.log("未登录")
                     //未登录跳转首页
                     uni.navigateTo({
                        url: '/pages/index/index',
@@ -80,6 +78,8 @@
            })
            
            
            // jpushModule.addGeofenceListener(result => {
            //    let code = result.code
            //    let type = result.type
@@ -115,7 +115,7 @@
            console.log('App Show')
         },
         onHide: function() {
            jpushModule.initJPushService();
            // jpushModule.initJPushService();
            console.log('App Hide')
         }
      }
@@ -131,6 +131,7 @@
   // 设置整个项目的背景色
   page {
      background-color: #f5f5f5;
      height: 100%;
   }
   /* #endif */