|
|
@@ -10,27 +10,9 @@
|
|
|
</view>
|
|
|
<view class="doctor-info">
|
|
|
<text class="doctor-name">{{ doctorInfo.name }}</text>
|
|
|
- <text class="doctor-title" v-if="doctorInfo.title">{{ doctorInfo.title }}</text>
|
|
|
- <text class="doctor-hospital" v-if="doctorInfo.hospital">{{ doctorInfo.hospital }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class="doctor-details">
|
|
|
- <view class="detail-item">
|
|
|
- <text class="label">科室:</text>
|
|
|
- <text class="value">{{ doctorInfo.department || '未填写' }}</text>
|
|
|
- </view>
|
|
|
- <view class="detail-item">
|
|
|
- <text class="label">联系电话:</text>
|
|
|
- <text class="value">{{ doctorInfo.phone || '未填写' }}</text>
|
|
|
- </view>
|
|
|
- <view class="detail-item">
|
|
|
- <text class="label">擅长领域:</text>
|
|
|
- <text class="value">{{ doctorInfo.specialty || '未填写' }}</text>
|
|
|
- </view>
|
|
|
- <view class="detail-item">
|
|
|
- <text class="label">简介:</text>
|
|
|
- <text class="value intro">{{ doctorInfo.introduction || '暂无介绍' }}</text>
|
|
|
+ <!-- 根据当前API返回数据,只显示姓名和电话 -->
|
|
|
+ <text class="doctor-phone" v-if="doctorInfo.phone">联系电话: {{ doctorInfo.phone }}</text>
|
|
|
+ <text class="doctor-phone" v-else>联系电话: 未提供</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -54,18 +36,12 @@ import { onLoad } from '@dcloudio/uni-app'
|
|
|
import CustomNav from '@/components/custom-nav.vue'
|
|
|
import { listUserBindingsByPatient, type UserBindingResponse, type UserBindingPageResponse } from '@/api/userBinding'
|
|
|
import { downloadAvatar } from '@/api/user'
|
|
|
-import { getUserInfo } from '@/api/user'
|
|
|
|
|
|
-// 为避免与导入的类型冲突,重命名本地接口
|
|
|
+// 简化医生信息接口,只包含API实际返回的字段
|
|
|
interface LocalDoctorInfo {
|
|
|
id: string
|
|
|
name: string
|
|
|
- title?: string
|
|
|
- hospital?: string
|
|
|
- department?: string
|
|
|
phone?: string
|
|
|
- specialty?: string
|
|
|
- introduction?: string
|
|
|
avatar?: string
|
|
|
}
|
|
|
|
|
|
@@ -143,76 +119,26 @@ const fetchDoctorInfo = async () => {
|
|
|
pageData.value.pages = pageResult.pages
|
|
|
|
|
|
// 如果有绑定的医生,获取第一个医生的详细信息
|
|
|
- // 这里需要另一个接口获取医生详细信息,暂时使用模拟数据
|
|
|
if (pageResult.records && pageResult.records.length > 0) {
|
|
|
const boundDoctor = pageResult.records[0]
|
|
|
|
|
|
- // 通过用户接口获取医生详细信息
|
|
|
+ // 直接使用绑定接口返回的信息,不再调用额外的用户详情接口
|
|
|
+ doctorInfo.value = {
|
|
|
+ id: boundDoctor.id,
|
|
|
+ name: boundDoctor.boundUserNickname || '未知医生',
|
|
|
+ phone: boundDoctor.boundUserPhone || '未提供', // 当电话为null时显示"未提供"
|
|
|
+ }
|
|
|
+
|
|
|
+ // 尝试下载头像(绑定接口返回的数据中可能没有 avatar)
|
|
|
try {
|
|
|
- // 将 ID 作为字符串传入以保证 Snowflake ID 的精度(前端全程文本存储)
|
|
|
- const userInfoResponse = await getUserInfo(String(boundDoctor.boundUserId))
|
|
|
- const userInfo = userInfoResponse.data?.data
|
|
|
-
|
|
|
- if (userInfo) {
|
|
|
- doctorInfo.value = {
|
|
|
- id: boundDoctor.id,
|
|
|
- name: userInfo.nickname || boundDoctor.boundUserNickname || '未知医生',
|
|
|
- title: userInfo.title || '医生',
|
|
|
- hospital: userInfo.hospital || '未知医院',
|
|
|
- department: userInfo.department || '未知科室',
|
|
|
- phone: boundDoctor.boundUserPhone || userInfo.phone || '未提供',
|
|
|
- specialty: userInfo.specialty || '未知',
|
|
|
- introduction: userInfo.introduction || '暂无介绍',
|
|
|
- avatar: userInfo.avatar
|
|
|
- }
|
|
|
- // 尝试从后端下载用户头像(如果后端未返回 avatar 或想替换为下载后的临时路径)
|
|
|
- try {
|
|
|
- if (boundDoctor.boundUserId) {
|
|
|
- const dlRes: any = await downloadAvatar(String(boundDoctor.boundUserId))
|
|
|
- if (dlRes && dlRes.statusCode === 200 && dlRes.tempFilePath) {
|
|
|
- downloadedAvatar.value = dlRes.tempFilePath
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (err) {
|
|
|
- console.warn('下载医生头像失败:', err)
|
|
|
+ if (boundDoctor.boundUserId) {
|
|
|
+ const dlRes: any = await downloadAvatar(String(boundDoctor.boundUserId))
|
|
|
+ if (dlRes && dlRes.statusCode === 200 && dlRes.tempFilePath) {
|
|
|
+ downloadedAvatar.value = dlRes.tempFilePath
|
|
|
}
|
|
|
- } else {
|
|
|
- // 如果获取详细信息失败,使用绑定接口返回的基础信息
|
|
|
- doctorInfo.value = {
|
|
|
- id: boundDoctor.id,
|
|
|
- name: boundDoctor.boundUserNickname || '未知医生',
|
|
|
- title: '医生',
|
|
|
- hospital: '未知医院',
|
|
|
- department: '未知科室',
|
|
|
- phone: boundDoctor.boundUserPhone || '未提供',
|
|
|
- specialty: '未知',
|
|
|
- introduction: '暂无介绍'
|
|
|
- }
|
|
|
- // 尝试下载头像(绑定接口返回的数据中可能没有 avatar)
|
|
|
- try {
|
|
|
- if (boundDoctor.boundUserId) {
|
|
|
- const dlRes: any = await downloadAvatar(String(boundDoctor.boundUserId))
|
|
|
- if (dlRes && dlRes.statusCode === 200 && dlRes.tempFilePath) {
|
|
|
- downloadedAvatar.value = dlRes.tempFilePath
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (err) {
|
|
|
- console.warn('下载医生头像失败:', err)
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('获取医生详细信息失败:', error)
|
|
|
- // 使用绑定接口返回的基础信息
|
|
|
- doctorInfo.value = {
|
|
|
- id: boundDoctor.id,
|
|
|
- name: boundDoctor.boundUserNickname || '未知医生',
|
|
|
- title: '医生',
|
|
|
- hospital: '未知医院',
|
|
|
- department: '未知科室',
|
|
|
- phone: boundDoctor.boundUserPhone || '未提供',
|
|
|
- specialty: '未知',
|
|
|
- introduction: '暂无介绍'
|
|
|
}
|
|
|
+ } catch (err) {
|
|
|
+ console.warn('下载医生头像失败:', err)
|
|
|
}
|
|
|
} else {
|
|
|
doctorInfo.value = null
|
|
|
@@ -313,47 +239,11 @@ onLoad(() => {
|
|
|
margin-bottom: 10rpx;
|
|
|
}
|
|
|
|
|
|
-.doctor-title {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #666;
|
|
|
- margin-bottom: 10rpx;
|
|
|
-}
|
|
|
-
|
|
|
-.doctor-hospital {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #666;
|
|
|
-}
|
|
|
-
|
|
|
-.doctor-details {
|
|
|
- padding: 30rpx 40rpx;
|
|
|
-}
|
|
|
-
|
|
|
-.detail-item {
|
|
|
- display: flex;
|
|
|
- margin-bottom: 20rpx;
|
|
|
-}
|
|
|
-
|
|
|
-.detail-item:last-child {
|
|
|
- margin-bottom: 0;
|
|
|
-}
|
|
|
-
|
|
|
-.label {
|
|
|
- width: 160rpx;
|
|
|
+.doctor-phone {
|
|
|
font-size: 28rpx;
|
|
|
color: #666;
|
|
|
}
|
|
|
|
|
|
-.value {
|
|
|
- flex: 1;
|
|
|
- font-size: 28rpx;
|
|
|
- color: #333;
|
|
|
- line-height: 1.5;
|
|
|
-}
|
|
|
-
|
|
|
-.value.intro {
|
|
|
- white-space: pre-wrap;
|
|
|
-}
|
|
|
-
|
|
|
.action-buttons {
|
|
|
display: flex;
|
|
|
padding: 30rpx 40rpx;
|