Сборка самых активных

This commit is contained in:
iriska-gri committed 2024-02-02 15:20:20 +03:00
1 parent 3449115b82
commit 973552fb8b
3 files changed
+71 -71

No files matched your search

@@ -44,20 +44,7 @@
:tooltip = val.year.unique
/>
</tr>
<tr
v-for="(val, key) in pages_count.data"
:key="key"
>
<td>{{key}}</td>
<td-tooltip
:number = modelrating?val.now.unique.length:val.now.countall
:tooltip = val.now.unique
/>
<td-tooltip
:number = modelrating?val.year.unique.length:val.year.countall
:tooltip = val.year.unique
/>
</tr>
</tbody>
</v-table>
@@ -1,43 +1,31 @@
<template>
<v-card
class="mx-auto" height="150px"
>
<v-card class="text-center h-100">
<div v-for="(user, key) in activusers" :key="key" >
<v-card
class="mx-auto"
height="150px"
>
<!-- <my-helper :pretext="user"/> -->
<my-helper :pretext="users"/>
<v-card-text class="text-h5 pa-2 pl-5 flex-wrap align-center d-flex justify-space-between">
{{name}}
<v-icon
color="blue-grey-lighten-1"
:icon="ico"
size="35"
/>
</v-card-text>
<v-divider/>
<v-card-text class="pa-0 d-flex flex-column h-100">
<v-row no-gutters>
<v-col lg=8 class="px-0 ">
<list-user :author=users />
<v-card-text class="pa-0 d-flex flex-column h-100">
<v-row no-gutters>
<v-col lg=8 class="px-0">
<list-user :author=user />
</v-col>
<v-col class="pt-8 text-center">
<span class="subheading text-h6">
{{users.count}}
<v-tooltip
v-if="name=='Активность'"
activator="parent"
location="top"
>
<div v-for="x in users.info" :key=x>
{{x}}
</div>
</v-tooltip>
{{Object.keys(user.session).length}}
</span>
</v-col>
</v-row>
</v-card-text>
</v-card>
</div>
</v-card>
</template>
@@ -45,34 +33,29 @@
import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
import listUser from '@/components/UI//fiousercard/listUser.vue'
import { ref } from 'vue'
export default {
components: { listUser },
props: {
name: {
type: String,
default: ''
},
users: {
activusers: {
type: Object,
default: {}
},
ico: {
type: String,
default: 'mdi-emoticon-poop'
}
},
setup() {
setup(props) {
return {
checkremote,
spravURL,
}
}
+47 -17
View File
@@ -17,21 +17,16 @@
visiting- (все данные)
<my-helper :pretext="visiting"/>
</v-col>
<v-col lg=5 class="bg-red d-flex flex-column">
<v-col lg=4 class="bg-red d-flex flex-column">
<rating-page :pages_count=pages_count />
</v-col>
<v-col class="d-flex flex-column bg-yellow">
<v-row class=" overflow-auto h-0">
<v-row no-gutters class=" overflow-auto h-0">
<v-col>
<v-card class="text-center h-100 ">
<div v-for="(x, key) in dataActivusers" :key="key" >
<top-user
:users = x
:name= key
:activusers = dataActivusers
/>
</div>
</v-card>
</v-col>
</v-row>
<!-- -->
@@ -236,8 +231,10 @@ setup(){
const visiting = ref([])
const feedback = ref([])
const staff = ref(0)
const dataLineChart = ref({})
const dataActivusers = ref({})
const dataTopUser = ref({})
const previous = ref({start: new Date(), end: new Date()})
const selected_days = ref({today: 'сегодня', year: {start: new Date(), end: new Date()}})
@@ -272,6 +269,7 @@ setup(){
previous_period()
let lineCharts = {}
let activusers = {}
let top_user = {}
// let portal_traffic = {
// now: {
// title: '',
@@ -297,25 +295,25 @@ setup(){
where.push(what)
}
}
console.log(visiting.value);
const groupedData = visiting.value.reduce((acc, item) => {
// Данные для графика по фильтру
if (item.visitdate >= format2(filterStore.date_period.startdate) && item.visitdate <= format2(filterStore.date_period.enddate)){
// ------------------------------
if (!lineCharts[item.visitdate]) {
lineCharts[item.visitdate] = {count: 0, unic: []}
}
checking_for_entry(lineCharts[item.visitdate]['unic'], splitname(item.author))
// ------------------------------
if (!activusers[splitname(item.author)])
{
activusers[splitname(item.author)] = {login: '', post: '', session: {} }
activusers[splitname(item.author)] = {session: {} }
}
activusers[splitname(item.author)].login = item.author.login
activusers[splitname(item.author)].post = item.author.post
if (!activusers[splitname(item.author)].session[item.visitdate]) {
activusers[splitname(item.author)].session[item.visitdate] = {pages: {}}
}
@@ -324,6 +322,14 @@ setup(){
}
activusers[splitname(item.author)].session[item.visitdate].pages[item.pages].count = item.count
// ------------------------------
if (!top_user[splitname(item.author)]) {
top_user[splitname(item.author)] = { user: {}, info: {}, tooltip: {}}
}
top_user[splitname(item.author)].user.login = item.author.login
top_user[splitname(item.author)].user.post = item.author.post
top_user[splitname(item.author)].user.fio = splitname(item.author)
// Данные для таблицы по страницам
@@ -349,16 +355,15 @@ setup(){
// Данные для посещаемость портала
if (item.visitdate >= format2(previous.value.start) && item.visitdate <= format2(previous.value.end)){
// console.log(item.visitdate, '------------------------------');
//
}
dataLineChart.value = lineCharts
dataActivusers.value = activusers
dataTopUser.value = top_user
return acc
}, {})
//
watch(()=>filterStore.date_period,(newValue,oldValue)=>{
if(newValue){
@@ -369,11 +374,36 @@ setup(){
pages_count.value.data = groupedData
tooltipinfo()
return groupedData
}
const tooltipinfo = () => {
let page = []
console.log(dataActivusers.value, '0------');
Object.entries(dataActivusers.value).reduce((acc, item) => {
dataTopUser.value[item[0]].info.session = Object.keys(item[1].session).length
// console.log(item[1], '1------');
Object.entries(item[1].session).reduce((acc_data, data) => {
if(!acc_data[item[0]]) {
acc_data[item[0]] =0
}
acc_data[item[0]] += Object.keys(data[1].pages).length
// console.log(Object.keys(data[1].pages).length , dataTopUser.value[item[0]], '------');
// dataTopUser.value[item[0]].info.pages += Object.keys(data[1].pages).length
// console.log(acc_data, data[1].pages, Object.keys(data[1].pages).length, '2------');
dataTopUser.value[item[0]].info.pages = acc_data[item[0]]
return acc_data
}, {})
// console.log(dataTopUser.value)
return acc
}, {})
}
const title_period = () => {
selected_days.value.year.start = format1(filterStore.date_period.startdate)