Комметнарии

This commit is contained in:
iriska-gri committed 2023-10-09 17:00:12 +03:00
1 parent eb48b4360c
commit a5cf33553b
10 files changed
+163 -87

No files matched your search

BIN
View File
Binary file not shown.
+14
View File
@@ -25,6 +25,7 @@
"vue": "^3.2.0",
"vue-jwt-decode": "^0.1.0",
"vue-router": "^4.0.0",
"vue-scrollto": "^2.20.0",
"vue3-autocounter": "^1.0.6",
"vuelidate": "^0.7.7",
"vuetify": "^3.0.0",
@@ -6207,6 +6208,11 @@
"node": ">=12.0.0"
}
},
"node_modules/bezier-easing": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/bezier-easing/-/bezier-easing-2.1.0.tgz",
"integrity": "sha512-gbIqZ/eslnUFC1tjEvtz0sgx+xTK20wDnYMIA27VA04R7w6xxXQPZDbibjA9DTWZRA2CXtwHykkVzlCaAJAZig=="
},
"node_modules/big-integer": {
"version": "1.6.51",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
@@ -12970,6 +12976,14 @@
"vue": "^3.2.0"
}
},
"node_modules/vue-scrollto": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/vue-scrollto/-/vue-scrollto-2.20.0.tgz",
"integrity": "sha512-7i+AGKJTThZnMEkhIPgrZjyAX+fXV7/rGdg+CV283uZZwCxwiMXaBLTmIc5RTA4uwGnT+E6eJle3mXQfM2OD3A==",
"dependencies": {
"bezier-easing": "2.1.0"
}
},
"node_modules/vue3-autocounter": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/vue3-autocounter/-/vue3-autocounter-1.0.6.tgz",
+1
View File
@@ -27,6 +27,7 @@
"vue": "^3.2.0",
"vue-jwt-decode": "^0.1.0",
"vue-router": "^4.0.0",
"vue-scrollto": "^2.20.0",
"vue3-autocounter": "^1.0.6",
"vuelidate": "^0.7.7",
"vuetify": "^3.0.0",
+11 -11
View File
@@ -69,15 +69,15 @@ export default {
}
,
eventRender: function(eventObj, $el) {
$el.popover({
title: eventObj.title,
content: eventObj.description,
trigger: 'hover',
placement: 'top',
container: 'body'
});
},
// eventRender: function(eventObj, $el) {
// $el.popover({
// title: eventObj.title,
// content: eventObj.description,
// trigger: 'hover',
// placement: 'top',
// container: 'body'
// });
// },
// eventDidMount: function(info) {
@@ -120,7 +120,7 @@ export default {
data.data[x].map(e=>{
let d = new Date(e.planned_date)
// console.log(, 'e---------d.addDays(e.count_days)--------e')
calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]})
}
@@ -128,7 +128,7 @@ export default {
)
}
console.log(data.data , 'genvacation--------------------');
})
}
+97 -42
View File
@@ -3,15 +3,18 @@
<v-card
v-show="pages=='home'"
class="mx-auto mb-0 "
:ref="i"
class="mx-auto"
:class="i>0?'mt-1':''"
v-for="(x, i) in newss" :key= i
>
<v-list-item class="w-100 pl-4 py-2 pt-3">
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
image="https://avataaars.io/?avatarStyle=Transparent&topType=ShortHairShortCurly&accessoriesType=Prescription02&hairColor=Black&facialHairType=Blank&clotheType=Hoodie&clotheColor=White&eyeType=Default&eyebrowType=DefaultNatural&mouthType=Default&skinColor=Light"
:image="accountStore.user.photo"
></v-avatar>
</template>
@@ -26,22 +29,52 @@
:src="`${burl}${x.link}`"
height="164px"
cover
width="96%"
width="92%"
class="mx-auto"
/>
<v-list-item class="w-100">
<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>
<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.id && 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 @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<v-card-text class="py-3">
<v-card-text class="py-0">
{{limitText(x.text)}}
</v-card-text>
<v-card-actions>
<v-btn
color="#3E8890"
variant="text"
:to="'/news'"
>
Подробнее
</v-btn>
</v-card-actions>
<!-- :to="'/news'" -->
</v-card>
<!-- ---------------------------------------------------------------------------------- -->
<!-- ------------------------------ @click="scrollMeTo('porto')"---------------------------------------------------- -->
<v-card v-show="pages=='news'"
class="mx-auto rounded-0"
:ref="i"
v-for="(x, i) in newss" :key= i
>
<v-list-item class="w-100 pl-4 py-2 pt-3">
@@ -49,8 +82,7 @@
<v-avatar
color="grey-darken-3"
image="https://avataaars.io/?avatarStyle=Transparent&topType=ShortHairShortCurly&accessoriesType=Prescription02&hairColor=Black&facialHairType=Blank&clotheType=Hoodie&clotheColor=White&eyeType=Default&eyebrowType=DefaultNatural&mouthType=Default&skinColor=Light"
></v-avatar>
:image=accountStore.user.photo></v-avatar>
</template>
<v-list-item-title>{{x.author.fio}}</v-list-item-title>
@@ -101,28 +133,37 @@
<div
v-for = "(y, key) in x.comment"
:key="key"
class="d-flex flex-column py-3"
class="d-flex flex-column pa-3"
>
<!-- :class="accountStore.user.login==y.author.login?'text-end mr-6':''" -->
<v-row class="justify-space-between">
<v-col class="flex-grow-1 text-subtitle-2">{{ splitname(y.author) }}
<v-btn
variant="text"
size="small"
icon='mdi-delete'
color="blue-grey-darken-1"
@click="deletComment(y.id, x.id)"
/></v-col>
<v-col class="flex-grow-2 text-subtitle-2 order-3">{{dateformat(y.cdate)}} </v-col>
<v-col class="flex-grow-0"></v-col>
<v-col class="flex-grow-1 text-nowrap text-subtitle-2 pb-4"
>{{ splitname(y.author) }}
</v-col>
<v-col class="pa-0 text-center text-subtitle-2 order-3">{{dateformat(y.cdate)}} </v-col>
</v-row>
<!-- <div style="text-align: center;">
<div style="display: inline-block; text-align: left;">
Centered
Content
</div>
</div> -->
<div class="text-subtitle-2">
</div>
<v-row>
<v-col class="pr-0">
<v-alert
<v-alert
class="comWy"
color="#f9f9f9"
:border="accountStore.user.login==y.author.login?'end':'start'"
@@ -133,14 +174,22 @@
{{ y.text }}
</v-alert>
<!-- <v-card
width="400"
:subtitle=splitname(y.author)
:text=y.text
elevation="1"
color="red"
></v-card> -->
</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="blue-grey-darken-1"
@click="deletComment(y.id, x.id)"
/>
</v-col>
</v-row>
</div>
</div>
@@ -154,6 +203,7 @@
</v-card>
<v-row justify="center">
<v-dialog
v-model="dialogCommentShow"
@@ -193,6 +243,7 @@
</v-card>
</v-dialog>
</v-row>
</v-container>
</template>
@@ -207,6 +258,7 @@ import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
const accountStore = useAccountStore()
export default {
@@ -219,7 +271,6 @@ export default {
}
},
setup(props){
const newss=ref([])
const dialogCommentShow = ref(false)
@@ -238,6 +289,10 @@ export default {
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
}
const newses =() => {
}
const openComent = (news) => {
dialogCommentShow.value=!dialogCommentShow.value
idnews.value = news
@@ -245,19 +300,19 @@ export default {
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).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-----------------')
})
}
const limitText=(text)=> {
const t = text.split(' ').slice(0, 25)
console.log(text.split(' ').slice(0, 25).join(' '));
console.log(t.length<25?'':'...');
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
@@ -270,15 +325,15 @@ export default {
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver("api/navigation/news/",newss)
getfromserver(`api/navigation/news/`,newss)
}
}, {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-----------------')
})
@@ -298,8 +353,8 @@ export default {
openComent,
addComment,
idnews,
deletComment
deletComment,
newses
}
}
@@ -312,7 +367,7 @@ export default {
height: 93vh;
}
.comWy {
/* .comWy {
width: 96%;
}
} */
</style>
+21 -27
View File
@@ -19,23 +19,7 @@
title="Портал МиФНС по ЦОД № 2"
variant="text"
:to="'/'" />
<!-- @click="drawer = !drawer" -->
<!-- <v-app-bar-nav-icon
:to="'/'"
>
<img
style="cursor:pointer"
:src="imageSrc"
/>
</v-app-bar-nav-icon> -->
<!-- <v-toolbar-title >
Портал МиФНС по ЦОД № 2
</v-toolbar-title> -->
<template v-slot:image>
<v-img gradient="to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)" />
</template>
@@ -111,7 +95,7 @@
</template>
</template>
</v-app-bar>
<v-navigation-drawer :rail="rail" permanent v-model="drawer">
<v-navigation-drawer :width="245" :rail="rail" permanent v-model="drawer">
<v-row class="my-0 h-100">
<v-col class="flex-column d-flex">
<v-row><v-col>
@@ -127,11 +111,12 @@
color="navigation">
<template v-slot:prepend>
<v-icon :icon="x.ico" />
<v-icon :icon="x.ico"/>
</template>
</v-list-item>
<v-list-group v-else
:class="rail?'railmenu':''"
:key="key"
:value="x.name">
<template v-slot:activator="{ props }">
@@ -141,12 +126,13 @@
:prepend-icon="x.ico" />
</template>
<v-list-item v-for="(child, k) in x.submenu"
:href="child.link"
:key="k"
:value="child.name"
:title="child.name"
:title="!rail?child.name:menuTruncated(child.name)"
:to="child.path"
:prepend-icon="child.subIcon">
>
</v-list-item>
</v-list-group>
</template>
@@ -167,8 +153,8 @@
</v-col>
</v-row>
<v-row class="flex-grow-0">
<v-col class="py-0 pl-1">
<v-list>
<v-col class="py-0 pl-1 d-flex flex-column">
<v-list class=" d-flex flex-column ">
<v-list-item v-if="!rail" class="text-caption font-weight-bold text-truncate">
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
@@ -180,12 +166,12 @@
</v-list-item>
<v-list-item v-else>
<v-list-item v-else class="align-center ml-2">
<v-tooltip
v-model="showTooltip"
location="top">
<template v-slot:activator="{ props }">
<v-icon v-bind="props" color="grey">
<v-icon v-bind="props" color="#7A7A7A">
mdi-account-eye
</v-icon>
</template>
@@ -398,9 +384,12 @@ export default {
const drawer_right = ref(true)
const menuGetUserDialog = ref(false)
const LikeDialog = ref(false)
const rail = ref(true)
const rail = ref(false)
const showTooltip = ref(false)
const menuTruncated = (menus) => {
return menus.slice(0,2).toUpperCase()
}
const toggleTheme = () => {
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark'
@@ -485,7 +474,8 @@ export default {
// userlinks,
appStore,
rail,
showTooltip
showTooltip,
menuTruncated
}
}
@@ -504,4 +494,8 @@ export default {
display: flex;
align-items: center;
}
.railmenu .v-list-group__items .v-list-item {
padding-inline-start: 11px!important;
}
</style>
+4 -1
View File
@@ -14,6 +14,8 @@ import { createApp } from 'vue'
import { registerPlugins } from '@/plugins'
import components from '@/components/UI/index'
import Vue3Autocounter from 'vue3-autocounter';
import VueScrollTo from 'vue-scrollto'
const app = createApp(App)
components.forEach((component) => {
@@ -21,7 +23,8 @@ components.forEach((component) => {
})
app.component('vue3-autocounter', Vue3Autocounter)
app.component('vue-scrollto', VueScrollTo)
// Vue.use(VueScrollTo)
registerPlugins(app)
+10 -2
View File
@@ -1,11 +1,19 @@
<template>
<!-- <div id="app">
<a href="#" id="return-top" v-scroll-to="'#top'">Top</a>
<div ref="top">Hi. I'm #top</div> -->
<!-- </div> -->
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
О портале
</v-col>
</v-row>
</v-col>
</v-row>
</template>
<script>
+1 -2
View File
@@ -114,7 +114,7 @@
elevation="0"
>
<News-list v-if="accountStore.cod2user"/>
<News-list :page="'home'" v-if="accountStore.cod2user"/>
@@ -190,7 +190,6 @@
function proba(){
axiosApiInstance.get('api/feedback/feedbackdata/')
.then(data => {
console.log(data.data);
t_baseCriteria.value = data.data.results
})
}
+4 -2
View File
@@ -26,8 +26,10 @@ class NewsAPIView(ListAPIView):
permission_classes = (AllowAny,)
def get(self, request):
print(request.GET.get("name"), '-----------------------------------------')
newsqueryset = News.objects.all().order_by('cdate')[:10]
if request.GET.get("name") == "home":
newsqueryset = News.objects.all().order_by('cdate')[:10]
else:
newsqueryset = News.objects.all().order_by('cdate')
result = []
for x in newsqueryset:
a=model_to_dict(x)