|
|
@@ -136,8 +136,13 @@
|
|
|
</view>
|
|
|
<view class="patient-content">
|
|
|
<view class="userIcon">
|
|
|
- <image v-if="item.patImage" :src="getFullImageUrl(item.patImage)" class="patImage"></image>
|
|
|
- <text v-else class="patImageFallback">{{ getAvatarText(item.patName) }}</text>
|
|
|
+ <image
|
|
|
+ v-if="item.patImage && !patientImageError[getPatientKey(item, index)]"
|
|
|
+ :src="getFullImageUrl(item.patImage)"
|
|
|
+ class="patImage"
|
|
|
+ @error="onPatientImageError(item, index)"
|
|
|
+ ></image>
|
|
|
+ <image v-else :src="getDefaultPatientAvatar(item)" class="patImage patImageFallback"></image>
|
|
|
</view>
|
|
|
<view class="info-col">
|
|
|
<view class="info-row">
|
|
|
@@ -168,12 +173,6 @@
|
|
|
<text class="buttonDesc">咨询记录</text>
|
|
|
</button>
|
|
|
</view>
|
|
|
- <view class="startview" v-if="item.statusCode == 'R'">
|
|
|
- <button data-btncode="R" :data-index="index" class="button refuseButton1" @tap.stop.prevent="lookPatient">
|
|
|
- <text class="buttonDesc">拒绝接诊</text>
|
|
|
- </button>
|
|
|
- </view>
|
|
|
-
|
|
|
<view class="startview" v-if="item.statusCode == 'A'">
|
|
|
<button :disabled="btnState" data-btncode="AR" :data-index="index" class="button refuseButton1" @tap.stop.prevent="lookPatient">
|
|
|
<text class="buttonDesc" style="color: red">取消接诊</text>
|
|
|
@@ -260,6 +259,8 @@ export default {
|
|
|
statusCode: 'R',
|
|
|
showSearch: false,
|
|
|
patName: '',
|
|
|
+ // 以就诊/患者 ID 记录头像加载失败状态,避免失败后仍显示空白圆形。
|
|
|
+ patientImageError: {},
|
|
|
patientData: Cache.get('patientData'),
|
|
|
|
|
|
queryDateRang: [
|
|
|
@@ -471,15 +472,36 @@ export default {
|
|
|
|
|
|
getFullImageUrl: function (url) {
|
|
|
if (!url) return '';
|
|
|
- if (/^(https?:)?\/\//i.test(url) || url.startsWith('data:')) {
|
|
|
- return url;
|
|
|
+ const imageUrl = String(url).trim();
|
|
|
+ if (/^(https?:)?\/\//i.test(imageUrl) || imageUrl.startsWith('data:')) {
|
|
|
+ return imageUrl;
|
|
|
}
|
|
|
- return this.imgDomain + url;
|
|
|
+
|
|
|
+ // 接口会返回 /patientapp/images/...,但图片服务实际公开路径为 /images/...
|
|
|
+ // 统一改写后再补全域名,避免 H5 环境请求到不存在的 /patientapp/images 路径。
|
|
|
+ const imagePath = imageUrl.replace(/^\/?patientapp\/images(?=\/|$)/i, '/images');
|
|
|
+ return this.imgDomain.replace(/\/$/, '') + (imagePath.startsWith('/') ? imagePath : '/' + imagePath);
|
|
|
+ },
|
|
|
+
|
|
|
+ getPatientKey: function (item, index) {
|
|
|
+ return String(item.admID || item.patID || item.hisPatientNo || index);
|
|
|
+ },
|
|
|
+
|
|
|
+ onPatientImageError: function (item, index) {
|
|
|
+ const key = this.getPatientKey(item, index);
|
|
|
+ if (this.patientImageError[key]) return;
|
|
|
+ this.setData({
|
|
|
+ patientImageError: {
|
|
|
+ ...this.patientImageError,
|
|
|
+ [key]: true
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
- getAvatarText: function (name) {
|
|
|
- if (!name) return '?';
|
|
|
- return String(name).charAt(0);
|
|
|
+ getDefaultPatientAvatar: function (item) {
|
|
|
+ return item.patSexDesc === '男'
|
|
|
+ ? 'https://hlwyy.scsmysgkyy.cn/images/icon/gender-male.png'
|
|
|
+ : 'https://hlwyy.scsmysgkyy.cn/images/icon/gender-female.png';
|
|
|
},
|
|
|
|
|
|
selectPatient: function (e) {
|
|
|
@@ -578,7 +600,9 @@ export default {
|
|
|
success: function (res) {
|
|
|
if (res.errorCode == '0') {
|
|
|
this.setData({
|
|
|
- dataList: res.result.data
|
|
|
+ dataList: res.result.data,
|
|
|
+ // 刷新列表时允许新返回的头像重新加载。
|
|
|
+ patientImageError: {}
|
|
|
});
|
|
|
}
|
|
|
}
|