Merge branch 'razrab'
No files matched your search
@@ -1,26 +1,27 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "front",
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"dependencies": {
|
||||
"@mdi/font": "7.0.96",
|
||||
"@vuelidate/core": "^2.0.3",
|
||||
"@vuelidate/validators": "^2.0.3",
|
||||
"axios": "^1.4.0",
|
||||
"chart.js": "^4.4.0",
|
||||
"chart.js": "^4.4.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"express-vue": "^5.12.0",
|
||||
"moment": "^2.29.4",
|
||||
"pinia": "^2.0.23",
|
||||
"roboto-fontface": "*",
|
||||
"v-tooltip": "^2.1.3",
|
||||
"vue": "^3.2.0",
|
||||
"vue-cal": "^4.8.1",
|
||||
"vue-chartjs": "^5.2.0",
|
||||
"vue-chartjs": "^5.3.0",
|
||||
"vue-jwt-decode": "^0.1.0",
|
||||
"vue-router": "^4.0.0",
|
||||
"vue3-autocounter": "^1.0.6",
|
||||
@@ -7353,9 +7354,9 @@
|
||||
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="
|
||||
},
|
||||
"node_modules/chart.js": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.0.tgz",
|
||||
"integrity": "sha512-vQEj6d+z0dcsKLlQvbKIMYFHd3t8W/7L2vfJIbYcfyPcRx92CsHqECpueN8qVGNlKyDcr5wBrYAYKnfu/9Q1hQ==",
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.1.tgz",
|
||||
"integrity": "sha512-C74QN1bxwV1v2PEujhmKjOZ7iUM4w6BWs23Md/6aOZZSlwMzeCIDGuZay++rBgChYru7/+QFeoQW0fQoP534Dg==",
|
||||
"dependencies": {
|
||||
"@kurkle/color": "^0.3.0"
|
||||
},
|
||||
@@ -13648,6 +13649,14 @@
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/move-concurrently": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
|
||||
@@ -21483,9 +21492,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vue-chartjs": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-5.2.0.tgz",
|
||||
"integrity": "sha512-d3zpKmGZr2OWHQ1xmxBcAn5ShTG917+/UCLaSpaCDDqT0U7DBsvFzTs69ZnHCgKoXT55GZDW8YEj9Av+dlONLA==",
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-5.3.0.tgz",
|
||||
"integrity": "sha512-8XqX0JU8vFZ+WA2/knz4z3ThClduni2Nm0BMe2u0mXgTfd9pXrmJ07QBI+WAij5P/aPmPMX54HCE1seWL37ZdQ==",
|
||||
"peerDependencies": {
|
||||
"chart.js": "^4.1.1",
|
||||
"vue": "^3.0.0-0 || ^2.7.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
@@ -14,15 +14,16 @@
|
||||
"@vuelidate/core": "^2.0.3",
|
||||
"@vuelidate/validators": "^2.0.3",
|
||||
"axios": "^1.4.0",
|
||||
"chart.js": "^4.4.0",
|
||||
"chart.js": "^4.4.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"express-vue": "^5.12.0",
|
||||
"moment": "^2.29.4",
|
||||
"pinia": "^2.0.23",
|
||||
"roboto-fontface": "*",
|
||||
"v-tooltip": "^2.1.3",
|
||||
"vue": "^3.2.0",
|
||||
"vue-cal": "^4.8.1",
|
||||
"vue-chartjs": "^5.2.0",
|
||||
"vue-chartjs": "^5.3.0",
|
||||
"vue-jwt-decode": "^0.1.0",
|
||||
"vue-router": "^4.0.0",
|
||||
"vue3-autocounter": "^1.0.6",
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
<template>
|
||||
<v-card
|
||||
class="rounded-0 h-100 flex-column d-flex"
|
||||
min-height="410"
|
||||
max-height="410"
|
||||
>
|
||||
<v-card-title class="pb-1">
|
||||
{{news.title}}
|
||||
</v-card-title>
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="d-flex flex-column ">
|
||||
<v-img
|
||||
:src="`${burl}${news.link}`"
|
||||
height="175px"
|
||||
width="92%"
|
||||
class="mx-auto"
|
||||
cover
|
||||
@click="openOneImg(news.link)"
|
||||
/>
|
||||
<!-- <v-list-item class="d-flex flex-column w-100 "> -->
|
||||
<!-- <v-row class="bg-red ma-0 d-flex">
|
||||
<v-col>
|
||||
<v-icon size="x-small" class="me-1" icon="mdi-account"/>
|
||||
<span class="text-caption me-2">
|
||||
{{splitname(news.author)}}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col>1</v-col>
|
||||
</v-row> -->
|
||||
|
||||
<!-- <div class="justify-self-start mt-1">
|
||||
<v-icon size="x-small" class="me-1" icon="mdi-account"/>
|
||||
<span class="text-caption me-2">
|
||||
{{splitname(news.author)}}
|
||||
</span>
|
||||
</div>
|
||||
<template v-slot:append>
|
||||
<div class="justify-self-end">
|
||||
<v-icon
|
||||
size="x-small"
|
||||
class="me-1"
|
||||
:icon="news.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'"
|
||||
@click="toggleIncrementLike(news.id, true)"
|
||||
/>
|
||||
<span class="subheading me-2">
|
||||
{{news.scores.filter(e=> e.score==true).length}}
|
||||
</span>
|
||||
<span class="me-1">
|
||||
·
|
||||
</span>
|
||||
<v-icon
|
||||
size="x-small"
|
||||
class="me-1"
|
||||
:icon="news.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'"
|
||||
@click="toggleIncrementLike(news.id, false)"
|
||||
/>
|
||||
<span class="subheading me-2">
|
||||
{{news.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"
|
||||
/>
|
||||
<span class="subheading">
|
||||
{{ news.comment.length }}
|
||||
</span>
|
||||
<span class="me-1">
|
||||
·
|
||||
</span>
|
||||
<v-icon
|
||||
size="x-small"
|
||||
class="me-1 mb-1"
|
||||
icon="mdi-image"
|
||||
/>
|
||||
<span class="subheading">
|
||||
{{ news.gallery.length }}
|
||||
</span>
|
||||
</div>
|
||||
</template> -->
|
||||
<!-- </v-list-item> -->
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider/>
|
||||
<v-row class="ma-0 flex-grow-0">
|
||||
<v-col
|
||||
class="py-1 pl-4"
|
||||
lg=5
|
||||
md=12
|
||||
sm=12
|
||||
>
|
||||
<v-icon size="x-small" class="me-1" icon="mdi-account"/>
|
||||
<span class="text-caption me-2">
|
||||
{{splitname(news.author)}}
|
||||
</span>
|
||||
</v-col>
|
||||
<v-col
|
||||
lg=7
|
||||
md=12
|
||||
sm=12
|
||||
class="py-1 text-end pr-4">
|
||||
<div class="justify-self-end">
|
||||
<v-icon
|
||||
size="x-small"
|
||||
class="me-1"
|
||||
:icon="news.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'"
|
||||
@click="toggleIncrementLike(news.id, true)"
|
||||
/>
|
||||
<span class="subheading me-2">
|
||||
{{news.scores.filter(e=> e.score==true).length}}
|
||||
</span>
|
||||
<span class="me-1">
|
||||
·
|
||||
</span>
|
||||
<v-icon
|
||||
size="x-small"
|
||||
class="me-1"
|
||||
:icon="news.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'"
|
||||
@click="toggleIncrementLike(news.id, false)"
|
||||
/>
|
||||
<span class="subheading me-2">
|
||||
{{news.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"
|
||||
/>
|
||||
<span class="subheading">
|
||||
{{ news.comment.length }}
|
||||
</span>
|
||||
<span class="me-1">
|
||||
·
|
||||
</span>
|
||||
<v-icon
|
||||
size="x-small"
|
||||
class="me-1 mb-1"
|
||||
icon="mdi-image"
|
||||
/>
|
||||
<span class="subheading">
|
||||
{{ news.gallery.length }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider/>
|
||||
<v-row class="ma-0 overflow-auto">
|
||||
<v-col
|
||||
class="py-0"
|
||||
:class="news.text.length==0?'align-self-center':'my-3'"
|
||||
>
|
||||
<v-card-text class="py-0 px-2">
|
||||
|
||||
<div v-if="news.text.length>0" v-html=limitText(news.text)></div>
|
||||
<div v-else class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light">Без описания</div>
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider/>
|
||||
<v-row class="flex-grow-0 ma-0">
|
||||
<v-col>
|
||||
<v-btn
|
||||
color="more_details_btn"
|
||||
variant="text"
|
||||
:to='`/newsfull?id=${news.id}`'
|
||||
size="small"
|
||||
append-icon="mdi-step-forward-2"
|
||||
>
|
||||
Подробнее
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import {splitname} from '@/utils/universal_functions'
|
||||
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
props: {
|
||||
news: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
},
|
||||
|
||||
setup(props, {emit}){
|
||||
|
||||
const burl = baseURL.slice(0,-1)
|
||||
|
||||
|
||||
|
||||
|
||||
const limitText=(text)=> {
|
||||
let parser = new DOMParser().parseFromString(text, "text/html");
|
||||
let doc = parser.body.textContent || ""
|
||||
doc = doc.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`)
|
||||
const t = doc.split(' ').slice(0, 50)
|
||||
return `${doc.split(' ').slice(0, 50).join(' ')} ${t.length<50?'':'...'}`
|
||||
}
|
||||
|
||||
|
||||
|
||||
const toggleIncrementLike = (newss, scores) => {
|
||||
axiosApiInstance.post(`api/navigation/newscrossroad/`, {news: newss, scores: scores}).then(result => {
|
||||
props.news.scores = result.data
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const openOneImg = () => {
|
||||
emit('openOneImg')
|
||||
}
|
||||
|
||||
return {
|
||||
accountStore,
|
||||
burl,
|
||||
limitText,
|
||||
splitname,
|
||||
toggleIncrementLike,
|
||||
openOneImg
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -31,6 +31,7 @@
|
||||
<v-img
|
||||
class="h-100"
|
||||
cover
|
||||
max-height="250px"
|
||||
:src="checkremote( `${spravURL}${userlinks.login}.jpg`)"
|
||||
/>
|
||||
</v-col>
|
||||
@@ -143,7 +144,8 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
setup(props, context) {
|
||||
setup(props
|
||||
, context) {
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
const userlinks = ref([])
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card
|
||||
class="bg-white pa-3 px-0"
|
||||
class="bg-white pa-1 px-0 "
|
||||
width="550"
|
||||
height="600"
|
||||
|
||||
>
|
||||
<v-card
|
||||
class="mx-auto overflow-auto mx-0 px-3"
|
||||
class="mx-auto overflow-auto mx-0 px-0"
|
||||
width="550"
|
||||
height="600"
|
||||
flat
|
||||
@@ -20,18 +20,19 @@
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pa-0 mb-3">
|
||||
|
||||
<v-col class="pa-0 mb-1">
|
||||
<v-divider class=""/>
|
||||
<v-text-field
|
||||
v-model="searchname"
|
||||
clearable
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
hide-details
|
||||
class="mx-0"
|
||||
class="ma-0"
|
||||
label="Поиск"
|
||||
rows="1"
|
||||
no-resize
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
@@ -43,7 +44,7 @@
|
||||
<div
|
||||
v-for="(x, key) in result"
|
||||
:key="key"
|
||||
class="px-3" >
|
||||
class="px-3 ddd" >
|
||||
|
||||
<v-list class="py-0">
|
||||
<v-list-subheader>{{key}} </v-list-subheader>
|
||||
@@ -53,7 +54,7 @@ class="px-3" >
|
||||
v-for="item in x"
|
||||
:key="item"
|
||||
|
||||
class="bg-transparent"
|
||||
class="bg-transparent "
|
||||
density="compact"
|
||||
:prepend-avatar="checkremote(`${spravURL}${item.login}.jpg`)"
|
||||
:title="item.fio"
|
||||
@@ -67,8 +68,8 @@ class="px-3" >
|
||||
</div>
|
||||
|
||||
</v-card>
|
||||
<v-divider/>
|
||||
<v-card-actions class="align-self-end pb-0">
|
||||
<v-divider class=""/>
|
||||
<v-card-actions class="pb-0" style="place-content: end">
|
||||
<v-btn
|
||||
color="more_details_btn"
|
||||
variant="text"
|
||||
@@ -135,6 +136,7 @@ export default {
|
||||
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${props.idpos}`).then(data => {
|
||||
|
||||
t_dailyRound.value = data.data.daily
|
||||
console.log(data.data.daily,'-------------------------');
|
||||
|
||||
|
||||
|
||||
@@ -152,7 +154,7 @@ export default {
|
||||
get() {
|
||||
let ob={}
|
||||
Object.keys(t_dailyRound.value).map(el1 => {
|
||||
let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(searchname.value))
|
||||
let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(searchname.value.toLowerCase()))
|
||||
|
||||
if(myarr.length>0)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="d-flex h-100">
|
||||
<div class="d-flex h-100 ">
|
||||
|
||||
<v-card
|
||||
v-if="t_daily.length > 0"
|
||||
@@ -19,7 +19,11 @@
|
||||
elevation="0"
|
||||
>
|
||||
<v-card class="h-100 text-center text-black_grey bg-black_and_white">
|
||||
<v-card-title class="statstyle py-0 text-overline font-weight-bold bg-black_and_white">
|
||||
<v-card-title
|
||||
class="statstyle py-0
|
||||
text-xl-overline
|
||||
text-lg-subtitle-1
|
||||
text-md-h5 font-weight-bold bg-black_and_white">
|
||||
{{x.position__name}}
|
||||
</v-card-title>
|
||||
<v-card-text
|
||||
@@ -60,7 +64,7 @@
|
||||
</v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row >
|
||||
<v-row class="ma-3">
|
||||
<!-- <v-col class="fiction flex-column d-flex align-self-center"> -->
|
||||
<v-card-text class="d-flex flex-column align-self-center " v-if="changeData">
|
||||
<!-- <v-row> -->
|
||||
@@ -91,9 +95,15 @@
|
||||
<!-- </v-col> -->
|
||||
<!-- </v-row> -->
|
||||
</v-card-text>
|
||||
<v-card-text v-else>
|
||||
|
||||
<v-row class="text-h5 text-white text-center h-100" align-content="center">Данные не загружены </v-row>
|
||||
<v-card-text v-else class="w-100">
|
||||
<!-- class="text-h5 text-white text-center h-100 text-sm-overline" -->
|
||||
<v-row
|
||||
class="text-white text-center text-lg-h5 h-100"
|
||||
align-content="center"
|
||||
justify="center"
|
||||
>
|
||||
Данные не загружены
|
||||
</v-row>
|
||||
|
||||
</v-card-text>
|
||||
<!-- </v-col> -->
|
||||
|
||||
@@ -1,58 +1,48 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row>
|
||||
<v-col>
|
||||
1
|
||||
<v-row class=" flex-grow-1 pa-1 d-flex h-0 overflow-auto">
|
||||
<v-col
|
||||
v-for="(x, key) in newsAll"
|
||||
:key="key"
|
||||
xl=3
|
||||
lg=4
|
||||
md=12
|
||||
sm=12
|
||||
xs=12
|
||||
cols=12
|
||||
class="d-flex pa-1 flex-column "
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="bg-red">
|
||||
<v-row class="flex-grow-0 ">
|
||||
<v-col class="pa-0" >
|
||||
<v-pagination
|
||||
v-model="page"
|
||||
:length=newsAll.countpage
|
||||
:length=countetnews+1
|
||||
:total-visible="7"
|
||||
@update:modelValue="loadNewsAll"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0" LG=2>
|
||||
<v-col class="flex-grow-0 py-0">
|
||||
<v-select
|
||||
style="width:53px"
|
||||
hide-details
|
||||
hide-selected
|
||||
density="compact"
|
||||
v-model="countpage"
|
||||
rounded
|
||||
variant="underlined"
|
||||
:items="[1, 8, 16, 24, 32, 40]"
|
||||
:items="[8, 16, 24, 32, 40]"
|
||||
@update:modelValue="loadNewsAll"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<!-- <div>
|
||||
<div>
|
||||
|
||||
{{newsAll.result}}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<v-pagination
|
||||
v-model="page"
|
||||
:length=newsAll.countpage
|
||||
:total-visible="7"
|
||||
@update:modelValue="loadNewsAll"
|
||||
/>
|
||||
<v-select
|
||||
hide-details
|
||||
density="compact"
|
||||
v-model="countpage"
|
||||
variant="underlined"
|
||||
:items="[1, 8, 16, 24, 32, 40]"
|
||||
@update:modelValue="loadNewsAll"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
@@ -60,20 +50,29 @@
|
||||
import { ref } from 'vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
import myHelper from './UI/my-helper.vue'
|
||||
import newsCard from './UI/news-card.vue'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
myHelper,
|
||||
newsCard
|
||||
},
|
||||
|
||||
setup(){
|
||||
|
||||
const newsAll=ref([])
|
||||
const countetnews = ref(0)
|
||||
const page = ref(1)
|
||||
const countpage = ref(1)
|
||||
const countpage = ref(8)
|
||||
const route = useRoute()
|
||||
|
||||
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
newsAll.value= result.data
|
||||
}
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage/countpage.value
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -81,12 +80,14 @@ export default {
|
||||
|
||||
return {
|
||||
newsAll,
|
||||
countetnews,
|
||||
page,
|
||||
countpage,
|
||||
loadNewsAll
|
||||
loadNewsAll,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -0,0 +1,632 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="Object.keys(newsFull).length>0"
|
||||
class="d-flex flex-column flex-fill"
|
||||
>
|
||||
<v-row class="d-flex flex-row ma-0">
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="pb-0 pr-0 ">
|
||||
<v-card
|
||||
height="350px"
|
||||
class="rounded-b-0"
|
||||
>
|
||||
<v-card-title class="pt-0 pb-1 flex-column d-flex">
|
||||
<v-row>
|
||||
<v-col lg=9 class="pt-4">
|
||||
{{newsFull.title}}
|
||||
</v-col>
|
||||
<v-col class="pa-0 pr-3 pt-1 flex-grow-1 d-flex flex-column flex-wrap">
|
||||
<v-switch
|
||||
v-model="gallery"
|
||||
class="align-self-end comgal"
|
||||
hide-details
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-tooltip location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon
|
||||
v-bind="props"
|
||||
icon='mdi-message-text-outline'
|
||||
color="pink-darken-4"
|
||||
/>
|
||||
<span class="pl-3">
|
||||
{{ newsFull.comment.length }}
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
Чат
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-tooltip location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon
|
||||
v-bind="props"
|
||||
:icon="'mdi-image'"
|
||||
color="teal-darken-2"
|
||||
/>
|
||||
<span class="pl-3">
|
||||
{{newsFull.gallery.length}}
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
Галерея
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
|
||||
<!-- -->
|
||||
<v-img
|
||||
:src="`${burl}${newsFull.link}`"
|
||||
height="450px"
|
||||
width="96%"
|
||||
class="mx-auto"
|
||||
cover
|
||||
@click="openOneImg(newsFull.link)"
|
||||
|
||||
/>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pt-0 pr-0">
|
||||
<v-card
|
||||
class="rounded-t-0 flex-column d-flex h-100 Line truncated
|
||||
>
|
||||
<v-list-item class="w-100">
|
||||
<template v-slot:prepend>
|
||||
<v-avatar
|
||||
color="loading_avatar"
|
||||
:image="checkremote(`${spravURL}${newsFull.author.login}.jpg`)"
|
||||
size="25"
|
||||
/>
|
||||
<v-list-item-title class="text-caption">
|
||||
{{splitname(newsFull.author)}}
|
||||
</v-list-item-title>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<div class="justify-self-end">
|
||||
<v-icon
|
||||
class="me-1"
|
||||
:icon="newsFull.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'"
|
||||
@click="toggleIncrementLike(newsFull.id, true)"
|
||||
/>
|
||||
<span class="subheading me-2">
|
||||
{{newsFull.scores.filter(e=> e.score==true).length}}
|
||||
</span>
|
||||
<span class="me-1">
|
||||
·
|
||||
</span>
|
||||
<v-icon
|
||||
class="me-1"
|
||||
:icon="newsFull.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'"
|
||||
@click="toggleIncrementLike(newsFull.id, false)"
|
||||
/>
|
||||
<span class="subheading me-2">
|
||||
{{newsFull.scores.filter(e=> e.score==false).length}}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-divider/>
|
||||
<v-row class="ma-0 my-3 overflow-auto h-0">
|
||||
<v-col class="pa-0">
|
||||
<v-card-text class="pt-0">
|
||||
<div
|
||||
v-if="newsFull.text"
|
||||
v-html=formatText(newsFull.text)>
|
||||
</div>
|
||||
<div v-else>
|
||||
<v-row>
|
||||
<v-col
|
||||
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||
>
|
||||
Без описания
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row
|
||||
class="d-flex flex-column "
|
||||
v-if="gallery"
|
||||
>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-card
|
||||
class="h-100 flex-column pa-3 d-flex overflow-auto overflow-x-hidden"
|
||||
>
|
||||
<div
|
||||
class="flex-column d-flex ma-3"
|
||||
>
|
||||
<v-row
|
||||
style="height:250px"
|
||||
class="justify-space-between"
|
||||
v-if="newsFull.gallery.length>0"
|
||||
>
|
||||
|
||||
<v-col
|
||||
v-for="e in newsFull.gallery" :key=e
|
||||
:lg="Math.floor(Math.random() * (Math.floor(5) - Math.ceil(3)) + Math.ceil(2))"
|
||||
class="flex-column d-flex pa-0 pb-3"
|
||||
>
|
||||
|
||||
<div
|
||||
|
||||
class='h-100 w-100 flex-column d-flex'
|
||||
>
|
||||
<v-row>
|
||||
<v-col class="d-flex">
|
||||
|
||||
<v-img
|
||||
cover
|
||||
|
||||
class=" pointer"
|
||||
:src="`${burl}${e.img}`"
|
||||
@click="openImg(e.id)"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-0 mt-0 align-self-center ">
|
||||
<v-col class="pa-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
size="small"
|
||||
:color="heartIcoAll(e)?'red':'black'"
|
||||
:icon= "heartIcoAll(e)?'mdi-heart':'mdi-heart-outline'"
|
||||
@click = toggleLikeAll(e.id)
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="pa-0 pl-1" >
|
||||
{{e.likes.length}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
<v-row v-else>
|
||||
<v-col
|
||||
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||
>
|
||||
|
||||
У новости нет фотографий
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
|
||||
<v-row v-else>
|
||||
<v-col class="">
|
||||
<v-card
|
||||
class="h-100 flex-column d-flex"
|
||||
>
|
||||
<v-row class="ma-0 my-3 overflow-auto h-0" v-if="newsFull.comment.length>0">
|
||||
<v-col class="pa-0">
|
||||
<v-card-text class="pt-0">
|
||||
|
||||
<div
|
||||
v-for = "(y, key) in newsFull.comment"
|
||||
:key="key"
|
||||
class="d-flex flex-column pa-3"
|
||||
>
|
||||
|
||||
|
||||
<v-row
|
||||
class="justify-space-between ma-0 align-center bgchat mr-7"
|
||||
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
|
||||
|
||||
>
|
||||
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
|
||||
|
||||
>
|
||||
{{ accountStore.user.login==y.author.login?'':splitname(y.author) }}
|
||||
</v-col>
|
||||
<v-col class="pa-0 text-center text-subtitle-2 ">
|
||||
|
||||
{{dateformat(y.cdate)}}
|
||||
</v-col>
|
||||
<v-col class="pa-0 pr-2 text-end text-subtitle-2 ">
|
||||
{{ accountStore.user.login!=y.author.login?'':splitname(y.author) }}
|
||||
</v-col>
|
||||
|
||||
|
||||
</v-row>
|
||||
|
||||
<div class="text-subtitle-2">
|
||||
|
||||
|
||||
</div>
|
||||
<v-row>
|
||||
<v-col class="pr-0">
|
||||
<v-alert
|
||||
|
||||
|
||||
color="bg_white"
|
||||
rounded=0
|
||||
:border="accountStore.user.login==y.author.login?'end':'start'"
|
||||
:border-color="accountStore.user.login==y.author.login?'success':'deep-purple accent-4'"
|
||||
elevation=0
|
||||
>
|
||||
|
||||
{{ y.text }}
|
||||
|
||||
</v-alert>
|
||||
</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="delete_btn"
|
||||
@click="deletComment(y.id, newsFull.id)"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-else>
|
||||
<v-col
|
||||
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||
>
|
||||
Оставьте первый комментарий
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider/>
|
||||
<v-row class="flex-grow-0 ma-1">
|
||||
<v-col>
|
||||
|
||||
<v-textarea
|
||||
label="Комментарий"
|
||||
no-resize
|
||||
variant="underlined"
|
||||
rows="1"
|
||||
row-height="25"
|
||||
shaped
|
||||
hide-details
|
||||
v-model="textcomment"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0 pl-0 py-0 align-self-center">
|
||||
<v-btn
|
||||
variant="text"
|
||||
density="compact"
|
||||
icon="mdi-google-play"
|
||||
color="teal-darken-4"
|
||||
:disabled="textcomment==''"
|
||||
@click="addComment(newsFull.id)"
|
||||
/>
|
||||
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogfoto"
|
||||
width="w-100"
|
||||
height="900"
|
||||
class="flex-column "
|
||||
>
|
||||
<v-card class="pa-4 h-100 flex-column d-flex">
|
||||
<v-row class="flex-grow-0 justify-end">
|
||||
<v-col class="pa-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
@click="dialogfoto = false"
|
||||
|
||||
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="flex-grow-0 align-self-center">
|
||||
<v-btn
|
||||
:disabled="newsFull.gallery.length==1"
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-chevron-left"
|
||||
@click = "indximg !=0? indximg -=1:indximg=newsFull.gallery.length-1"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="flex-column h_cards pa-0">
|
||||
<v-img
|
||||
class="d-flex"
|
||||
:src="`${burl}${galleryimges.img}`"
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column flex-grow-0">
|
||||
|
||||
<v-row>
|
||||
<v-col class="flex-column d-flex align-end align-self-center">
|
||||
<v-btn
|
||||
:disabled="newsFull.gallery.length==1"
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-chevron-right"
|
||||
@click = "indximg !=newsFull.gallery.length-1? indximg +=1:indximg=0"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-1 align-self-center d-flex placeIt">
|
||||
<v-col class="pa-0">
|
||||
<v-btn
|
||||
|
||||
density="compact"
|
||||
variant="text"
|
||||
:color="heartIco()?'red':'black'"
|
||||
:icon= "heartIco()?'mdi-heart':'mdi-heart-outline'"
|
||||
@click = toggleLike(galleryimges.id)
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="pa-0 text-overline">
|
||||
{{galleryimges.likes.length}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogfotoOne"
|
||||
width="w-100"
|
||||
height="900"
|
||||
class="flex-column "
|
||||
>
|
||||
<v-card class="pa-4 h-100 flex-column d-flex">
|
||||
<v-row class="flex-grow-0 justify-end">
|
||||
<v-col class="pa-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
@click="dialogfotoOne = false"
|
||||
|
||||
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
|
||||
<v-col class="flex-column h_cards pa-0">
|
||||
<v-img
|
||||
class="d-flex"
|
||||
:src="`${burl}${galleryimges}`"
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useRoute } from 'vue-router'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { ref, watch } from 'vue'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import { spravURL } from '@/utils/axios-api'
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
import { format } from 'date-fns'
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
export default {
|
||||
|
||||
|
||||
|
||||
setup(){
|
||||
|
||||
|
||||
const textcomment = ref('')
|
||||
const route = useRoute()
|
||||
const newsFull=ref([])
|
||||
const gallery = ref(false)
|
||||
|
||||
const burl = baseURL.slice(0,-1)
|
||||
|
||||
const loadNews = () => {
|
||||
axiosApiInstance.get(`api/navigation/newscrossroad/?id=${route.query.id}`).then(result => {
|
||||
newsFull.value=result.data.result[0]
|
||||
|
||||
|
||||
// newss.value= result.data
|
||||
// if (newss.value.result[0].gallery.length > 0) {
|
||||
// newss.value.result[0].gallery.forEach(e=>
|
||||
// e.bg=colors[Math.floor(Math.random() * colors.length)
|
||||
|
||||
// ]
|
||||
|
||||
// )
|
||||
if (newsFull.value.gallery.length> 0) {
|
||||
gallery.value = true
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
loadNews()
|
||||
|
||||
const splitname = (name) => {
|
||||
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
|
||||
}
|
||||
|
||||
const formatText= (text) => {
|
||||
|
||||
return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`)
|
||||
|
||||
}
|
||||
|
||||
const dateformat = (datas) => {
|
||||
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
|
||||
}
|
||||
|
||||
const addComment = (idnew) => {
|
||||
|
||||
|
||||
|
||||
axiosApiInstance.post(`api/navigation/newscrossroad/`, {news: idnew, text: textcomment.value}).then(result => {
|
||||
newsFull.value.comment= result.data.comment
|
||||
})
|
||||
textcomment.value=""
|
||||
}
|
||||
|
||||
const deletComment = (id, news) => {
|
||||
axiosApiInstance.post(`api/navigation/newscrossroad/`, {delid: id, news: news}).then(result => {
|
||||
newsFull.value.comment= result.data.comment
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const heartIcoAll = (image) => {
|
||||
return image.likes.filter(e=>e.user==accountStore.user.login).length==1
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------ Галерея
|
||||
const galleryimges=ref([])
|
||||
const dialogfoto = ref(false)
|
||||
const dialogfotoOne = ref(false)
|
||||
const indximg = ref('')
|
||||
|
||||
const openImg = (idimg) => {
|
||||
dialogfoto.value = true
|
||||
indximg.value = newsFull.value.gallery.findIndex(e=>e.id == idimg)
|
||||
}
|
||||
|
||||
const openOneImg = (idimg) => {
|
||||
dialogfotoOne.value = true
|
||||
galleryimges.value = idimg
|
||||
console.log(idimg);
|
||||
|
||||
}
|
||||
|
||||
watch(()=>indximg ,(newValue,oldValue)=>{
|
||||
if(newValue){
|
||||
galleryimges.value = newsFull.value.gallery[newValue.value]
|
||||
}
|
||||
|
||||
}, {deep:true})
|
||||
|
||||
|
||||
|
||||
|
||||
// Лайки на фотографии
|
||||
|
||||
const toggleLike = (idimage) => {
|
||||
axiosApiInstance.post(`api/navigation/gallery/`, {image: idimage}).then(result => {
|
||||
galleryimges.value.likes= result.data
|
||||
})
|
||||
}
|
||||
|
||||
const toggleLikeAll = (idimage) => {
|
||||
axiosApiInstance.post(`api/navigation/gallery/`, {image: idimage}).then(result => {
|
||||
newsFull.value.gallery.filter(e=>e.id ==idimage)[0].likes = result.data
|
||||
})
|
||||
}
|
||||
const heartIco = () => {
|
||||
return galleryimges.value.likes.filter(e=>e.user==accountStore.user.login).length==1
|
||||
}
|
||||
|
||||
const toggleIncrementLike = (news, scores) => {
|
||||
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
|
||||
newsFull.value.scores= result.data
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
route,
|
||||
newsFull,
|
||||
gallery,
|
||||
burl,
|
||||
checkremote,
|
||||
spravURL,
|
||||
splitname,
|
||||
accountStore,
|
||||
formatText,
|
||||
dateformat,
|
||||
textcomment,
|
||||
addComment,
|
||||
deletComment,
|
||||
heartIcoAll,
|
||||
heartIco,
|
||||
toggleLikeAll,
|
||||
toggleLike,
|
||||
openImg,
|
||||
dialogfoto,
|
||||
galleryimges,
|
||||
indximg,
|
||||
toggleIncrementLike,
|
||||
openOneImg,
|
||||
dialogfotoOne
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.comgal .v-switch__thumb {
|
||||
|
||||
color: white!important;
|
||||
|
||||
}
|
||||
|
||||
.h_cards {
|
||||
|
||||
height: 86vh;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row class="mt-0 h-0 overflow-auto ">
|
||||
<v-col
|
||||
v-for="(x, key) in newsAll"
|
||||
:key="key"
|
||||
class="pb-1 pt-0"
|
||||
lg=12
|
||||
md=6
|
||||
sm=6
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogfotoOne"
|
||||
width="w-100"
|
||||
height="900"
|
||||
class="flex-column "
|
||||
>
|
||||
<v-card class="pa-4 h-100 flex-column d-flex">
|
||||
<v-row class="flex-grow-0 justify-end">
|
||||
<v-col class="pa-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
@click="dialogfotoOne = false"
|
||||
|
||||
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
|
||||
<v-col class="flex-column h_cards pa-0">
|
||||
<v-img
|
||||
class="d-flex"
|
||||
:src="`${burl}${galleryimges}`"
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="mt-3"/>
|
||||
<v-row class="flex-grow-0 ma-0 align-items-center">
|
||||
<v-col class="flex-column d-flex pa-0 align-end">
|
||||
<v-btn
|
||||
size="small"
|
||||
variant="text"
|
||||
icon="mdi-newspaper"
|
||||
color="blue-darken-4"
|
||||
:to='`/news`'
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="py-0 pl-0 flex-grow-0 text-end align-self-center text-caption font-weight-bold text-no-wrap">
|
||||
Всего новостей: {{countetnews}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
import newsCard from './UI/news-card.vue'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
newsCard
|
||||
},
|
||||
|
||||
setup(){
|
||||
|
||||
const newsAll=ref([])
|
||||
const countetnews = ref(0)
|
||||
const page = ref(1)
|
||||
const countpage = ref(8)
|
||||
const route = useRoute()
|
||||
const galleryimges=ref('')
|
||||
const dialogfotoOne = ref(false)
|
||||
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
loadNewsAll()
|
||||
|
||||
const openOneImg = (idimg) => {
|
||||
dialogfotoOne.value = true
|
||||
galleryimges.value = idimg
|
||||
console.log(idimg);
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
newsAll,
|
||||
countetnews,
|
||||
page,
|
||||
countpage,
|
||||
loadNewsAll,
|
||||
galleryimges,
|
||||
dialogfotoOne,
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -1,8 +1,12 @@
|
||||
<template>
|
||||
<div class="flex-column h-100 ">
|
||||
|
||||
|
||||
<v-card
|
||||
<div class="flex-column h-100">
|
||||
<div
|
||||
v-for="(x, key) in newss.result"
|
||||
:key="key"
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
</div>
|
||||
<!-- <v-card
|
||||
:ref="i"
|
||||
style="width:421px"
|
||||
class="mx-auto px-3 pt-3 elevation-0"
|
||||
@@ -61,7 +65,7 @@
|
||||
<v-divider/>
|
||||
|
||||
<v-divider class="mt-1"/>
|
||||
</v-card>
|
||||
</v-card> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -75,11 +79,13 @@ import myHelper from './UI/my-helper.vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { format } from 'date-fns'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import newsCard from './UI/news-card.vue'
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
export default {
|
||||
components: { myHelper },
|
||||
components: { myHelper,
|
||||
newsCard
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
<v-col v-else class="flex-column d-flex" v-for="(x, i) in newss.result" :key=i>
|
||||
|
||||
<v-row>
|
||||
<v-col class=" flex-column d-flex">
|
||||
<!-- <v-col class=" flex-column d-flex">
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="pb-0 pr-0">
|
||||
<v-card
|
||||
@@ -496,7 +496,7 @@
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-col>
|
||||
</v-col> -->
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-dialog
|
||||
@@ -702,9 +702,7 @@ export default {
|
||||
|
||||
const toggleIncrementLike = (news, scores) => {
|
||||
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
|
||||
|
||||
newss.value.result[newss.value.result.findIndex(e=> e.id==news)].scores= result.data
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ import AuthForm from '@/components/UI/Auth-form.vue'
|
||||
import OnlineUsers from '@/components/onlineUsers.vue'
|
||||
import CardUsers from '@/components/cardUsers.vue'
|
||||
import CardLike from '@/components/cardLike.vue'
|
||||
import { pagecounter } from '@/utils/universal_functions'
|
||||
// import { pagecounter } from '@/utils/universal_functions'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
export default {
|
||||
@@ -326,7 +326,7 @@ export default {
|
||||
mixins: [uf],
|
||||
|
||||
setup() {
|
||||
pagecounter()
|
||||
// pagecounter()
|
||||
const router = useRouter()
|
||||
const appStore = useAppStore()
|
||||
const theme = useTheme();
|
||||
|
||||
@@ -5,6 +5,10 @@ const routes = [
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/layouts/default/DefaultPortal.vue'),
|
||||
meta:{
|
||||
title:"Вход"
|
||||
},
|
||||
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
@@ -97,6 +101,15 @@ const routes = [
|
||||
ico: "mdi-newspaper"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/newsfull',
|
||||
name: 'FullNewsPage',
|
||||
component: () => import('@/components/news-full.vue'),
|
||||
meta:{
|
||||
title:"Одна новость",
|
||||
ico: "mdi-newspaper"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/userinfo',
|
||||
name: 'UsersInfoPage',
|
||||
|
||||
@@ -15,7 +15,7 @@ export const useAccountStore = defineStore('AccountStore', () => {
|
||||
const setUser = (value)=> {
|
||||
value.photo = checkremote(`${spravURL}${value.login}.jpg`)
|
||||
user.value=value
|
||||
console.log(value.photo, 'value.photo-------------------')
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export function getfromserver(path, reactive){
|
||||
|
||||
export function bgimage(filecheck){
|
||||
const h = new URL(`@assets/bg-for-number-carousel.png`, import.meta.url).href
|
||||
console.log(h, 'ffffffffffffffffffffffffffffff');
|
||||
|
||||
return h
|
||||
}
|
||||
// bg-for-number-carousel.png
|
||||
@@ -58,25 +58,29 @@ export function checkremote(filecheck){
|
||||
|
||||
export default str;
|
||||
|
||||
|
||||
export function splitname (name) {
|
||||
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
|
||||
}
|
||||
|
||||
export function pagecounter(){
|
||||
|
||||
const router = useRouter()
|
||||
const accountStore = useAccountStore()
|
||||
const appStore = useAppStore()
|
||||
console.log(router.currentRoute.value.meta, '-------------ttt------------------');
|
||||
let postdata = {user__id: "user" in accountStore &&"id" in accountStore.user? accountStore.user.id: null,
|
||||
page: router.currentRoute.value.meta.title,
|
||||
fullPath: router.currentRoute.value.fullPath,
|
||||
ico: router.currentRoute.value.meta.ico
|
||||
console.log(router.currentRoute.value.meta, '----роутер страницы--');
|
||||
let postdata = {
|
||||
user__id: "user" in accountStore &&"id" in accountStore.user? accountStore.user.id: null,
|
||||
page: router.currentRoute.value.meta.title,
|
||||
fullPath: router.currentRoute.value.fullPath,
|
||||
ico: router.currentRoute.value.meta.ico
|
||||
}
|
||||
console.log(postdata, 'postdata');
|
||||
|
||||
|
||||
}
|
||||
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata)
|
||||
.then(result => {
|
||||
|
||||
appStore.countvisitor = result.data})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,85 +1,289 @@
|
||||
<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="ma-3"
|
||||
class="d-flex flex-column"
|
||||
lg=4
|
||||
>
|
||||
<v-table density="compact" class="mt-3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left">
|
||||
Страница
|
||||
</th>
|
||||
<th class="text-left">
|
||||
Количество посещений
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in visiting.pages"
|
||||
:key="item.name"
|
||||
>
|
||||
<td>{{ item.page }}</td>
|
||||
<td>{{ item.count__sum }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</v-table>
|
||||
|
||||
<!-- <v-table density="compact" class="mt-3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left">
|
||||
Пользователь
|
||||
</th>
|
||||
<th class="text-left">
|
||||
Страница
|
||||
</th>
|
||||
<th class="text-left">
|
||||
Количество посещений
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in visiting.users"
|
||||
:key="item.name"
|
||||
>
|
||||
<td>{{ item.user__username }}</td>
|
||||
<td>{{ item.page }}</td>
|
||||
<td>{{ item.count__sum }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</v-table> -->
|
||||
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col>
|
||||
<!-- {{ countvis() }} -->
|
||||
<v-card
|
||||
class="d-flex flex-column my-2 ml-3 text-center"
|
||||
title="Количество посещений">
|
||||
<!-- <div class="mb-3 pl-3 d-flex flex-column align-start text-subtitle-1">
|
||||
<p class="pb-1">
|
||||
Посетителей сегодня: {{ countvis()['now'] }}
|
||||
</p>
|
||||
<p class="pb-1">
|
||||
Посетителей на прошлой неделе: {{ countvis()['week'] }}
|
||||
</p>
|
||||
<p>
|
||||
Посетителей с начала года {{ countvis()['year'] }}
|
||||
</p>
|
||||
</div> -->
|
||||
<v-list class="d-flex flex-column align-start text-subtitle-1">
|
||||
<v-list-item>
|
||||
Посетителей сегодня: {{ countvis()['now'] }}
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
Посетителей на прошлой неделе: {{ countvis()['week'] }}
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
Посетителей с начала года: {{ countvis()['year'] }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col >
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column ">
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="pa-0 pb-2">
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="d-flex flex-column ">
|
||||
<v-row>
|
||||
<v-col
|
||||
lg=9
|
||||
>
|
||||
<!-- <v-card class="text-center" title="Рейтинг посещаемости страниц портала">
|
||||
<div v-for="(val, key) in countgrupp()" :key = key>
|
||||
{{key}} : {{ val.now }} {{ val.week }} {{ val.year }}
|
||||
|
||||
</div>
|
||||
</v-card> -->
|
||||
<v-card class="pt-3 text-center" title="Рейтинг посещаемости страниц портала">
|
||||
<v-table class="pt-3 ma-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Имя страницы</th>
|
||||
<th class="text-center">Сегодня</th>
|
||||
<th class="text-center">На прошлой неделе</th>
|
||||
<th class="text-center">С начала года</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(val, key) in countgrupp()" :key = key>
|
||||
<td class="text-left">{{key}}</td>
|
||||
<td class="text-center">{{ val.now }}</td>
|
||||
<td class="text-center">{{ val.week }}</td>
|
||||
<td class="text-center">{{ val.year }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
</v-card>
|
||||
|
||||
<!-- <div v-for="(val, key) in countgrupp()" :key = key>
|
||||
{{key}} : {{ val.now }} {{ val.week }} {{ val.year }}
|
||||
|
||||
</div> -->
|
||||
</v-col>
|
||||
<!-- <v-col class="bg-black">
|
||||
<div v-for="(val, key) in activuser()" :key = key>
|
||||
{{key}} : {{ val.count }} {{ val.login }}
|
||||
|
||||
</div>
|
||||
|
||||
</v-col> -->
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import {pagecounter} from '@/utils/universal_functions'
|
||||
import {getfromserver} from '@/utils/universal_functions'
|
||||
import { ref, computed } from 'vue'
|
||||
import {getfromserver, pagecounter, splitname} from '@/utils/universal_functions'
|
||||
import moment from 'moment'
|
||||
// import {
|
||||
// Chart as ChartJS,
|
||||
// CategoryScale,
|
||||
// LinearScale,
|
||||
// PointElement,
|
||||
// LineElement,
|
||||
// Title,
|
||||
// Tooltip,
|
||||
// Legend
|
||||
// } from 'chart.js'
|
||||
// import { Line } from 'vue-chartjs'
|
||||
// import * as chartConfig from './chartConfig.js'
|
||||
|
||||
// ChartJS.register(
|
||||
// CategoryScale,
|
||||
// LinearScale,
|
||||
// PointElement,
|
||||
// LineElement,
|
||||
// Title,
|
||||
// Tooltip,
|
||||
// Legend
|
||||
// )
|
||||
|
||||
export default {
|
||||
// components: {
|
||||
// Line
|
||||
// },
|
||||
|
||||
setup(){
|
||||
|
||||
// const data = {
|
||||
// labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||
// datasets: [
|
||||
// {
|
||||
// label: 'Data One',
|
||||
// backgroundColor: '#f87979',
|
||||
// data: [40, 39, 10, 40, 39, 80, 40]
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
// const options = {
|
||||
// responsive: true,
|
||||
// maintainAspectRatio: false
|
||||
// }
|
||||
|
||||
const visiting = ref([])
|
||||
const previousWeekStart = moment().subtract(1, 'weeks').startOf('week'); // начало предыдущей недели
|
||||
const previousWeekEnd = moment().subtract(1, 'weeks').endOf('week'); // конец предыдущей недели
|
||||
|
||||
const maxDate = new Date(
|
||||
Math.max(
|
||||
...visiting.value.map(e => {
|
||||
return new Date(e.visitdate);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
getfromserver(`api/watcher/counter/`, visiting)
|
||||
pagecounter()
|
||||
const visiting = ref({})
|
||||
|
||||
const countvis = () => {
|
||||
|
||||
let filteres = visiting.value.reduce((acc, item) => {
|
||||
|
||||
acc['year'] += item.count
|
||||
|
||||
if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) {
|
||||
acc['now'] += item.count
|
||||
|
||||
}
|
||||
|
||||
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
||||
acc['week'] += item.count
|
||||
}
|
||||
|
||||
return acc
|
||||
}, {now: 0, week: 0, year: 0})
|
||||
|
||||
|
||||
return filteres
|
||||
}
|
||||
|
||||
|
||||
|
||||
const countgrupp = () => {
|
||||
|
||||
const groupedData =
|
||||
visiting.value.reduce((acc, item) => {
|
||||
|
||||
if (!acc[item.pages]) {
|
||||
acc[item.pages] = {now: 0, week: 0, year: 0}
|
||||
}
|
||||
|
||||
acc[item.pages]['year'] += item.count
|
||||
|
||||
if (item.visitdate == moment(maxDate.value).format('YYYY-MM-DD')) {
|
||||
acc[item.pages]['now'] += item.count
|
||||
}
|
||||
|
||||
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
||||
acc[item.pages]['week'] += item.count
|
||||
}
|
||||
|
||||
|
||||
return acc
|
||||
}, {});
|
||||
|
||||
|
||||
|
||||
return groupedData
|
||||
}
|
||||
|
||||
|
||||
const activuser = () => {
|
||||
|
||||
const groupedData =
|
||||
visiting.value.reduce((acc, item) => {
|
||||
console.log(Object.keys(acc).length, 'item------------');
|
||||
|
||||
|
||||
if (Object.keys(acc).length <4) {
|
||||
|
||||
|
||||
|
||||
if (!acc[splitname(item.author)]) {
|
||||
acc[splitname(item.author)] = {count: 0, login: ''}
|
||||
}
|
||||
|
||||
acc[splitname(item.author)]['count'] += item.count
|
||||
acc[splitname(item.author)]['login'] = item.author.login
|
||||
|
||||
}
|
||||
|
||||
|
||||
return acc
|
||||
}, {});
|
||||
|
||||
console.log(groupedData, 'groupedData--------');
|
||||
|
||||
|
||||
|
||||
const sorted = Object.entries(groupedData)
|
||||
.sort(([,a],[,b]) => b.count-a.count)
|
||||
.reduce((r, [k, v]) =>
|
||||
|
||||
({ ...r, [k]: v } ), {}
|
||||
|
||||
)
|
||||
|
||||
// .reduce((acc, item) => ({
|
||||
|
||||
// ...acc, [item]: groupedData[item]
|
||||
// }), {})
|
||||
|
||||
|
||||
|
||||
getfromserver(`api/watcher/counter/`, visiting)
|
||||
// Object.values(groupedData).sort(function(a, b) {
|
||||
// console.log(a, b);
|
||||
// return parseFloat(a.splitname(item.author)) - parseFloat(b.splitname(item.author));
|
||||
// });
|
||||
// groupedData.sort(function(a, b) { console.log(a,b, 'groupedData')})
|
||||
// groupedData.sort((a, b) => parseFloat(b.price) - parseFloat(a.price));
|
||||
console.log(sorted, 'groupedDatsorteda');
|
||||
|
||||
return {
|
||||
visiting
|
||||
}
|
||||
// const sortedValues = Object.values(groupedData).sort((a,b)=>b[1]-a[1])
|
||||
// topUser.value = sortedValues.slice(0, 1)
|
||||
// console.log(topUser.value, 'groupedData');
|
||||
|
||||
return sorted
|
||||
}
|
||||
|
||||
return {
|
||||
visiting,
|
||||
countvis,
|
||||
countgrupp,
|
||||
activuser,
|
||||
// chartConfig,
|
||||
// data,
|
||||
// options
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {pagecounter} from '@/utils/universal_functions'
|
||||
|
||||
export default {
|
||||
setup(){
|
||||
pagecounter()
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,40 +1,52 @@
|
||||
<template>
|
||||
<v-container fluid class="d-flex mx-0 ">
|
||||
<v-row>
|
||||
<v-container fluid class="d-flex mx-0 pa-0">
|
||||
<v-row class="ma-2">
|
||||
<v-col
|
||||
class="d-flex flex-column"
|
||||
lg=7
|
||||
md=12
|
||||
cols=12
|
||||
>
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="pr-0 pb-0">
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="pa-1">
|
||||
<Carousel-list/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row style="height:250px">
|
||||
<v-col class="d-flex flex-column pr-0 pt-3" >
|
||||
<v-col class="d-flex flex-column pa-1">
|
||||
<event-calendar/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-col
|
||||
class="d-flex flex-column"
|
||||
lg=5
|
||||
md=12
|
||||
cols=12
|
||||
>
|
||||
<v-row>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row>
|
||||
<v-row >
|
||||
<v-col
|
||||
cols="4"
|
||||
class="pb-0"
|
||||
lg=4
|
||||
md=2
|
||||
cols=12
|
||||
class="pa-1"
|
||||
style="min-height:250px"
|
||||
>
|
||||
<digital-letna/>
|
||||
</v-col>
|
||||
<v-col class="pb-0 pl-0 d-flex flex-column">
|
||||
<v-col
|
||||
class="d-flex flex-column pa-1"
|
||||
lg=8
|
||||
md=10
|
||||
cols=12
|
||||
style="min-height:550px"
|
||||
>
|
||||
<v-card class="h-100 d-flex flex-column">
|
||||
|
||||
|
||||
<v-row class="d-flex h-0 overflow-auto">
|
||||
<v-col>
|
||||
<News-list-home />
|
||||
<v-row class="d-flex justify-md-center">
|
||||
<v-col class="flex-column d-flex">
|
||||
<news-home/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
@@ -43,35 +55,49 @@
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col>
|
||||
<v-card class=" flex-colmn">
|
||||
<v-btn-toggle
|
||||
v-model="toggle"
|
||||
divided
|
||||
variant="outlined"
|
||||
<v-col class="pa-1">
|
||||
<v-card class="flex-colmn">
|
||||
<v-sheet
|
||||
class="mx-auto "
|
||||
:class="favorit.length>10?'mx-n3':''"
|
||||
max-width="800"
|
||||
>
|
||||
<v-tooltip
|
||||
v-for="x in favorit"
|
||||
:key="x"
|
||||
:text="x.page"
|
||||
location="top"
|
||||
<v-slide-group
|
||||
show-arrows
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
v-bind="props"
|
||||
:icon="x.ico"
|
||||
:to="x.fullPath"
|
||||
/>
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</v-btn-toggle>
|
||||
<v-slide-group-item
|
||||
v-for="x in favorit"
|
||||
:key="x"
|
||||
>
|
||||
<v-btn-toggle
|
||||
v-model="toggle"
|
||||
divided
|
||||
variant="outlined"
|
||||
>
|
||||
<v-tooltip
|
||||
|
||||
|
||||
:text="x.pages__page"
|
||||
location="top"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
v-bind="props"
|
||||
:icon="x.pages__ico"
|
||||
:to="x.pages__fullPath"
|
||||
/>
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</v-btn-toggle>
|
||||
</v-slide-group-item>
|
||||
</v-slide-group>
|
||||
</v-sheet>
|
||||
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
@@ -85,6 +111,7 @@
|
||||
import CarouselNumbers from '@/components/carousel-numbers.vue'
|
||||
import CalendarFull from '@/components/UI/Calendar-full.vue'
|
||||
import NewsListHome from '@/components/news-list-home.vue'
|
||||
import NewsHome from '@/components/news-home.vue'
|
||||
import LoadRound from '@/components/load-round.vue'
|
||||
import DigitalLetna from '@/components/digital-letna.vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
@@ -101,7 +128,8 @@
|
||||
NewsListHome,
|
||||
LoadRound,
|
||||
DigitalLetna,
|
||||
EventCalendar
|
||||
EventCalendar,
|
||||
NewsHome
|
||||
},
|
||||
|
||||
|
||||
@@ -111,14 +139,16 @@
|
||||
const favorit = ref([])
|
||||
const toggle = ref(null)
|
||||
|
||||
pagecounter()
|
||||
const accountStore = useAccountStore()
|
||||
pagecounter()
|
||||
|
||||
onMounted(() => {
|
||||
favoritLinks()
|
||||
|
||||
})
|
||||
|
||||
const favoritLinks = () => {
|
||||
|
||||
|
||||
axiosApiInstance.get(`api/watcher/selectedlinks/`)
|
||||
.then(data => {
|
||||
|
||||
@@ -85,7 +85,7 @@ class roundExcel():
|
||||
k=7
|
||||
|
||||
|
||||
for i in sorted(self.df['department'].unique(), reverse=True):
|
||||
for i in self.df['department'].unique():
|
||||
|
||||
ws.cell(row = k, column = 2).value = i
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ class DailyRoundUpAPIView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname')
|
||||
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname').order_by('id_dict_department__order_department')
|
||||
print(user,' helloooooooooooo')
|
||||
|
||||
re = roundExcel(user)
|
||||
file_path = getattr(re, request.GET.get("excel"))()
|
||||
@@ -85,7 +85,7 @@ class DailyRoundUpAPIView(APIView):
|
||||
class DailyloadAPIView(APIView):
|
||||
def get(self, request):
|
||||
try:
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'fio', 'post')
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'fio', 'post').order_by('id_dict_department__order_department')
|
||||
|
||||
dailyr = DailyRoundUp.objects.filter(todaysDate=date.today()).values_list('user', 'position__name', 'position')
|
||||
df_user = pd.DataFrame.from_records(user)
|
||||
|
||||
|
After Width: | Height: | Size: 897 KiB |
|
After Width: | Height: | Size: 578 KiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 342 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 195 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 850 KiB |
@@ -102,11 +102,11 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
if request.GET.__contains__('id'):
|
||||
print('Получена одна новость по ид')
|
||||
newsqueryset = News.objects.filter(pk=int(request.GET.get('id')))
|
||||
countpage= 0
|
||||
else:
|
||||
print('Получены все новости по ид')
|
||||
newsqueryset = News.objects.all().order_by('-cdate')
|
||||
countpage = newsqueryset.count()
|
||||
print(countpage,'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
|
||||
if request.GET.get("name") == "/":
|
||||
print('Запрос на новости для главной страницы')
|
||||
newsqueryset = newsqueryset[:10]
|
||||
@@ -122,7 +122,36 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
|
||||
|
||||
|
||||
return Response({"result":result, "countpage": round(countpage/int(request.GET.get("countpage")))})
|
||||
return Response({"result":result, "countpage": countpage})
|
||||
# round(countpage/int(request.GET.get("countpage")))
|
||||
def post(self, request):
|
||||
|
||||
if 'scores' in request.data:
|
||||
upd, created = ScoreNews.objects.get_or_create(news_id=request.data['news'], author=self.request.user)
|
||||
|
||||
if created or (upd.score != request.data['scores']):
|
||||
upd.score = request.data['scores']
|
||||
else:
|
||||
upd.score = None
|
||||
|
||||
upd.cdate=datetime.now()
|
||||
upd.save()
|
||||
|
||||
back = [{"score":y.score, "user":y.author.username} for y in ScoreNews.objects.filter(news_id=request.data['news'])]
|
||||
|
||||
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, "id": y.pk,
|
||||
"author":model_to_dict(y.author.user)
|
||||
} 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(y.author.user)
|
||||
} for y in CommentNews.objects.filter(news_id=request.data['news']))}
|
||||
|
||||
return Response(back)
|
||||
|
||||
class CarouselsAPIView(ListAPIView):
|
||||
permission_classes = (AllowAny,)
|
||||
|
||||
@@ -1,27 +1,38 @@
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from accounts.models import User
|
||||
# Create your models here.
|
||||
import pandas as pd
|
||||
|
||||
class CountVisitor(models.Model):
|
||||
page = models.CharField(db_index=True, max_length=255)
|
||||
visitdate = models.DateField()
|
||||
user = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT)
|
||||
count = models.IntegerField(default=0)
|
||||
fullPath = models.CharField(max_length=255)
|
||||
class Pages(models.Model):
|
||||
page = models.CharField(max_length=255)
|
||||
fullPath = models.CharField(max_length=255)
|
||||
ico = models.CharField(verbose_name='Иконка', max_length=150, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.page)
|
||||
return str(self.page)
|
||||
|
||||
|
||||
class CountVisitor(models.Model):
|
||||
# page = models.CharField(db_index=True, max_length=255)
|
||||
pages = models.ForeignKey(Pages, on_delete=models.PROTECT, related_name='get_pages', verbose_name='Страница', null=True)
|
||||
visitdate = models.DateField()
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, verbose_name='Пользователь', null=True, blank=True)
|
||||
count = models.IntegerField(default=0)
|
||||
# fullPath = models.CharField(max_length=255)
|
||||
# ico = models.CharField(verbose_name='Иконка', max_length=150, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pages)
|
||||
|
||||
|
||||
|
||||
class Meta:
|
||||
# class Meta:
|
||||
|
||||
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['page', 'user', 'visitdate', 'fullPath', 'ico'], name='unique appversion')
|
||||
]
|
||||
# constraints = [
|
||||
# models.UniqueConstraint(fields=['page', 'user', 'visitdate', 'fullPath', 'ico'], name='unique appversion')
|
||||
# ]
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
|
||||
from rest_framework import serializers
|
||||
from .models import *
|
||||
from userauth.serializers import *
|
||||
|
||||
class CountSerializer(serializers.ModelSerializer):
|
||||
author = serializers.SerializerMethodField('get_user')
|
||||
pages = serializers.CharField(source='pages.page')
|
||||
fullPath = serializers.CharField(source='pages.fullPath')
|
||||
ico = serializers.CharField(source='pages.ico')
|
||||
|
||||
class CountSerializer(serializers.BaseSerializer):
|
||||
class Meta:
|
||||
model = CountVisitor
|
||||
fields = ['author', 'pages', 'fullPath', 'ico', 'visitdate', 'count']
|
||||
|
||||
pass
|
||||
def get_user(self, obj):
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data
|
||||
@@ -10,44 +10,35 @@ from datetime import date
|
||||
from django.db.models import Sum
|
||||
from userauth.models import *
|
||||
import pandas as pd
|
||||
# Create your views here.
|
||||
# Create your views here. visitdate__year='2023', visitdate__month='01', visitdate__day='21'
|
||||
|
||||
class Counter(ListAPIView):
|
||||
permission_classes = (AllowAny,)
|
||||
serializer_class = CountSerializer
|
||||
|
||||
def get(self, request):
|
||||
res = CountVisitor.objects.values('page').annotate(Sum('count'))
|
||||
users = CountVisitor.objects.values('page', 'user__username').annotate(Sum('count'))
|
||||
outuser = DictEmployee.objects.values('login', 'fio')
|
||||
pUser = pd.DataFrame.from_records(users)
|
||||
pOutUser = pd.DataFrame.from_records(outuser)
|
||||
h = pUser.merge(pOutUser, how="left", left_on="user__username", right_on="login")
|
||||
|
||||
for x in users:
|
||||
if x['user__username'] is not None:
|
||||
x['user__username'] = h.loc[h['login']==x['user__username']]['fio'].unique()[0]
|
||||
else:
|
||||
x['user__username'] = 'Анонимные'
|
||||
|
||||
return Response({"pages":res, "users": users})
|
||||
res = CountVisitor.objects.filter(visitdate__range=['2023-01-01', '2023-12-31']).annotate(Sum('count'))
|
||||
result = CountSerializer(res, many=True).data
|
||||
return Response(result)
|
||||
|
||||
|
||||
def post(self, request):
|
||||
myfullPath = request.data['fullPath']
|
||||
if "?" in myfullPath:
|
||||
myfullPath= myfullPath.split("?")[0]
|
||||
# print(fullPath.split("?")[0], '---request.data-------------------------')
|
||||
|
||||
page, create = Pages.objects.get_or_create(page=request.data['page'], fullPath=myfullPath, ico=request.data['ico'])
|
||||
|
||||
if request.data['user__id'] is not None:
|
||||
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),page=request.data['page'], visitdate=date.today(), fullPath=myfullPath, ico=request.data['ico'])
|
||||
else:
|
||||
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, page=request.data['page'], visitdate=date.today(), fullPath=myfullPath, ico=request.data['ico'])
|
||||
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),pages=page, visitdate=date.today())
|
||||
else:
|
||||
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
||||
watch.count+=1
|
||||
watch.save()
|
||||
|
||||
res = {"totalvisit": CountVisitor.objects.filter(page=request.data['page']).aggregate(Sum('count'))['count__sum'],
|
||||
"visittoday":CountVisitor.objects.filter(visitdate=date.today(), page=request.data['page']).aggregate(Sum('count'))['count__sum'],
|
||||
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), page=request.data['page']).count()
|
||||
|
||||
res = {"totalvisit": CountVisitor.objects.filter(pages=page.id).aggregate(Sum('count'))['count__sum'],
|
||||
"visittoday":CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).aggregate(Sum('count'))['count__sum'],
|
||||
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count()
|
||||
}
|
||||
|
||||
return Response(res)
|
||||
@@ -56,9 +47,8 @@ class SelectedLinksAPIView(ListAPIView):
|
||||
|
||||
def get(self, request):
|
||||
user = User.objects.get(username=self.request.user)
|
||||
res = CountVisitor.objects.values('page','fullPath','ico').filter(user_id=user).annotate(Sum('count')).exclude(fullPath='/')
|
||||
res = CountVisitor.objects.values('pages__page','pages__fullPath','pages__ico').filter(user_id=user).annotate(Sum('count')).exclude(pages__fullPath='/')
|
||||
sort = res.order_by('-count__sum')[:20]
|
||||
|
||||
|
||||
return Response(sort)
|
||||
|
||||