Карточки пользователей
This commit is contained in:
1 parent
0a1b3b2bf9
commit
5f4ea62005
16 files changed
+66
-20
No files matched your search
@@ -56,7 +56,7 @@ class UserCommentSerializer(serializers.ModelSerializer):
|
||||
def get_user(self, obj):
|
||||
|
||||
# obj.user
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data
|
||||
return InfoUserCardSerializer(DictEmployee.objects.get(login=obj.user)).data
|
||||
|
||||
class UserCommerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class NewsSerializer(serializers.ModelSerializer):
|
||||
return False
|
||||
|
||||
def get_user(self, obj):
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.author.username)).data
|
||||
return InfoUserCardSerializer(DictEmployee.objects.get(login=obj.author.username)).data
|
||||
|
||||
def get_score(self, obj):
|
||||
return ScoreNewsSerializer(obj.get_news.all(), many=True).data
|
||||
|
||||
@@ -111,6 +111,7 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
|
||||
result = NewsSerializer(newsqueryset, many=True).data
|
||||
|
||||
|
||||
return Response({"result":result, "countpage": countpage})
|
||||
|
||||
def post(self, request):
|
||||
|
||||
@@ -119,4 +119,12 @@ class ShortUserSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = DictEmployee
|
||||
fields = ['familyname', 'name', 'parentname', 'id', 'login', 'post', 'department']
|
||||
# fields='__all__'
|
||||
|
||||
|
||||
class InfoUserCardSerializer(serializers.ModelSerializer):
|
||||
# login = serializers.CharField()
|
||||
|
||||
|
||||
class Meta:
|
||||
model = DictEmployee
|
||||
fields = ['department', 'fio', 'post', 'email', 'tel', 'room', 'login', 'familyname', 'name', 'parentname', 'id']
|
||||
@@ -34,7 +34,7 @@ class PagesSerializer(serializers.ModelSerializer):
|
||||
|
||||
def get_user(self, obj):
|
||||
|
||||
return ShortUserSerializer(obj.user.user).data
|
||||
return InfoUserCardSerializer(obj.user.user).data
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<v-row no-gutters v-if="top.comment[0].time_create != '1990-01-01'">
|
||||
<v-col lg=5 class="bg-teal-lighten-4 align-self-center">
|
||||
<list-user
|
||||
:author= "top.author"
|
||||
:author= "top.author"
|
||||
:from_which="'top_comment'"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
v-model:expanded="expanded"
|
||||
:headers="dessertHeaders"
|
||||
:items="dataActivusers"
|
||||
item-value="user.id"
|
||||
item-value="user"
|
||||
show-expand
|
||||
class="h-0 cursor-default bg-grey_white"
|
||||
:sort-by="[{ key: 'info.count', order: 'desc' }]"
|
||||
@@ -169,7 +169,7 @@ export default {
|
||||
let res = []
|
||||
|
||||
props.activusers.forEach((e) => {
|
||||
|
||||
|
||||
let ind = res.findIndex(el => el.user.id == e.user.id)
|
||||
if (ind == -1) {
|
||||
res.push({user: e.user,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
{{splitname(author)}}
|
||||
</span>
|
||||
<info-user-card
|
||||
:author=author
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
Для отрисовки карточки, необходимы поля от пользователя
|
||||
|
||||
department
|
||||
fio
|
||||
post
|
||||
email
|
||||
tel
|
||||
room
|
||||
login
|
||||
|
||||
const basicInformation = () => [
|
||||
{title: 'Отдел:', info: department},
|
||||
{title: 'ФИО:', info: fio},
|
||||
{title: 'Должность:', info: post},
|
||||
]
|
||||
|
||||
const subInformation = () => [
|
||||
{title: 'E-mail: ', info: email},
|
||||
{title: 'Телефон: ', info: tel},
|
||||
{title: 'Комната: ', info: room},
|
||||
{title: 'Логин: ', info: login},
|
||||
]
|
||||
+14
-7
@@ -8,6 +8,8 @@
|
||||
<v-card height="480">
|
||||
<v-card-title class="pl-6">
|
||||
Информация
|
||||
|
||||
|
||||
</v-card-title>
|
||||
<v-divider/>
|
||||
<v-card-text>
|
||||
@@ -94,6 +96,11 @@ export default {
|
||||
loging: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
||||
author: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -117,16 +124,16 @@ export default {
|
||||
}, {deep:true})
|
||||
|
||||
const basicInformation = () => [
|
||||
{title: 'Отдел:', info: userlinks.value.department},
|
||||
{title: 'ФИО:', info: userlinks.value.fio},
|
||||
{title: 'Должность:', info: userlinks.value.post},
|
||||
{title: 'Отдел:', info: props.author.department},
|
||||
{title: 'ФИО:', info: props.author.fio},
|
||||
{title: 'Должность:', info: props.author.post},
|
||||
]
|
||||
|
||||
const subInformation = () => [
|
||||
{title: 'E-mail: ', info: userlinks.value.email},
|
||||
{title: 'Телефон: ', info: userlinks.value.tel},
|
||||
{title: 'Комната: ', info: userlinks.value.room},
|
||||
{title: 'Логин: ', info: userlinks.value.login},
|
||||
{title: 'E-mail: ', info: props.author.email},
|
||||
{title: 'Телефон: ', info: props.author.tel},
|
||||
{title: 'Комната: ', info: props.author.room},
|
||||
{title: 'Логин: ', info: props.author.login},
|
||||
]
|
||||
|
||||
return {
|
||||
@@ -31,6 +31,7 @@
|
||||
/>
|
||||
<span class="font-weight-medium text-grey-darken-3 myleft text-caption">
|
||||
{{splitname(author)}}
|
||||
|
||||
</span>
|
||||
</v-chip>
|
||||
|
||||
@@ -49,6 +50,7 @@
|
||||
|
||||
|
||||
<info-user-card
|
||||
:author="author"
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<div class="align-center d-flex flex-column py-1">
|
||||
|
||||
|
||||
<v-btn
|
||||
variant="text"
|
||||
v-for="x in onlineuser"
|
||||
@@ -16,6 +18,7 @@
|
||||
</v-avatar>
|
||||
</v-btn>
|
||||
<info-user-card
|
||||
|
||||
:opendialog = open
|
||||
:loging="loging"
|
||||
@update:opendialog="open = $event"
|
||||
@@ -39,6 +42,7 @@ export default {
|
||||
const wsfuncs={onliner:function(data){
|
||||
let newset = new Set(data)
|
||||
let arr= Array.from(newset)
|
||||
|
||||
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
|
||||
onlineuser.value = arr
|
||||
}}
|
||||
@@ -46,7 +50,6 @@ export default {
|
||||
let onlineuser= ref([])
|
||||
|
||||
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
|
||||
|
||||
const whatuser=(x)=> {
|
||||
loging.value = x
|
||||
open.value = true
|
||||
@@ -54,6 +57,7 @@ export default {
|
||||
|
||||
connect.onmessage=(e)=>{
|
||||
let data = JSON.parse(e.data)
|
||||
|
||||
wsfuncs[data['message']['action']](data.message.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<v-card
|
||||
class="bg-transparent"
|
||||
|
||||
density="compact"
|
||||
:prepend-avatar="checkremote(`${spravURL}${author.login}.jpg`)"
|
||||
:title="author.fio"
|
||||
@@ -11,6 +9,7 @@
|
||||
variant="text" @click="open=true"
|
||||
/>
|
||||
<info-user-card
|
||||
:author=author
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import myHelper from '@/components/UI/my-helper';
|
||||
import InfoUserCard from '@/components/UI/infoUserCard.vue';
|
||||
import InfoUserCard from '@/components/UI/fiousercard/infoUserCard.vue';
|
||||
import TooltipText from '@/components/UI/tooltip-text.vue'
|
||||
import AlertDefault from '@/layouts/default/alertDefault.vue'
|
||||
import listUser from '@/components/UI/fiousercard/listUser.vue';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class="d-flex pa-1 flex-column "
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
|
||||
{{aNewsAll}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-0 ">
|
||||
@@ -69,6 +69,7 @@ export default {
|
||||
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage/countpage.value
|
||||
visiblePage.value = countetnews.value <= 1 ? 1 : countetnews.value+1
|
||||
@@ -80,6 +81,7 @@ export default {
|
||||
|
||||
return {
|
||||
newsAll,
|
||||
|
||||
countetnews,
|
||||
page,
|
||||
countpage,
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
|
||||
|
||||
>
|
||||
<!-- <my-helper :pretext = newsFull /> -->
|
||||
|
||||
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
|
||||
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user