guifei zhu
2024-11-27 6017f46b762663b9393cdae8422e0de1ed3db218
App.vue
@@ -1,10 +1,46 @@
<script>
   import Vue from 'vue'
   export default {
      globalData: {
         token: ""
      },
      onLaunch: function() {
         //此处为unipush2.0的推送方法
         // uni-app客户端获取push客户端标记
         // uni.getPushClientId({
         //    success: (res) => {
         //       let push_clientid = res.cid
         //       console.log('客户端推送标识:', push_clientid)
         //    },
         //    fail(err) {
         //       console.log(err)
         //    }
         // })
         // uni.onPushMessage((res) => {
         //    console.log("收到推送消息:", res) //监听推送消息
         // })
         //推送仅支持Android ios原生平台
         // #ifdef APP-PLUS
         console.log('APP-PLUS:')
         // 此处为unipush1.0的推送方法
         plus.push.getClientInfoAsync((info) => {
            let cid = info["clientid"];
            console.log('客户端推送标识:', cid)
            this.$store.dispatch('setCid', cid); // 使用 action 更新 cid
         });
         // #endif
         uni.onPushMessage((res) => {
            console.log("收到推送消息:", res) //监听推送消息
         })
         uni.getSystemInfo({
            success: function(e) {
               // #ifndef MP