Статистика фронт

This commit is contained in:
iriska-gri committed 2024-01-16 15:40:58 +03:00
1 parent b9afc985de
commit 21fc9d67c6
7 files changed
+279 -75

No files matched your search

@@ -0,0 +1,41 @@
<template>
<v-row>
<v-col>
<v-card :title="name" class="text-center" >
<v-card-text >
<v-row >
<v-col
class="text-h2 text-center"
>
{{total}}
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-col>
</v-row>
</template>
<script>
export default {
props: {
name: {
type: String,
default: ''
},
total: {
type: Number,
default: 0
}
}
}
</script>
<style>
</style>
@@ -1,24 +1,61 @@
<template>
<div>
<div>
<div v-for="(val, key) in average()" :key = key>
{{key}}
{{val}}
</div>
<v-row >
<v-col>
<card-total
name="Всего поставлено оценок"
:total="total"
/>
<v-divider/>
<v-card class="pa-3">
<star-like
:criteria=average()
:rating=average()
/>
</v-card>
<v-divider/>
<card-total
name="Всего оставлено комментариев"
:total="crit.total"
/>
<v-divider/>
<top-user
name= "Самый активный критик"
:users=crit
/>
</v-col>
{{total}}
{{crit}}
</div>
<div>{{average()}}</div>
</div>
{{crit}}
</v-row>
</template>
<script>
import { ref } from 'vue'
import {splitname} from '@/utils/universal_functions'
import starLike from '@/components/UI/feedback/star-like.vue'
import CardTotal from '@/components/UI/aboutportal/card-total.vue'
import TopUser from '@/components/UI/aboutportal/top-user.vue'
export default {
components: {
starLike,
CardTotal,
TopUser
},
props: {
feedback: {
type: Array,
@@ -26,9 +63,11 @@ export default {
},
},
setup(props, context) {
const total = ref(0)
const crit = ref({max: 0, fio: 0, total: 0})
const crit = ref({count: 0, fio: 0, total: 0})
const average = () => {
@@ -42,20 +81,26 @@ export default {
.reduce((acc, item) => {
if (!acc[item.namecrit]) {
acc[item.namecrit] = {rating: [], ico: ''}
acc[item.namecrit] = {rating: [], ico: '', color: '', name: ''}
}
acc[item.namecrit]['rating'].push(item.rating)
acc[item.namecrit]['ico'] = item.ico
acc[item.namecrit]['color'] = item.color
acc[item.namecrit]['name'] = item.namecrit
tot.add(item.usercom)
if (!us[splitname(item.author)]) {
us[splitname(item.author)] = {max: new Set(), login: 0}
if (!us[splitname(item.author)]) {
us[splitname(item.author)] = {count: new Set(), login: 0}
}
if (item.comment.length > 0) {
us[splitname(item.author)]['max'].add(item.usercom)
us[splitname(item.author)]['count'].add(item.usercom)
us[splitname(item.author)]['login'] = item.author.login
us[splitname(item.author)]['post'] = item.author.post
}
return acc
@@ -76,10 +121,12 @@ export default {
for (let [key,val] of Object.entries(us))
{
t += val.max.size
if (crit.value.max < val.max.size) {
crit.value = {fio:key,max:val.max.size, login: val.login}
t += val.count.size
if (crit.value.count < val.count.size) {
crit.value = {fio:key,count:val.count.size, login: val.login, post: val.post}
}
}
@@ -0,0 +1,73 @@
<template>
<v-card
class="mx-auto"
>
<v-card-text class="text-h5 pb-2 pt-6">
{{name}}
</v-card-text>
<v-row>
<v-col lg=8> <v-card-actions>
<v-list-item>
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${users.login}.jpg`)"
></v-avatar>
</template>
<v-list-item-title>{{users.fio}}</v-list-item-title>
<v-list-item-subtitle>{{users.post}}</v-list-item-subtitle>
</v-list-item>
</v-card-actions></v-col>
<v-col class="align-self-center text-right">
<v-icon
color="teal-darken-3"
icon="mdi-comment-account-outline"
size="45"
></v-icon>
<span class="subheading text-h6 me-5 pl-3">{{users.count}}</span>
</v-col>
</v-row>
</v-card>
</template>
<script>
import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
export default {
props: {
name: {
type: String,
default: ''
},
users: {
type: Object,
default: {}
},
},
setup() {
return {
checkremote,
spravURL,
}
}
}
</script>
<style>
</style>
@@ -0,0 +1,66 @@
<template>
<div>
<v-row
v-for="(x, key) in criteria"
:key = key
>
<v-col class="flex-grow-0 pb-0">
<v-icon
size="large"
:color="x.color"
:icon="x.ico"
/>
</v-col>
<v-col class="pb-0" lg=3>
{{x.name}}
</v-col>
<v-col class="py-0">
<v-rating
v-model="message[key].rating"
:hover="typeof(key) == 'number'"
half-increments
color="yellow"
/>
</v-col>
<v-divider/>
</v-row >
</div>
</template>
<script>
import { computed } from 'vue'
export default {
props: {
criteria: {
type: Object,
default: {}
},
rating: {
type: Object,
default: {}
}
},
setup(props, { emit }) {
const message = computed({
get: () => props.rating,
set: (value) => emit('update:rating', value)
})
return {
message,
}
}
}
</script>
<style>
</style>
+9 -26
View File
@@ -8,37 +8,18 @@
<v-row>
<v-col class="flex-grow-0 py-0 text-no-wrap align-self-center text-button">
Оцените сайт
</v-col>
<v-divider/>
</v-row>
<v-row
v-for="(x, key) in feedbackdata.basecrit"
:key = key
>
<v-col class="flex-grow-0 pb-0">
<v-icon
size="large"
:color="x.color"
:icon="x.ico"
/>
</v-col>
<v-col class="pb-0" lg=3>
{{x.name}}
</v-col>
<v-col class="py-0">
<v-rating
v-model="feedbackdata.nowrating[key].rating"
hover
half-increments
color="yellow"
/>
</v-col>
<v-divider/>
</v-row >
<star-like
:criteria=feedbackdata.basecrit
:rating=feedbackdata.nowrating
@update:rating="feedbackdata.nowrating = $event"
/>
<v-row class="mt-6">
<v-col class="pa-0 px-3">
<v-textarea
<v-textarea
label="Ваши комментарии сделают портал лучше"
hide-details
variant="outlined"
@@ -76,8 +57,10 @@
<script>
import { ref, onMounted, computed } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
import starLike from '@/components/UI/feedback/star-like.vue'
export default {
components: { starLike },
props: {
LikeDialog: {
+21 -27
View File
@@ -1,5 +1,5 @@
<template>
<v-row>
<v-row class="ma-3">
<!-- <v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
@@ -10,10 +10,10 @@
lg=4
>
<v-row class="flex-grow-0">
<v-col class="bg-orange">
<v-col>
<v-card
class="d-flex flex-column my-2 ml-3 text-center"
class="d-flex flex-column text-center"
title="Количество посещений">
<v-list class="d-flex flex-column align-start text-subtitle-1">
@@ -30,12 +30,13 @@
</v-card>
</v-col>
</v-row>
<v-row>
<feedmodul :feedback="feedback"/>
<!-- <v-row>
<v-col class="bg-red">
<feedmodul :feedback="feedback"/>
{{crit}}
</v-col>
</v-row>
</v-row> -->
</v-col>
<v-col class="d-flex flex-column ">
<v-row class="flex-grow-0">
@@ -75,15 +76,15 @@
</v-col>
<v-col class="bg-black">
<div v-for="(val, key) in activuser()" :key = key>
{{key}} : {{ val.count }} {{ val.login }}
<div v-for="(val, key) in activuser()" :key = key>
<top-user :users=val/>
</div>
<v-card class="d-flex" title="Самые активные пользователи">
</v-card>
</v-col>
</v-row>
@@ -116,13 +117,16 @@ import lineGraph from '@/components/graph/line-graph.vue'
import { axiosApiInstance } from '@/utils/axios-api'
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'
export default {
components: { lineGraph,
components: {
lineGraph,
Feedmodul,
DateSelect },
DateSelect,
TopUser
},
setup(){
@@ -227,26 +231,13 @@ setup(){
}
const visition = () => {
// ${startdate.value}
axiosApiInstance.get(`api/watcher/counter/?start=${startdate.value}&end=${endate.value}`).then(result => {
visiting.value = result.data.result
feedback.value = result.data.feedback
})}
//
pagecounter()
const countgrupp = () => {
let us = {}
let countall = {now: 0, week: 0, year: 0}
@@ -324,9 +315,12 @@ setup(){
if (!acc[splitname(item.author)]) {
acc[splitname(item.author)] = {count: 0, login: ''}
}
acc[splitname(item.author)]['fio'] = splitname(item.author)
acc[splitname(item.author)]['count'] += item.count
acc[splitname(item.author)]['login'] = item.author.login
acc[splitname(item.author)]['post'] = item.author.post
}