no message

This commit is contained in:
wangdongbo 2026-02-10 14:29:18 +08:00
parent 1c3aca8700
commit 840d26197f
5 changed files with 449 additions and 448 deletions

View File

@ -3,7 +3,7 @@ MP_IMAGE_URL=https://patient.youcan365.com
MP_CACHE_PREFIX=development MP_CACHE_PREFIX=development
MP_WX_APP_ID=wx1d8337a40c11d66c MP_WX_APP_ID=wx1d8337a40c11d66c
MP_CORP_ID=wwe3fb2faa52cf9dfb MP_CORP_ID=wwe3fb2faa52cf9dfb
MP_TIM_SDK_APP_ID=1600123876 MP_TIM_SDK_APP_ID=1600126296
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
MP_INVITE_PATIENT_QRCODE=https://patient.youcan365.com/invite-patient MP_INVITE_PATIENT_QRCODE=https://patient.youcan365.com/invite-patient
MP_PATIENT_PAGE_BASE_URL= 'https://www.youcan365.com/patientDeploy/#/' MP_PATIENT_PAGE_BASE_URL= 'https://www.youcan365.com/patientDeploy/#/'

View File

@ -3,7 +3,7 @@ MP_IMAGE_URL=https://patient.youcan365.com
MP_CACHE_PREFIX=development MP_CACHE_PREFIX=development
MP_WX_APP_ID=wx1d8337a40c11d66c MP_WX_APP_ID=wx1d8337a40c11d66c
MP_CORP_ID=wwe3fb2faa52cf9dfb MP_CORP_ID=wwe3fb2faa52cf9dfb
MP_TIM_SDK_APP_ID=1600123876 MP_TIM_SDK_APP_ID=1600126296
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
MP_INVITE_PATIENT_QRCODE=https://patient.youcan365.com/invite-patient MP_INVITE_PATIENT_QRCODE=https://patient.youcan365.com/invite-patient
MP_PATIENT_PAGE_BASE_URL= 'https://www.youcan365.com/patientDeploy/#/' MP_PATIENT_PAGE_BASE_URL= 'https://www.youcan365.com/patientDeploy/#/'

386
App.vue
View File

