mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
show username and avatar in user basic setting tab
This commit is contained in:
@@ -79,6 +79,7 @@ type UserBasicInfo struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Nickname string `json:"nickname"`
|
Nickname string `json:"nickname"`
|
||||||
AvatarUrl string `json:"avatar"`
|
AvatarUrl string `json:"avatar"`
|
||||||
|
AvatarProvider string `json:"avatarProvider,omitempty"`
|
||||||
DefaultAccountId int64 `json:"defaultAccountId,string"`
|
DefaultAccountId int64 `json:"defaultAccountId,string"`
|
||||||
TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
|
TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
|
||||||
Language string `json:"language"`
|
Language string `json:"language"`
|
||||||
@@ -136,6 +137,7 @@ type UserProfileResponse struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Nickname string `json:"nickname"`
|
Nickname string `json:"nickname"`
|
||||||
AvatarUrl string `json:"avatar"`
|
AvatarUrl string `json:"avatar"`
|
||||||
|
AvatarProvider string `json:"avatarProvider,omitempty"`
|
||||||
DefaultAccountId int64 `json:"defaultAccountId,string"`
|
DefaultAccountId int64 `json:"defaultAccountId,string"`
|
||||||
TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
|
TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
|
||||||
Language string `json:"language"`
|
Language string `json:"language"`
|
||||||
@@ -197,6 +199,7 @@ func (u *User) ToUserBasicInfo() *UserBasicInfo {
|
|||||||
Email: u.Email,
|
Email: u.Email,
|
||||||
Nickname: u.Nickname,
|
Nickname: u.Nickname,
|
||||||
AvatarUrl: u.getAvatarUrl(),
|
AvatarUrl: u.getAvatarUrl(),
|
||||||
|
AvatarProvider: u.getAvatarProvider(),
|
||||||
DefaultAccountId: u.DefaultAccountId,
|
DefaultAccountId: u.DefaultAccountId,
|
||||||
TransactionEditScope: u.TransactionEditScope,
|
TransactionEditScope: u.TransactionEditScope,
|
||||||
Language: u.Language,
|
Language: u.Language,
|
||||||
@@ -216,6 +219,7 @@ func (u *User) ToUserProfileResponse() *UserProfileResponse {
|
|||||||
Email: u.Email,
|
Email: u.Email,
|
||||||
Nickname: u.Nickname,
|
Nickname: u.Nickname,
|
||||||
AvatarUrl: u.getAvatarUrl(),
|
AvatarUrl: u.getAvatarUrl(),
|
||||||
|
AvatarProvider: u.getAvatarProvider(),
|
||||||
DefaultAccountId: u.DefaultAccountId,
|
DefaultAccountId: u.DefaultAccountId,
|
||||||
TransactionEditScope: u.TransactionEditScope,
|
TransactionEditScope: u.TransactionEditScope,
|
||||||
Language: u.Language,
|
Language: u.Language,
|
||||||
@@ -229,6 +233,10 @@ func (u *User) ToUserProfileResponse() *UserProfileResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *User) getAvatarProvider() string {
|
||||||
|
return settings.Container.Current.AvatarProvider
|
||||||
|
}
|
||||||
|
|
||||||
func (u *User) getAvatarUrl() string {
|
func (u *User) getAvatarUrl() string {
|
||||||
avatarProvider := settings.Container.Current.AvatarProvider
|
avatarProvider := settings.Container.Current.AvatarProvider
|
||||||
|
|
||||||
|
|||||||
@@ -1003,6 +1003,8 @@ export default {
|
|||||||
'Basic Settings': 'Basic Settings',
|
'Basic Settings': 'Basic Settings',
|
||||||
'Security Settings': 'Security Settings',
|
'Security Settings': 'Security Settings',
|
||||||
'Two-Factor Authentication Settings': 'Two-Factor Authentication Settings',
|
'Two-Factor Authentication Settings': 'Two-Factor Authentication Settings',
|
||||||
|
'Username:': 'Username:',
|
||||||
|
'Avatar Provider:': 'Avatar Provider:',
|
||||||
'Current Password': 'Current Password',
|
'Current Password': 'Current Password',
|
||||||
'New Password': 'New Password',
|
'New Password': 'New Password',
|
||||||
'Modify Password': 'Modify Password',
|
'Modify Password': 'Modify Password',
|
||||||
|
|||||||
@@ -1003,6 +1003,8 @@ export default {
|
|||||||
'Basic Settings': '基本设置',
|
'Basic Settings': '基本设置',
|
||||||
'Security Settings': '安全设置',
|
'Security Settings': '安全设置',
|
||||||
'Two-Factor Authentication Settings': '两步验证设置',
|
'Two-Factor Authentication Settings': '两步验证设置',
|
||||||
|
'Username:': '用户名:',
|
||||||
|
'Avatar Provider:': '头像提供方:',
|
||||||
'Current Password': '当前密码',
|
'Current Password': '当前密码',
|
||||||
'New Password': '新密码',
|
'New Password': '新密码',
|
||||||
'Modify Password': '修改密码',
|
'Modify Password': '修改密码',
|
||||||
|
|||||||
@@ -7,7 +7,26 @@
|
|||||||
<v-progress-circular indeterminate size="24" class="ml-2" v-if="loading"></v-progress-circular>
|
<v-progress-circular indeterminate size="24" class="ml-2" v-if="loading"></v-progress-circular>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<v-form>
|
<v-card-text class="d-flex">
|
||||||
|
<v-avatar rounded="lg" color="primary" variant="tonal" size="100" class="me-6">
|
||||||
|
<v-img :src="oldProfile.avatar" v-if="oldProfile.avatar"/>
|
||||||
|
<v-icon size="48" :icon="icons.user" v-else-if="!oldProfile.avatar"/>
|
||||||
|
</v-avatar>
|
||||||
|
<div class="d-flex flex-column justify-center gap-5">
|
||||||
|
<p class="text-body-1 mb-0">
|
||||||
|
<span class="mr-2">{{ $t('Username:') }}</span>
|
||||||
|
<span>{{ oldProfile.username }}</span>
|
||||||
|
</p>
|
||||||
|
<p class="text-body-1 mb-0">
|
||||||
|
<span class="mr-2">{{ $t('Avatar Provider:') }}</span>
|
||||||
|
<span>{{ currentUserAvatarProvider }}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</v-card-text>
|
||||||
|
|
||||||
|
<v-divider />
|
||||||
|
|
||||||
|
<v-form class="mt-6">
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12" md="6">
|
<v-col cols="12" md="6">
|
||||||
@@ -198,6 +217,10 @@ import { useAccountsStore } from '@/stores/account.js';
|
|||||||
import datetimeConstants from '@/consts/datetime.js';
|
import datetimeConstants from '@/consts/datetime.js';
|
||||||
import { getNameByKeyValue } from '@/lib/common.js';
|
import { getNameByKeyValue } from '@/lib/common.js';
|
||||||
|
|
||||||
|
import {
|
||||||
|
mdiAccount
|
||||||
|
} from '@mdi/js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
const self = this;
|
const self = this;
|
||||||
@@ -232,7 +255,10 @@ export default {
|
|||||||
shortTimeFormat: 0
|
shortTimeFormat: 0
|
||||||
},
|
},
|
||||||
loading: true,
|
loading: true,
|
||||||
saving: false
|
saving: false,
|
||||||
|
icons: {
|
||||||
|
user: mdiAccount
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -311,6 +337,13 @@ export default {
|
|||||||
name: self.$t('This year or later')
|
name: self.$t('This year or later')
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
currentUserAvatarProvider() {
|
||||||
|
if (this.oldProfile.avatarProvider === 'gravatar') {
|
||||||
|
return 'Gravatar';
|
||||||
|
} else {
|
||||||
|
return this.$t('None');
|
||||||
|
}
|
||||||
|
},
|
||||||
inputIsNotChanged() {
|
inputIsNotChanged() {
|
||||||
return !!this.inputIsNotChangedProblemMessage;
|
return !!this.inputIsNotChangedProblemMessage;
|
||||||
},
|
},
|
||||||
@@ -431,8 +464,11 @@ export default {
|
|||||||
return getNameByKeyValue(src, value, keyField, nameField, defaultName);
|
return getNameByKeyValue(src, value, keyField, nameField, defaultName);
|
||||||
},
|
},
|
||||||
setCurrentUserProfile(profile) {
|
setCurrentUserProfile(profile) {
|
||||||
|
this.oldProfile.username = profile.username;
|
||||||
this.oldProfile.email = profile.email;
|
this.oldProfile.email = profile.email;
|
||||||
this.oldProfile.nickname = profile.nickname;
|
this.oldProfile.nickname = profile.nickname;
|
||||||
|
this.oldProfile.avatar = profile.avatar;
|
||||||
|
this.oldProfile.avatarProvider = profile.avatarProvider;
|
||||||
this.oldProfile.defaultAccountId = profile.defaultAccountId;
|
this.oldProfile.defaultAccountId = profile.defaultAccountId;
|
||||||
this.oldProfile.transactionEditScope = profile.transactionEditScope;
|
this.oldProfile.transactionEditScope = profile.transactionEditScope;
|
||||||
this.oldProfile.language = profile.language;
|
this.oldProfile.language = profile.language;
|
||||||
|
|||||||
Reference in New Issue
Block a user