Merge branch 'razrab' into feature/create_app

This commit is contained in:
iriska-gri committed 2023-10-05 13:42:52 +03:00
commit cd4dd6dfd4
5 files changed
+59 -13

No files matched your search

+18 -9
View File
@@ -1,8 +1,6 @@
<template>
<v-container class="py-1 newsVH px-0 bg-transparent overflow-auto">
<!-- <my-helper
:pretext ="newss"
/> -->
<v-card
class="mx-auto mb-0 "
v-for="(x, i) in newss" :key= i
@@ -105,13 +103,15 @@
class="d-flex align-center flex-column py-3"
>
<div class="text-subtitle-2">{{dateformat(y.cdate)}}
<v-btn
icon='mdi-thumb-down-outline'
color="red-lighten-2"
/>
variant="text"
size="small"
icon='mdi-delete'
color="blue-grey-darken-1"
@click="deletComment(y.id, x.id)"
/>
</div>
<v-card
@@ -234,7 +234,15 @@ export default {
}
}, {deep:true})
const deletComment = (id, news) => {
axiosApiInstance.post(`api/navigation/news/`, {delid: id, news: news}).then(result => {
// dialogCommentShow.value=!dialogCommentShow.value
newss.value[newss.value.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
console.log(result.data, 'result.data-----------------')
})
}
return {
@@ -249,7 +257,8 @@ export default {
textcomment,
openComent,
addComment,
idnews
idnews,
deletComment
}
+8 -2
View File
@@ -9,9 +9,10 @@
>
<v-icon
class="px-3"
size="20"
:icon="rail?'mdi-chevron-right':'mdi-chevron-left'"
:icon="`mdi-chevron${rail?'-right':'-left'}`"
@click="rail = !rail"
/>
@@ -441,7 +442,7 @@ size="20"
const drawer_right=ref(true)
const menuGetUserDialog=ref(false)
const LikeDialog=ref(false)
const rail = ref(true)
const rail = ref(false)
const toggleTheme = () => {
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark'
@@ -481,6 +482,11 @@ size="20"
ico: 'mdi-routes',
path:"/securyty"
},
{
name: 'Новости',
ico: 'mdi-newspaper',
path:"/news"
},
{
name: 'О портале',
ico: 'mdi-information-variant',
+5
View File
@@ -58,6 +58,11 @@ const routes = [
name: 'AboutPortalPage',
component: () => import('@/views/AboutPortalPage.vue'),
},
{
path: '/news',
name: 'AboutNewsPage',
component: () => import('@/views/NewsPage.vue'),
},
],
},
]
+19
View File
@@ -0,0 +1,19 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Новости
</v-col>
</v-row>
</template>
<script>
export default {
}
</script>
<style>
</style>
+9 -2
View File
@@ -39,7 +39,8 @@ class NewsAPIView(ListAPIView):
a['scores'] = [{"score":y.score, "user":y.author.username} 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
"text":k.text,
"id": k.pk
} for k in x.get_comment_news.all()
]
@@ -62,7 +63,13 @@ class NewsAPIView(ListAPIView):
if 'text' in request.data:
CommentNews.objects.create(news_id=request.data['news'], author=self.request.user, text=request.data['text'])
back = {'news': request.data['news'], 'comment': ({"text":y.text, "cdate":y.cdate,
back = {'news': request.data['news'], 'comment': ({"text":y.text, "cdate":y.cdate, "id": y.pk,
"author":model_to_dict(DictEmployee.objects.using('user_directory').get(login=y.author.username))
} for y in CommentNews.objects.filter(news_id=request.data['news']))}
if 'delid' in request.data:
CommentNews.objects.filter(pk=request.data['delid']).delete()
back = {'news': request.data['news'], 'comment': ({"text":y.text, "cdate":y.cdate, "id": y.pk,
"author":model_to_dict(DictEmployee.objects.using('user_directory').get(login=y.author.username))
} for y in CommentNews.objects.filter(news_id=request.data['news']))}