Левая статистика
This commit is contained in:
1 parent
2b79d64c37
commit
3c6ba1325d
7 files changed
+117
-48
No files matched your search
@@ -4,7 +4,7 @@
|
||||
>
|
||||
<v-card-text class="text-h5 pa-2 pl-5 flex-wrap align-center d-flex justify-space-between">
|
||||
{{name}}
|
||||
<!-- <my-helper :pretext="users"/> -->
|
||||
|
||||
<v-icon
|
||||
color="blue-grey-lighten-1"
|
||||
:icon="ico"
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<v-list class="pa-0">
|
||||
<v-list-item
|
||||
v-if="!rail"
|
||||
class="text-caption font-weight-bold text-truncate"
|
||||
>
|
||||
<v-tooltip>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon
|
||||
icon="mdi-information"
|
||||
color="cyan-darken-3"
|
||||
size="12"
|
||||
v-bind="props"
|
||||
/>
|
||||
</template>
|
||||
<span class="text-caption">
|
||||
Информация о странице: <br/>
|
||||
{{router.currentRoute.value.meta.title}} <br/>
|
||||
с {{format1(appStore.countvisitor.visitdate)}}
|
||||
</span>
|
||||
</v-tooltip>
|
||||
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
|
||||
<v-divider />
|
||||
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
|
||||
<v-divider />
|
||||
<p>Из них уникальных: {{ appStore.countvisitor.uniqtoday }}</p>
|
||||
<v-divider />
|
||||
</v-list-item>
|
||||
<v-list-item v-else class="align-center">
|
||||
<v-tooltip
|
||||
v-model="showTooltip"
|
||||
location="top"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon
|
||||
v-bind="props"
|
||||
color="grey"
|
||||
>
|
||||
mdi-account-eye
|
||||
</v-icon>
|
||||
</template>
|
||||
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
|
||||
<v-divider />
|
||||
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
|
||||
<v-divider />
|
||||
<p>Из них уникальных: {{ appStore.countvisitor.uniqtoday }}</p>
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { format1 } from '@/utils/universal_functions'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAppStore } from '@/store/app'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
|
||||
props: {
|
||||
rail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
setup() {
|
||||
const router = useRouter()
|
||||
const appStore = useAppStore()
|
||||
const showTooltip = ref(false)
|
||||
|
||||
return {
|
||||
router,
|
||||
appStore,
|
||||
showTooltip,
|
||||
format1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<!-- cycle -->
|
||||
|
||||
<v-carousel
|
||||
|
||||
cycle
|
||||
interval="10000"
|
||||
cover
|
||||
height="450"
|
||||
@@ -10,7 +10,7 @@
|
||||
show-arrows="hover"
|
||||
color="white"
|
||||
>
|
||||
|
||||
|
||||
<v-carousel-item
|
||||
v-for="(x, i) in carous" :key="i"
|
||||
:src="`${burl}${x.link}`"
|
||||
|
||||
@@ -203,40 +203,10 @@
|
||||
</v-list>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="py-0 pl-1 d-flex flex-column">
|
||||
<v-list class=" d-flex flex-column ">
|
||||
|
||||
<v-list-item v-if="!rail" class="text-caption font-weight-bold text-truncate">
|
||||
<p>Посещений всего:{{ appStore.countvisitor.totalvisit }}</p>
|
||||
<v-divider />
|
||||
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
|
||||
<v-divider />
|
||||
<p>Уникальных посещений: {{ appStore.countvisitor.uniqtoday }}</p>
|
||||
<v-divider />
|
||||
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item v-else class="align-center ml-2">
|
||||
<v-tooltip
|
||||
v-model="showTooltip"
|
||||
location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon v-bind="props" color="grey">
|
||||
mdi-account-eye
|
||||
</v-icon>
|
||||
</template>
|
||||
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
|
||||
<v-divider />
|
||||
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
|
||||
<v-divider />
|
||||
<p>Уникальных посещений: {{ appStore.countvisitor.uniqtoday }}</p>
|
||||
</v-tooltip>
|
||||
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-row no-gutters class="flex-grow-0">
|
||||
<v-col>
|
||||
<page-counter :rail=rail />
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
</v-col>
|
||||
|
||||
@@ -293,25 +263,30 @@ import { ref, computed} from 'vue'
|
||||
import uf from '@/utils/universal_functions'
|
||||
import { useAccountStore } from '@/store/AccountStore'
|
||||
import { useMainmenuStore } from '@/store/MainmenuStore'
|
||||
import { useAppStore } from '@/store/app'
|
||||
import { useTheme } from "vuetify";
|
||||
import AuthForm from '@/components/UI/Auth-form.vue'
|
||||
import OnlineUsers from '@/components/UI/fiousercard/onlineUsers.vue'
|
||||
import CardLike from '@/components/cardLike.vue'
|
||||
import { clearAxios } from '@/utils/axios-api'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
|
||||
import PageCounter from '../../components/UI/defaultportal/page-counter.vue'
|
||||
export default {
|
||||
|
||||
components: { AuthForm, OnlineUsers, CardLike, VcardUser },
|
||||
components: {
|
||||
AuthForm,
|
||||
OnlineUsers,
|
||||
CardLike,
|
||||
VcardUser,
|
||||
PageCounter
|
||||
},
|
||||
|
||||
mixins: [uf],
|
||||
|
||||
setup() {
|
||||
// pagecounter()
|
||||
const router = useRouter()
|
||||
const appStore = useAppStore()
|
||||
|
||||
|
||||
const theme = useTheme();
|
||||
const mainmenuStore = useMainmenuStore()
|
||||
const accountStore = useAccountStore()
|
||||
@@ -431,11 +406,11 @@ export default {
|
||||
imageSrc,
|
||||
LikeDialog,
|
||||
scrimg,
|
||||
appStore,
|
||||
|
||||
rail,
|
||||
showTooltip,
|
||||
menuTruncated,
|
||||
router,
|
||||
|
||||
alert,
|
||||
burl
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ export const useAppStore = defineStore('app', () => {
|
||||
const loading = ref(false)
|
||||
const countvisitor = ref({ "totalvisit": 0,
|
||||
"visittoday":0,
|
||||
"uniqtoday" : 0})
|
||||
"uniqtoday" : 0,
|
||||
"visitdate" : '2024-01-01'
|
||||
})
|
||||
return {loading,countvisitor}
|
||||
|
||||
},
|
||||
|
||||
@@ -15,3 +15,8 @@ class CountSerializer(serializers.ModelSerializer):
|
||||
|
||||
def get_user(self, obj):
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data
|
||||
|
||||
class VisitdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = CountVisitor
|
||||
fields = ['visitdate']
|
||||
@@ -44,10 +44,13 @@ class Counter(ListAPIView):
|
||||
# watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
||||
watch.count+=1
|
||||
watch.save()
|
||||
|
||||
|
||||
datavisit = CountVisitor.objects.filter(pages=page.id).earliest('visitdate')
|
||||
|
||||
res = {"totalvisit": CountVisitor.objects.filter(pages=page.id).aggregate(Sum('count'))['count__sum'],
|
||||
"visittoday":CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).aggregate(Sum('count'))['count__sum'],
|
||||
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count()
|
||||
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count(),
|
||||
"visitdate" : VisitdateSerializer(datavisit).data['visitdate']
|
||||
}
|
||||
|
||||
return Response(res)
|
||||
|
||||
Reference in new issue
Block a user