add polls

This commit is contained in:
baoliang 2020-09-12 15:31:50 +08:00
parent 9a51ff4ea5
commit 0aaf61a457
10 changed files with 83 additions and 1 deletions

BIN
polls/static/.DS_Store vendored Normal file

Binary file not shown.

BIN
polls/static/polls/.DS_Store vendored Normal file

Binary file not shown.

22
polls/static/polls/js/echarts.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -18,6 +18,7 @@
<script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
{% block add_css %} {% endblock %}
</head>
<body>
<div class="flex-container">
@ -25,5 +26,6 @@
</div>
<script src="{% static 'js/jquery-1.11.2.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
{% block add_js %} {% endblock %}
</body>
</html>

View File

@ -0,0 +1,52 @@
{% extends 'polls/base.html' %}
{% load static %}
{% block content%}
<div class="row">
<div class="col-xs-12">
<div id="chart1" style="width: 100%%;height:400px;margin-bottom:40px;"></div>
</div>
<div class="col-xs-12">
<div id="chart2" style="width: 100%%;height:400px;margin-bottom:40px;"></div>
</div>
</div>
{% endblock%}
{% block add_js %}
<script src="{% static 'polls/js/echarts.min.js' %}"></script>
<script type="text/javascript">
var myChart = echarts.init(document.getElementById('chart1'));
var option = {
title: {
text: '新媒体数量'
},
tooltip: {},
legend: {
data:['数量']
},
xAxis: {
data: ["公众号","微博","头条号","其他"]
},
yAxis: {},
series: [{
name: '数量',
type: 'bar',
data: [5, 20, 36, 10]
}]
};
myChart.setOption(option);
var myChart2 = echarts.init(document.getElementById('chart2'));
var option = {
title: {
text: '新媒体文章量'
},
xAxis: {
data: ["公众号","微博","头条号","其他"]
},
yAxis: {},
series: [{
data: [820, 932, 901, 934, 1290, ],
type: 'line'
}]
};
myChart2.setOption(option);
</script>
{% endblock %}

View File

@ -17,4 +17,5 @@ urlpatterns = [
path('medias/create/', views.create_media, name='polls_add_media'),
path('medias/list/', views.medias, name='polls_medias'),
path('news/detail/', views.news_detail, name='polls_news_detail'),
path('monitor/statistics/', views.monitor_statistics, name='polls_monitor_statistics')
]

View File

@ -2,3 +2,4 @@ from .user import index, status_500, status_401, polls_login, send_code, registe
from .notice import notices, read_notice
from .media import medias, create_media
from .news import news_detail
from .monitor import monitor_statistics

Binary file not shown.

4
polls/views/monitor.py Normal file
View File

@ -0,0 +1,4 @@
from django.shortcuts import render
def monitor_statistics(request):
return render(request, 'polls/monitor_statistics.html')