@ -1,14 +1,18 @@
<script> <script>
import useAccountStore from "@/store/account.js"; import useAccountStore from "@/store/account.js";
import { globalTimChatManager } from "@/utils/tim-chat.js"; import {
globalTimChatManager
} from "@/utils/tim-chat.js";
export default { export default {
onLaunch: function () { onLaunch: function() {
// pinia store getActivePinia const {
const { account, login, initIMAfterLogin, getDoctorInfo } = account,
useAccountStore(); login,
initIMAfterLogin,
getDoctorInfo
} = useAccountStore();
// IM
if (account && account.openid) { if (account && account.openid) {
console.log("App Launch: 已有登录信息,初始化 IM"); console.log("App Launch: 已有登录信息,初始化 IM");
initIMAfterLogin().catch((err) => { initIMAfterLogin().catch((err) => {
@ -22,10 +26,10 @@ export default {
}); });
} }
}, },
onShow: function () { onShow: function() {
console.log("App Show"); console.log("App Show");
}, },
onHide: function () { onHide: function() {
console.log("App Hide"); console.log("App Hide");
// 退退IM // 退退IM
// try { // try {
@ -38,129 +42,130 @@ export default {
// console.error('退IM:', error); // console.error('退IM:', error);
// } // }
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
$primary-color: #0877f1; $primary-color: #0877f1;
page { page {
height: 100%; height: 100%;
background: #f5f5f5; background: #f5f5f5;
} }
/* 全局按钮样式 - 使用项目主题色 */ /* 全局按钮样式 - 使用项目主题色 */
button[type="primary"], button[type="primary"],
.button-primary, .button-primary,
uni-button[type="primary"] { uni-button[type="primary"] {
background-color: $primary-color !important; background-color: $primary-color !important;
border-color: $primary-color !important; border-color: $primary-color !important;
color: #fff !important; color: #fff !important;
} }
button[type="primary"]:not([disabled]):active, button[type="primary"]:not([disabled]):active,
.button-primary:active, .button-primary:active,
uni-button[type="primary"]:not([disabled]):active { uni-button[type="primary"]:not([disabled]):active {
background-color: darken($primary-color, 10%) !important; background-color: darken($primary-color, 10%) !important;
border-color: darken($primary-color, 10%) !important; border-color: darken($primary-color, 10%) !important;
} }
/* 微信小程序按钮样式覆盖 */ /* 微信小程序按钮样式覆盖 */
.wx-button[type="primary"] { .wx-button[type="primary"] {
background-color: $primary-color !important; background-color: $primary-color !important;
border-color: $primary-color !important; border-color: $primary-color !important;
color: #fff !important; color: #fff !important;
} }
.shadow-up { .shadow-up {
box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px,
rgba(0, 0, 0, 0.1) 0px -10px 15px -3px, rgba(0, 0, 0, 0.1) 0px -4px 6px -4px; rgba(0, 0, 0, 0.1) 0px -10px 15px -3px, rgba(0, 0, 0, 0.1) 0px -4px 6px -4px;
} }
.shadow-lg { .shadow-lg {
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
} }
.relative { .relative {
position: relative; position: relative;
} }
.absolute {
.absolute {
position: absolute; position: absolute;
} }
.inline-block { .inline-block {
display: inline-block; display: inline-block;
} }
.flex { .flex {
display: flex; display: flex;
} }
.flex-col { .flex-col {
flex-direction: column; flex-direction: column;
} }
.flex-wrap { .flex-wrap {
flex-wrap: wrap; flex-wrap: wrap;
} }
.flex-grow { .flex-grow {
flex-grow: 1; flex-grow: 1;
} }
.flex-shrink-0 { .flex-shrink-0 {
flex-shrink: 0; flex-shrink: 0;
} }
.items-center { .items-center {
align-items: center; align-items: center;
} }
.justify-center { .justify-center {
justify-content: center; justify-content: center;
} }
.justify-between { .justify-between {
justify-content: space-between; justify-content: space-between;
} }
.justify-around { .justify-around {
justify-content: space-around; justify-content: space-around;
} }
.justify-end { .justify-end {
justify-content: flex-end; justify-content: flex-end;
} }
.bg-gray { .bg-gray {
background: #f5f5f5; background: #f5f5f5;
} }
.bg-primary { .bg-primary {
background: $primary-color; background: $primary-color;
} }
.bg-success { .bg-success {
background: green; background: green;
} }
.bg-white { .bg-white {
background: #fff; background: #fff;
} }
.bg-warning { .bg-warning {
background: orange; background: orange;
} }
.bg-danger { .bg-danger {
background: rgb(248 113 113); background: rgb(248 113 113);
} }
.bg-light-text-color { .bg-light-text-color {
position: relative; position: relative;
} }
.bg-light-text-color::after { .bg-light-text-color::after {
content: ""; content: "";
position: absolute; position: absolute;
top: 0; top: 0;
@ -169,256 +174,257 @@ uni-button[type="primary"]:not([disabled]):active {
height: 100%; height: 100%;
opacity: 0.2; opacity: 0.2;
background: currentColor; background: currentColor;
} }
.py-3 { .py-3 {
padding-top: 6rpx; padding-top: 6rpx;
padding-bottom: 6rpx; padding-bottom: 6rpx;
} }
.py-5 { .py-5 {
padding-top: 10rpx; padding-top: 10rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.p-15 { .p-15 {
padding: 30rpx; padding: 30rpx;
} }
.p-10 { .p-10 {
padding: 20rpx; padding: 20rpx;
} }
.px-5 { .px-5 {
padding-left: 10rpx; padding-left: 10rpx;
padding-right: 10rpx; padding-right: 10rpx;
} }
.px-10 { .px-10 {
padding-left: 20rpx; padding-left: 20rpx;
padding-right: 20rpx; padding-right: 20rpx;
} }
.px-12 { .px-12 {
padding-left: 24rpx; padding-left: 24rpx;
padding-right: 24rpx; padding-right: 24rpx;
} }
.px-15 { .px-15 {
padding-left: 30rpx; padding-left: 30rpx;
padding-right: 30rpx; padding-right: 30rpx;
} }
.pt-5 { .pt-5 {
padding-top: 10rpx; padding-top: 10rpx;
} }
.pt-15 {
.pt-15 {
padding-top: 30rpx; padding-top: 30rpx;
} }
.break-all { .break-all {
word-break: break-all; word-break: break-all;
} }
.pb-5 { .pb-5 {
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.pb-10 { .pb-10 {
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.py-10 { .py-10 {
padding-top: 20rpx; padding-top: 20rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.py-12 { .py-12 {
padding-top: 24rpx; padding-top: 24rpx;
padding-bottom: 24rpx; padding-bottom: 24rpx;
} }
.py-15 { .py-15 {
padding-top: 30rpx; padding-top: 30rpx;
padding-bottom: 30rpx; padding-bottom: 30rpx;
} }
.mr-5 { .mr-5 {
margin-right: 10rpx; margin-right: 10rpx;
} }
.mr-10 { .mr-10 {
margin-right: 20rpx; margin-right: 20rpx;
} }
.ml-15 { .ml-15 {
margin-left: 30rpx; margin-left: 30rpx;
} }
.mb-5 { .mb-5 {
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.mb-10 { .mb-10 {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.mt-10 { .mt-10 {
margin-top: 20rpx; margin-top: 20rpx;
} }
.mt-15 { .mt-15 {
margin-top: 30rpx; margin-top: 30rpx;
} }
.mt-12 { .mt-12 {
margin-top: 24rpx; margin-top: 24rpx;
} }
.mx-10 { .mx-10 {
margin-left: 20rpx; margin-left: 20rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
.mx-auto { .mx-auto {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
.rounded { .rounded {
border-radius: 16rpx; border-radius: 16rpx;
} }
.rounded-sm { .rounded-sm {
border-radius: 8rpx; border-radius: 8rpx;
} }
.rounded-full { .rounded-full {
border-radius: 999px; border-radius: 999px;
} }
.text-center { .text-center {
text-align: center; text-align: center;
} }
.text-right { .text-right {
text-align: right; text-align: right;
} }
.text-gray { .text-gray {
color: #999; color: #999;
} }
.text-black { .text-black {
color: #000; color: #000;
} }
.text-dark { .text-dark {
color: #333; color: #333;
} }
.text-danger { .text-danger {
color: #f56c6c; color: #f56c6c;
} }
.text-primary { .text-primary {
color: $primary-color; color: $primary-color;
} }
.text-success { .text-success {
color: #67c23a; color: #67c23a;
} }
.text-white { .text-white {
color: #fff; color: #fff;
} }
.text-warning { .text-warning {
color: #f56c6c; color: #f56c6c;
} }
.text-sm { .text-sm {
font-size: 24rpx; font-size: 24rpx;
} }
.text-base { .text-base {
font-size: 28rpx; font-size: 28rpx;
} }
.text-lg { .text-lg {
font-size: 32rpx; font-size: 32rpx;
} }
.text-xl { .text-xl {
font-size: 36rpx; font-size: 36rpx;
} }
.leading-normal { .leading-normal {
line-height: 1.5; line-height: 1.5;
} }
.border { .border {
border: 1px solid #eee; border: 1px solid #eee;
} }
.border-dashed { .border-dashed {
border: 1px dashed #eee; border: 1px dashed #eee;
} }
.border-b { .border-b {
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }
.border-auto { .border-auto {
border: 1px solid; border: 1px solid;
} }
.border-dashed-auto { .border-dashed-auto {
border: 1px dashed; border: 1px dashed;
} }
.border-primary { .border-primary {
border: 1px solid $primary-color; border: 1px solid $primary-color;
} }
.font-semibold { .font-semibold {
font-weight: bold; font-weight: bold;
} }
.truncate { .truncate {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.w-0 { .w-0 {
width: 0; width: 0;
} }
.w-full { .w-full {
width: 100%; width: 100%;
} }
.overflow-hidden { .overflow-hidden {
overflow: hidden; overflow: hidden;
} }
.border-box { .border-box {
box-sizing: border-box; box-sizing: border-box;
} }
.line-clamp-2 { .line-clamp-2 {
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
overflow: hidden; overflow: hidden;
} }
.h-full { .h-full {
height: 100%; height: 100%;
} }
.safe-bottom-padding { .safe-bottom-padding {
height: env(safe-area-inset-bottom); height: env(safe-area-inset-bottom);
} }
</style> </style>

View File

@ -368,22 +368,6 @@ const loadConversationList = async () => {
} }
} catch (error) { } catch (error) {
console.error("加载会话列表失败:", error); console.error("加载会话列表失败:", error);
//
if (
error.message &&
(error.message.includes("超时") || error.message.includes("连接"))
) {
uni.showToast({
title: "网络连接不稳定,请重试",
icon: "none",
});
} else {
uni.showToast({
title: error.message || "加载失败,请重试",
icon: "none",
});
}
} finally { } finally {
loading.value = false; loading.value = false;
} }

View File

@ -245,11 +245,16 @@ async function tryConsumePendingFollowUpSend() {
const currentGroupId = normalizeGroupId(groupId.value || ""); const currentGroupId = normalizeGroupId(groupId.value || "");
// //
if (!payloadConversationID || payloadConversationID !== currentConversationID) return; if (!payloadConversationID || payloadConversationID !== currentConversationID)
if (payloadGroupId && currentGroupId && payloadGroupId !== currentGroupId) return; return;
if (payloadGroupId && currentGroupId && payloadGroupId !== currentGroupId)
return;
const messages = Array.isArray(payload.messages) ? payload.messages : []; const messages = Array.isArray(payload.messages) ? payload.messages : [];
const context = payload.context && typeof payload.context === "object" ? payload.context : {}; const context =
payload.context && typeof payload.context === "object"
? payload.context
: {};
if (!messages.length) { if (!messages.length) {
uni.removeStorageSync(PENDING_FOLLOWUP_SEND_STORAGE_KEY); uni.removeStorageSync(PENDING_FOLLOWUP_SEND_STORAGE_KEY);
return; return;
@ -438,7 +443,9 @@ onLoad((options) => {
}; };
const rawGroupId = decodeQueryValue(options.groupID || ""); const rawGroupId = decodeQueryValue(options.groupID || "");
groupId.value = rawGroupId.startsWith("GROUP") ? rawGroupId.replace(/^GROUP/, "") : rawGroupId; groupId.value = rawGroupId.startsWith("GROUP")
? rawGroupId.replace(/^GROUP/, "")
: rawGroupId;
messageList.value = []; messageList.value = [];
isLoading.value = false; isLoading.value = false;
if (options.conversationID) { if (options.conversationID) {
@ -872,13 +879,17 @@ onShow(() => {
checkLoginAndInitTIM(); checkLoginAndInitTIM();
} else if (timChatManager.tim && !timChatManager.isLoggedIn) { } else if (timChatManager.tim && !timChatManager.isLoggedIn) {
timChatManager.ensureIMConnection(); timChatManager.ensureIMConnection();
} else if (timChatManager.tim && timChatManager.isLoggedIn && chatInfo.value.conversationID) { } else if (
timChatManager.tim &&
timChatManager.isLoggedIn &&
chatInfo.value.conversationID
) {
// //
console.log("页面从后台返回,重新加载消息列表"); console.log("页面从后台返回,重新加载消息列表");
messageList.value = []; messageList.value = [];
isCompleted.value = false; isCompleted.value = false;
lastFirstMessageId.value = ""; lastFirstMessageId.value = "";
loadMessageList(); // loadMessageList();
} }
startIMMonitoring(30000); startIMMonitoring(30000);