bug修复
This commit is contained in:
parent
840d26197f
commit
dd9722862f
@ -1,5 +1,5 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { onShow, onUnload } from '@dcloudio/uni-app'
|
||||
import { onShow, onUnload, onLoad } from '@dcloudio/uni-app'
|
||||
import api from '@/utils/api.js'
|
||||
import useTeamStore from '@/store/team.js'
|
||||
|
||||
@ -47,12 +47,12 @@ export default function useGroupChat(groupID) {
|
||||
// 如果找不到成员信息,根据是否为团队成员返回默认头像
|
||||
return isTeamMember(userId) ? '/static/home/avatar.svg' : '/static/default-patient-avatar.png'
|
||||
}
|
||||
|
||||
|
||||
// 如果有头像且不为空字符串,返回头像
|
||||
if (member.avatar && member.avatar.trim() !== '') {
|
||||
return member.avatar
|
||||
}
|
||||
|
||||
|
||||
// 否则根据是否为团队成员返回默认头像
|
||||
return member.isTeamMember ? '/static/home/avatar.svg' : '/static/default-patient-avatar.png'
|
||||
}
|
||||
@ -61,11 +61,11 @@ export default function useGroupChat(groupID) {
|
||||
async function getGroupInfo() {
|
||||
const gid = typeof groupID === 'string' ? groupID : groupID.value
|
||||
if (!gid) return
|
||||
|
||||
|
||||
try {
|
||||
// 1. 获取群聊基本信息
|
||||
const groupResult = await api('getGroupListByGroupId', { groupId: gid })
|
||||
|
||||
|
||||
if (groupResult && groupResult.success && groupResult.data) {
|
||||
groupInfo.value = {
|
||||
groupID: gid,
|
||||
@ -73,14 +73,14 @@ export default function useGroupChat(groupID) {
|
||||
status: groupResult.data.orderStatus || 'active',
|
||||
teamId: groupResult.data.teamId
|
||||
}
|
||||
|
||||
|
||||
// 2. 如果有teamId,获取团队成员头像和名称
|
||||
if (groupResult.data.teamId) {
|
||||
const memberMap = await teamStore.getTeamMemberAvatarsAndName(groupResult.data.teamId)
|
||||
|
||||
|
||||
// 3. 存储团队成员ID列表
|
||||
teamMemberIds.value = Object.keys(memberMap)
|
||||
|
||||
|
||||
// 4. 构建团队成员列表(从返回的 { userId: { avatar, name } } 中提取)
|
||||
members.value = teamMemberIds.value.map(userId => {
|
||||
const memberInfo = memberMap[userId] || {}
|
||||
@ -91,7 +91,7 @@ export default function useGroupChat(groupID) {
|
||||
isTeamMember: true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 5. 添加患者信息(使用默认患者头像)
|
||||
if (groupResult.data.patient) {
|
||||
const pid = groupResult.data.patientId?.toString() || ''
|
||||
@ -115,6 +115,7 @@ export default function useGroupChat(groupID) {
|
||||
getGroupInfo()
|
||||
})
|
||||
|
||||
|
||||
onUnload(() => {
|
||||
// 清理资源
|
||||
})
|
||||
|
||||
@ -883,16 +883,8 @@ onShow(() => {
|
||||
timChatManager.tim &&
|
||||
timChatManager.isLoggedIn &&
|
||||
chatInfo.value.conversationID
|
||||
) {
|
||||
// 页面从后台返回时,重新加载消息列表
|
||||
console.log("页面从后台返回,重新加载消息列表");
|
||||
messageList.value = [];
|
||||
isCompleted.value = false;
|
||||
lastFirstMessageId.value = "";
|
||||
// loadMessageList();
|
||||
}
|
||||
|
||||
startIMMonitoring(30000);
|
||||
)
|
||||
startIMMonitoring(30000);
|
||||
|
||||
// 监听回访任务发送事件
|
||||
uni.$on("send-followup-message", handleSendFollowUpMessage);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user