add message
This commit is contained in:
parent
e6e9ad93bd
commit
40f57f62d6
|
@ -6,6 +6,10 @@
|
|||
<div class="col-xs-12">
|
||||
<div id="chart1" style="width: 100%%;height:400px;margin:20px 10px;"></div>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<div id="chart2" style="width: 100%%;height:400px;margin:20px 10px;"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock%}
|
||||
|
@ -99,7 +103,7 @@
|
|||
};
|
||||
var option = {
|
||||
title: {
|
||||
text: '逐月累计发文量',
|
||||
text: '全省政务新媒体更新次数(逐月)',
|
||||
subtextStyle: {
|
||||
fontSize: 16,
|
||||
},
|
||||
|
@ -163,5 +167,158 @@
|
|||
]
|
||||
};
|
||||
myChart.setOption(option);
|
||||
|
||||
|
||||
var myChart2 = echarts.init(document.getElementById('chart2'));
|
||||
var posList = [
|
||||
'left', 'right', 'top', 'bottom',
|
||||
'inside',
|
||||
'insideTop', 'insideLeft', 'insideRight', 'insideBottom',
|
||||
'insideTopLeft', 'insideTopRight', 'insideBottomLeft', 'insideBottomRight'
|
||||
];
|
||||
|
||||
myChart2.configParameters = {
|
||||
rotate: {
|
||||
min: -90,
|
||||
max: 90
|
||||
},
|
||||
align: {
|
||||
options: {
|
||||
left: 'left',
|
||||
center: 'center',
|
||||
right: 'right'
|
||||
}
|
||||
},
|
||||
verticalAlign: {
|
||||
options: {
|
||||
top: 'top',
|
||||
middle: 'middle',
|
||||
bottom: 'bottom'
|
||||
}
|
||||
},
|
||||
position: {
|
||||
options: echarts.util.reduce(posList, function (map, pos) {
|
||||
map[pos] = pos;
|
||||
return map;
|
||||
}, {})
|
||||
},
|
||||
distance: {
|
||||
min: 0,
|
||||
max: 100
|
||||
}
|
||||
};
|
||||
|
||||
myChart2.config = {
|
||||
rotate: 90,
|
||||
align: 'left',
|
||||
verticalAlign: 'middle',
|
||||
position: 'insideBottom',
|
||||
distance: 15,
|
||||
onChange: function () {
|
||||
var labelOption = {
|
||||
normal: {
|
||||
rotate: myChart2.config.rotate,
|
||||
align: myChart2.config.align,
|
||||
verticalAlign: myChart2.config.verticalAlign,
|
||||
position: myChart2.config.position,
|
||||
distance: myChart2.config.distance
|
||||
}
|
||||
};
|
||||
myChart2.setOption({
|
||||
series: [{
|
||||
label: labelOption
|
||||
}, {
|
||||
label: labelOption
|
||||
}, {
|
||||
label: labelOption
|
||||
}, {
|
||||
label: labelOption
|
||||
}]
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var labelOption = {
|
||||
show: true,
|
||||
position: myChart.config.position,
|
||||
distance: myChart.config.distance,
|
||||
align: myChart.config.align,
|
||||
verticalAlign: myChart.config.verticalAlign,
|
||||
rotate: myChart.config.rotate,
|
||||
formatter: '{c} {name|{a}}',
|
||||
fontSize: 8,
|
||||
rich: {
|
||||
name: {
|
||||
textBorderColor: '#fff'
|
||||
}
|
||||
}
|
||||
};
|
||||
var option = {
|
||||
title: {
|
||||
text: '全省政务新媒体开设数量(逐月)',
|
||||
subtextStyle: {
|
||||
fontSize: 16,
|
||||
},
|
||||
left: 'center'
|
||||
},
|
||||
color: ['#003366', '#006699', '#4cabce', '#e5323e', '#ccc'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
top: '10%',
|
||||
data: ['微信', '微博', '头条', '抖音', '其它']
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
axisTick: {show: false},
|
||||
data: ['6月','7月', '8月', '9月', '10月']
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '微信',
|
||||
type: 'bar',
|
||||
barGap: 0,
|
||||
label: labelOption,
|
||||
data: [40, 80, 44, 36, 78]
|
||||
},
|
||||
{
|
||||
name: '微博',
|
||||
type: 'bar',
|
||||
label: labelOption,
|
||||
data: [25, 14, 41, 10, 18]
|
||||
},
|
||||
{
|
||||
name: '头条',
|
||||
type: 'bar',
|
||||
label: labelOption,
|
||||
data: [21, 32, 21, 14, 19]
|
||||
},
|
||||
{
|
||||
name: '抖音',
|
||||
type: 'bar',
|
||||
label: labelOption,
|
||||
data: [98, 77, 101, 99, 40]
|
||||
},
|
||||
{
|
||||
name: '其他',
|
||||
type: 'bar',
|
||||
label: labelOption,
|
||||
data: [25, 32, 46, 20, 8]
|
||||
}
|
||||
]
|
||||
};
|
||||
myChart2.setOption(option);
|
||||
</script>
|
||||
{% endblock %}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -16,7 +16,7 @@ def last_messages(request):
|
|||
return HttpResponse(status=405)
|
||||
id = request.user.id
|
||||
group_id = request.GET.get('group_id')
|
||||
messages = Message.objects.filter(send_to_id=group_id)
|
||||
messages = Message.objects.filter(send_to_id=group_id)[:100]
|
||||
results = []
|
||||
for o in messages:
|
||||
result = dict()
|
||||
|
|
|
@ -71,6 +71,7 @@ def read_notice(request):
|
|||
def detail_notice(request, notice_id):
|
||||
if request.method == 'POST':
|
||||
return HttpResponse(status=405)
|
||||
print(notice_id, (not notice_id))
|
||||
if not notice_id:
|
||||
return JsonResponse({'status': 'error', 'message': '通知ID错误'})
|
||||
try:
|
||||
|
@ -79,23 +80,24 @@ def detail_notice(request, notice_id):
|
|||
results['id'] = notice.id
|
||||
results['category'] = notice.type
|
||||
results['content'] = notice.content
|
||||
ReplyModel = apps.get_model(notice.app, notice.model)
|
||||
m = ReplyModel.objects.get(pk=notice.record_id)
|
||||
detail = dict()
|
||||
detail['id'] = m.id
|
||||
detail['code'] = m.code
|
||||
if notice.model == 'Weixin':
|
||||
detail['type'] = 'weixin'
|
||||
elif notice.model == 'Weibo':
|
||||
detail['type'] = 'weibo'
|
||||
elif notice.model == 'Toutiao':
|
||||
detail['type'] = 'Toutiao'
|
||||
elif notice.model == 'Douyin':
|
||||
detail['type'] = 'douyin'
|
||||
else:
|
||||
detail['type'] = 'qita'
|
||||
detail['status'] = m.status
|
||||
results['media'] = detail
|
||||
if notice.type == 1:
|
||||
ReplyModel = apps.get_model(notice.app, notice.model)
|
||||
m = ReplyModel.objects.get(pk=notice.record_id)
|
||||
detail = dict()
|
||||
detail['id'] = m.id
|
||||
detail['code'] = m.code
|
||||
if notice.model == 'Weixin':
|
||||
detail['type'] = 'weixin'
|
||||
elif notice.model == 'Weibo':
|
||||
detail['type'] = 'weibo'
|
||||
elif notice.model == 'Toutiao':
|
||||
detail['type'] = 'Toutiao'
|
||||
elif notice.model == 'Douyin':
|
||||
detail['type'] = 'douyin'
|
||||
else:
|
||||
detail['type'] = 'qita'
|
||||
results['media'] = detail
|
||||
detail['status'] = m.status
|
||||
results['added'] = notice.added.strftime("%Y-%m-%d %H:%M:%S")
|
||||
results['updated'] = notice.updated.strftime("%Y-%m-%d %H:%M:%S")
|
||||
return JsonResponse({'status': 'success', 'message': results})
|
||||
|
|
|
@ -10,6 +10,7 @@ from polls.models import Message, Notice, Task, TaskAddition
|
|||
from polls.tasks import process_task
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from polls.utils import model_to_dict, queryset_to_list, parse
|
||||
from dashboard.models import Group, Group_user, Userprofile
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
|
@ -65,6 +66,13 @@ def create_task(request):
|
|||
if picture:
|
||||
pictureAddtion = TaskAddition.objects.create(
|
||||
task=task, category=2, image=picture)
|
||||
|
||||
for group in groups:
|
||||
users = Group_user.objects.filter(group=group)
|
||||
for u in users:
|
||||
g = Group.objects.get(id=group)
|
||||
content = '用户%s在群组“%s”发布了任务,请查收消息' % (profile.name, g.name)
|
||||
Notice.create_normal_notice(u.user_id, content)
|
||||
return JsonResponse({'status': 'success'})
|
||||
|
||||
|
||||
|
@ -88,12 +96,19 @@ def get_task(request):
|
|||
result['content'] = task.content
|
||||
result['total'] = task.total()
|
||||
result['record'] = task.record()
|
||||
# records = task.records()
|
||||
# n = []
|
||||
# for r in records:
|
||||
# p = dict()
|
||||
# profile = r.user.profile
|
||||
# print(profile)
|
||||
result['isOwner'] = task.created_by_id == id
|
||||
records = task.records()
|
||||
n = []
|
||||
for r in records:
|
||||
p = dict()
|
||||
p['id'] = r.id
|
||||
p['added'] = task.added.strftime("%Y-%m-%d %H:%M:%S")
|
||||
p['status'] = r.status
|
||||
profile = Userprofile.objects.filter(user_id=r.user_id).first()
|
||||
p['name'] = profile.name
|
||||
p['organization'] = profile.organization.name
|
||||
n.append(p)
|
||||
result['records'] = n
|
||||
result['added'] = task.added.strftime("%Y-%m-%d %H:%M:%S")
|
||||
return JsonResponse({'status': 'success', 'message': result})
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ def password_recover_step_one(request):
|
|||
if not phone:
|
||||
return JsonResponse({'status': 'error', 'message': '手机号不正确'})
|
||||
code = request.POST.get('code')
|
||||
print(code)
|
||||
if not code:
|
||||
return JsonResponse({'status': 'error', 'message': '验证码不正确'})
|
||||
verify_code = VerifyCode.objects.filter(
|
||||
|
|
Loading…
Reference in New Issue