График
This commit is contained in:
1 parent
6ca56c6408
commit
f699b4ffef
4 files changed
+66
-7
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>
|
||||
<v-row>
|
||||
<v-col
|
||||
<!-- <v-col
|
||||
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-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {pagecounter} from '@/utils/universal_functions'
|
||||
import lineGraph from '@/components/graph/line-graph.vue'
|
||||
|
||||
export default {
|
||||
|
||||
components: { lineGraph },
|
||||
|
||||
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()
|
||||
|
||||
return {
|
||||
data,
|
||||
options
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -119,10 +119,7 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
|
||||
|
||||
result = NewsSerializer(newsqueryset, many=True).data
|
||||
print(result, '------------------------------')
|
||||
|
||||
|
||||
|
||||
|
||||
return Response({"result":result, "countpage": countpage})
|
||||
|
||||
def post(self, request):
|
||||
|
||||
@@ -31,8 +31,8 @@ class Counter(ListAPIView):
|
||||
|
||||
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())
|
||||
else:
|
||||
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
||||
# else:
|
||||
# watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
|
||||
watch.count+=1
|
||||
watch.save()
|
||||
|
||||
|
||||
Reference in new issue
Block a user