zhouwenxuan
2023-09-06 0b2357a173a2bc52f3532bfcf93ff31daf226231
App.vue
@@ -1,23 +1,118 @@
<script>
var jpushModule = uni.requireNativePlugin("JG-JPush")
   export default {
      onLaunch: function() {
         console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
         console.log('App Launch')
         // uni.hideTabBar({});
         // uni.clearStorageSync();
         // uni.clearStorage();
      },
      onShow: function() {
         console.log('App Show')
         // uni.hideTabBar();
         // uni.clearStorageSync();
         // uni.clearStorage();
      },
      onHide: function() {
         // uni.clearStorageSync();
         console.log('App Hide')
         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
            //    })
            // })
            // jpushModule.addGeofenceListener(result => {
            //    let code = result.code
            //    let type = result.type
            //    let geofenceId = result.geofenceId
            //    let userInfo = result.userInfo
            //    uni.showToast({
            //       icon: 'none',
            //       title: '触发地理围栏',
            //       duration: 3000
            //    })
            // })
      //       jpushModule.setIsAllowedInMessagePop(true)
      //       jpushModule.pullInMessage(result => {
      //          let code = result.code
      //          console.log(code)
      //       })
      //       jpushModule.addInMessageListener(result => {
      //          let eventType = result.eventType
      //          let messageType = result.messageType
      //          let content = result.content
      //          console.log('inMessageListener', eventType, messageType, content)
      //          uni.showToast({
      //             icon: 'none',
      //             title: JSON.stringify(result),
      //             duration: 3000
      //          })
      //       })
         },
         onShow: function() {
            console.log('App Show')
         },
         onHide: function() {
            // jpushModule.initJPushService();
            console.log('App Hide')
         }
      }
   }
</script>
<style lang="scss">
@@ -29,6 +124,7 @@
   // 设置整个项目的背景色
   page {
      background-color: #f5f5f5;
      height: 100%;
   }
   /* #endif */