Compare commits

..

No commits in common. "24f201729b8a988ebeecb17d8e8aa51dd4aed222" and "9a251ddcb0d937b0104cf1de656169fcd1e5d382" have entirely different histories.

8 changed files with 1277 additions and 1303 deletions

View File

@ -1,34 +1,18 @@
<template> <template>
<view class="message-page"> <view class="message-page">
<!-- 头部组件 --> <!-- 头部组件 -->
<message-header <message-header v-model:activeTab="activeTab" @team-change="handleTeamChange" @add-patient="handleAddPatient" />
v-model:activeTab="activeTab"
@team-change="handleTeamChange"
@add-patient="handleAddPatient"
/>
<!-- 消息列表 --> <!-- 消息列表 -->
<scroll-view <scroll-view class="message-list" scroll-y="true" refresher-enabled :refresher-triggered="refreshing"
class="message-list" @refresherrefresh="handleRefresh" @scrolltolower="handleLoadMore">
scroll-y="true"
refresher-enabled
:refresher-triggered="refreshing"
@refresherrefresh="handleRefresh"
@scrolltolower="handleLoadMore"
>
<!-- 消息列表项 --> <!-- 消息列表项 -->
<view <view v-for="conversation in filteredConversationList"
v-for="conversation in filteredConversationList" :key="conversation.groupID || conversation.conversationID" class="message-item"
:key="conversation.groupID || conversation.conversationID" @click="handleClickConversation(conversation)">
class="message-item"
@click="handleClickConversation(conversation)"
>
<view class="avatar-container"> <view class="avatar-container">
<image <image class="avatar" :src="conversation.avatar || '/static/default-avatar.png'"
class="avatar" mode="aspectFill" />
:src="conversation.avatar || '/static/default-avatar.png'"
mode="aspectFill"
/>
<view v-if="conversation.unreadCount > 0" class="unread-badge"> <view v-if="conversation.unreadCount > 0" class="unread-badge">
<text class="unread-text">{{ <text class="unread-text">{{
conversation.unreadCount > 99 ? "99+" : conversation.unreadCount conversation.unreadCount > 99 ? "99+" : conversation.unreadCount
@ -40,10 +24,7 @@
<view class="header"> <view class="header">
<view class="name-info"> <view class="name-info">
<text class="name">{{ formatPatientName(conversation) }}</text> <text class="name">{{ formatPatientName(conversation) }}</text>
<text <text v-if="conversation.patientSex || conversation.patientAge" class="patient-info">
v-if="conversation.patientSex || conversation.patientAge"
class="patient-info"
>
{{ formatPatientInfo(conversation) }} {{ formatPatientInfo(conversation) }}
</text> </text>
</view> </view>
@ -60,10 +41,7 @@
</view> </view>
<!-- 空状态 --> <!-- 空状态 -->
<view <view v-if="!loading && filteredConversationList.length === 0" class="empty-container">
v-if="filteredConversationList.length === 0"
class="empty-container"
>
<image class="empty-image" src="/static/empty.svg" mode="aspectFit" /> <image class="empty-image" src="/static/empty.svg" mode="aspectFit" />
<text class="empty-text">{{ <text class="empty-text">{{
activeTab === "processing" ? "暂无处理中的会话" : "暂无已结束的会话" activeTab === "processing" ? "暂无处理中的会话" : "暂无已结束的会话"
@ -71,10 +49,7 @@
</view> </view>
<!-- 加载更多 --> <!-- 加载更多 -->
<view <view v-if="hasMore && filteredConversationList.length > 0" class="load-more">
v-if="hasMore && filteredConversationList.length > 0"
class="load-more"
>
<text class="load-more-text">{{ <text class="load-more-text">{{
loadingMore ? "加载中..." : "上拉加载更多" loadingMore ? "加载中..." : "上拉加载更多"
}}</text> }}</text>
@ -84,26 +59,49 @@
</template> </template>
<script setup> <script setup>
import { ref, computed } from "vue"; import {
import { onLoad, onShow, onHide } from "@dcloudio/uni-app"; ref,
import { storeToRefs } from "pinia"; computed
} from "vue";
import {
onLoad,
onShow,
onHide
} from "@dcloudio/uni-app";
import {
storeToRefs
} from "pinia";
import useAccountStore from "@/store/account.js"; import useAccountStore from "@/store/account.js";
import useTeamStore from "@/store/team.js"; import useTeamStore from "@/store/team.js";
import useInfoCheck from "@/hooks/useInfoCheck.js"; import useInfoCheck from "@/hooks/useInfoCheck.js";
import { globalTimChatManager } from "@/utils/tim-chat.js"; import {
import { mergeConversationWithGroupDetails } from "@/utils/conversation-merger.js"; globalTimChatManager
} from "@/utils/tim-chat.js";
import {
mergeConversationWithGroupDetails
} from "@/utils/conversation-merger.js";
import MessageHeader from "./components/message-header.vue"; import MessageHeader from "./components/message-header.vue";
// //
const { account, openid, isIMInitialized } = storeToRefs(useAccountStore()); const {
const { initIMAfterLogin } = useAccountStore(); account,
openid,
isIMInitialized
} = storeToRefs(useAccountStore());
const {
initIMAfterLogin
} = useAccountStore();
// //
const teamStore = useTeamStore(); const teamStore = useTeamStore();
const { getTeams } = teamStore; const {
getTeams
} = teamStore;
// //
const { withInfo } = useInfoCheck(); const {
withInfo
} = useInfoCheck();
// //
const currentTeamId = ref(""); // "" const currentTeamId = ref(""); // ""
@ -164,13 +162,14 @@ const initIM = async () => {
}); });
const success = await initIMAfterLogin(); const success = await initIMAfterLogin();
uni.hideLoading(); uni.hideLoading();
// if (!success) {
// uni.showToast({ if (!success) {
// title: "IM", uni.showToast({
// icon: "none", title: "IM连接失败请重试",
// }); icon: "none",
// return false; });
// } return false;
}
} else if (globalTimChatManager && !globalTimChatManager.isLoggedIn) { } else if (globalTimChatManager && !globalTimChatManager.isLoggedIn) {
uni.showLoading({ uni.showLoading({
title: "重连中...", title: "重连中...",
@ -192,8 +191,7 @@ const loadConversationList = async () => {
try { try {
console.log("开始加载群聊列表"); console.log("开始加载群聊列表");
if (!globalTimChatManager || !globalTimChatManager.getGroupList) { if (!globalTimChatManager || !globalTimChatManager.getGroupList) {
loading.value = false; throw new Error("IM管理器未初始化");
return;
} }
const result = await globalTimChatManager.getGroupList(); const result = await globalTimChatManager.getGroupList();
if (result && result.success && result.groupList) { if (result && result.success && result.groupList) {
@ -309,7 +307,8 @@ const setupConversationListener = () => {
const existing = conversationList.value[existingIndex]; const existing = conversationList.value[existingIndex];
if ( if (
existing.lastMessage !== conversationData.lastMessage || existing.lastMessage !== conversationData.lastMessage ||
existing.lastMessageTime !== conversationData.lastMessageTime || existing.lastMessageTime !== conversationData
.lastMessageTime ||
existing.unreadCount !== conversationData.unreadCount || existing.unreadCount !== conversationData.unreadCount ||
existing.patientName !== conversationData.patientName || existing.patientName !== conversationData.patientName ||
existing.patientSex !== conversationData.patientSex || existing.patientSex !== conversationData.patientSex ||

View File

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

View File

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

View File

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

View File

@ -1,33 +1,18 @@
<template> <template>
<view class="message-page"> <view class="message-page">
<!-- 头部组件 --> <!-- 头部组件 -->
<message-header <message-header v-model:activeTab="activeTab" @team-change="handleTeamChange" @add-patient="handleAddPatient" />
v-model:activeTab="activeTab"
@team-change="handleTeamChange"
@add-patient="handleAddPatient"
/>
<!-- 消息列表 --> <!-- 消息列表 -->
<scroll-view <scroll-view class="message-list" scroll-y="true" refresher-enabled :refresher-triggered="refreshing"
class="message-list" @refresherrefresh="handleRefresh" @scrolltolower="handleLoadMore">
scroll-y="true"
refresher-enabled
:refresher-triggered="refreshing"
@refresherrefresh="handleRefresh"
@scrolltolower="handleLoadMore"
>
<!-- 消息列表项 --> <!-- 消息列表项 -->
<view <view v-for="conversation in filteredConversationList"
v-for="conversation in filteredConversationList" :key="conversation.groupID || conversation.conversationID" class="message-item"
:key="conversation.groupID || conversation.conversationID" @click="handleClickConversation(conversation)">
class="message-item"
@click="handleClickConversation(conversation)"
>
<view class="avatar-container"> <view class="avatar-container">
<image <image class="avatar" :src="conversation.avatar || '/static/default-patient-avatar.png'"
class="avatar" mode="aspectFill" />
:src="conversation.avatar || '/static/default-patient-avatar.png'"
mode="aspectFill"
/>
<view v-if="conversation.unreadCount > 0" class="unread-badge"> <view v-if="conversation.unreadCount > 0" class="unread-badge">
<text class="unread-text">{{ <text class="unread-text">{{
conversation.unreadCount > 99 ? "99+" : conversation.unreadCount conversation.unreadCount > 99 ? "99+" : conversation.unreadCount
@ -39,10 +24,7 @@
<view class="header"> <view class="header">
<view class="name-info"> <view class="name-info">
<text class="name">{{ formatPatientName(conversation) }}</text> <text class="name">{{ formatPatientName(conversation) }}</text>
<text <text v-if="conversation.patientSex || conversation.patientAge" class="patient-info">
v-if="conversation.patientSex || conversation.patientAge"
class="patient-info"
>
{{ formatPatientInfo(conversation) }} {{ formatPatientInfo(conversation) }}
</text> </text>
</view> </view>
@ -59,20 +41,7 @@
</view> </view>
<!-- 空状态 --> <!-- 空状态 -->
<view <view v-if="!loading && filteredConversationList.length === 0" class="empty-container">
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" /> <image class="empty-image" src="/static/empty.svg" mode="aspectFit" />
<text class="empty-text">{{ <text class="empty-text">{{
activeTab === "processing" ? "暂无处理中的会话" : "暂无已结束的会话" activeTab === "processing" ? "暂无处理中的会话" : "暂无已结束的会话"
@ -80,10 +49,7 @@
</view> </view>
<!-- 加载更多 --> <!-- 加载更多 -->
<view <view v-if="hasMore && filteredConversationList.length > 0" class="load-more">
v-if="hasMore && filteredConversationList.length > 0"
class="load-more"
>
<text class="load-more-text">{{ <text class="load-more-text">{{
loadingMore ? "加载中..." : "上拉加载更多" loadingMore ? "加载中..." : "上拉加载更多"
}}</text> }}</text>
@ -93,26 +59,49 @@
</template> </template>
<script setup> <script setup>
import { ref, computed } from "vue"; import {
import { onLoad, onShow, onHide } from "@dcloudio/uni-app"; ref,
import { storeToRefs } from "pinia"; computed
} from "vue";
import {
onLoad,
onShow,
onHide
} from "@dcloudio/uni-app";
import {
storeToRefs
} from "pinia";
import useAccountStore from "@/store/account.js"; import useAccountStore from "@/store/account.js";
import useTeamStore from "@/store/team.js"; import useTeamStore from "@/store/team.js";
import useInfoCheck from "@/hooks/useInfoCheck.js"; import useInfoCheck from "@/hooks/useInfoCheck.js";
import { globalTimChatManager } from "@/utils/tim-chat.js"; import {
import { mergeConversationWithGroupDetails } from "@/utils/conversation-merger.js"; globalTimChatManager
} from "@/utils/tim-chat.js";
import {
mergeConversationWithGroupDetails
} from "@/utils/conversation-merger.js";
import MessageHeader from "../home/components/message-header.vue"; import MessageHeader from "../home/components/message-header.vue";
// //
const { account, openid, isIMInitialized } = storeToRefs(useAccountStore()); const {
const { initIMAfterLogin } = useAccountStore(); account,
openid,
isIMInitialized
} = storeToRefs(useAccountStore());
const {
initIMAfterLogin
} = useAccountStore();
// //
const teamStore = useTeamStore(); const teamStore = useTeamStore();
const { getTeams } = teamStore; const {
getTeams
} = teamStore;
// //
const { withInfo } = useInfoCheck(); const {
withInfo
} = useInfoCheck();
// //
const currentTeamId = ref(""); // "" const currentTeamId = ref(""); // ""
@ -178,8 +167,7 @@ const initIM = async () => {
// //
uni.showModal({ uni.showModal({
title: "IM连接失败", title: "IM连接失败",
content: content: "连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
"连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
confirmText: "重新登陆", confirmText: "重新登陆",
cancelText: "取消", cancelText: "取消",
success: (res) => { success: (res) => {
@ -187,7 +175,7 @@ const initIM = async () => {
// //
handleReloginIM(); handleReloginIM();
} }
}, }
}); });
return false; return false;
} }
@ -202,8 +190,7 @@ const initIM = async () => {
// //
uni.showModal({ uni.showModal({
title: "IM连接失败", title: "IM连接失败",
content: content: "连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
"连接失败请检查网络后重试。如果IM连接失败请重新登陆IM再连接",
confirmText: "重新登陆", confirmText: "重新登陆",
cancelText: "取消", cancelText: "取消",
success: (res) => { success: (res) => {
@ -211,7 +198,7 @@ const initIM = async () => {
// //
handleReloginIM(); handleReloginIM();
} }
}, }
}); });
return false; return false;
} }
@ -408,7 +395,8 @@ const setupConversationListener = () => {
const existing = conversationList.value[existingIndex]; const existing = conversationList.value[existingIndex];
if ( if (
existing.lastMessage !== conversationData.lastMessage || existing.lastMessage !== conversationData.lastMessage ||
existing.lastMessageTime !== conversationData.lastMessageTime || existing.lastMessageTime !== conversationData
.lastMessageTime ||
existing.unreadCount !== conversationData.unreadCount || existing.unreadCount !== conversationData.unreadCount ||
existing.patientName !== conversationData.patientName || existing.patientName !== conversationData.patientName ||
existing.patientSex !== conversationData.patientSex || existing.patientSex !== conversationData.patientSex ||

View File

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

View File

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

View File

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