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

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

No files matched your search

@@ -44,20 +44,7 @@
:tooltip = val.year.unique :tooltip = val.year.unique
/> />
</tr> </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> </tbody>
</v-table> </v-table>
@@ -1,43 +1,31 @@
<template> <template>
<v-card <v-card class="text-center h-100">
class="mx-auto" height="150px" <div v-for="(user, key) in activusers" :key="key" >
> <v-card
class="mx-auto"
height="150px"
>
<my-helper :pretext="users"/> <!-- <my-helper :pretext="user"/> -->
<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-divider/>
<v-card-text class="pa-0 d-flex flex-column h-100"> <v-card-text class="pa-0 d-flex flex-column h-100">
<v-row no-gutters> <v-row no-gutters>
<v-col lg=8 class="px-0 "> <v-col lg=8 class="px-0">
<list-user :author=users /> <list-user :author=user />
</v-col> </v-col>
<v-col class="pt-8 text-center"> <v-col class="pt-8 text-center">
<span class="subheading text-h6"> <span class="subheading text-h6">
{{users.count}} {{Object.keys(user.session).length}}
<v-tooltip
v-if="name=='Активность'"
activator="parent"
location="top"
>
<div v-for="x in users.info" :key=x>
{{x}}
</div>
</v-tooltip>
</span> </span>
</v-col> </v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
</v-card>
</div>
</v-card> </v-card>
</template> </template>
@@ -45,6 +33,7 @@
import { spravURL } from '@/utils/axios-api' import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions' import {checkremote} from '@/utils/universal_functions'
import listUser from '@/components/UI//fiousercard/listUser.vue' import listUser from '@/components/UI//fiousercard/listUser.vue'
import { ref } from 'vue'
export default { export default {
components: { listUser }, components: { listUser },
@@ -52,27 +41,21 @@ export default {
props: { props: {
name: { activusers: {
type: String,
default: ''
},
users: {
type: Object, type: Object,
default: {} default: {}
}, },
ico: {
type: String,
default: 'mdi-emoticon-poop'
}
}, },
setup() { setup(props) {
return { return {
checkremote, checkremote,
spravURL, spravURL,
} }
} }
+46 -16
View File
@@ -17,21 +17,16 @@
visiting- (все данные) visiting- (все данные)
<my-helper :pretext="visiting"/> <my-helper :pretext="visiting"/>
</v-col> </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 /> <rating-page :pages_count=pages_count />
</v-col> </v-col>
<v-col class="d-flex flex-column bg-yellow"> <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-col>
<v-card class="text-center h-100 ">
<div v-for="(x, key) in dataActivusers" :key="key" >
<top-user <top-user
:users = x :activusers = dataActivusers
:name= key
/> />
</div>
</v-card>
</v-col> </v-col>
</v-row> </v-row>
<!-- --> <!-- -->
@@ -236,8 +231,10 @@ setup(){
const visiting = ref([]) const visiting = ref([])
const feedback = ref([]) const feedback = ref([])
const staff = ref(0) const staff = ref(0)
const dataLineChart = ref({}) const dataLineChart = ref({})
const dataActivusers = ref({}) const dataActivusers = ref({})
const dataTopUser = ref({})
const previous = ref({start: new Date(), end: new Date()}) const previous = ref({start: new Date(), end: new Date()})
const selected_days = ref({today: 'сегодня', year: {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() previous_period()
let lineCharts = {} let lineCharts = {}
let activusers = {} let activusers = {}
let top_user = {}
// let portal_traffic = { // let portal_traffic = {
// now: { // now: {
// title: '', // title: '',
@@ -297,25 +295,25 @@ setup(){
where.push(what) where.push(what)
} }
} }
console.log(visiting.value);
const groupedData = visiting.value.reduce((acc, item) => { const groupedData = visiting.value.reduce((acc, item) => {
// Данные для графика по фильтру // Данные для графика по фильтру
if (item.visitdate >= format2(filterStore.date_period.startdate) && item.visitdate <= format2(filterStore.date_period.enddate)){ if (item.visitdate >= format2(filterStore.date_period.startdate) && item.visitdate <= format2(filterStore.date_period.enddate)){
// ------------------------------
if (!lineCharts[item.visitdate]) { if (!lineCharts[item.visitdate]) {
lineCharts[item.visitdate] = {count: 0, unic: []} lineCharts[item.visitdate] = {count: 0, unic: []}
} }
checking_for_entry(lineCharts[item.visitdate]['unic'], splitname(item.author)) checking_for_entry(lineCharts[item.visitdate]['unic'], splitname(item.author))
// ------------------------------
if (!activusers[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]) { if (!activusers[splitname(item.author)].session[item.visitdate]) {
activusers[splitname(item.author)].session[item.visitdate] = {pages: {}} 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 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,17 +355,16 @@ setup(){
// Данные для посещаемость портала // Данные для посещаемость портала
if (item.visitdate >= format2(previous.value.start) && item.visitdate <= format2(previous.value.end)){ if (item.visitdate >= format2(previous.value.start) && item.visitdate <= format2(previous.value.end)){
// console.log(item.visitdate, '------------------------------'); //
} }
dataLineChart.value = lineCharts dataLineChart.value = lineCharts
dataActivusers.value = activusers dataActivusers.value = activusers
dataTopUser.value = top_user
return acc return acc
}, {}) }, {})
//
watch(()=>filterStore.date_period,(newValue,oldValue)=>{ watch(()=>filterStore.date_period,(newValue,oldValue)=>{
if(newValue){ if(newValue){
visitionreduce() visitionreduce()
@@ -369,10 +374,35 @@ setup(){
pages_count.value.data = groupedData pages_count.value.data = groupedData
tooltipinfo()
return groupedData 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 = () => { const title_period = () => {