This commit is contained in:
guange 2019-01-21 10:47:46 +08:00
parent b151c8bbc6
commit d11371e526
5 changed files with 21 additions and 10 deletions

View File

@ -1057,7 +1057,7 @@ border-radius: 3px;
text-align: right;
display: block;
color: #ffffff;
width: 130px;
width: 100px;
}
.percentChart li .rightPercent{
flex:1;

View File

@ -1,4 +1,5 @@
{% load static %}
{% load myapp %}
<!DOCTYPE html>
<html lang="en">
@ -8,7 +9,7 @@
<link href="{% static "styles/common.css" %}" rel="stylesheet">
<script type="text/javascript">
var platform_info = {{platform_info|safe}};
var platform_info = {{platform_info_json|safe}};
var last_day_product = {{last_day_product|safe}};
var last_day_comment = {{last_day_comment|safe}};
@ -109,21 +110,21 @@
<div class="div_any_title"><img src="{% static "images/title_2.png" %}">各商品采集数据量</div>
<div class="percentChart">
<li>
<span class="leftTitle">京东Android</span>
<span class="leftTitle">存储空间</span>
<div class="rightPercent">
<span>120</span>
<p style="width:30%">40</p >
<span>{{platform_info.disk_total}}</span>
<p style="width:{%present(platform_info.disk_used,platform_info.disk_total)%}%">{{platform_info.disk_used}}</plaintext></p >
</div>
</li>
<li>
<span class="leftTitle">京东iPhone</span>
<span class="leftTitle">内存占用</span>
<div class="rightPercent">
<span>500</span>
<p style="width:60%">300</p >
<span>{{platform_info.mem_total}}</span>
<p style="width:{%present(platform_info.mem_used / platform_info.mem_total)%}%">{{platform_info.mem_used}}</p >
</div>
</li>
<li>
<span class="leftTitle">微信购物</span>
<span class="leftTitle">进程数</span>
<div class="rightPercent">
<span>300</span>
<p style="width:50%">150</p >

View File

@ -0,0 +1,9 @@
from django import template
register = template.Library()
def present(val1, val2):
"""获取两个数的百分比,取整 val1 / val2 """
return int(val1 * 100 / val2)

View File

@ -22,7 +22,8 @@ def crawl(request):
last_day_comment.append(last_day.comment_c)
return render(request, 'myapp/crawl.html', {"crawl_info": crawl_info,
"platform_info":json.dumps(platform_info),
"platform_info_json":json.dumps(platform_info),
"platform_info": platform_info,
"news": news,
"last_day_product":json.dumps(last_day_product),
"last_day_comment": json.dumps(last_day_comment)})