diff --git a/subPackages/chat/chat.vue b/subPackages/chat/chat.vue index f73956e..36808dd 100644 --- a/subPackages/chat/chat.vue +++ b/subPackages/chat/chat.vue @@ -22,15 +22,15 @@ 职称 - 主任医师 + {{ doctorDetailInfo.title || '--' }} 医院 - 北京协和医院 + {{ doctorDetailInfo.hospital || '--' }} 擅长 - 冠心病、高血压、心力衰竭、心律失常的诊断与药物治疗 + {{ doctorDetailInfo.good_at || '--' }} @@ -185,6 +185,7 @@ export default { data() { return { doctorUserInfo: { id: 0, avatar: '', nick_name: '医生', room_id: '' }, + doctorDetailInfo: { title: '', hospital: '', good_at: '' }, // 医生详情信息 showDoctorDetail: false, currentUserId: '', doctorId: 'doctor-1', @@ -236,10 +237,11 @@ export default { if (option.room_id) this.fetchRoomStatus(option.room_id); + // 无论是否有nickName,都需要获取医生详情信息(职称、医院、擅长) + this.fetchDoctorInfo(doctorId); + const nickName = this.doctorUserInfo.nick_name; - if (!nickName || nickName === 'undefined' || nickName === 'null') { - this.fetchDoctorInfo(doctorId); - } else { + if (nickName && nickName !== 'undefined' && nickName !== 'null') { uni.setNavigationBarTitle({ title: `与${nickName}医生的对话` }); } @@ -365,6 +367,12 @@ export default { nick_name: doctorInfo.nick_name || '医生', avatar: doctorInfo.avatar || this.doctorAvatar, }; + // 保存完整的医生详情信息 + this.doctorDetailInfo = { + title: doctorInfo.title || '', + hospital: doctorInfo.hospital || '', + good_at: doctorInfo.good_at || '' + }; if (doctorInfo.avatar) this.doctorAvatar = doctorInfo.avatar; uni.setNavigationBarTitle({ title: `与${this.doctorUserInfo.nick_name}医生的对话` }); }