Табы для карточки начало

This commit is contained in:
iriska-gri committed 2023-11-16 08:27:41 +03:00
1 parent 76947614a2
commit 9c0671da7b
9 files changed
+16 -516

No files matched your search

+5 -81
View File
@@ -62,86 +62,10 @@ class getuserAPIView(APIView):
def get(self, request):
userlogin = request.query_params.get('userlogin')
queryset = model_to_dict(DictEmployee.objects.using('user_directory').get(login=userlogin))
dt=datetime.now()
queryset = DictEmployee.objects.using('user_directory').get(login=request.query_params.get('userlogin'))
r=CardUserSerializer(queryset).data
print(datetime.now()-dt)
addons = DictCommitteeOrderAddon.objects.using('user_directory').values('number', 'date', 'text')
users = DictEmployee.objects.using('user_directory').values('fio', 'id')
responsibility = OrderResponsibilityEmployee.objects.using('user_directory').values('id_order_responsibility__number',
'id_order_responsibility',
'id_dict_employee',
'id_order_responsibility__date',
'id_order_responsibility__name',
'id_order_responsibility__sphere_of_responsibility'
)
responemployee = responsibility.filter(id_dict_employee=queryset['id'])
print(users, '+++++++++++++++++')
respfiles = OrderResponsibilityFiles.objects.using('user_directory').values('file_name', 'id_order_responsibility')
resp =[]
for x in responemployee:
x['name'] = x.pop('id_order_responsibility__name')
x['number'] = x.pop('id_order_responsibility__number')
x['date'] = x.pop('id_order_responsibility__date')
x['sphere'] = x.pop('id_order_responsibility__sphere_of_responsibility')
# print(x['id_order_responsibility'])
x['file'] = respfiles.filter(id_order_responsibility=x['id_order_responsibility'])
x['employee'] = [
{
"fio2": users.values('fio').get(id=k['id_dict_employee']),
"id": k['id_dict_employee']
} for k in responsibility.values('id_dict_employee').filter(id_order_responsibility=x['id_order_responsibility'])
]
# responsibility.values('id_dict_employee').filter(id_order_responsibility=x['id_order_responsibility'])
# for k in responsibility.values('id_dict_employee').filter(id_order_responsibility=x['id_order_responsibility']) :
# v = users.filter(id=k['id_dict_employee'])
# print(v, 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk')
resp.append(x)
com = Committee2.objects.using('user_directory').filter(id_dict_employee=queryset['id']).values('id_committee1_id',
'id_committee1_id__name',
'id_committee1_id__num_start',
'id_committee1_id__date_start',
'id_committee1_id__comment',
'id_committee1_id__id_dict_committee_type__name',
'id_dict_committee_position__name'
)
# j = respfiles.filter(id_committee1='24')
# print(responsibility, '0000000000000000000000000000000')
# com['name']=com.pop('id_committee1_id__name')
committee = []
for x in com:
x['name'] = x.pop('id_committee1_id__name')
x['number'] = x.pop('id_committee1_id__num_start')
x['date'] = x.pop('id_committee1_id__date_start')
x['comment'] = x.pop('id_committee1_id__comment')
x['position_com'] = x.pop('id_committee1_id__id_dict_committee_type__name')
x['type_com'] = x.pop('id_dict_committee_position__name')
x['addons']=addons.filter(id_committee1=x['id_committee1_id'])
# # a=model_to_dict(x)
# # committee.append(a)
# # print(x['id_committee1_id'], '----------------------------------------')
committee.append(x)
#
# emp = DictEmployee.objects.using('user_directory').values('login', 'id')
# dfcom = pd.DataFrame.from_records(com)
# dfemp = pd.DataFrame.from_records(emp)
# h = dfcom.merge(dfemp, how="left", left_on="id_dict_employee", right_on="id")
# print(h, '====================================================================')
return Response({"info":queryset, "com": committee, "resp": resp})
return Response(CardUserSerializer(queryset).data)
BIN
View File
Binary file not shown.
+2 -8
View File
@@ -105,11 +105,8 @@ export default {
const userlinks = ref([])
const loadlinksUser=async()=>{
// console.log(`accountStore`, accountStore);
const res = await clearAxios.get('api/accounts/getuser/?userlogin='+props.loging)
console.log(res.data ,'=kkkkkkkkkkkkkkkkkkkkk');
userlinks.value=res.data.info
userlinks.value=res.data
}
const basicInformation = () => [
@@ -129,10 +126,7 @@ export default {
context.emit('menusClose')
}
onMounted(() => {
loadlinksUser()
})
loadlinksUser()
return {
menusCloses,
+1 -1
View File
@@ -13,7 +13,7 @@
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="185px"
height="175px"
cover
width="92%"
class="mx-auto"
-389
View File
@@ -1,389 +0,0 @@
<template>
<v-container class="py-0 newsVH px-0 bg-transparent overflow-auto">
<v-card
v-show="route.path=='/'"
:ref="i"
class="mx-auto"
:class="i>0?'mt-1':''"
v-for="(x, i) in newss.result" :key= i
>
<v-card-title class="py-1">
{{x.title}}
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="164px"
cover
width="92%"
class="mx-auto"
/>
<v-list-item class="w-100">
<div class="justify-self-start mt-1">
<v-icon size="x-small" class="me-1" icon="mdi-account" ></v-icon>
<span class="text-caption me-2">{{splitname(x.author)}}</span>
</div>
<template v-slot:append>
<div class="justify-self-end">
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<v-divider/>
<v-card-text class="pb-0">
{{limitText(x.text)}}
</v-card-text>
<div class="pt-1 pl-1 pb-2">
<v-btn
color="more_details_btn"
variant="text"
:to='`/news?id=${x.id}`'
size="small"
append-icon="mdi-step-forward-2">
Подробнее
</v-btn>
</div>
</v-card>
<!-- ------------------------------ @click="scrollMeTo('porto')"---------------------------------------------------- -->
<div >
<v-card v-show="route.path=='/news'"
class="mx-auto rounded-0"
v-for="(x, i) in newss.result" :key=i
>
<v-list-item class="w-100 pl-4 py-2 pt-3">
<template v-slot:prepend>
<v-avatar
color="loading_avatar"
:image=accountStore.user.photo></v-avatar>
</template>
<v-list-item-title>{{x.author.fio}}</v-list-item-title>
<v-list-item-subtitle>Участник</v-list-item-subtitle>
</v-list-item>
<v-card-title class="pt-0 pb-1">
{{x.title}}
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="350px"
width="96%"
class="mx-auto"
cover
/>
<v-list-item class="w-100">
<template v-slot:append>
<div class="justify-self-end">
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<div >
<v-divider/>
<v-card-text>
{{x.text}}
</v-card-text>
<v-divider/>
<v-expand-transition>
<div v-show="x.showComment" v-if="x.comment.length>0">
<div
v-for = "(y, key) in x.comment"
:key="key"
class="d-flex flex-column pa-3"
>
<v-row
class="justify-space-between ma-0 align-center bgchat mr-7"
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
>
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
>
{{ accountStore.user.login==y.author.login?'':splitname(y.author) }}
</v-col>
<v-col class="pa-0 text-center text-subtitle-2 ">
{{dateformat(y.cdate)}}
</v-col>
<v-col class="pa-0 pr-2 text-end text-subtitle-2 ">
{{ accountStore.user.login!=y.author.login?'':splitname(y.author) }}
</v-col>
</v-row>
<div class="text-subtitle-2">
</div>
<v-row>
<v-col class="pr-0">
<v-alert
color="white"
rounded=0
:border="accountStore.user.login==y.author.login?'end':'start'"
:border-color="accountStore.user.login==y.author.login?'success':'deep-purple accent-4'"
elevation=0>
{{ y.text }}
</v-alert>
</v-col>
<v-col class="flex-grow-0 d-flex pa-0 align-center"
:class="accountStore.user.login==y.author.login?'pa-0':'pa-5'"
>
<v-btn
v-if="accountStore.user.login==y.author.login"
variant="text"
size="small"
icon='mdi-delete'
color="delete_btn"
@click="deletComment(y.id, x.id)"
/>
</v-col>
</v-row>
</div>
</div>
</v-expand-transition>
</div>
</v-card>
</div>
<v-row justify="center">
<v-dialog
v-model="dialogCommentShow"
persistent
width="550">
<v-card>
<v-card-title class="text-h5">
Прокоментировать новость
</v-card-title>
<v-card-text>
<v-textarea
variant="solo"
hide-details
rows="5"
v-model="textcomment"
></v-textarea>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="modal_btn"
variant="text"
@click="dialogCommentShow = false"
>
Отмена
</v-btn>
<v-btn
color="modal_btn"
variant="text"
@click="addComment"
>
Отправить
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</v-container>
<v-container v-show="route.path=='/news'">
<div class="pagination" >
<v-pagination
class="flex-grow-1"
v-model="page"
:length="newss.allnews"
prev-icon="mdi-menu-left"
next-icon="mdi-menu-right"
@click="pagelistNews"
></v-pagination>
<v-select
class="flex-grow-0 pt-2"
density="compact"
v-model="selecnews"
variant="outlined"
:items="['1', '2', '3', '4', '5', '6']"
>
</v-select>
</div>
</v-container>
</template>
<script>
import { ref, watch, onBeforeUpdate, onMounted } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
import { useRoute } from 'vue-router'
const accountStore = useAccountStore()
export default {
components: { myHelper },
setup(){
const divs = ref([])
onBeforeUpdate(() => {
divs.value = []
})
const newss=ref([])
const dialogCommentShow = ref(false)
const burl = baseURL.slice(0,-1)
const textcomment = ref('')
const idnews = ref(0)
const page = ref(1)
const selecnews = ref(2)
const route = useRoute()
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
if (route.path == '/news' && 'id' in route.query){
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}&id=${route.query.id}`
}
getfromserver(str, newss)
const toggleIncrementLike = (news, scores) => {
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==news)].scores= result.data
})
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
dialogCommentShow.value=!dialogCommentShow.value
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
textcomment.value=""
}
const deletComment = (id, news) => {
axiosApiInstance.post(`api/navigation/news/`, {delid: id, news: news}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
}
const pagelistNews =() => {
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`, newss)
}
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`,newss)
}
}, {deep:true})
watch(()=>selecnews ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${newValue.value}`, newss)
}
}, {deep:true})
const dateformat = (datas) => {
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
}
const openComent = (news) => {
dialogCommentShow.value=!dialogCommentShow.value
idnews.value = news
}
const limitText=(text)=> {
const t = text.split(' ').slice(0, 25)
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
const splitname = (name) => {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
return {
newss,
burl,
limitText,
toggleIncrementLike,
dialogCommentShow,
accountStore,
dateformat,
splitname,
textcomment,
openComent,
addComment,
idnews,
deletComment,
pagelistNews,
divs,
page,
selecnews,
route
}
}
}
</script>
<style scoped>
.pagination {
display: flex;
}
.newsVH {
height: 92vh;
}
.bgchat {
background-color: #efe9f98a;
}
.bgchatnot {
background-color: #eef9efad;
}
/* .bgf {
background: url("@/assets/message.jpg") repeat-y;
} */
</style>
+3 -18
View File
@@ -7,19 +7,17 @@
title="x"
nav
@click="whatuser(x)">
<v-dialog
</v-list-item>
<v-dialog
v-model="menuGetUserDialog"
persistent
width="600">
{{spravURL}}
<Card-users
:menuGetUserDialog="menuGetUserDialog"
:loging="loging"
@menusClose="menuGetUserDialog=false"/>
</v-dialog>
</v-list-item>
</div>
</template>
@@ -51,33 +49,20 @@ export default {
const accountStore = useAccountStore()
let onlineuser= ref([])
// const userlinks = ref([])
// const loadlinksUser=async()=>{
// // console.log(`accountStore`, accountStore);
// const res = await clearAxios.get('api/accounts/getuser/?userlogin='+props.loging)
// userlinks.value=res.data
// }
// const gh = () => {
// console.log('hi');
// }
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
const whatuser=(x)=> {
loging.value = x
menuGetUserDialog.value=true
}
connect.onmessage=(e)=>{
let data = JSON.parse(e.data)
wsfuncs[data['message']['action']](data.message.data)
}
watch(()=>accountStore.cod2user,function(){
// console.log('newValue')
if (!accountStore.cod2user.value){
connect.close()
}
@@ -287,18 +287,6 @@
<Online-users />
<!-- <template v-slot:append>
<v-list lines="one">
<v-list-item
v-for="(val,key) in appStore.countvisitor"
:key="key"
:title="val"
></v-list-item>
</v-list>
</template> -->
</v-navigation-drawer>
+2 -2
View File
@@ -148,7 +148,7 @@
import {useAppStore} from '@/store/app'
import {useAccountStore} from '@/store/AccountStore'
import {pagecounter} from '@/utils/universal_functions'
import NewsList from '@/components/news-list.vue'
import CarouselList from '@/components/carousel-list.vue'
import CarouselNumbers from '@/components/carousel-numbers.vue'
import CalendarFull from '@/components/UI/Calendar-full.vue'
@@ -162,7 +162,7 @@
export default {
components: {
NewsList,
CarouselList,
CarouselNumbers,
CalendarFull,
+3 -5
View File
@@ -5,21 +5,19 @@
lg="6"
>
<news-list-news/>
<!-- <News-list
/> -->
</v-col>
</v-row>
</template>
<script>
import NewsList from '@/components/news-list.vue'
import {pagecounter} from '@/utils/universal_functions'
import NewsListNews from '../components/news-list-news.vue'
export default {
components: {
NewsList,
NewsListNews
},
setup(){