| | |
| | | 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> |
| | |
| | | |
| | | |
| | | 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( |
| | |
| | | }; |
| | | |
| | | function generateCircularAvatar(name: string, size = 100): string { |
| | | console.log('name: ', name) |
| | | const canvas = document.createElement('canvas'); |
| | | canvas.width = size; |
| | | canvas.height = size; |