support set gravatar as user avatar provider

This commit is contained in:
MaysWind
2023-07-01 00:51:45 +08:00
parent a8b76d5537
commit 652b3e1954
7 changed files with 61 additions and 2 deletions
+4
View File
@@ -16,6 +16,10 @@ export const useUserStore = defineStore('user', {
const userInfo = state.currentUserInfo || {};
return userInfo.nickname || userInfo.username || null;
},
currentUserAvatar(state) {
const userInfo = state.currentUserInfo || {};
return userInfo.avatar || null;
},
currentUserDefaultAccountId(state) {
const userInfo = state.currentUserInfo || {};
return userInfo.defaultAccountId || '';
+7 -2
View File
@@ -113,14 +113,16 @@
<v-icon :icon="(theme === 'light' ? icons.themeLight : (theme === 'dark' ? icons.themeDark : icons.themeAuto))" size="24" />
</v-btn>
<v-avatar class="cursor-pointer" color="primary" variant="tonal">
<v-icon :icon="icons.user"/>
<v-img :src="currentUserAvatar" v-if="currentUserAvatar"/>
<v-icon :icon="icons.user" v-else-if="!currentUserAvatar"/>
<v-menu activator="parent" width="230" location="bottom end" offset="14px">
<v-list>
<v-list-item>
<template #prepend>
<v-list-item-action start>
<v-avatar color="primary" variant="tonal">
<v-icon :icon="icons.user"/>
<v-img :src="currentUserAvatar" v-if="currentUserAvatar"/>
<v-icon :icon="icons.user" v-else-if="!currentUserAvatar"/>
</v-avatar>
</v-list-item-action>
</template>
@@ -264,6 +266,9 @@ export default {
currentNickName() {
return this.userStore.currentUserNickname || this.$t('User');
},
currentUserAvatar() {
return this.userStore.currentUserAvatar;
},
theme: {
get: function () {
return this.settingsStore.appSettings.theme;