Skip to content

Commit

Permalink
增加 日期。
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy committed Dec 8, 2017
1 parent cd76ef4 commit 24fa19a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions web/dataTableHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 6,13 @@
import libs.stock_web_dic as stock_web_dic
import web.base as webBase
import logging
import datetime

WEB_EASTMONEY_URL = u"""
<a class='btn btn-info btn-xs' href='http://quote.eastmoney.com/%s.html' target='_blank'>查看</a>
<a class='btn btn-danger btn-xs' href='/data/indicators?code=%s' target='_blank'>指标</a>
"""
#和在dic中的字符串一致。字符串前面都不特别声明是u""
# 和在dic中的字符串一致。字符串前面都不特别声明是u""
eastmoney_name = "东方财富"


Expand All @@ -23,6 24,8 @@ def get(self):
stockWeb = stock_web_dic.STOCK_WEB_DATA_MAP[name]
# self.uri_ = ("self.request.url:", self.request.uri)
# print self.uri_
date_now = datetime.datetime.now()
date_now_str = date_now.strftime("%Y%m%d")
try:
# 增加columns 字段中的【东方财富】
logging.info(eastmoney_name in stockWeb.column_names)
Expand All @@ -38,7 41,8 @@ def get(self):
except Exception as e:
print("error :", e)
logging.info("####################GetStockHtmlHandlerEnd")
self.render("stock_web.html", stockWeb=stockWeb, leftMenu=webBase.GetLeftMenu(self.request.uri))
self.render("stock_web.html", stockWeb=stockWeb, date_now=date_now_str,
leftMenu=webBase.GetLeftMenu(self.request.uri))


# 获得股票数据内容。
Expand Down
5 changes: 4 additions & 1 deletion web/templates/stock_web.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 12,9 @@ <h3 class="header smaller lighter blue">{{ stockWeb.name }}</h3>
<div class="col-md-4" id="filter_col{{ index 1 }}" data-column="{{ index }}">
{{ stockWeb.column_names[index] }} &nbsp;
<!-- Column - {{ stockWeb.column_names[index] }} - {{ element }} -->
<input type="text" class="column_filter input-group-sm form-control" id="col{{ index }}_filter">
<input type="text" class="column_filter input-group-sm form-control"
{% if element == 'date' %} value="{{ date_now }}" {% end %}
id="col{{ index }}_filter">
</div>
{% end %}
</div>
Expand Down Expand Up @@ -68,6 70,7 @@ <h3 class="header smaller lighter blue">{{ stockWeb.name }}</h3>
$(this).val()
).draw();
});
$('input.column_filter').click();//第一次点击执行,读取时间信息。

$.fn.dataTable.Buttons.defaults.dom.container.className = 'dt-buttons btn-overlap btn-group btn-overlap';

Expand Down

0 comments on commit 24fa19a

Please sign in to comment.