From b44e169dd8a6e0f15d3788970176922e96aec6e1 Mon Sep 17 00:00:00 2001 From: zhao_js <349234519@qq.com> Date: 星期三, 15 十一月 2023 09:55:33 +0800 Subject: [PATCH] no message --- uniapp/App.vue | 49 +++++++++++++++++++++++++++++-------------------- 1 files changed, 29 insertions(+), 20 deletions(-) diff --git a/uniapp/App.vue b/uniapp/App.vue index ac5afb2..d385ab8 100644 --- a/uniapp/App.vue +++ b/uniapp/App.vue @@ -33,11 +33,12 @@ } else { //APP鍦ㄧ嚎锛屾敹鍒版秷鎭笉浼氬寘鍚玹ype灞炴��,杩欐椂鐨刾ayload鏄疛SON瀛楃涓诧紝闇�瑕佽浆涓篔SON瀵硅薄 payload = JSON.parse(msg.payload); } - console.log(payload); + if (payload != null || payload != undefined) { // var messageType = payload.messageType; // onLaunch 鐢熷懡鍛ㄦ湡閲岋紝椤甸潰璺宠浆鏈夐棶棰�,璺充笉杩囧幓 // 搴旇鏄〉闈㈣繕娌″姞杞斤紝鍔犱笂瀹氭椂鍚庯紝灏卞彲浠ヤ簡锛� + console.log(payload); setTimeout(() => { uni.navigateTo({ url: payload @@ -46,6 +47,7 @@ } } else { // Android var payload = msg.payload; + console.log(payload); if (payload != null || payload != undefined) { // onLaunch 鐢熷懡鍛ㄦ湡閲岋紝椤甸潰璺宠浆鏈夐棶棰�,璺充笉杩囧幓 // 搴旇鏄〉闈㈣繕娌″姞杞斤紝鍔犱笂瀹氭椂鍚庯紝灏卞彲浠ヤ簡锛� @@ -74,12 +76,18 @@ }); } } else { // Android - var payload = JSON.parse(msg.content); + console.log(msg.content); + plus.push.createMessage(msg.content, msg.payload, { + title: messageTitle + //icon:'/static/images/app/pushlogo.png' + }); + /* var payload = JSON.parse(msg.content); + var messageTitle = payload.title; var messageContent = payload.content; plus.push.createMessage(messageContent, payload, { title: messageTitle - }) + }) */ } }, false); //娑堟伅鎺ㄩ�佺粨鏉� @@ -134,8 +142,8 @@ // #endif } }) - - + + }, globalData: { platform: '', @@ -151,9 +159,9 @@ argumentStr: '' }, - data(){ + data() { return { - + } }, onShow: function() { @@ -198,7 +206,8 @@ ...mapMutations(['login']), bcInit: function() { var that = this; - if (uni.getSystemInfoSync().platform == 'ios') { + //uni.getSystemInfoSync().platform == 'ios' + if (true) { const plug = uni.requireNativePlugin('xiguazhu-baichuan'); plug.init({}, result => { //console.log('1111111111111111111'); @@ -211,13 +220,15 @@ that.globalData.hasbcinit = true; } }, - targetArgument(args){ + targetArgument(args) { var toarg = args.replace('dafanguan://', ''); - var argObj = JSON.parse(decodeURIComponent(toarg)); + uni.navigateTo({ + url: toarg + }); + /* var argObj = JSON.parse(decodeURIComponent(toarg)); switch (argObj.totype) { case "0": //鍐呴摼 - if(argObj.url) - { + if (argObj.url) { uni.navigateTo({ url: argObj.url }); @@ -225,19 +236,17 @@ break; default: break; - } + } */ }, - getArgument(isload=false) { - if(this.globalData.argumentStr&&this.globalData.argumentStr.length>0) - { + getArgument(isload = false) { + if (this.globalData.argumentStr && this.globalData.argumentStr.length > 0) { return; } try { var args = plus.runtime.arguments; console.log(args); if (args) { - if(isload) - { + if (isload) { this.globalData.argumentStr = args; return; } @@ -267,7 +276,7 @@ updatePushCid: function() { let clientInfo = uni.getStorageSync('clientInfo'); if (clientInfo && clientInfo != 'null' && clientInfo.clientid) { - console.log('寮�濮嬫洿鏂�:'+clientInfo.clientid); + console.log('寮�濮嬫洿鏂�:' + clientInfo.clientid); this.$u.api.updateCid({ pushcid: clientInfo.clientid }).then(e => {}).catch(function(err) {}) @@ -314,7 +323,7 @@ that.globalData.ifwt = 0 } } - + // #endif }).catch(function(err) { that.globalData.hasinit = false; -- Gitblit v1.9.3