Client - display user picture in users administration

This commit is contained in:
Sam 2021-10-31 13:36:36 +01:00
parent 4a5f175053
commit feb4f0f7c3
2 changed files with 18 additions and 14 deletions

View File

@ -31,7 +31,12 @@
</thead> </thead>
<tbody> <tbody>
<tr v-for="user in users" :key="user.username"> <tr v-for="user in users" :key="user.username">
<td></td> <td>
<span class="cell-heading">
{{ $t('user.PROFILE.PICTURE') }}
</span>
<UserPicture :user="user" />
</td>
<td> <td>
<span class="cell-heading"> <span class="cell-heading">
{{ $t('user.USERNAME') }} {{ $t('user.USERNAME') }}
@ -116,6 +121,7 @@
import AdminUsersSelects from '@/components/Administration/AdminUsersSelects.vue' import AdminUsersSelects from '@/components/Administration/AdminUsersSelects.vue'
import Pagination from '@/components/Common/Pagination.vue' import Pagination from '@/components/Common/Pagination.vue'
import UserPicture from '@/components/User/UserPicture.vue'
import { ROOT_STORE, USER_STORE, USERS_STORE } from '@/store/constants' import { ROOT_STORE, USER_STORE, USERS_STORE } from '@/store/constants'
import { IPagination, TPaginationPayload } from '@/types/api' import { IPagination, TPaginationPayload } from '@/types/api'
import { IUserProfile } from '@/types/user' import { IUserProfile } from '@/types/user'
@ -126,6 +132,7 @@
components: { components: {
AdminUsersSelects, AdminUsersSelects,
Pagination, Pagination,
UserPicture,
}, },
setup() { setup() {
const store = useStore() const store = useStore()
@ -240,6 +247,15 @@
.left-text { .left-text {
text-align: left; text-align: left;
} }
::v-deep(.user-picture) {
img {
height: 30px;
width: 30px;
}
.no-picture {
font-size: 2em;
}
}
@media screen and (max-width: $small-limit) { @media screen and (max-width: $small-limit) {
.top-button { .top-button {

View File

@ -28,11 +28,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { PropType, computed, defineComponent } from 'vue' import { PropType, defineComponent } from 'vue'
import UserPicture from '@/components/User/UserPicture.vue' import UserPicture from '@/components/User/UserPicture.vue'
import { IUserProfile } from '@/types/user' import { IUserProfile } from '@/types/user'
import { getApiUrl } from '@/utils'
export default defineComponent({ export default defineComponent({
name: 'ProfileDisplay', name: 'ProfileDisplay',
@ -45,17 +44,6 @@
required: true, required: true,
}, },
}, },
setup(props) {
return {
authUserPictureUrl: computed(() =>
props.user.picture
? `${getApiUrl()}/users/${
props.user.username
}/picture?${Date.now()}`
: ''
),
}
},
}) })
</script> </script>