Merge remote-tracking branch 'origin/dev-wdb' into dev-hjf
This commit is contained in:
commit
7bc3e9e4c8
@ -1,28 +1,28 @@
|
|||||||
{
|
{
|
||||||
"name" : "ykt-wxapp",
|
"name": "ykt-team-wxapp",
|
||||||
"appid" : "__UNI__06F5B0E",
|
"appid": "__UNI__3EBDA15",
|
||||||
"description" : "",
|
"description": "",
|
||||||
"versionName" : "1.0.0",
|
"versionName": "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode": "100",
|
||||||
"transformPx" : false,
|
"transformPx": false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus": {
|
||||||
"usingComponents" : true,
|
"usingComponents": true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler": "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion": 3,
|
||||||
"splashscreen" : {
|
"splashscreen": {
|
||||||
"alwaysShowBeforeRender" : true,
|
"alwaysShowBeforeRender": true,
|
||||||
"waiting" : true,
|
"waiting": true,
|
||||||
"autoclose" : true,
|
"autoclose": true,
|
||||||
"delay" : 0
|
"delay": 0
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {},
|
"modules": {},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute": {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
"android" : {
|
"android": {
|
||||||
"permissions" : [
|
"permissions": [
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
@ -41,32 +41,32 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {},
|
"ios": {},
|
||||||
/* SDK配置 */
|
/* SDK配置 */
|
||||||
"sdkConfigs" : {}
|
"sdkConfigs": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
"quickapp" : {},
|
"quickapp": {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin": {
|
||||||
"appid" : "wx93af55767423938e",
|
"appid": "wx93af55767423938e",
|
||||||
"setting" : {
|
"setting": {
|
||||||
"urlCheck" : false
|
"urlCheck": false
|
||||||
},
|
},
|
||||||
"usingComponents" : true
|
"usingComponents": true
|
||||||
},
|
},
|
||||||
"mp-alipay" : {
|
"mp-alipay": {
|
||||||
"usingComponents" : true
|
"usingComponents": true
|
||||||
},
|
},
|
||||||
"mp-baidu" : {
|
"mp-baidu": {
|
||||||
"usingComponents" : true
|
"usingComponents": true
|
||||||
},
|
},
|
||||||
"mp-toutiao" : {
|
"mp-toutiao": {
|
||||||
"usingComponents" : true
|
"usingComponents": true
|
||||||
},
|
},
|
||||||
"uniStatistics" : {
|
"uniStatistics": {
|
||||||
"enable" : false
|
"enable": false
|
||||||
},
|
},
|
||||||
"vueVersion" : "3"
|
"vueVersion": "3"
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "ykt-wxapp",
|
"name": "医客通患者端",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
|
|||||||
1
pages/home/avatar.svg
Normal file
1
pages/home/avatar.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 5.4 KiB |
@ -16,6 +16,101 @@ $primary-color: #0877F1;
|
|||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 患者信息栏样式 */
|
||||||
|
.patient-info-bar {
|
||||||
|
position: relative;
|
||||||
|
background: #fff;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
padding: 20rpx 32rpx;
|
||||||
|
z-index: 10;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patient-info-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patient-basic-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16rpx;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patient-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patient-detail {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4rpx;
|
||||||
|
padding: 8rpx 16rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-pending {
|
||||||
|
background: #fff3cd;
|
||||||
|
|
||||||
|
.badge-text {
|
||||||
|
color: #856404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-processing {
|
||||||
|
background: #d1ecf1;
|
||||||
|
|
||||||
|
.badge-text {
|
||||||
|
color: #0c5460;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-finished {
|
||||||
|
background: #d4edda;
|
||||||
|
|
||||||
|
.badge-text {
|
||||||
|
color: #155724;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-cancelled {
|
||||||
|
background: #f8d7da;
|
||||||
|
|
||||||
|
.badge-text {
|
||||||
|
color: #721c24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-rejected {
|
||||||
|
background: #f8d7da;
|
||||||
|
|
||||||
|
.badge-text {
|
||||||
|
color: #721c24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.chat-content {
|
.chat-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -348,7 +443,7 @@ $primary-color: #0877F1;
|
|||||||
.text-input,
|
.text-input,
|
||||||
.voice-input-btn {
|
.voice-input-btn {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 16rpx 46rpx;
|
padding: 26rpx 46rpx;
|
||||||
background-color: #f3f5fa;
|
background-color: #f3f5fa;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
margin: 0 16rpx;
|
margin: 0 16rpx;
|
||||||
@ -931,7 +1026,7 @@ $primary-color: #0877F1;
|
|||||||
.text-input::-moz-placeholder,
|
.text-input::-moz-placeholder,
|
||||||
.text-input:-ms-input-placeholder,
|
.text-input:-ms-input-placeholder,
|
||||||
.text-input::placeholder {
|
.text-input::placeholder {
|
||||||
line-height: normal;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.voice-input-btn::-webkit-input-placeholder,
|
.voice-input-btn::-webkit-input-placeholder,
|
||||||
|
|||||||
@ -1,13 +1,18 @@
|
|||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { onShow, onUnload } from '@dcloudio/uni-app'
|
import { onShow, onUnload } from '@dcloudio/uni-app'
|
||||||
|
import api from '@/utils/api.js'
|
||||||
|
import useTeamStore from '@/store/team.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简单的群聊hook
|
* 群聊hook - 管理群聊成员和头像
|
||||||
* @param {string} groupID 群组ID
|
* @param {string} groupID 群组ID
|
||||||
*/
|
*/
|
||||||
export default function useGroupChat(groupID) {
|
export default function useGroupChat(groupID) {
|
||||||
const groupInfo = ref({})
|
const groupInfo = ref({})
|
||||||
const members = ref([])
|
const members = ref([])
|
||||||
|
const teamMemberIds = ref([]) // 存储团队成员的userId列表
|
||||||
|
const patientId = ref('') // 存储患者ID
|
||||||
|
const teamStore = useTeamStore()
|
||||||
|
|
||||||
// 群聊成员映射
|
// 群聊成员映射
|
||||||
const chatMember = computed(() => {
|
const chatMember = computed(() => {
|
||||||
@ -15,30 +20,92 @@ export default function useGroupChat(groupID) {
|
|||||||
members.value.forEach(member => {
|
members.value.forEach(member => {
|
||||||
res[member.id] = {
|
res[member.id] = {
|
||||||
name: member.name,
|
name: member.name,
|
||||||
avatar: member.avatar || '/static/default-avatar.png'
|
avatar: member.avatar,
|
||||||
|
isTeamMember: member.isTeamMember // 标记是否为团队成员
|
||||||
|
}
|
||||||
|
// 如果成员有 miniAppId(患者的聊天 userID),也添加一个映射(用于消息的 from 字段)
|
||||||
|
if (member.miniAppId) {
|
||||||
|
res[member.miniAppId] = {
|
||||||
|
name: member.name,
|
||||||
|
avatar: member.avatar,
|
||||||
|
isTeamMember: member.isTeamMember
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取群聊信息
|
// 判断某个userId是否为团队成员
|
||||||
|
const isTeamMember = (userId) => {
|
||||||
|
return teamMemberIds.value.includes(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户头像(根据是否为团队成员返回不同的默认头像)
|
||||||
|
const getUserAvatar = (userId) => {
|
||||||
|
const member = chatMember.value[userId]
|
||||||
|
if (!member) {
|
||||||
|
// 如果找不到成员信息,根据是否为团队成员返回默认头像
|
||||||
|
// 团队成员和患者都使用 default-avatar.png
|
||||||
|
return '/static/default-avatar.png'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果有头像且不为空字符串,返回头像
|
||||||
|
if (member.avatar && member.avatar.trim() !== '') {
|
||||||
|
return member.avatar
|
||||||
|
}
|
||||||
|
|
||||||
|
// 否则使用默认头像
|
||||||
|
return '/static/default-avatar.png'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取群聊信息和成员头像
|
||||||
async function getGroupInfo() {
|
async function getGroupInfo() {
|
||||||
const gid = typeof groupID === 'string' ? groupID : groupID.value
|
const gid = typeof groupID === 'string' ? groupID : groupID.value
|
||||||
if (!gid) return
|
if (!gid) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 这里可以调用API获取群聊信息
|
// 1. 获取群聊基本信息
|
||||||
// const res = await getGroupDetail(gid)
|
const groupResult = await api('getGroupListByGroupId', { groupId: gid })
|
||||||
// if (res && res.success) {
|
|
||||||
// groupInfo.value = res.data
|
|
||||||
// members.value = res.data.members || []
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 暂时使用本地数据
|
if (groupResult && groupResult.success && groupResult.data) {
|
||||||
groupInfo.value = {
|
groupInfo.value = {
|
||||||
groupID: gid,
|
groupID: gid,
|
||||||
name: '群聊',
|
name: groupResult.data.team?.name || '群聊',
|
||||||
status: 'active'
|
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] || {}
|
||||||
|
return {
|
||||||
|
id: userId,
|
||||||
|
name: memberInfo.name || userId, // 使用返回的 name,如果没有则用 userId
|
||||||
|
avatar: memberInfo.avatar || '', // 使用返回的 avatar
|
||||||
|
isTeamMember: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 5. 添加患者信息(使用默认患者头像)
|
||||||
|
if (groupResult.data.patient) {
|
||||||
|
const pid = groupResult.data.patientId?.toString() || ''
|
||||||
|
patientId.value = pid
|
||||||
|
members.value.push({
|
||||||
|
id: pid,
|
||||||
|
name: groupResult.data.patient.name || '患者',
|
||||||
|
avatar: '', // 患者不设置头像,使用默认
|
||||||
|
isTeamMember: false,
|
||||||
|
miniAppId: groupResult.data.patient.miniAppId || '' // 患者的聊天 userID
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取群聊信息失败:', error)
|
console.error('获取群聊信息失败:', error)
|
||||||
@ -57,6 +124,8 @@ export default function useGroupChat(groupID) {
|
|||||||
groupInfo,
|
groupInfo,
|
||||||
members,
|
members,
|
||||||
chatMember,
|
chatMember,
|
||||||
getGroupInfo
|
getGroupInfo,
|
||||||
|
isTeamMember,
|
||||||
|
getUserAvatar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="chat-page">
|
<view class="chat-page">
|
||||||
|
<!-- 患者信息栏 -->
|
||||||
|
<view class="patient-info-bar" v-if="patientInfo.name">
|
||||||
|
<view class="patient-info-content">
|
||||||
|
<view class="patient-basic-info">
|
||||||
|
<text class="patient-name">{{ patientInfo.name }}</text>
|
||||||
|
<text class="patient-detail"
|
||||||
|
>{{ patientInfo.sex }} · {{ patientInfo.age }}岁</text
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
<view class="status-badge" :class="chatStatusInfo.badgeClass" v-if="chatStatusInfo.badgeText">
|
||||||
|
<text class="badge-text">{{ chatStatusInfo.badgeText }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 聊天消息区域 -->
|
<!-- 聊天消息区域 -->
|
||||||
<scroll-view
|
<scroll-view
|
||||||
class="chat-content"
|
class="chat-content"
|
||||||
@ -50,23 +65,19 @@
|
|||||||
|
|
||||||
<!-- 消息内容 -->
|
<!-- 消息内容 -->
|
||||||
<view v-else class="message-content">
|
<view v-else class="message-content">
|
||||||
<!-- 医生头像(左侧) -->
|
<!-- 发送者头像(统一处理) -->
|
||||||
<image
|
<image
|
||||||
v-if="message.flow === 'in'"
|
v-if="message.flow === 'in'"
|
||||||
class="doctor-msg-avatar"
|
class="doctor-msg-avatar"
|
||||||
:src="
|
:src="getUserAvatar(message.from)"
|
||||||
chatMember[message.from]?.avatar || '/static/default-avatar.png'
|
|
||||||
"
|
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 患者头像(右侧) -->
|
<!-- 发送者头像(统一处理) -->
|
||||||
<image
|
<image
|
||||||
v-if="message.flow === 'out'"
|
v-if="message.flow === 'out'"
|
||||||
class="user-msg-avatar"
|
class="user-msg-avatar"
|
||||||
:src="
|
:src="getUserAvatar(message.from)"
|
||||||
chatMember[message.from]?.avatar || '/static/home/avatar.svg'
|
|
||||||
"
|
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -180,12 +191,12 @@ const { initIMAfterLogin } = useAccountStore();
|
|||||||
const chatInputRef = ref(null);
|
const chatInputRef = ref(null);
|
||||||
|
|
||||||
const groupId = ref("");
|
const groupId = ref("");
|
||||||
const { chatMember, getGroupInfo } = useGroupChat(groupId);
|
const { chatMember, getGroupInfo, getUserAvatar } = useGroupChat(groupId);
|
||||||
|
|
||||||
// 动态设置导航栏标题
|
// 动态设置导航栏标题
|
||||||
const updateNavigationTitle = () => {
|
const updateNavigationTitle = (title = "群聊") => {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: "群聊",
|
title: title,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -202,6 +213,26 @@ const isEvaluationPopupOpen = ref(false);
|
|||||||
// 订单状态
|
// 订单状态
|
||||||
const orderStatus = ref("");
|
const orderStatus = ref("");
|
||||||
|
|
||||||
|
// 患者信息
|
||||||
|
const patientInfo = ref({
|
||||||
|
name: "",
|
||||||
|
sex: "",
|
||||||
|
age: "",
|
||||||
|
mobile: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
// 患者ID
|
||||||
|
const patientId = ref("");
|
||||||
|
|
||||||
|
// 聊天状态信息
|
||||||
|
const chatStatusInfo = ref({
|
||||||
|
show: false,
|
||||||
|
title: "",
|
||||||
|
detail: "",
|
||||||
|
badgeText: "",
|
||||||
|
badgeClass: "",
|
||||||
|
});
|
||||||
|
|
||||||
// 计算弹框显示状态
|
// 计算弹框显示状态
|
||||||
const showConsultCancel = computed(() => orderStatus.value === "pending");
|
const showConsultCancel = computed(() => orderStatus.value === "pending");
|
||||||
const showConsultApply = computed(
|
const showConsultApply = computed(
|
||||||
@ -258,9 +289,33 @@ const fetchGroupOrderStatus = async () => {
|
|||||||
if (result.success && result.data) {
|
if (result.success && result.data) {
|
||||||
orderStatus.value = result.data.orderStatus || "";
|
orderStatus.value = result.data.orderStatus || "";
|
||||||
corpId.value = result.data.corpId || "";
|
corpId.value = result.data.corpId || "";
|
||||||
|
|
||||||
|
// 更新导航栏标题为团队名称
|
||||||
|
const teamName = result.data.team?.name || "群聊";
|
||||||
|
updateNavigationTitle(teamName);
|
||||||
|
|
||||||
|
// 更新患者信息
|
||||||
|
if (result.data.patient) {
|
||||||
|
patientInfo.value = {
|
||||||
|
name: result.data.patient.name || "",
|
||||||
|
sex: result.data.patient.sex || "",
|
||||||
|
age: result.data.patient.age || "",
|
||||||
|
mobile: result.data.patient.mobile || "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// 更新患者ID
|
||||||
|
if (result.data.patientId) {
|
||||||
|
patientId.value = result.data.patientId.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新聊天状态栏信息
|
||||||
|
updateChatStatusInfo(result.data);
|
||||||
|
|
||||||
console.log("获取群组订单状态:", {
|
console.log("获取群组订单状态:", {
|
||||||
orderStatus: orderStatus.value,
|
orderStatus: orderStatus.value,
|
||||||
corpId: corpId.value,
|
corpId: corpId.value,
|
||||||
|
teamName: teamName,
|
||||||
|
patientInfo: patientInfo.value,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error("获取群组订单状态失败:", result.message);
|
console.error("获取群组订单状态失败:", result.message);
|
||||||
@ -270,7 +325,72 @@ const fetchGroupOrderStatus = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理接收到的系统消息
|
// 更新聊天状态栏信息
|
||||||
|
const updateChatStatusInfo = (groupData) => {
|
||||||
|
const status = groupData.orderStatus || "";
|
||||||
|
|
||||||
|
let statusConfig = {
|
||||||
|
show: false,
|
||||||
|
title: "",
|
||||||
|
detail: "",
|
||||||
|
badgeText: "",
|
||||||
|
badgeClass: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case "pending":
|
||||||
|
statusConfig = {
|
||||||
|
show: true,
|
||||||
|
title: "等待医生接受",
|
||||||
|
detail: "您的咨询申请已提交",
|
||||||
|
badgeText: "待处理",
|
||||||
|
badgeClass: "badge-pending",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case "processing":
|
||||||
|
statusConfig = {
|
||||||
|
show: true,
|
||||||
|
title: "咨询进行中",
|
||||||
|
detail: "医生正在为您服务",
|
||||||
|
badgeText: "进行中",
|
||||||
|
badgeClass: "badge-processing",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case "finished":
|
||||||
|
statusConfig = {
|
||||||
|
show: true,
|
||||||
|
title: "咨询已完成",
|
||||||
|
detail: "感谢您的咨询",
|
||||||
|
badgeText: "已完成",
|
||||||
|
badgeClass: "badge-finished",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case "cancelled":
|
||||||
|
statusConfig = {
|
||||||
|
show: true,
|
||||||
|
title: "咨询已取消",
|
||||||
|
detail: "您已取消此次咨询",
|
||||||
|
badgeText: "已取消",
|
||||||
|
badgeClass: "badge-cancelled",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case "rejected":
|
||||||
|
statusConfig = {
|
||||||
|
show: true,
|
||||||
|
title: "咨询已拒绝",
|
||||||
|
detail: "医生已拒绝您的咨询申请",
|
||||||
|
badgeText: "已拒绝",
|
||||||
|
badgeClass: "badge-rejected",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
statusConfig.show = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
chatStatusInfo.value = statusConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理系统消息接收
|
||||||
function handleSystemMessageReceived(message) {
|
function handleSystemMessageReceived(message) {
|
||||||
try {
|
try {
|
||||||
if (!message.payload?.data) return;
|
if (!message.payload?.data) return;
|
||||||
@ -696,7 +816,7 @@ const handleScrollToUpper = async () => {
|
|||||||
onShow(() => {
|
onShow(() => {
|
||||||
if (!account.value || !openid.value) {
|
if (!account.value || !openid.value) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pages-center/login/login",
|
url: "/pages/login/login",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
55
store/team.js
Normal file
55
store/team.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { defineStore, storeToRefs } from "pinia";
|
||||||
|
import api from '@/utils/api';
|
||||||
|
import { toast } from '@/utils/widget';
|
||||||
|
import useAccountStore from "./account";
|
||||||
|
|
||||||
|
|
||||||
|
export default defineStore("teamStore", () => {
|
||||||
|
const { account, doctorInfo } = storeToRefs(useAccountStore());
|
||||||
|
const teams = ref([]);
|
||||||
|
|
||||||
|
const chargeTeams = computed(() => {
|
||||||
|
const userid = doctorInfo.value?.userid;
|
||||||
|
return teams.value.filter(team => {
|
||||||
|
const memberLeaderList = Array.isArray(team.memberLeaderList) ? team.memberLeaderList : [];
|
||||||
|
return memberLeaderList.includes(userid);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
async function getTeam(teamId) {
|
||||||
|
if (!teamId || !account.value?.corpId) return;
|
||||||
|
const res = await api('getTeamData', { teamId, corpId: account.value.corpId });
|
||||||
|
if (res && res.data) {
|
||||||
|
return res.data;
|
||||||
|
} else {
|
||||||
|
toast(res?.message || '获取团队信息失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function getTeams() {
|
||||||
|
const corpId = account.value?.corpId;
|
||||||
|
const mateId = doctorInfo.value?.userid;
|
||||||
|
if (!corpId || !mateId) return;
|
||||||
|
const res = await api('getJoinedTeams', { corpId, mateId });
|
||||||
|
teams.value = res && Array.isArray(res.data) ? res.data : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取团队成员头像和名称映射
|
||||||
|
async function getTeamMemberAvatarsAndName(teamId) {
|
||||||
|
if (!teamId || !account.value?.corpId) return {};
|
||||||
|
const res = await api('getTeamMemberAvatarsAndName', {
|
||||||
|
teamId,
|
||||||
|
corpId: account.value.corpId
|
||||||
|
});
|
||||||
|
if (res && res.success && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return { teams, chargeTeams, getTeam, getTeams, getTeamMemberAvatarsAndName }
|
||||||
|
})
|
||||||
@ -9,7 +9,8 @@ const urlsConfig = {
|
|||||||
wxAppLogin: 'wxAppLogin',
|
wxAppLogin: 'wxAppLogin',
|
||||||
getTeamHealthTemplate: 'getTeamHealthTemplate',
|
getTeamHealthTemplate: 'getTeamHealthTemplate',
|
||||||
getTeamHealthTemps: "getTeamHealthTemps",
|
getTeamHealthTemps: "getTeamHealthTemps",
|
||||||
getCorpMemberJob: "getCorpMemberJob"
|
getCorpMemberJob: "getCorpMemberJob",
|
||||||
|
getTeamMemberAvatarsAndName: "getTeamMemberAvatarsAndName"
|
||||||
},
|
},
|
||||||
|
|
||||||
knowledgeBase: {
|
knowledgeBase: {
|
||||||
|
|||||||
@ -926,7 +926,7 @@ class TimChatManager {
|
|||||||
uni.removeStorageSync('account')
|
uni.removeStorageSync('account')
|
||||||
uni.removeStorageSync('openid')
|
uni.removeStorageSync('openid')
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages-center/login/login'
|
url: '/pages/login/login'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -50,4 +50,89 @@ export async function confirm(content, opt = {}) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存图片到相册
|
||||||
|
export async function saveImageToPhotosAlbum(filePath) {
|
||||||
|
try {
|
||||||
|
// 检查授权
|
||||||
|
const authRes = await uni.getSetting()
|
||||||
|
if (!authRes[1].authSetting['scope.writePhotosAlbum']) {
|
||||||
|
// 请求授权
|
||||||
|
try {
|
||||||
|
await uni.authorize({ scope: 'scope.writePhotosAlbum' })
|
||||||
|
} catch (err) {
|
||||||
|
// 用户拒绝授权,引导去设置
|
||||||
|
const [modalErr, modalRes] = await uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '需要您授权保存相册',
|
||||||
|
confirmText: '去设置',
|
||||||
|
cancelText: '取消'
|
||||||
|
})
|
||||||
|
|
||||||
|
if (modalRes && modalRes.confirm) {
|
||||||
|
await uni.openSetting()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存图片
|
||||||
|
await uni.saveImageToPhotosAlbum({ filePath })
|
||||||
|
await toast('保存成功')
|
||||||
|
} catch (err) {
|
||||||
|
console.error('保存图片失败:', err)
|
||||||
|
await toast('保存失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享到微信
|
||||||
|
export function shareToWeChat(options = {}) {
|
||||||
|
const { title = '', path = '', imageUrl = '' } = options
|
||||||
|
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
path,
|
||||||
|
imageUrl,
|
||||||
|
success: () => {
|
||||||
|
toast('分享成功')
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('分享失败:', err)
|
||||||
|
toast('分享失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享第三方小程序给微信好友
|
||||||
|
export function shareThirdPartyMiniProgram(options = {}) {
|
||||||
|
const {
|
||||||
|
title = '',
|
||||||
|
appId = '',
|
||||||
|
path = '',
|
||||||
|
imageUrl = '',
|
||||||
|
webUrl = '',
|
||||||
|
miniProgramType = 0
|
||||||
|
} = options
|
||||||
|
|
||||||
|
if (!appId) {
|
||||||
|
console.error('分享第三方小程序需要提供 appId')
|
||||||
|
toast('分享配置错误')
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
path,
|
||||||
|
imageUrl,
|
||||||
|
miniProgramType, // 0-正式版 1-开发版 2-体验版
|
||||||
|
webpageUrl: webUrl, // 兼容低版本的网页链接
|
||||||
|
success: () => {
|
||||||
|
toast('分享成功')
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('分享失败:', err)
|
||||||
|
toast('分享失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user