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

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

No files matched your search

@@ -1,5 +1,10 @@
<template>
<line-graph :data="data" :options="options"/>
<v-card
class="d-flex flex-column text-center"
height="200px"
>
<line-graph :data="data" :options="options"/>
</v-card>
</template>
<script>
@@ -22,7 +27,6 @@ export default {
setup(props, {emit}) {
const arrlines = {}
// const customLabel = []
const data = computed({
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>
+26 -78
View File
@@ -34,63 +34,15 @@
<v-row no-gutters class="gap flex-grow-0">
<v-col lg=3>
<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">
{{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>
<portal-traffic
:selected_days=selected_days
:countvising=countvising
/>
</v-col>
<v-col>
<v-card
class="d-flex flex-column text-center"
height="200px"
>
<line-chart :visiting="visiting"/>
<!-- <line-graph :data="data" :options="options"/> -->
</v-card>
</v-col>
</v-row>
@@ -127,11 +79,10 @@
<v-table fixed-header
height="430px">
<thead>
<tr>
<tr class="text-uppercase">
<th>Имя страницы</th>
<th class="text-center"> на {{today}}</th>
<th class="text-center">с {{weekday[0]}} по {{weekday[1]}}</th>
<th class="text-center">с {{year[0]}} по {{year[1]}}</th>
<th class="text-center"> на {{today}} </th>
<th class="text-center">за период</th>
</tr>
</thead>
@@ -139,7 +90,6 @@
<tr v-for="(val, key) in countgrupp()" :key = key>
<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.week[0].size:val.week[1] }}</td>
<td class="text-center">{{ modelrating?val.year[0].size:val.year[1] }}</td>
</tr>
@@ -188,6 +138,7 @@ import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
import DateSelect from '@/components/UI/date-select.vue'
import TopUser from '@/components/UI/aboutportal/top-user.vue'
import LineChart from '@/components/UI/aboutportal/line-chart.vue'
import PortalTraffic from '@/components/UI/aboutportal/portal-traffic.vue'
export default {
@@ -195,21 +146,24 @@ export default {
Feedmodul,
DateSelect,
TopUser,
LineChart
LineChart,
PortalTraffic
},
setup(){
const visiting = 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 startdate =ref(format2(new Date(new Date().getFullYear(), 0, 1)))
const endate =ref(format2(new Date()))
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 weekday = ref('')
const year = ref('')
const modelrating = ref(false)
@@ -260,7 +214,7 @@ setup(){
const countgrupp = () => {
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 =
@@ -268,7 +222,7 @@ setup(){
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)
@@ -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)])
{
@@ -327,16 +275,15 @@ setup(){
const periodname = () => {
let datas = weekstart(endate.value)
today.value = 'сегодня'
selected_days.value.today = 'сегодня'
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)]
year.value = [format1(startdate.value), format1(endate.value)]
selected_days.value.year = [format1(startdate.value), format1(endate.value)]
}
@@ -397,7 +344,8 @@ setup(){
periodname,
weekstart,
today,
weekday,
selected_days,
year,
modelrating