Компонент для Посещение портала

This commit is contained in:
iriska-gri committed 2024-01-29 11:59:08 +03:00
1 parent 3c6ba1325d
commit 34c5dd79ff
3 files changed
+87 -76

No files matched your search

@@ -1,5 +1,10 @@
<template> <template>
<v-card
class="d-flex flex-column text-center"
height="200px"
>
<line-graph :data="data" :options="options"/> <line-graph :data="data" :options="options"/>
</v-card>
</template> </template>
<script> <script>
@@ -22,7 +27,6 @@ export default {
setup(props, {emit}) { setup(props, {emit}) {
const arrlines = {} const arrlines = {}
// const customLabel = []
const data = computed({ const data = computed({
get() { get() {
@@ -0,0 +1,59 @@
<template>
<v-card
class="text-center"
height="200px"
>
<v-card-title class="pb-0 pt-2">
Количество Посетителей
</v-card-title>
<v-card-subtitle>
(уникальные/всего)
</v-card-subtitle>
<v-card-text class="pl-0">
<v-list density="compact" class="text-start text-subtitle-1 pt-0">
<v-list-item >
на
<span class="font-weight-bold">
{{selected_days.today}}
</span>
: {{countvising['now'][0].size}}
/ {{countvising['now'][1]}}
</v-list-item>
<v-list-item>
с
<span class="font-weight-bold">
{{selected_days.year[0]}}
</span>
по
<span class="font-weight-bold">
{{selected_days.year[1]}}
</span>
: {{countvising['year'][0].size}}
/ {{countvising['year'][1]}}
</v-list-item>
</v-list>
</v-card-text>
</v-card>
</template>
<script>
export default {
props: {
selected_days: {
type: Object,
default: () => {}
},
countvising: {
type: Object,
default: () => {}
}
}
}
</script>
<style>
</style>
+23 -75
View File
@@ -34,63 +34,15 @@
<v-row no-gutters class="gap flex-grow-0"> <v-row no-gutters class="gap flex-grow-0">
<v-col lg=3> <v-col lg=3>
<v-card <portal-traffic
class="text-center" :selected_days=selected_days
height="200px" :countvising=countvising
> />
<v-card-title class="pb-0 pt-2">
Количество Посетителей
</v-card-title>
<v-card-subtitle>
(уникальные/всего)
</v-card-subtitle>
<v-card-text class="pl-0">
<v-list density="compact" class="text-start text-subtitle-1 pt-0">
<v-list-item >
на
<span class="font-weight-bold">
{{today}}
</span>
: {{countvising['now'][0].size}}
/ {{countvising['now'][1]}}
</v-list-item>
<v-list-item>
с
<span class="font-weight-bold">
{{weekday[0]}}
</span>
по
<span class="font-weight-bold">
{{weekday[1]}}
</span>
: {{countvising['week'][0].size}}
/ {{countvising['week'][1]}}
</v-list-item>
<v-list-item>
с
<span class="font-weight-bold">
{{year[0]}}
</span>
по
<span class="font-weight-bold">
{{year[1]}}
</span>
: {{countvising['year'][0].size}}
/ {{countvising['year'][1]}}
</v-list-item>
</v-list>
</v-card-text>
</v-card>
</v-col> </v-col>
<v-col> <v-col>
<v-card
class="d-flex flex-column text-center"
height="200px"
>
<line-chart :visiting="visiting"/> <line-chart :visiting="visiting"/>
<!-- <line-graph :data="data" :options="options"/> -->
</v-card>
</v-col> </v-col>
</v-row> </v-row>
@@ -127,11 +79,10 @@
<v-table fixed-header <v-table fixed-header
height="430px"> height="430px">
<thead> <thead>
<tr> <tr class="text-uppercase">
<th>Имя страницы</th> <th>Имя страницы</th>
<th class="text-center"> на {{today}} </th> <th class="text-center"> на {{today}} </th>
<th class="text-center">с {{weekday[0]}} по {{weekday[1]}}</th> <th class="text-center">за период</th>
<th class="text-center">с {{year[0]}} по {{year[1]}}</th>
</tr> </tr>
</thead> </thead>
@@ -139,7 +90,6 @@
<tr v-for="(val, key) in countgrupp()" :key = key> <tr v-for="(val, key) in countgrupp()" :key = key>
<td class="text-left">{{key}}</td> <td class="text-left">{{key}}</td>
<td class="text-center">{{ modelrating?val.now[0].size:val.now[1] }} </td> <td class="text-center">{{ modelrating?val.now[0].size:val.now[1] }} </td>
<td class="text-center">{{ modelrating?val.week[0].size:val.week[1] }}</td>
<td class="text-center">{{ modelrating?val.year[0].size:val.year[1] }}</td> <td class="text-center">{{ modelrating?val.year[0].size:val.year[1] }}</td>
</tr> </tr>
@@ -188,6 +138,7 @@ import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
import DateSelect from '@/components/UI/date-select.vue' import DateSelect from '@/components/UI/date-select.vue'
import TopUser from '@/components/UI/aboutportal/top-user.vue' import TopUser from '@/components/UI/aboutportal/top-user.vue'
import LineChart from '@/components/UI/aboutportal/line-chart.vue' import LineChart from '@/components/UI/aboutportal/line-chart.vue'
import PortalTraffic from '@/components/UI/aboutportal/portal-traffic.vue'
export default { export default {
@@ -195,21 +146,24 @@ export default {
Feedmodul, Feedmodul,
DateSelect, DateSelect,
TopUser, TopUser,
LineChart LineChart,
PortalTraffic
}, },
setup(){ setup(){
const visiting = ref([]) const visiting = ref([])
const feedback = ref([]) const feedback = ref([])
const countvising = ref({now: [new Set(), 0], week: [new Set(), 0], year: [new Set(), 0]}) const countvising = ref({now: [new Set(), 0], year: [new Set(), 0]})
const crit = ref([]) const crit = ref([])
const startdate =ref(format2(new Date(new Date().getFullYear(), 0, 1))) const startdate =ref(format2(new Date(new Date().getFullYear(), 0, 1)))
const endate =ref(format2(new Date())) const endate =ref(format2(new Date()))
const icons = ['mdi-numeric-1-box-outline', 'mdi-numeric-2-box-outline', 'mdi-numeric-3-box-outline'] const icons = ['mdi-numeric-1-box-outline', 'mdi-numeric-2-box-outline', 'mdi-numeric-3-box-outline']
const selected_days = ref({today: '', year: ''})
const today = ref('') const today = ref('')
const weekday = ref('')
const year = ref('') const year = ref('')
const modelrating = ref(false) const modelrating = ref(false)
@@ -260,7 +214,7 @@ setup(){
const countgrupp = () => { const countgrupp = () => {
let us = {} let us = {}
let countall = {now: [new Set(), 0], week: [new Set(), 0], year: [new Set(), 0]} let countall = {now: [new Set(), 0], year: [new Set(), 0]}
const groupedData = const groupedData =
@@ -268,7 +222,7 @@ setup(){
if (!acc[item.pages]) { if (!acc[item.pages]) {
acc[item.pages] = {now: [new Set(), 0], week: [new Set(), 0], year: [new Set(), 0]} acc[item.pages] = {now: [new Set(), 0], year: [new Set(), 0]}
} }
acc[item.pages]['year'][0].add(item.author.id) acc[item.pages]['year'][0].add(item.author.id)
@@ -286,13 +240,7 @@ setup(){
} }
let week = weekstart(endate.value)
if (item.visitdate >=format2(week.WeekStart) && item.visitdate <= format2(week.WeekEnd)) {
acc[item.pages]['week'][0].add(item.author.id)
acc[item.pages]['week'][1] += item.count
countall['week'][0].add(item.author.id)
countall['week'][1] += item.count
}
if (!us[splitname(item.author)]) if (!us[splitname(item.author)])
{ {
@@ -328,15 +276,14 @@ setup(){
const periodname = () => { const periodname = () => {
let datas = weekstart(endate.value) let datas = weekstart(endate.value)
today.value = 'сегодня' selected_days.value.today = 'сегодня'
if (format2(new Date()) != format2(endate.value)) { if (format2(new Date()) != format2(endate.value)) {
today.value = format1(endate.value) selected_days.value.today = format1(endate.value)
} }
weekday.value = [format1(datas.WeekStart), format1(datas.WeekEnd)]
selected_days.value.year = [format1(startdate.value), format1(endate.value)]
year.value = [format1(startdate.value), format1(endate.value)]
} }
@@ -397,7 +344,8 @@ setup(){
periodname, periodname,
weekstart, weekstart,
today, today,
weekday, selected_days,
year, year,
modelrating modelrating