Новости
This commit is contained in:
1 parent
9c4e662fc9
commit
4a22b0248d
3 files changed
+34
-25
No files matched your search
BIN
Binary file not shown.
@@ -12,20 +12,14 @@
|
|||||||
v-for="(x, i) in newss.result" :key= i
|
v-for="(x, i) in newss.result" :key= i
|
||||||
>
|
>
|
||||||
|
|
||||||
<v-list-item class="w-100 pl-4 py-2 pt-3">
|
<!-- <v-list-item class="w-100 pl-4 py-2 pt-3">
|
||||||
<template v-slot:prepend>
|
|
||||||
<v-avatar
|
|
||||||
size="35"
|
|
||||||
color="grey-darken-3"
|
|
||||||
:image="accountStore.user.photo"
|
|
||||||
></v-avatar>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<v-list-item-title class="text-body-2">{{x.author.fio}}</v-list-item-title>
|
<v-list-item-title class="text-body-2">{{x.author.fio}}</v-list-item-title>
|
||||||
|
|
||||||
<v-list-item-subtitle>Участник</v-list-item-subtitle>
|
|
||||||
</v-list-item>
|
</v-list-item> -->
|
||||||
<v-card-title class="pt-0 pb-1">
|
<v-card-title class="py-1">
|
||||||
{{x.title}}
|
{{x.title}}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-img
|
<v-img
|
||||||
@@ -36,6 +30,11 @@
|
|||||||
class="mx-auto"
|
class="mx-auto"
|
||||||
/>
|
/>
|
||||||
<v-list-item class="w-100">
|
<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>
|
||||||
|
<!-- <v-list-item-title class="text-caption">{{splitname(x.author)}}</v-list-item-title> -->
|
||||||
|
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<div class="justify-self-end">
|
<div class="justify-self-end">
|
||||||
@@ -46,25 +45,31 @@
|
|||||||
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
|
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
|
||||||
<span class="me-1">·</span>
|
<span class="me-1">·</span>
|
||||||
<v-icon size="x-small" class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
|
<v-icon size="x-small" 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>
|
<span class="pointer subheading">{{ x.comment.length }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
<v-divider/>
|
||||||
<v-card-text class="py-0">
|
<v-card-text class="pb-0">
|
||||||
{{limitText(x.text)}}
|
{{limitText(x.text)}}
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<!-- <v-card-actions class="py-0"> -->
|
||||||
<!-- :to="'/news'" -->
|
<!-- :to="'/news'" -->
|
||||||
<v-btn
|
<div class="pt-1 pl-1 pb-2">
|
||||||
color="#3E8890"
|
<v-btn
|
||||||
|
color="light-green-darken-4"
|
||||||
variant="text"
|
variant="text"
|
||||||
:to='`/news?id=${x.id}`'
|
:to='`/news?id=${x.id}`'
|
||||||
|
size="small"
|
||||||
|
|
||||||
|
append-icon="mdi-step-forward-2"
|
||||||
|
|
||||||
>
|
>
|
||||||
Подробнее
|
Подробнее
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-actions>
|
</div>
|
||||||
|
|
||||||
|
<!-- </v-card-actions> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -214,7 +219,7 @@
|
|||||||
|
|
||||||
</v-card>
|
</v-card>
|
||||||
<div v-show="route.path=='/news'">
|
<div v-show="route.path=='/news'">
|
||||||
<my-helper :pretext = 'newss'/>
|
|
||||||
|
|
||||||
<v-pagination
|
<v-pagination
|
||||||
v-model="page"
|
v-model="page"
|
||||||
@@ -315,11 +320,7 @@ export default {
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
|
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log(route.path, '33333333333333333333333333333333333333333');
|
|
||||||
if (route.path == '/news' && 'id' in route.query){
|
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}`
|
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}&id=${route.query.id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +338,7 @@ export default {
|
|||||||
dialogCommentShow.value=!dialogCommentShow.value
|
dialogCommentShow.value=!dialogCommentShow.value
|
||||||
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
|
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
|
||||||
})
|
})
|
||||||
|
textcomment.value=""
|
||||||
}
|
}
|
||||||
|
|
||||||
const deletComment = (id, news) => {
|
const deletComment = (id, news) => {
|
||||||
|
|||||||
+9
-2
@@ -38,14 +38,16 @@ class NewsAPIView(ListAPIView):
|
|||||||
else:
|
else:
|
||||||
newsqueryset =newsqueryset[int(request.GET.get("page"))*int(request.GET.get("selected")):int(request.GET.get("page"))*int(request.GET.get("selected"))+int(request.GET.get("selected"))]
|
newsqueryset =newsqueryset[int(request.GET.get("page"))*int(request.GET.get("selected")):int(request.GET.get("page"))*int(request.GET.get("selected"))+int(request.GET.get("selected"))]
|
||||||
result = []
|
result = []
|
||||||
|
print(len(newsqueryset))
|
||||||
for x in newsqueryset:
|
for x in newsqueryset:
|
||||||
|
|
||||||
|
# print(x.get_news.all(), '-----------------------x.get_news.all()')
|
||||||
a=model_to_dict(x)
|
a=model_to_dict(x)
|
||||||
a['link']= str(x.link.url)
|
a['link']= str(x.link.url)
|
||||||
a['show'] = False
|
a['show'] = False
|
||||||
a['showComment'] = False
|
a['showComment'] = False
|
||||||
a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username))
|
a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username))
|
||||||
a['scores'] = [{"score":y.score, "user":y.author.username} for y in x.get_news.all()]
|
a['scores'] = [{"score":y.score, "user":y.author.id} for y in x.get_news.all()]
|
||||||
a['comment'] = [{"author":model_to_dict(DictEmployee.objects.using('user_directory').get(login=k.author.username)),
|
a['comment'] = [{"author":model_to_dict(DictEmployee.objects.using('user_directory').get(login=k.author.username)),
|
||||||
"cdate":k.cdate,
|
"cdate":k.cdate,
|
||||||
"text":k.text,
|
"text":k.text,
|
||||||
@@ -54,6 +56,11 @@ class NewsAPIView(ListAPIView):
|
|||||||
]
|
]
|
||||||
|
|
||||||
result.append(a)
|
result.append(a)
|
||||||
|
# for y in x.get_news.all():
|
||||||
|
# print(y.author.id, '-----------------------x.get_news.all()')
|
||||||
|
if len(newsqueryset) ==1:
|
||||||
|
result[0]['showComment'] = True
|
||||||
|
|
||||||
return Response({"result": result, "allnews": round(allnews/int(request.GET.get("selected")))})
|
return Response({"result": result, "allnews": round(allnews/int(request.GET.get("selected")))})
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
|
|||||||
Reference in new issue
Block a user