Compare commits

...

2 Commits

8 changed files with 1303 additions and 1277 deletions

View File

@ -1,18 +1,34 @@
<template>
<view class="message-page">
<!-- 头部组件 -->
<message-header v-model:activeTab="activeTab" @team-change="handleTeamChange" @add-patient="handleAddPatient" />
<message-header
v-model:activeTab="activeTab"
@team-change="handleTeamChange"
@add-patient="handleAddPatient"
/>
<!-- 消息列表 -->
<scroll-view class="message-list" scroll-y="true" refresher-enabled :refresher-triggered="refreshing"
@refresherrefresh="handleRefresh" @scrolltolower="handleLoadMore">
<scroll-view
class="message-list"
scroll-y="true"
refresher-enabled
:refresher-triggered="refreshing"
@refresherrefresh="handleRefresh"
@scrolltolower="handleLoadMore"
>
<!-- 消息列表项 -->
<view v-for="conversation in filteredConversationList"
:key="conversation.groupID || conversation.conversationID" class="message-item"
@click="handleClickConversation(conversation)">
<view
v-for="conversation in filteredConversationList"
:key="conversation.groupID || conversation.conversationID"
class="message-item"
@click="handleClickConversation(conversation)"
>
<view class="avatar-container">
<image class="avatar" :src="conversation.avatar || '/static/default-avatar.png'"
mode="aspectFill" />
<image
class="avatar"
:src="conversation.avatar || '/static/default-avatar.png'"
mode="aspectFill"
/>
<view v-if="conversation.unreadCount > 0" class="unread-badge">
<text class="unread-text">{{
conversation.unreadCount > 99 ? "99+" : conversation.unreadCount
@ -24,7 +40,10 @@
<view class="header">
<view class="name-info">
<text class="name">{{ formatPatientName(conversation) }}</text>
<text v-if="conversation.patientSex || conversation.patientAge" class="patient-info">
<text
v-if="conversation.patientSex || conversation.patientAge"
class="patient-info"
>
{{ formatPatientInfo(conversation) }}
</text>
</view>
@ -41,7 +60,10 @@
</view>
<!-- 空状态 -->
<view v-if="!loading && filteredConversationList.length === 0" class="empty-container">
<view
v-if="filteredConversationList.length === 0"
class="empty-container"
>
<image class="empty-image" src="/static/empty.svg" mode="aspectFit" />
<text class="empty-text">{{
activeTab === "processing" ? "暂无处理中的会话" : "暂无已结束的会话"
@ -49,7 +71,10 @@
</view>
<!-- 加载更多 -->
<view v-if="hasMore && filteredConversationList.length > 0" class="load-more">
<view
v-if="hasMore && filteredConversationList.length > 0"
class="load-more"
>
<text class="load-more-text">{{
loadingMore ? "加载中..." : "上拉加载更多"
}}</text>
@ -59,63 +84,40 @@
</template>
<script setup>
import {
ref,
computed
} from "vue";
import {
onLoad,
onShow,
onHide
} from "@dcloudio/uni-app";
import {
storeToRefs
} from "pinia";
import useAccountStore from "@/store/account.js";
import useTeamStore from "@/store/team.js";
import useInfoCheck from "@/hooks/useInfoCheck.js";
import {
globalTimChatManager
} from "@/utils/tim-chat.js";
import {
mergeConversationWithGroupDetails
} from "@/utils/conversation-merger.js";
import MessageHeader from "./components/message-header.vue";
import { ref, computed } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
import useAccountStore from "@/store/account.js";
import useTeamStore from "@/store/team.js";
import useInfoCheck from "@/hooks/useInfoCheck.js";
import { globalTimChatManager } from "@/utils/tim-chat.js";
import { mergeConversationWithGroupDetails } from "@/utils/conversation-merger.js";
import MessageHeader from "./components/message-header.vue";
//
const {
account,
openid,
isIMInitialized
} = storeToRefs(useAccountStore());
const {
initIMAfterLogin
} = useAccountStore();
//
const { account, openid, isIMInitialized } = storeToRefs(useAccountStore());
const { initIMAfterLogin } = useAccountStore();
//
const teamStore = useTeamStore();
const {
getTeams
} = teamStore;
//
const teamStore = useTeamStore();
const { getTeams } = teamStore;
//
const {
withInfo
} = useInfoCheck();
//
const { withInfo } = useInfoCheck();
//
const currentTeamId = ref(""); // ""
//
const currentTeamId = ref(""); // ""
//
const conversationList = ref([]);
const loading = ref(false);
const loadingMore = ref(false);
const hasMore = ref(false);
const refreshing = ref(false);
const activeTab = ref("processing");
//
const conversationList = ref([]);
const loading = ref(false);
const loadingMore = ref(false);
const hasMore = ref(false);
const refreshing = ref(false);
const activeTab = ref("processing");
// orderStatus
const filteredConversationList = computed(() => {
// orderStatus
const filteredConversationList = computed(() => {
let filtered = [];
if (activeTab.value === "processing") {
@ -139,37 +141,36 @@
filtered = filtered.filter((conv) => conv.teamId === currentTeamId.value);
}
return filtered;
});
});
//
const handleTeamChange = (teamId) => {
//
const handleTeamChange = (teamId) => {
currentTeamId.value = teamId;
console.log("切换到团队ID:", teamId);
};
};
// - 使 withInfo 使
const handleAddPatient = withInfo(() => {
// - 使 withInfo 使
const handleAddPatient = withInfo(() => {
uni.navigateTo({
url: "/pages/work/team/invite/invite-patient",
});
});
});
// IM
const initIM = async () => {
// IM
const initIM = async () => {
if (!isIMInitialized.value) {
uni.showLoading({
title: "连接中...",
});
const success = await initIMAfterLogin();
uni.hideLoading();
if (!success) {
uni.showToast({
title: "IM连接失败请重试",
icon: "none",
});
return false;
}
// if (!success) {
// uni.showToast({
// title: "IM",
// icon: "none",
// });
// return false;
// }
} else if (globalTimChatManager && !globalTimChatManager.isLoggedIn) {
uni.showLoading({
title: "重连中...",
@ -182,16 +183,17 @@
}
}
return true;
};
};
//
const loadConversationList = async () => {
//
const loadConversationList = async () => {
if (loading.value) return;
loading.value = true;
try {
console.log("开始加载群聊列表");
if (!globalTimChatManager || !globalTimChatManager.getGroupList) {
throw new Error("IM管理器未初始化");
loading.value = false;
return;
}
const result = await globalTimChatManager.getGroupList();
if (result && result.success && result.groupList) {
@ -230,13 +232,13 @@
} finally {
loading.value = false;
}
};
};
//
let updateTimer = null;
//
let updateTimer = null;
//
const setupConversationListener = () => {
//
const setupConversationListener = () => {
if (!globalTimChatManager) return;
//
@ -307,8 +309,7 @@
const existing = conversationList.value[existingIndex];
if (
existing.lastMessage !== conversationData.lastMessage ||
existing.lastMessageTime !== conversationData
.lastMessageTime ||
existing.lastMessageTime !== conversationData.lastMessageTime ||
existing.unreadCount !== conversationData.unreadCount ||
existing.patientName !== conversationData.patientName ||
existing.patientSex !== conversationData.patientSex ||
@ -386,15 +387,15 @@
);
}
});
};
};
//
const formatPatientName = (conversation) => {
//
const formatPatientName = (conversation) => {
return conversation.patientName || "未知患者";
};
};
// +
const formatPatientInfo = (conversation) => {
// +
const formatPatientInfo = (conversation) => {
const parts = [];
//
@ -410,10 +411,10 @@
}
return parts.join(" ");
};
};
//
const formatMessageTime = (timestamp) => {
//
const formatMessageTime = (timestamp) => {
if (!timestamp) return "";
const now = Date.now();
@ -452,10 +453,10 @@
//
return `${date.getFullYear()}${date.getMonth() + 1}${date.getDate()}`;
};
};
//
const handleClickConversation = (conversation) => {
//
const handleClickConversation = (conversation) => {
console.log("点击会话:", conversation);
//
@ -471,10 +472,10 @@
uni.navigateTo({
url: `/pages/message/index?conversationID=${conversation.conversationID}&groupID=${conversation.groupID}`,
});
};
};
//
const handleLoadMore = () => {
//
const handleLoadMore = () => {
if (loadingMore.value || !hasMore.value) return;
loadingMore.value = true;
@ -482,25 +483,25 @@
setTimeout(() => {
loadingMore.value = false;
}, 1000);
};
};
//
const handleRefresh = async () => {
//
const handleRefresh = async () => {
refreshing.value = true;
try {
await loadConversationList();
} finally {
refreshing.value = false;
}
};
};
//
onLoad(() => {
//
onLoad(() => {
console.log("消息列表页面加载");
});
});
//
onShow(async () => {
//
onShow(async () => {
try {
//
await getTeams();
@ -524,10 +525,10 @@
icon: "none",
});
}
});
});
//
onHide(() => {
//
onHide(() => {
//
if (updateTimer) {
clearTimeout(updateTimer);
@ -539,49 +540,49 @@
globalTimChatManager.setCallback("onConversationListUpdated", null);
globalTimChatManager.setCallback("onMessageReceived", null);
}
});
});
</script>
<style scoped lang="scss">
.message-page {
.message-page {
width: 100%;
height: 100vh;
background-color: #f5f5f5;
display: flex;
flex-direction: column;
}
}
.message-list {
.message-list {
width: 100%;
flex: 1;
}
}
.loading-container,
.empty-container {
.loading-container,
.empty-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
}
}
.loading-text {
.loading-text {
font-size: 28rpx;
color: #999;
}
}
.empty-image {
.empty-image {
width: 200rpx;
height: 200rpx;
margin-bottom: 20rpx;
}
}
.empty-text {
.empty-text {
font-size: 28rpx;
color: #999;
}
}
.message-item {
.message-item {
display: flex;
align-items: center;
padding: 24rpx 32rpx;
@ -591,21 +592,21 @@
&:active {
background-color: #f5f5f5;
}
}
}
.avatar-container {
.avatar-container {
position: relative;
margin-right: 24rpx;
flex-shrink: 0;
}
}
.avatar {
.avatar {
width: 96rpx;
height: 96rpx;
border-radius: 8rpx;
}
}
.unread-badge {
.unread-badge {
position: absolute;
top: -8rpx;
right: -8rpx;
@ -617,37 +618,37 @@
display: flex;
align-items: center;
justify-content: center;
}
}
.unread-text {
.unread-text {
font-size: 20rpx;
color: #fff;
line-height: 1;
}
}
.content {
.content {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
min-width: 0;
}
}
.header {
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8rpx;
}
}
.name-info {
.name-info {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
}
.name {
.name {
font-size: 30rpx;
font-weight: 500;
color: #333;
@ -655,42 +656,42 @@
text-overflow: ellipsis;
white-space: nowrap;
flex-shrink: 1;
}
}
.patient-info {
.patient-info {
font-size: 26rpx;
padding-left: 12rpx;
color: #999;
flex-shrink: 0;
}
}
.time {
.time {
font-size: 24rpx;
color: #999;
margin-left: 16rpx;
flex-shrink: 0;
}
}
.message-preview {
.message-preview {
display: flex;
align-items: center;
}
}
.preview-text {
.preview-text {
font-size: 26rpx;
color: #999;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.load-more {
.load-more {
padding: 20rpx 0;
text-align: center;
}
}
.load-more-text {
.load-more-text {
font-size: 24rpx;
color: #999;
}
}
</style>

View File

@ -5,7 +5,13 @@
<view class="mt-12 text-base text-dark">全周期健康管理伙伴</view>
</view>
<view class="login-btn-wrap">
<button v-if="checked" class="login-btn" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
<button
v-if="checked"
class="login-btn"
type="primary"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>
手机号快捷登录
</button>
<!-- <button v-if="checked" class="login-btn" type="primary" @click="getPhoneNumber()">
@ -15,7 +21,10 @@
手机号快捷登录
</button>
</view>
<view class="flex items-center justify-center mt-12 px-15" @click="checked = !checked">
<view
class="flex items-center justify-center mt-12 px-15"
@click="checked = !checked"
>
<checkbox :checked="checked" style="transform: scale(0.7)" />
<view class="text-sm text-gray">我已阅读并同意</view>
<view class="text-sm text-primary">用户协议</view>
@ -76,8 +85,8 @@ async function getPhoneNumber(e) {
await attempToPage(redirectUrl.value);
} else if (res && !(doctorInfo.value && doctorInfo.value.anotherName)) {
uni.redirectTo({
url: '/pages/work/profile'
})
url: "/pages/work/profile",
});
} else if (res) {
toHome();
}

