Merge branch 'feature/create_app' of http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2 into feature/create_app

This commit is contained in:
Alex committed 2023-10-05 15:49:01 +03:00
commit d30fea6ab0
6 files changed
+212 -66

No files matched your search

BIN
View File
Binary file not shown.
+17 -8
View File
@@ -1,8 +1,6 @@
<template> <template>
<v-container class="py-1 newsVH px-0 bg-transparent overflow-auto"> <v-container class="py-1 newsVH px-0 bg-transparent overflow-auto">
<!-- <my-helper
:pretext ="newss"
/> -->
<v-card <v-card
class="mx-auto mb-0 " class="mx-auto mb-0 "
v-for="(x, i) in newss" :key= i v-for="(x, i) in newss" :key= i
@@ -105,12 +103,14 @@
class="d-flex align-center flex-column py-3" class="d-flex align-center flex-column py-3"
> >
<div class="text-subtitle-2">{{dateformat(y.cdate)}} <div class="text-subtitle-2">{{dateformat(y.cdate)}}
<v-btn <v-btn
variant="text"
icon='mdi-thumb-down-outline' size="small"
color="red-lighten-2" icon='mdi-delete'
color="blue-grey-darken-1"
@click="deletComment(y.id, x.id)"
/> />
</div> </div>
@@ -234,8 +234,16 @@ export default {
} }
}, {deep:true}) }, {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 { return {
newss, newss,
@@ -249,7 +257,8 @@ export default {
textcomment, textcomment,
openComent, openComent,
addComment, addComment,
idnews idnews,
deletComment
} }
+162 -56
View File
@@ -1,11 +1,30 @@
<template> <template>
<v-app> <v-app>
<v-app-bar :elevation="2" density="compact" color="teal-darken-4" class="pl-4"> <v-app-bar
:elevation="2"
density="compact"
color="teal-darken-4"
class="pl-4"
>
<v-icon class="px-3" size="20" :icon="rail ? 'mdi-chevron-right' : 'mdi-chevron-left'" @click="rail = !rail" /> <v-icon
<v-card class="bg-transparent py" density="compact" :prepend-avatar="imageSrc" title="Портал МиФНС по ЦОД № 2"
variant="text" :to="'/'" /> class="px-3"
size="20"
:icon="`mdi-chevron${rail?'-right':'-left'}`"
@click="rail = !rail"
/>
<v-card
class="bg-transparent py"
density="compact"
:prepend-avatar="imageSrc"
title="Портал МиФНС по ЦОД № 2"
variant="text"
:to="'/'"
/>
<!-- @click="drawer = !drawer" --> <!-- @click="drawer = !drawer" -->
<!-- <v-app-bar-nav-icon <!-- <v-app-bar-nav-icon
:to="'/'" :to="'/'"
@@ -24,17 +43,34 @@
</v-toolbar-title> --> </v-toolbar-title> -->
<template v-slot:image> <template v-slot:image>
<v-img gradient="to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)" /> <v-img
gradient="to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)"
/>
</template> </template>
<template v-slot:append> <template v-slot:append>
<template v-if="accountStore.cod2user"> <template v-if="accountStore.cod2user">
<v-card class="bg-transparent" density="compact" :prepend-avatar="accountStore.user.photo" <v-card
:title="accountStore.user.fio" :subtitle="accountStore.user.post" variant="text" @click="getcard" />
class="bg-transparent"
density="compact"
:prepend-avatar="accountStore.user.photo"
:title="accountStore.user.fio"
:subtitle="accountStore.user.post"
variant="text"
@click="getcard"
/>
<v-dialog v-model="menuGetUserDialog" persistent width="600"> <v-dialog
<Card-users :menuGetUserDialog="menuGetUserDialog" :loging="accountStore.user.login" v-model="menuGetUserDialog"
@menusClose="menuGetUserDialog = false" /> persistent
width="600"
>
<Card-users
:menuGetUserDialog="menuGetUserDialog"
:loging="accountStore.user.login"
@menusClose="menuGetUserDialog=false"
/>
</v-dialog> </v-dialog>
@@ -42,30 +78,61 @@
<v-tooltip location="bottom"> <v-tooltip location="bottom">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn v-bind="props" dark to="/faq" icon="mdi-comment-question-outline" /> <v-btn
v-bind="props"
dark
to="/faq"
icon="mdi-comment-question-outline"
/>
</template> </template>
<span>F.A.Q.</span> <span>F.A.Q.</span>
</v-tooltip> </v-tooltip>
<v-dialog v-model="LikeDialog" persistent width="800"> <v-dialog
v-model="LikeDialog"
persistent
width="800"
>
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn v-bind="props" dark icon="mdi-thumb-up-outline" /> <v-btn
v-bind="props"
dark
icon="mdi-thumb-up-outline"
/>
</template> </template>
<Card-like :LikeDialog="LikeDialog" @menusClose="LikeDialog = false" /> <Card-like
:LikeDialog="LikeDialog"
@menusClose="LikeDialog=false"
/>
</v-dialog> </v-dialog>
<v-btn icon @click="toggleTheme"> <v-btn
<v-icon class="mr-1" color="lampa"> icon
@click="toggleTheme"
>
<v-icon
class="mr-1"
color="lampa"
>
mdi-lightbulb-outline mdi-lightbulb-outline
</v-icon> </v-icon>
</v-btn> </v-btn>
<v-btn dark icon="mdi-magnify"/> <v-btn dark icon="mdi-magnify"/>
<v-btn dark icon="mdi-account-multiple-outline" @click="drawer_right = !drawer_right" /> <v-btn
<v-btn dark icon="mdi-logout" @click="accountStore.logout" /> dark
icon="mdi-account-multiple-outline"
@click="drawer_right=!drawer_right"
/>
<v-btn
dark
icon="mdi-logout"
@click="accountStore.logout"
/>
</template> </template>
@@ -80,34 +147,77 @@
</template> </template>
</template> </template>
</v-app-bar> </v-app-bar>
<v-navigation-drawer :rail="rail" permanent v-model="drawer"> <v-navigation-drawer
:rail="rail"
permanent
v-model="drawer"
>
<v-row class="my-0 h-100"> <v-row class="my-0 h-100">
<v-col class="flex-column d-flex"> <v-col class="flex-column d-flex">
<v-row><v-col> <v-row><v-col>
<v-list nav density="compact"> <v-list
nav
density="compact">
<template v-for="(x, key) in navigations"> <template v-for="(x, key) in navigations">
<v-list-item v-if="!('submenu' in x)" :key="x.key" :title="x.name" :value="x.name" :href="x.link" <v-list-item
:to="x.path" color="navigation"> v-if="!('submenu' in x)"
:key="x.key"
:title="x.name"
:value="x.name"
:href="x.link"
:to="x.path"
color="navigation"
>
<template v-slot:prepend> <template v-slot:prepend>
<v-icon :icon="x.ico" /> <v-icon
:icon="x.ico"
/>
</template> </template>
</v-list-item> </v-list-item>
<v-list-group v-else :key="key" :value="x.name"> <v-list-group
v-else
:key="key"
:value="x.name"
>
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-list-item v-bind="props" :title="x.name" :prepend-icon="x.ico" /> <v-list-item
v-bind="props"
:title="x.name"
:prepend-icon="x.ico"
/>
</template> </template>
<v-list-item v-for="(child, k) in x.submenu" :href="child.link" :key="k" :value="child.name" <v-list-item
:title="child.name" :to="child.path"> v-for="(child, k) in x.submenu"
</v-list-item>
:href="child.link"
:key="k"
:value="child.name"
:title="child.name"
:to="child.path"
/>
</v-list-group> </v-list-group>
</template> </template>
</v-list> </v-list>
<v-list nav density="compact"> <v-list
<v-list-item v-for="x of mainmenuStore.portallinks" :key="x.name" :title="x.name" :value="x.name" nav
:href="x.link" color="teal-darken-4"> density="compact"
>
<v-list-item v-for="x of mainmenuStore.portallinks"
:key="x.name"
:title="x.name"
:value="x.name"
:href="x.link"
color="teal-darken-4"
>
<template v-slot:prepend> <template v-slot:prepend>
<v-icon :icon="x.imagecode" /> <v-icon
:icon="x.imagecode"
/>
</template> </template>
</v-list-item> </v-list-item>
</v-list> </v-list>
@@ -116,7 +226,7 @@
<v-col class="py-0 pl-1"> <v-col class="py-0 pl-1">
<v-list> <v-list>
<v-list-item v-if="!rail" class="text-caption font-weight-bold text-truncate"> <v-list-item class="text-caption font-weight-bold text-truncate">
<p >Посещений всего: {{ appStore.countvisitor.totalvisit }}</p> <p >Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
<v-divider/> <v-divider/>
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p> <p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
@@ -125,21 +235,6 @@
<v-divider/> <v-divider/>
</v-list-item> </v-list-item>
<v-list-item v-else>
<v-tooltip v-model="showTooltip" location="top">
<template v-slot:activator="{ props }">
<v-icon v-bind="props">
mdi-account-eye
</v-icon>
</template>
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
<v-divider />
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
<v-divider />
<p>Уникальных посещений: {{ appStore.countvisitor.uniqtoday }}</p>
</v-tooltip>
</v-list-item>
</v-list> </v-list>
</v-col> </v-col>
</v-row> </v-row>
@@ -264,7 +359,9 @@
</v-navigation-drawer> --> </v-navigation-drawer> -->
<v-main class="d-flex bg-main_theme"> <v-main class="d-flex bg-main_theme">
<router-view />
<router-view
/>
<!-- <div class="mystat d-flex flex-column"> <!-- <div class="mystat d-flex flex-column">
<v-btn <v-btn
class="mb-1" class="mb-1"
@@ -285,8 +382,14 @@
</v-btn> </v-btn>
</div> --> </div> -->
</v-main> </v-main>
<v-navigation-drawer v-if="accountStore.cod2user" v-model="drawer_right" rail permanent location="right" <v-navigation-drawer
@click="rail = false"> v-if="accountStore.cod2user"
v-model="drawer_right"
rail
permanent
location="right"
@click="rail = false"
>
<Online-users/> <Online-users/>
@@ -306,6 +409,7 @@
</v-app> </v-app>
</template> </template>
@@ -338,9 +442,7 @@ export default {
const drawer_right=ref(true) const drawer_right=ref(true)
const menuGetUserDialog=ref(false) const menuGetUserDialog=ref(false)
const LikeDialog=ref(false) const LikeDialog=ref(false)
const rail = ref(true) const rail = ref(false)
const showTooltip = ref(false)
const toggleTheme = () => { const toggleTheme = () => {
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark' theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark'
@@ -380,6 +482,11 @@ export default {
ico: 'mdi-routes', ico: 'mdi-routes',
path:"/securyty" path:"/securyty"
}, },
{
name: 'Новости',
ico: 'mdi-newspaper',
path:"/news"
},
{ {
name: 'О портале', name: 'О портале',
ico: 'mdi-information-variant', ico: 'mdi-information-variant',
@@ -419,8 +526,7 @@ export default {
LikeDialog, LikeDialog,
// userlinks, // userlinks,
appStore, appStore,
rail, rail
showTooltip
} }
} }
+5
View File
@@ -58,6 +58,11 @@ const routes = [
name: 'AboutPortalPage', name: 'AboutPortalPage',
component: () => import('@/views/AboutPortalPage.vue'), 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['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)), 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,
"id": k.pk
} for k in x.get_comment_news.all() } for k in x.get_comment_news.all()
] ]
@@ -62,7 +63,13 @@ class NewsAPIView(ListAPIView):
if 'text' in request.data: if 'text' in request.data:
CommentNews.objects.create(news_id=request.data['news'], author=self.request.user, text=request.data['text']) 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)) "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']))} } for y in CommentNews.objects.filter(news_id=request.data['news']))}