From c8d3934771e38a1a2b924d1ab4a94d500d6b354b Mon Sep 17 00:00:00 2001 From: zouyanyan <254651820@qq.com> Date: Sat, 18 Jul 2026 17:03:11 +0800 Subject: [PATCH] upbug --- App.vue | 56 +++++++++++++++++++++----------------- pages/chatbox/chat-box.vue | 19 ++++++++++++- pages/index/index.vue | 7 +---- 3 files changed, 50 insertions(+), 32 deletions(-) diff --git a/App.vue b/App.vue index 704a00d..b726a1b 100644 --- a/App.vue +++ b/App.vue @@ -75,44 +75,44 @@ } else{ // 预约课程列表 - uni.reLaunch({ + uni.navigateTo({ url: `/pages/book/booklist` }); } } if(extras && extras.type && extras.type == 'groupMessage') { // 群聊消息 - // let chat = { - // type: 'GROUP', - // targetId: extras.groupId, - // showName: '加载中...', - // headImage: '/static/image/kf.png', - // }; - // this.$store.dispatch('chatStore/openChat', chat); - // let chatIdx = this.$store.getters['chatStore/findChatIdx'](chat); + let chat = { + type: 'GROUP', + targetId: extras.groupId, + showName: '加载中...', + headImage: '/static/image/kf.png', + }; + this.$store.dispatch('chatStore/openChat', chat); + let chatIdx = this.$store.getters['chatStore/findChatIdx'](chat); + uni.navigateTo({ + url: `/pages/chatbox/chat-box?chatIdx=${chatIdx}` + }); // uni.reLaunch({ - // url: `/pages/chatbox/chat-box?chatIdx=${chatIdx}` + // url: `/pages/chatbox/chat` // }); - uni.reLaunch({ - url: `/pages/chatbox/chat` - }); } if(extras && extras.type && extras.type == 'privateMessage') { // 私信消息 - // let chat = { - // type: 'PRIVATE', - // targetId: extras.senderId, - // showName: '加载中...', - // headImage: '/static/image/kf.png', - // }; - // this.$store.dispatch('chatStore/openChat', chat); - // let chatIdx = this.$store.getters['chatStore/findChatIdx'](chat) + let chat = { + type: 'PRIVATE', + targetId: extras.senderId, + showName: '加载中...', + headImage: '/static/image/kf.png', + }; + this.$store.dispatch('chatStore/openChat', chat); + let chatIdx = this.$store.getters['chatStore/findChatIdx'](chat) + uni.navigateTo({ + url: `/pages/chatbox/chat-box?chatIdx=${chatIdx}` + }); // uni.reLaunch({ - // url: `/pages/chatbox/chat-box?chatIdx=${chatIdx}` + // url: `/pages/chatbox/chat` // }); - uni.reLaunch({ - url: `/pages/chatbox/chat` - }); } if(!extras){ @@ -121,6 +121,12 @@ }); } } + + // 消息推送事件 + if (notificationEventType == 'notificationArrived') { + + } + }); jpushModule.getRegistrationID(result => { console.log("极光推送--注册ID", result.registerID) diff --git a/pages/chatbox/chat-box.vue b/pages/chatbox/chat-box.vue index 5a9fe7f..246d23a 100644 --- a/pages/chatbox/chat-box.vue +++ b/pages/chatbox/chat-box.vue @@ -205,7 +205,9 @@ export default { this.scrollToBottom(); this.needScrollToBottom = false; } + this.setBadge(); }, + methods: { // 映射 Vuex actions ...mapActions('chatStore', [ @@ -222,7 +224,22 @@ export default { ]), ...mapActions('friendStore', ['updateFriend']), ...mapActions('groupStore', ['updateGroup']), - + // 设置app角标 + setBadge() { + var count = myCache("massageCount")?myCache("massageCount"):-1; + if (count > 0) { + // app清除角标的数量 + //#ifdef APP-PLUS + plus.runtime.setBadgeNumber(count); + //#endif + + } else { + // app清除角标的数量 + //#ifdef APP-PLUS + plus.runtime.setBadgeNumber(-1); + //#endif + } + }, // 以下是原业务方法,只需将 `this.chatStore.xxx` 替换为映射后的方法名 onRecorderInput() { this.showRecord = true; diff --git a/pages/index/index.vue b/pages/index/index.vue index 6657819..0779f99 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -302,12 +302,7 @@ // 版本更新 checkupdate(); - }, - mounted() { - if(this.userid==""||this.userid=="0"){ - this.$refs.loginId.open(); - } - }, + }, onPullDownRefresh() { console.log('onPullDownRefresh'); setTimeout(()=>{