View File

@ -1,6 +1,6 @@
// SCSS 变量定义
$font-size-text: 28rpx;
$font-size-tip: 24rpx;
$font-size-text: 30rpx;
$font-size-tip: 28rpx;
$font-size-title: 32rpx;
$text-color-sub: #999;
$primary-color: #0877F1;
@ -331,7 +331,7 @@ $primary-color: #0877F1;
}
.message-text {
font-size: $font-size-text;
font-size: 30rpx;
line-height: 1.4;
word-wrap: break-word;
word-break: break-all;

View File

@ -393,13 +393,13 @@ const checkLoginAndInitTIM = async () => {
});
const success = await initIMAfterLogin();
uni.hideLoading();
if (!success) {
uni.showToast({
title: "IM连接失败请重试",
icon: "none",
});
return;
}
// if (!success) {
// uni.showToast({
// title: "IM",
// icon: "none",
// });
// return;
// }
} else if (!timChatManager.isLoggedIn) {
uni.showLoading({
title: "重连中...",

View File

@ -1,18 +1,33 @@
<template>
<view class="message-page">
<!-- 头部组件 -->
<message-header v-model:activeTab="activeTab" @team-change="handleTeamChange" @add-patient="handleAddPatient" />
<message-header
v-model:activeTab="activeTab"
@team-change="handleTeamChange"
@add-patient="handleAddPatient"
/>
<!-- 消息列表 -->
<scroll-view class="message-list" scroll-y="true" refresher-enabled :refresher-triggered="refreshing"
@refresherrefresh="handleRefresh" @scrolltolower="handleLoadMore">
<scroll-view
class="message-list"
scroll-y="true"
refresher-enabled
:refresher-triggered="refreshing"
@refresherrefresh="handleRefresh"
@scrolltolower="handleLoadMore"
>
<!-- 消息列表项 -->
<view v-for="conversation in filteredConversationList"
:key="conversation.groupID || conversation.conversationID" class="message-item"
@click="handleClickConversation(conversation)">
<view
v-for="conversation in filteredConversationList"
:key="conversation.groupID || conversation.conversationID"
class="message-item"
@click="handleClickConversation(conversation)"
>
<view class="avatar-container">
<image class="avatar" :src="conversation.avatar || '/static/default-patient-avatar.png'"
mode="aspectFill" />
<image
class="avatar"
:src="conversation.avatar || '/static/default-patient-avatar.png'"
mode="aspectFill"
/>
<view v-if="conversation.unreadCount > 0" class="unread-badge">
<text class="unread-text">{{
conversation.unreadCount > 99 ? "99+" : conversation.unreadCount
@ -24,7 +39,10 @@
<view class="header">
<view class="name-info">
<text class="name">{{ formatPatientName(conversation) }}</text>
<text v-if="conversation.patientSex || conversation.patientAge" class="patient-info">
<text
v-if="conversation.patientSex || conversation.patientAge"
class="patient-info"
>
{{ formatPatientInfo(conversation) }}
</text>
</view>
@ -41,7 +59,20 @@
</view>
<!-- 空状态 -->
<view v-if="!loading && filteredConversationList.length === 0" class="empty-container">
<view
v-if="!loading && conversationList.length === 0"
class="empty-container"
>
<image class="empty-image" src="/static/empty.svg" mode="aspectFit" />
<text class="empty-text">医生信息未获取请稍后重试</text>
</view>
<view
v-else-if="
!loading &&
filteredConversationList.length === 0
"
class="empty-container"
>
<image class="empty-image" src="/static/empty.svg" mode="aspectFit" />
<text class="empty-text">{{
activeTab === "processing" ? "暂无处理中的会话" : "暂无已结束的会话"
@ -49,7 +80,10 @@
</view>
<!-- 加载更多 -->
<view v-if="hasMore && filteredConversationList.length > 0" class="load-more">
<view
v-if="hasMore && filteredConversationList.length > 0"
class="load-more"
>
<text class="load-more-text">{{
loadingMore ? "加载中..." : "上拉加载更多"
}}</text>
@ -59,63 +93,40 @@
</template>
<script setup>
import {
ref,
computed
} from "vue";
import {
onLoad,
onShow,
onHide
} from "@dcloudio/uni-app";
import {
storeToRefs
} from "pinia";
import useAccountStore from "@/store/account.js";
import useTeamStore from "@/store/team.js";
import useInfoCheck from "@/hooks/useInfoCheck.js";
import {
globalTimChatManager
} from "@/utils/tim-chat.js";
import {
mergeConversationWithGroupDetails
} from "@/utils/conversation-merger.js";
import MessageHeader from "../home/components/message-header.vue";
import { ref, computed } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
import useAccountStore from "@/store/account.js";
import useTeamStore from "@/store/team.js";
import useInfoCheck from "@/hooks/useInfoCheck.js";
import { globalTimChatManager } from "@/utils/tim-chat.js";
import { mergeConversationWithGroupDetails } from "@/utils/conversation-merger.js";
import MessageHeader from "../home/components/message-header.vue";
//
const {
account,
openid,
isIMInitialized
} = storeToRefs(useAccountStore());
const {
initIMAfterLogin
} = useAccountStore();
//
const { account, openid, isIMInitialized } = storeToRefs(useAccountStore());
const { initIMAfterLogin } = useAccountStore();
//
const teamStore = useTeamStore();
const {
getTeams
} = teamStore;
//
const teamStore = useTeamStore();
const { getTeams } = teamStore;
//
const {
withInfo
} = useInfoCheck();
//
const { withInfo } = useInfoCheck();
//
const currentTeamId = ref(""); // ""
//
const currentTeamId = ref(""); // ""
//
const conversationList = ref([]);
const loading = ref(false);
const loadingMore = ref(false);
const hasMore = ref(false);
const refreshing = ref(false);
const activeTab = ref("processing");
//
const conversationList = ref([]);
const loading = ref(false);
const loadingMore = ref(false);
const hasMore = ref(false);
const refreshing = ref(false);
const activeTab = ref("processing");
// orderStatus
const filteredConversationList = computed(() => {
// orderStatus
const filteredConversationList = computed(() => {
let filtered = [];
if (activeTab.value === "processing") {
@ -139,23 +150,23 @@
filtered = filtered.filter((conv) => conv.teamId === currentTeamId.value);
}
return filtered;
});
});
//
const handleTeamChange = (teamId) => {
//
const handleTeamChange = (teamId) => {
currentTeamId.value = teamId;
console.log("切换到团队ID:", teamId);
};
};
// - 使 withInfo 使
const handleAddPatient = withInfo(() => {
// - 使 withInfo 使
const handleAddPatient = withInfo(() => {
uni.navigateTo({
url: "/pages/work/team/invite/invite-patient",
});
});
});
// IM
const initIM = async () => {
// IM
const initIM = async () => {
if (!isIMInitialized.value) {
uni.showLoading({
title: "连接中...",
@ -167,7 +178,8 @@
//
uni.showModal({
title: "IM连接失败",
content: "连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
content:
"连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
confirmText: "重新登陆",
cancelText: "取消",
success: (res) => {
@ -175,7 +187,7 @@
//
handleReloginIM();
}
}
},
});
return false;
}
@ -190,7 +202,8 @@
//
uni.showModal({
title: "IM连接失败",
content: "连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
content:
"连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
confirmText: "重新登陆",
cancelText: "取消",
success: (res) => {
@ -198,16 +211,16 @@
//
handleReloginIM();
}
}
},
});
return false;
}
}
return true;
};
};
// IM
const handleReloginIM = async () => {
// IM
const handleReloginIM = async () => {
try {
uni.showLoading({
title: "重新登陆中...",
@ -245,10 +258,10 @@
icon: "none",
});
}
};
};
//
const loadConversationList = async () => {
//
const loadConversationList = async () => {
if (loading.value) return;
loading.value = true;
try {
@ -318,13 +331,13 @@
} finally {
loading.value = false;
}
};
};
//
let updateTimer = null;
//
let updateTimer = null;
//
const setupConversationListener = () => {
//
const setupConversationListener = () => {
if (!globalTimChatManager) return;
//
@ -395,8 +408,7 @@
const existing = conversationList.value[existingIndex];
if (
existing.lastMessage !== conversationData.lastMessage ||
existing.lastMessageTime !== conversationData
.lastMessageTime ||
existing.lastMessageTime !== conversationData.lastMessageTime ||
existing.unreadCount !== conversationData.unreadCount ||
existing.patientName !== conversationData.patientName ||
existing.patientSex !== conversationData.patientSex ||
@ -474,15 +486,15 @@
);
}
});
};
};
//
const formatPatientName = (conversation) => {
//
const formatPatientName = (conversation) => {
return conversation.patientName || "未知患者";
};
};
// +
const formatPatientInfo = (conversation) => {
// +
const formatPatientInfo = (conversation) => {
const parts = [];
//
@ -498,10 +510,10 @@
}
return parts.join(" ");
};
};
//
const formatMessageTime = (timestamp) => {
//
const formatMessageTime = (timestamp) => {
if (!timestamp) return "";
const now = Date.now();
@ -540,10 +552,10 @@
//
return `${date.getFullYear()}${date.getMonth() + 1}${date.getDate()}`;
};
};
//
const handleClickConversation = (conversation) => {
//
const handleClickConversation = (conversation) => {
console.log("点击会话:", conversation);
//
@ -559,10 +571,10 @@
uni.navigateTo({
url: `/pages/message/index?conversationID=${conversation.conversationID}&groupID=${conversation.groupID}`,
});
};
};
//
const handleLoadMore = () => {
//
const handleLoadMore = () => {
if (loadingMore.value || !hasMore.value) return;
loadingMore.value = true;
@ -570,25 +582,25 @@
setTimeout(() => {
loadingMore.value = false;
}, 1000);
};
};
//
const handleRefresh = async () => {
//
const handleRefresh = async () => {
refreshing.value = true;
try {
await loadConversationList();
} finally {
refreshing.value = false;
}
};
};
//
onLoad(() => {
//
onLoad(() => {
console.log("消息列表页面加载");
});
});
//
onShow(async () => {
//
onShow(async () => {
try {
//
await getTeams();
@ -612,10 +624,10 @@
icon: "none",
});
}
});
});
//
onHide(() => {
//
onHide(() => {
//
if (updateTimer) {
clearTimeout(updateTimer);
@ -627,49 +639,49 @@
globalTimChatManager.setCallback("onConversationListUpdated", null);
globalTimChatManager.setCallback("onMessageReceived", null);
}
});
});
</script>
<style scoped lang="scss">
.message-page {
.message-page {
width: 100%;
height: 100vh;
background-color: #f5f5f5;
display: flex;
flex-direction: column;
}
}
.message-list {
.message-list {
width: 100%;
flex: 1;
}
}
.loading-container,
.empty-container {
.loading-container,
.empty-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
}
}
.loading-text {
.loading-text {
font-size: 28rpx;
color: #999;
}
}
.empty-image {
.empty-image {
width: 200rpx;
height: 200rpx;
margin-bottom: 20rpx;
}
}
.empty-text {
.empty-text {
font-size: 28rpx;
color: #999;
}
}
.message-item {
.message-item {
display: flex;
align-items: center;
padding: 24rpx 32rpx;
@ -679,21 +691,21 @@
&:active {
background-color: #f5f5f5;
}
}
}
.avatar-container {
.avatar-container {
position: relative;
margin-right: 24rpx;
flex-shrink: 0;
}
}
.avatar {
.avatar {
width: 96rpx;
height: 96rpx;
border-radius: 8rpx;
}
}
.unread-badge {
.unread-badge {
position: absolute;
top: -8rpx;
right: -8rpx;
@ -705,37 +717,37 @@
display: flex;
align-items: center;
justify-content: center;
}
}
.unread-text {
.unread-text {
font-size: 20rpx;
color: #fff;
line-height: 1;
}
}
.content {
.content {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
min-width: 0;
}
}
.header {
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8rpx;
}
}
.name-info {
.name-info {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
}
.name {
.name {
font-size: 30rpx;
font-weight: 500;
color: #333;
@ -743,42 +755,42 @@
text-overflow: ellipsis;
white-space: nowrap;
flex-shrink: 1;
}
}
.patient-info {
.patient-info {
font-size: 26rpx;
padding-left: 12rpx;
color: #999;
flex-shrink: 0;
}
}
.time {
.time {
font-size: 24rpx;
color: #999;
margin-left: 16rpx;
flex-shrink: 0;
}
}
.message-preview {
.message-preview {
display: flex;
align-items: center;
}
}
.preview-text {
.preview-text {
font-size: 26rpx;
color: #999;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.load-more {
.load-more {
padding: 20rpx 0;
text-align: center;
}
}
.load-more-text {
.load-more-text {
font-size: 24rpx;
color: #999;
}
}
</style>

View File

@ -41,6 +41,7 @@ export default defineStore("accountStore", () => {
async function loginByCode(phoneCode = '') {
try {
const { code } = await uni.login({
appid,
provider: "weixin",
@ -61,13 +62,12 @@ export default defineStore("accountStore", () => {
}
account.value = res.data;
openid.value = res.data.openid;
// 持久化账户信息
cache.set(CACHE_KEYS.ACCOUNT, res.data);
cache.set(CACHE_KEYS.OPENID, res.data.openid);
// 登录成功后初始化腾讯IM
await getDoctorInfo(openid.value);
await getDoctorInfo({ openid: openid.value });
await initIMAfterLogin();
return res.data
}

View File

@ -283,7 +283,6 @@ function generateSendLink(survey, answerId, customerId, customerName, sendSurvey
const { corpId, userId } = context;
const isSystem = survey.createBy === 'system';
let url = '';
debugger
if (isSystem) {
// 系统问卷:使用 VITE_SURVEY_URL
url = `${env?.MP_SURVEY_URL}?corpId=${corpId}&surveryId=${survey.surveryId}&memberId=${customerId}&sendSurveyId=${sendSurveyId}&userId=${userId}`;

View File

@ -1030,6 +1030,11 @@ class TimChatManager {
// 获取群聊列表
getGroupList() {
return new Promise((resolve, reject) => {
// 检查userId是否存在不存在则不需要初始化
if (!this.currentUserID) {
return
}
// 如果 TIM 实例不存在,等待初始化
if (!this.tim) {
console.log('TIM实例不存在等待初始化...')