Новости
This commit is contained in:
1 parent
9c4e662fc9
commit
4a22b0248d
3 files changed
+36
-27
No files matched your search
BIN
Binary file not shown.
@@ -12,20 +12,14 @@
|
||||
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
|
||||
size="35"
|
||||
color="grey-darken-3"
|
||||
:image="accountStore.user.photo"
|
||||
></v-avatar>
|
||||
</template>
|
||||
<!-- <v-list-item class="w-100 pl-4 py-2 pt-3">
|
||||
|
||||
|
||||
<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-card-title class="pt-0 pb-1">
|
||||
|
||||
</v-list-item> -->
|
||||
<v-card-title class="py-1">
|
||||
{{x.title}}
|
||||
</v-card-title>
|
||||
<v-img
|
||||
@@ -36,7 +30,12 @@
|
||||
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>
|
||||
<!-- <v-list-item-title class="text-caption">{{splitname(x.author)}}</v-list-item-title> -->
|
||||
|
||||
<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.id && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
|
||||
@@ -46,25 +45,31 @@
|
||||
<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 @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
|
||||
<span class="pointer subheading">{{ x.comment.length }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
<v-card-text class="py-0">
|
||||
<v-divider/>
|
||||
<v-card-text class="pb-0">
|
||||
{{limitText(x.text)}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<!-- <v-card-actions class="py-0"> -->
|
||||
<!-- :to="'/news'" -->
|
||||
<v-btn
|
||||
color="#3E8890"
|
||||
<div class="pt-1 pl-1 pb-2">
|
||||
<v-btn
|
||||
color="light-green-darken-4"
|
||||
variant="text"
|
||||
:to='`/news?id=${x.id}`'
|
||||
|
||||
size="small"
|
||||
|
||||
append-icon="mdi-step-forward-2"
|
||||
|
||||
>
|
||||
Подробнее
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</div>
|
||||
|
||||
<!-- </v-card-actions> -->
|
||||
|
||||
|
||||
|
||||
@@ -214,7 +219,7 @@
|
||||
|
||||
</v-card>
|
||||
<div v-show="route.path=='/news'">
|
||||
<my-helper :pretext = 'newss'/>
|
||||
|
||||
|
||||
<v-pagination
|
||||
v-model="page"
|
||||
@@ -315,11 +320,7 @@ export default {
|
||||
const route = useRoute()
|
||||
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){
|
||||
|
||||
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
|
||||
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
|
||||
})
|
||||
textcomment.value=""
|
||||
}
|
||||
|
||||
const deletComment = (id, news) => {
|
||||
|
||||
+9
-2
@@ -38,14 +38,16 @@ class NewsAPIView(ListAPIView):
|
||||
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"))]
|
||||
result = []
|
||||
|
||||
print(len(newsqueryset))
|
||||
for x in newsqueryset:
|
||||
|
||||
# print(x.get_news.all(), '-----------------------x.get_news.all()')
|
||||
a=model_to_dict(x)
|
||||
a['link']= str(x.link.url)
|
||||
a['show'] = False
|
||||
a['showComment'] = False
|
||||
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)),
|
||||
"cdate":k.cdate,
|
||||
"text":k.text,
|
||||
@@ -54,6 +56,11 @@ class NewsAPIView(ListAPIView):
|
||||
]
|
||||
|
||||
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")))})
|
||||
|
||||
def post(self, request):
|
||||
|
||||
Reference in new issue
Block a user