This commit is contained in:
iriska-gri committed 2024-02-27 17:07:26 +03:00
1 parent 5aa4136cfd
commit 3875cc2a5a
5 files changed
+81 -10

No files matched your search

@@ -1,6 +1,6 @@
<template>
<v-card class="text-center text-blue-grey-darken-4 d-flex h-100 flex-column cursor-default justify-center">
<!-- <my-helper :pretext="x"/> -->
<v-row no-gutters class="flex-grow-0 ">
<v-col class="text-h5 font-weight-bold pl-5">
{{indicator.title}}
@@ -44,7 +44,7 @@
:color="val.previos<val.user.length?'green-darken-2':'deep-orange-darken-4'"
:icon="val.previos<val.user.length?'mdi-arrow-up-bold':'mdi-arrow-down-bold'"
/>
<!-- <my-helper :pretext="alldata.beforperiod"/> -->
<!-- -->
{{100 - parseFloat( val.user.length * 100 /val.previos).toFixed(2)}} %
</td>
<td v-if="!val.previos"></td>
@@ -118,7 +118,7 @@ export default {
props.alldata.beforperiod.filter( e=> data2.diff(moment(e.visitdate), 'days') < between).reduce((acc, item) => {
res.period.previos += item.total
res.period.previos += item.user.length
return acc
}, res.period.previos)
+66 -5
View File
@@ -35,9 +35,10 @@
<v-row no-gutters class="h-100 gap">
<v-col class="flex-column d-flex">
<v-row no-gutters class="flex-column gap" >
<!-- <v-col v-for="x in dataIndicators" :key=x>
<my-helper :pretext="alldata.period"/>
<v-col v-for="x in cardtotal" :key=x>
<card-total :indicator=x />
</v-col> -->
</v-col>
</v-row>
</v-col>
@@ -99,19 +100,78 @@ export default {
setup(){
const cardtotal = ref(
{
"crr": {
"title": "Удержание",
"abb": "(CRR)",
"tooltip": "Показатель удержания клиентов (retention rate) — это коэффициент, который отражает способность компании выстраивать крепкие отношения с покупателями. Он показывает, насколько хорошо бизнес удерживает постоянных клиентов в течение определенного промежутка времени. Метрику также называют customer retention rate, или CRR.",
"data": 0
},
"br": {
"title": "Отказы",
"abb": "(BR)",
"tooltip": "Термин в веб-аналитике, обозначающий процентное соотношение количества посетителей, покинувших сайт прямо со страницы входа или просмотревших не более одной страницы сайта",
"data": 0
},
"ppv": {
"title": "Страниц за визит",
"abb": "(PPV)",
"tooltip": "Глубина просмотра страниц — поведенческая метрика, которая показывает, сколько страниц на сайте в среднем просматривает пользователь",
"data": 0
}
})
const filterStore = usePortalFilterStore()
const alldata =ref({period: [], staff: 0, beforperiod: []})
const visition = () => {
axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => {
alldata.value = result.data
console.log(result.data, 'result.data');
alldata.value = preparedata(result.data)
console.log(result.data, 'result.data');
totalfn()
})}
visition()
const preparedata=(data)=>{
let beforperiod = []
data.beforperiod.forEach((e)=>{
let ind = beforperiod.findIndex(el=>el.visitdate===e.visitdate)
if(ind>-1){
beforperiod[ind].user.push(e.user__user_id)
}else{
beforperiod.push({visitdate: e.visitdate, user:[e.user__user_id]})
}
})
data.beforperiod=beforperiod
return data
}
const totalfn = () => {
let beforperiodusers = new Set([])
alldata.value.beforperiod.forEach(e => beforperiodusers.add(...e.user))
let periodusers = new Set([])
let brdata = {}
alldata.value.period.forEach((e) => {
periodusers.add(e.user.id)
if (!brdata[e.user.id]) {
brdata[e.user.id] = []
}
brdata[e.user.id].push(e.fullPath)
})
console.log(brdata, 'brdata')
let bothuser = new Set([...periodusers].filter(element => beforperiodusers.has(element)))
cardtotal.value.crr.data = bothuser.size*100/beforperiodusers.size
}
watch(()=>filterStore.date_period,()=>{
@@ -374,7 +434,8 @@ setup(){
return {
alldata
alldata,
cardtotal
// visiting,
// pages_count,
// visitionreduce,
+3 -1
View File
@@ -14,7 +14,7 @@
<v-col lg=3 class="w100">
<v-row no-gutters class="h-100 gap">
<v-col >
<portal-traffic :traffic=dataAttendance />
<!-- <portal-traffic :traffic=dataAttendance /> -->
</v-col>
<v-col lg=9>
@@ -34,7 +34,9 @@
<v-row no-gutters class="h-100 gap">
<v-col class="flex-column d-flex">
<v-row no-gutters class="flex-column gap" >
<my-helper :pretext="dataIndicators"/>
<v-col v-for="x in dataIndicators" :key=x>
<!-- -->
<card-total :indicator=x />
</v-col>
</v-row>