单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-09-16 b3e78764e84144a9d64a9d28f293dc4a75e22134
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 user-avatar" 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(
@@ -249,11 +252,11 @@
    !bedsideAuxiliaryScreenStore.deviceData.deviceCode
  )
    return ElMessage.warning("未初始化或正在进行初始化操作中");
    console.log(loginDialogRef)
    loginDialogRef.value.openDialog();
};
function generateCircularAvatar(name: string, size = 100): string {
  console.log('name: ', name)
  const canvas = document.createElement('canvas');
  canvas.width = size;
  canvas.height = size;
@@ -311,6 +314,11 @@
      height: 10px;
      object-fit: contain;
      cursor: pointer;
      &.user-avatar {
        width: 10px;
        border-radius: 50%;
        overflow: hidden;
      }
      &:not(:first-child) {
        margin-left: 9px;
      }