sbd-npm 1.3.71 → 1.3.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.71",
3
+ "version": "1.3.72",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -50,7 +50,7 @@ $(function () {
50
50
  Util.set_table_loading("market_overview_zone");
51
51
  let cache = DailySummary.get_cache();
52
52
  if (cache.hasOwnProperty("index")) {
53
- DailySummary.pack_index_data(cache["index"]);
53
+ DailySummary.pack_index_summary_data(cache["index"]);
54
54
  }
55
55
  if (cache.hasOwnProperty("change_percent")) {
56
56
  DailySummary.pack_change_percent(cache["change_percent"]);
@@ -85,7 +85,7 @@ $(function () {
85
85
  /**
86
86
  * 当前行情指数
87
87
  */
88
- pack_index_data: function (index_data) {
88
+ pack_index_summary_data: function (index_data) {
89
89
  let _html = [], change_color_data = [];
90
90
  index_data.forEach(function (item) {
91
91
  let cls = "", sort = "";
@@ -113,7 +113,7 @@ $(function () {
113
113
  _html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', item["change"], '(<span id="', change_rate_id, '">', item["change_rate"], '</span>%)</i></span>');
114
114
  _html.push('</div>');
115
115
  });
116
- $("#index_data").html(_html.join(""));
116
+ $("#index_summary_data").html(_html.join(""));
117
117
  change_color_data.forEach(function (item) {
118
118
  let change_rate_obj = $("#change_rate_" + item["key"]);
119
119
  change_rate_obj.css("background-color", item["new"]);
@@ -174,7 +174,7 @@ $(function () {
174
174
  let bd_obj = $('#big_deal_pie');
175
175
  if (bd_obj.length) {
176
176
  if (big_deal_date > 0) {
177
- $("#big_deal_date").html("(" + Util.seconds_to_format(big_deal_date, "%Y-%m-%d") + ") ");
177
+ $("#big_deal_date").html("(" + Util.seconds_to_format(big_deal_date, "%Y-%m-%d") + ")");
178
178
  }
179
179
  if (DailySummary.big_deal === {} || DailySummary.big_deal["buy1000"] !== bd["buy1000"] || DailySummary.big_deal["buy800"] !== bd["buy800"]
180
180
  || DailySummary.big_deal["buy600"] !== bd["buy600"] || DailySummary.big_deal["buy400"] !== bd["buy400"]
@@ -358,16 +358,14 @@ $(function () {
358
358
  * 一些统计数据
359
359
  */
360
360
  fetch_statistics_daily: function () {
361
- let date = $("#trade_date").val();
362
- let news_type = $("#news_type").val();
363
361
  let payload = {
364
- date: date,
362
+ date: $("#trade_date").val(),
365
363
  action: "statistics_daily",
366
364
  limit_num: DailySummary.limit_num(),
367
- news_type: news_type
365
+ news_type: $("#news_type").val()
368
366
  };
369
367
  Util.post(location.pathname, payload, function (j) {
370
- DailySummary.pack_index_data(j["index"]);
368
+ DailySummary.pack_index_summary_data(j["index"]);
371
369
  DailySummary.pack_change_percent(j["change_percent"]);
372
370
  DailySummary.pack_big_deal(j["big_deal"], j["big_deal_date"]);
373
371
  DailySummary.pack_hsgt_money_flow(j["hmf"]);
@@ -435,6 +433,34 @@ $(function () {
435
433
  });
436
434
  Util.render_table_html(market + "_table_body", _html);
437
435
  }
436
+ },
437
+
438
+ // 指数历史行情数据
439
+ render_index_hist_modal: function() {
440
+ Util.show_loading();
441
+ let payload = {
442
+ action: "index_hist",
443
+ index_code: "ths_all_a",
444
+ start_date: $("#index_hist_modal_start_date").val(),
445
+ end_date: $("#index_hist_modal_end_date").val()
446
+ };
447
+ Util.post("/action", payload, function (j) {
448
+ let _html = [];
449
+ j["data"].forEach(function (item) {
450
+ _html.push("<tr>");
451
+ _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
452
+ _html.push("<td>", item["open"], "</td>");
453
+ _html.push("<td>", item["close"], "</td>");
454
+ _html.push("<td>", item["low"], "</td>");
455
+ _html.push("<td>", item["high"], "</td>");
456
+ _html.push("<td>", Util.parse_ratio(item["p_change_rate"]), "</td>");
457
+ _html.push("<td data-val='", item["volume"], "'>", Util.to_unit(item["volume"]), "股</td>");
458
+ _html.push("<td data-val='", item["amount"], "'>", Util.to_unit(item["amount"]), "</td>");
459
+ _html.push("</tr>");
460
+ });
461
+ Util.render_table_html("index_hist_modal_body_body", _html);
462
+ Util.hide_tips();
463
+ });
438
464
  }
439
465
 
440
466
  };
@@ -461,8 +487,7 @@ $(function () {
461
487
  if (!chart_instance) {
462
488
  $("#" + element_id).html('<div class="x_panel"><div class="x_title"><h2>' + title + '</h2><div class="clearfix"></div></div><div class="x_content2" style="height:450px;"><div id="' + line_id + '" class="graph_line"></div></div></div>');
463
489
  }
464
- let date_data = [];
465
- let val_data = [];
490
+ let date_data = [], val_data = [];
466
491
  data.forEach(function (item) {
467
492
  if (item[key] && item[key] > 0) {
468
493
  date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
@@ -475,7 +500,7 @@ $(function () {
475
500
  render_market_overview_modal: function (obj) {
476
501
  let title = $.trim($(obj).text());
477
502
  $("#at_title").html("[" + title + "]数据");
478
- $("#market_overview_load_status").html("<tr><td colspan='6'>Loading...</td></tr>");
503
+ Util.set_table_loading("market_overview_load_status");
479
504
  if (Modal.mo_end_time === 0) {
480
505
  Modal.init_market_overview_time(obj);
481
506
  } else {
@@ -591,15 +616,46 @@ $(function () {
591
616
  Modal.render_market_overview_modal(e.relatedTarget);
592
617
  });
593
618
  mom_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
619
+ Util.set_table_loading("market_overview_load_status");
620
+ Util.hide_tips();
621
+ });
622
+
623
+ Util.init_modal_skeleton("index_hist_modal", '');
624
+ $("#index_hist_modal_title").html(Util.pack_html_link("https://m.10jqka.com.cn/stockpage/48_883957/", "同花顺全A指数"));
625
+ Util.init_table_skeleton({
626
+ "element_id": "index_hist_modal_body",
627
+ "caption": '<caption class="text-right"><div class="form-inline"><div class="form-group" id="index_hist_modal_start_end_date"></div><button class="btn btn-default" id="index_hist_modal_query">查 询</button></div></caption>',
628
+ "head_cols": [
629
+ {"name": "日期", "table_sort": 1},
630
+ {"name": "开盘价", "table_sort": 1},
631
+ {"name": "收盘价", "table_sort": 1},
632
+ {"name": "最低价", "table_sort": 1},
633
+ {"name": "最高价", "table_sort": 1},
634
+ {"name": "涨跌", "table_sort": 1},
635
+ {"name": "成交量", "table_sort": 1},
636
+ {"name": "成交额", "table_sort": 1},
637
+ ]
638
+ });
639
+ let mam_obj = $('#index_hist_modal');
640
+ mam_obj.on('shown.bs.modal', function (e) {
641
+ Util.set_table_loading("index_hist_modal_body_body");
642
+ if ($("#index_hist_modal_start_date").length <= 0) {
643
+ Util.init_range_date("index_hist_modal_start_end_date", DailySummary, "render_index_hist_modal");
644
+ }
645
+ $("#index_hist_modal_query").click(function () {
646
+ DailySummary.render_index_hist_modal();
647
+ });
648
+ DailySummary.render_index_hist_modal();
649
+ });
650
+ mam_obj.on('hidden.bs.modal', function () {
594
651
  Util.hide_tips();
595
- $("#market_overview_load_status").html("<tr><td colspan='6'>Loading...</td></tr>");
596
652
  });
597
653
 
598
654
  Util.init_modal_skeleton("stock_rate_modal", '');
599
655
  $("#stock_rate_modal_title").html("<span id='cp_val'></span>涨跌幅");
600
656
  Util.init_table_skeleton({
601
657
  "element_id": "stock_rate_modal_body",
602
- "caption": "none",
658
+ "caption": '<caption class="text-right" id="stock_rate_modal_body_body_tips"></caption>',
603
659
  "head_cols": [
604
660
  {"name": "序号"},
605
661
  {"name": "代码"},
@@ -624,6 +680,7 @@ $(function () {
624
680
  });
625
681
  srm_obj.on('hidden.bs.modal', function () {
626
682
  $("#cp_val").html("");
683
+ $("#stock_rate_modal_body_body_tips").html("");
627
684
  Util.set_table_loading("stock_rate_modal_body_body");
628
685
  Util.hide_tips();
629
686
  });
package/util.js CHANGED
@@ -1738,8 +1738,8 @@ const Util = {
1738
1738
  });
1739
1739
  let component_obj = $('#' + component_id);
1740
1740
  component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
1741
- let coin = $(e.relatedTarget).attr("data-coin");
1742
1741
  Util.set_table_loading(component_id + "_body_body");
1742
+ let coin = $(e.relatedTarget).attr("data-coin");
1743
1743
  if ($("#" + component_id + "_start_date").length <= 0) {
1744
1744
  Util.init_range_date(component_id + "_start_end_date", Util, "render_btc_modal", 60);
1745
1745
  }
@@ -1752,7 +1752,6 @@ const Util = {
1752
1752
  Util.render_btc_modal();
1753
1753
  });
1754
1754
  component_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
1755
- Util.set_table_loading(component_id + "_body_body");
1756
1755
  Util.hide_tips();
1757
1756
  });
1758
1757
  },
@@ -1767,7 +1766,13 @@ const Util = {
1767
1766
  return false;
1768
1767
  }
1769
1768
  Util.show_loading();
1770
- let payload = {coin: coin, start_date: $("#btc_modal_start_date").val(), end_date: $("#btc_modal_end_date").val(), action: "btc_data", "currency_type": $("#currency_type").val()};
1769
+ let payload = {
1770
+ coin: coin,
1771
+ start_date: $("#btc_modal_start_date").val(),
1772
+ end_date: $("#btc_modal_end_date").val(),
1773
+ action: "btc_data",
1774
+ "currency_type": $("#currency_type").val()
1775
+ };
1771
1776
  Util.post(Util.get_url("coin_price"), payload, function (j) {
1772
1777
  let _html = [], low_price = 0, high_price = 0;
1773
1778
  j["data"].forEach(function (item) {