From 8034a303e73f24827469445a3143d59e8c5c9338 Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Thu, 20 Mar 2025 14:35:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=8E=A8=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=82=B9=E5=87=BB=E5=90=8E=EF=BC=8C=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=AF=BB=E4=B8=8D=E5=87=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 2 + src/main.js | 1 + src/pages/chatSettings/index.vue | 6 +- src/pages/index/components/chatItem.vue | 337 +++++++++--------- src/pages/index/index.vue | 29 +- src/pages/search/components/searchList.vue | 15 +- .../search/moreResult/moreResultDetail.vue | 8 +- 7 files changed, 212 insertions(+), 186 deletions(-) diff --git a/components.d.ts b/components.d.ts index 0dae289..5202040 100644 --- a/components.d.ts +++ b/components.d.ts @@ -30,6 +30,8 @@ declare module 'vue' { LoginMessage: typeof import('./src/components/talk/message/LoginMessage.vue')['default'] Message: typeof import('./src/components/x-message/message/index.vue')['default'] MixedMessage: typeof import('./src/components/talk/message/MixedMessage.vue')['default'] + NButton: typeof import('naive-ui')['NButton'] + NIcon: typeof import('naive-ui')['NIcon'] PageAnimation: typeof import('./src/components/page-animation/index.vue')['default'] RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/main.js b/src/main.js index 5a9a805..160aa0a 100644 --- a/src/main.js +++ b/src/main.js @@ -69,6 +69,7 @@ export function createApp() { window.openUniPushMsg = (msg) => { console.log("=====点击通知栏消息") let pushMsg = JSON.parse(decodeURIComponent(msg)) + console.log("=====pushMsg",pushMsg) //由于弹窗前处理了不该弹窗的场景,因此这里弹窗可以一并处理 //也就是都跳转到聊天页面 const talkStore = useTalkStore() diff --git a/src/pages/chatSettings/index.vue b/src/pages/chatSettings/index.vue index fb3b9da..370556f 100644 --- a/src/pages/chatSettings/index.vue +++ b/src/pages/chatSettings/index.vue @@ -504,8 +504,7 @@ const toSearchByConditionPage = (flag) => { condition = 'link' } uni.navigateTo({ - url: - '/pages/search/searchByCondition/index?condition=' + condition + url: '/pages/search/searchByCondition/index?condition=' + condition, }) } } @@ -644,7 +643,8 @@ const toSearchPage = () => { '/pages/search/moreResult/moreResultDetail?talk_type=' + dialogueParams.type + '&receiver_id=' + - dialogueParams.receiver_id, + dialogueParams.receiver_id + + '&hideFirstRecord=1', }) } diff --git a/src/pages/index/components/chatItem.vue b/src/pages/index/components/chatItem.vue index 0558a11..de994cd 100644 --- a/src/pages/index/components/chatItem.vue +++ b/src/pages/index/components/chatItem.vue @@ -1,43 +1,50 @@ diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index b7f90fa..4122846 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -125,6 +125,7 @@ import { ref, watch, computed } from 'vue' import { onShow, onLoad } from '@dcloudio/uni-app' import { useChatList } from '@/store/chatList/index.js' import { useAuth } from '@/store/auth' +import { ServeClearTalkUnreadNum } from '@/api/chat' import { useTalkStore, useUserStore, useDialogueStore } from '@/store' import chatItem from './components/chatItem.vue' import addCircle from '@/static/image/chatList/addCircle.png' @@ -237,21 +238,23 @@ onLoad((options) => { if (items?.value?.length > 0) { items.value.forEach((openSession) => { if (openSession.index_name === options?.openSessionIndexName) { - dialogueStore.setDialogue(openSession) - if (openSession.unread_num > 0) { - ServeClearTalkUnreadNum({ - talk_type: openSession.talk_type, - receiver_id: openSession.receiver_id, - }).then(() => { - talkStore.updateItem({ - index_name: openSession.index_name, - unread_num: 0, + setTimeout(() => { + dialogueStore.setDialogue(openSession) + if (openSession.unread_num > 0) { + ServeClearTalkUnreadNum({ + talk_type: openSession.talk_type, + receiver_id: openSession.receiver_id, + }).then(() => { + talkStore.updateItem({ + index_name: openSession.index_name, + unread_num: 0, + }) }) + } + uni.navigateTo({ + url: `/pages/dialog/index?sessionId=${openSession.id}`, }) - } - uni.navigateTo({ - url: `/pages/dialog/index?sessionId=${openSession.id}`, - }) + }, 500) } }) } diff --git a/src/pages/search/components/searchList.vue b/src/pages/search/components/searchList.vue index 02fc90f..fea0221 100644 --- a/src/pages/search/components/searchList.vue +++ b/src/pages/search/components/searchList.vue @@ -36,7 +36,10 @@ -
+
userStore.uid), //当前用户id + hideFirstRecord: false, //是否隐藏前缀及搜索群/用户主体信息 }) onLoad((options) => { @@ -55,6 +57,10 @@ onLoad((options) => { } console.log(JSON.parse(decodeURIComponent(state.apiParams))) + + if (options.hideFirstRecord) { + state.hideFirstRecord = options.hideFirstRecord === '1' ? true : false + } }) //分页查询时,最后一条id变化 @@ -116,7 +122,7 @@ const clickSearchItem = ( }) } else { uni.navigateTo({ - url: '/pages/dialog/index?msgInfo=' + res, + url: '/pages/dialog/index?msgInfo=' + res + '&keepDialogInfo=1', }) } }