График
This commit is contained in:
1 parent
6ca56c6408
commit
f699b4ffef
4 files changed
+65
-6
No files matched your search
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Line } from 'vue-chartjs'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'lineGraph',
|
||||||
|
components: {
|
||||||
|
Line
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
onMounted(() => {
|
||||||
|
this.renderChart(this.data, this.options)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -1,18 +1,49 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col
|
<!-- <v-col
|
||||||
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||||
>
|
>
|
||||||
Об инспекции
|
Об инспекции
|
||||||
|
</v-col> -->
|
||||||
|
|
||||||
|
<v-col>
|
||||||
|
<line-graph :data="data" :options="options"/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {pagecounter} from '@/utils/universal_functions'
|
import {pagecounter} from '@/utils/universal_functions'
|
||||||
|
import lineGraph from '@/components/graph/line-graph.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
components: { lineGraph },
|
||||||
|
|
||||||
setup(){
|
setup(){
|
||||||
|
const data = {
|
||||||
|
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: 'Data One',
|
||||||
|
backgroundColor: '#f87979',
|
||||||
|
data: [40, 39, 10, 40, 39, 80, 40]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
const options = {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: false
|
||||||
|
}
|
||||||
pagecounter()
|
pagecounter()
|
||||||
|
|
||||||
|
return {
|
||||||
|
data,
|
||||||
|
options
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -119,9 +119,6 @@ class NewsCrossroadAPIView(ListAPIView):
|
|||||||
|
|
||||||
|
|
||||||
result = NewsSerializer(newsqueryset, many=True).data
|
result = NewsSerializer(newsqueryset, many=True).data
|
||||||
print(result, '------------------------------')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Response({"result":result, "countpage": countpage})
|
return Response({"result":result, "countpage": countpage})
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ class Counter(ListAPIView):
|
|||||||
|
|
||||||
if request.data['user__id'] is not None:
|
if request.data['user__id'] is not None:
|
||||||
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),pages=page, visitdate=date.today())
|
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),pages=page, visitdate=date.today())
|
||||||
else:
|
# else:
|
||||||
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
# watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
||||||
watch.count+=1
|
watch.count+=1
|
||||||
watch.save()
|
watch.save()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user