fix: 提交

This commit is contained in:
wangdongbo 2026-01-30 14:25:36 +08:00
parent 01529b1b99
commit d74c06325d
3 changed files with 38 additions and 26 deletions

View File

@ -7,8 +7,14 @@
<view v-if="customScroll" class="page-scroll">
<slot></slot>
</view>
<scroll-view v-else scroll-y="true" :scroll-top="scrollTop" class="page-scroll" @scrolltolower="scrolltolower"
@scroll="onScroll">
<scroll-view
v-else
scroll-y="true"
:scroll-top="scrollTop"
class="page-scroll"
@scrolltolower="scrolltolower"
@scroll="onScroll"
>
<slot></slot>
</scroll-view>
</view>
@ -16,19 +22,19 @@
<slot name="footer"></slot>
</view>
<!-- #ifdef MP-->
<view class="safeareaBottom"></view>
<!-- <view class="safeareaBottom"></view> -->
<!-- #endif -->
</view>
</template>
<script setup>
import { computed, useSlots, ref } from 'vue';
import useDebounce from '@/utils/useDebounce';
import { computed, useSlots, ref } from "vue";
import useDebounce from "@/utils/useDebounce";
const emits = defineEmits(['reachBottom']);
const emits = defineEmits(["reachBottom"]);
const props = defineProps({
customScroll: { type: Boolean, default: false },
mainStyle: { default: '' },
pageStyle: { default: '' }
mainStyle: { default: "" },
pageStyle: { default: "" },
});
const slots = useSlots();
const hasHeader = computed(() => !!slots.header);
@ -37,7 +43,7 @@ const hasFooter = computed(() => !!slots.footer);
const scrollTop = ref(0);
const scrolltolower = useDebounce(() => {
emits('reachBottom');
emits("reachBottom");
});
const onScroll = useDebounce((e) => {
@ -49,9 +55,8 @@ function scrollToBottom() {
}
defineExpose({
scrollToBottom
})
scrollToBottom,
});
</script>
<style lang="scss" scoped>
.full-page {

View File

@ -285,14 +285,17 @@ const setupConversationListener = () => {
existing.lastMessageTime !== conversationData.lastMessageTime ||
existing.unreadCount !== conversationData.unreadCount
) {
// 使 Object.assign
Object.assign(
conversationList.value[existingIndex],
conversationData
);
//
conversationList.value[existingIndex] = {
...conversationData,
//
avatar: existing.avatar || conversationData.avatar,
//
unreadCount: Math.max(existing.unreadCount || 0, conversationData.unreadCount || 0)
};
needSort = true;
console.log(
`已更新会话: ${conversationData.name}, unreadCount: ${conversationData.unreadCount}`
`已更新会话: ${conversationData.name}, unreadCount: ${conversationList.value[existingIndex].unreadCount}`
);
}
} else {
@ -325,19 +328,23 @@ const setupConversationListener = () => {
if (conversationIndex !== -1) {
const conversation = conversationList.value[conversationIndex];
//
//
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const isViewingConversation =
currentPage?.route === "pages/message/index";
//
if (isViewingConversation) {
// groupID
const currentGroupID = currentPage?.options?.groupID;
const isViewingThisConversation =
currentPage?.route === "pages/message/index" &&
currentGroupID === conversation.groupID;
//
if (isViewingThisConversation) {
console.log("用户正在查看该会话,不增加未读数");
return;
}
//
//
conversation.unreadCount = (conversation.unreadCount || 0) + 1;
console.log(
"已更新会话未读数:",

View File

@ -143,8 +143,8 @@ function mergeConversationData(conversation, groupDetailsMap) {
// 更新显示名称(使用后端的患者信息)
name: formatConversationName(groupDetail),
// 更新头像
avatar: groupDetail.patient?.avatar || conversation.avatar || '/static/default-avatar.png'
// 更新头像(优先使用已有头像,避免闪动)
avatar: conversation.avatar || groupDetail.patient?.avatar || '/static/default-avatar.png'
}
}