add message

This commit is contained in:
baoliang 2020-09-26 18:22:59 +08:00
parent 252d171a2c
commit c87076d495
9 changed files with 67 additions and 4 deletions

View File

@ -0,0 +1,56 @@
{% extends 'polls/base.html' %}
{% load static %}
{% block content%}
<div class="flex-container">
<div class="row">
<div class="col-xs-12">
<div id="chart1" style="width: 100%%;height:400px;margin:20px 10px;"></div>
</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: '政务新媒体存在问题占比',
left: 'center',
subtextStyle: {
fontSize: 16,
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
top: '15%',
data: ['账号不存在', '账号已关闭', '监测期间无更新', '两周无更新', '名称变更']
},
series: [
{
name: '总量',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: [
{name: '账号不存在', value:27},
{name: '账号已关闭', vlaue:1},
{name: '监测期间无更新', value:6},
{name: '两周无更新', value:46},
{name: '名称变更', value:25},
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]};
myChart.setOption(option);
</script>
{% endblock %}

View File

@ -55,7 +55,7 @@
var option2 = {
title: {
text: '政务新媒体区域分布',
subtext: '省直部门{{total1}},市直部门{{total2}},县区政府{{total3}}',
subtext: '省直部门{{total1}},市直部门{{total2}},县区政府{{total3}}',
subtextStyle: {
fontSize: 16,
},

View File

@ -30,6 +30,8 @@ urlpatterns = [
views.news_detail, name='polls_news_detail'),
path('monitor/statistics/', views.monitor_statistics,
name='polls_monitor_statistics'),
path('monitor/result/', views.monitor_result,
name='polls_monitor_result'),
path('tasks/list/', views.tasks, name='polls_tasks_list'),
path('tasks/create/', views.create_task, name='polls_tasks_create'),
path('tasks/create_test/', views.create_test_task,

View File

@ -2,7 +2,7 @@ from .user import index, status_500, status_401, polls_login, send_code, registe
from .notice import notices, notice_top, read_notice, reply_notice
from .media import medias, my_medias, create_media, update_media, media_detail
from .news import news_list, news_top, news_detail
from .monitor import monitor_statistics
from .monitor import monitor_statistics, monitor_result
from .task import tasks, create_task, create_test_task
from .group import groups, room
from .compartment import compartments

View File

@ -104,3 +104,7 @@ def monitor_statistics(request):
total3 = NewMedia.category_three_count()
return render(request, 'polls/monitor_statistics.html', {'chart1_data': chart1_data, 'total': total, 'chart2_data': chart2_data, 'total1': total1, 'total2': total2, 'total3': total3})
def monitor_result(request):
return render(request, 'polls/monitor_result.html')

View File

@ -24,13 +24,14 @@ def tasks(request):
result = dict()
result['id'] = o.id
m = []
for g in o.groups:
for g in o.groups.all():
n = model_to_dict(g, ['id', 'name'])
m.append(n)
result['groups'] = m
result['content'] = o.content
result['added'] = o.added.strftime("%Y-%m-%d %H:%M:%S")
results.append(result)
return JsonResponse(results, safe=False)
return JsonResponse({'status': 'success', 'message':results}, safe=False)
@csrf_exempt