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