| | |
| | | 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> |
| | |
| | | |
| | | |
| | | 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( |
| | |
| | | !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; |
| | |
| | | height: 10px; |
| | | object-fit: contain; |
| | | cursor: pointer; |
| | | &.user-avatar { |
| | | width: 10px; |
| | | border-radius: 50%; |
| | | overflow: hidden; |
| | | } |
| | | &:not(:first-child) { |
| | | margin-left: 9px; |
| | | } |