From 5548b8c1c50947c862c85d0c4048459a39482d3b Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期五, 12 九月 2025 15:03:34 +0800
Subject: [PATCH] ID1766-修改患者样式

---
 src/views/mobile/bedsideAuxiliaryScreen/components/Login/userInfo.vue |    2 +-
 src/views/mobile/bedsideAuxiliaryScreen/components/Header.vue         |    8 ++++++--
 src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue    |   11 +++++++++++
 src/store/type/user.type.ts                                           |    1 +
 4 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/store/type/user.type.ts b/src/store/type/user.type.ts
index 45408d9..5e69b20 100644
--- a/src/store/type/user.type.ts
+++ b/src/store/type/user.type.ts
@@ -14,4 +14,5 @@
   updateUser: string | null;
   userCode: string;
   userName: string;
+  userAvatar: string | null;
 }
\ No newline at end of file
diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/Header.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/Header.vue
index 6617912..ab1b54d 100644
--- a/src/views/mobile/bedsideAuxiliaryScreen/components/Header.vue
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/Header.vue
@@ -65,7 +65,7 @@
         alt=""
         @click="openSettingDeviceDialog"
       />
-      <img v-if="userInfo?.code" :src="generateCircularAvatar(userInfo.userName)" class="btn-img" alt="" @click="openLoginDialog" />
+      <img v-if="userInfo?.code" :src="userInfo?.userAvatar" class="btn-img" alt="" @click="openLoginDialog" />
       <img v-else :src="userImg" class="btn-img" alt="" @click="openLoginDialog" />
     </div>
   </div>
@@ -167,7 +167,10 @@
 
 
 const userInfo = computed(() => {
-  return bedsideAuxiliaryScreenStore.userInfo;
+  if (!bedsideAuxiliaryScreenStore.userInfo) return null
+  return Object.assign({}, bedsideAuxiliaryScreenStore.userInfo, {
+    userAvatar: bedsideAuxiliaryScreenStore.userInfo?.userAvatar ? bedsideAuxiliaryScreenStore.userInfo?.userAvatar : generateCircularAvatar(bedsideAuxiliaryScreenStore.userInfo?.userName)
+  });
 });
 
 watch(
@@ -254,6 +257,7 @@
 };
 
 function generateCircularAvatar(name: string, size = 100): string {
+  console.log('name: ', name)
   const canvas = document.createElement('canvas');
   canvas.width = size;
   canvas.height = size;
diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue
index 697cd71..fe56ba9 100644
--- a/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue
@@ -69,6 +69,16 @@
       };
     });
 
+    const userInfo = computed(() => {
+      const userInfo = bedsideAuxiliaryScreenStore.userInfo;
+      if (!userInfo) return null;
+      return {
+        ...userInfo,
+        床号: bedsideAuxiliaryScreenStore.deviceData.devicdeNo,
+        设备编号: bedsideAuxiliaryScreenStore.deviceCode
+      }
+    });
+
     const openDialog = () => {
       state.show = true;
     };
@@ -112,6 +122,7 @@
       handleCancel,
       openDialog,
       onLogout,
+      userInfo,
     };
   },
 };
diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/Login/userInfo.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/Login/userInfo.vue
index 05346b8..bf5a6d7 100644
--- a/src/views/mobile/bedsideAuxiliaryScreen/components/Login/userInfo.vue
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/Login/userInfo.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="userinfo-container">
-    <!-- <img :src="userInfo.用户头像" alt="" srcset="" class="user-avatar"> -->
+    <img :src="userInfo.userAvatar" alt="" srcset="" class="user-avatar">
     <div class="user-text">当前账户:{{ userInfo.userName }}</div>
     <div class="user-text">床号:{{ userInfo.床号 }}</div>
     <div class="user-text">设备号:{{ userInfo.设备编号 }}</div>

--
Gitblit v1.8.0