sbd-npm 1.3.69 → 1.3.71

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.69",
3
+ "version": "1.3.71",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -47,10 +47,8 @@ $(function () {
47
47
  load_cache: function () {
48
48
  DailySummary["hsgt_money_flow_chart"] = Util.show_chart_loading(DailySummary["hsgt_money_flow_chart"], "hsgt_money_flow_line");
49
49
  try {
50
+ Util.set_table_loading("market_overview_zone");
50
51
  let cache = DailySummary.get_cache();
51
- if (cache.hasOwnProperty("market_overview")) {
52
- DailySummary.pack_market_overview(cache["market_overview"]);
53
- }
54
52
  if (cache.hasOwnProperty("index")) {
55
53
  DailySummary.pack_index_data(cache["index"]);
56
54
  }
@@ -88,11 +86,9 @@ $(function () {
88
86
  * 当前行情指数
89
87
  */
90
88
  pack_index_data: function (index_data) {
91
- let _html = [];
92
- let change_color_data = [];
89
+ let _html = [], change_color_data = [];
93
90
  index_data.forEach(function (item) {
94
- let cls = "";
95
- let sort = "";
91
+ let cls = "", sort = "";
96
92
  if (item["change"] > 0) {
97
93
  cls = "red";
98
94
  sort = "fa-sort-asc";
@@ -147,7 +143,7 @@ $(function () {
147
143
  _stock_rate_html.push('<span class="sr-only">', rate_width, '% Complete</span>');
148
144
  _stock_rate_html.push('</div>');
149
145
  _stock_rate_html.push('</div></div>');
150
- _stock_rate_html.push('<div class="w_right w_20"><span><a href="#" data-toggle="modal" data-target=".stock-rate-modal" data-cp="', rate_range, '">', rate, '</a></span></div>');
146
+ _stock_rate_html.push('<div class="w_right w_20"><span><a href="#" data-toggle="modal" data-target=".stock_rate_modal" data-cp="', rate_range, '">', rate, '</a></span></div>');
151
147
  _stock_rate_html.push('</div>');
152
148
  return _stock_rate_html.join("");
153
149
  };
@@ -163,8 +159,8 @@ $(function () {
163
159
  $("#stock_rate_bar").html(stock_rate_html.join(""));
164
160
  let up_num = pr["r0_3"] + pr["r3_5"] + pr["r5_7"] + pr["r7_10"];
165
161
  let down_num = pr["r10_7"] + pr["r7_5"] + pr["r5_3"] + pr["r3_0"];
166
- let stock_rate_tips = '涨: <b style="color: #FFF;" class="label label-danger">' + up_num + '</b> (涨停:<b><a style="text-decoration: underline;" class="text-danger" href="#" data-toggle="modal" data-target=".stock-rate-modal" data-cp="10% ~ 10%">' + pr["r10"] + '</a></b>), ';
167
- stock_rate_tips += '跌: <b style="color: #FFF;" class="label label-success">' + down_num + '</b> (跌停:<b><a style="text-decoration: underline;" class="text-success" href="#" data-toggle="modal" data-target=".stock-rate-modal" data-cp="-10% ~ -10%">' + pr["r_10"] + '</a></b>), ';
162
+ let stock_rate_tips = '涨: <b style="color: #FFF;" class="label label-danger">' + up_num + '</b> (涨停:<b><a style="text-decoration: underline;" class="text-danger" href="#" data-toggle="modal" data-target=".stock_rate_modal" data-cp="10% ~ 10%">' + pr["r10"] + '</a></b>), ';
163
+ stock_rate_tips += '跌: <b style="color: #FFF;" class="label label-success">' + down_num + '</b> (跌停:<b><a style="text-decoration: underline;" class="text-success" href="#" data-toggle="modal" data-target=".stock_rate_modal" data-cp="-10% ~ -10%">' + pr["r_10"] + '</a></b>), ';
168
164
  stock_rate_tips += '涨跌比: <b style="color: #FFF;" class="label label-info">' + Util.to_float(up_num / down_num, 2) + '</b>';
169
165
  $("#stock_rate_tips").html(stock_rate_tips);
170
166
  },
@@ -310,19 +306,37 @@ $(function () {
310
306
  mo_amount += market["item"]["amount"];
311
307
  }
312
308
  _html.push("<tr>");
313
- _html.push("<td>", Util.pack_html_link(market["url"], market["name"]), "</td>");
314
- _html.push(DailySummary.pack_mo_item_html(market, "market_capital", "万亿"));
315
- _html.push(DailySummary.pack_mo_item_html(market, "pe", ""));
316
- _html.push(DailySummary.pack_mo_item_html(market, "volume", "亿股"));
317
- _html.push(DailySummary.pack_mo_item_html(market, "amount", "亿"));
309
+ _html.push("<td style='padding: 18px 0;'>", Util.pack_html_link(market["url"], market["name"]), "</td>");
310
+ if (!market["item"]["market_capital"] && market["item"]["prev_market_capital"]) {
311
+ market["item"]["market_capital"] = market["item"]["prev_market_capital"];
312
+ }
313
+ _html.push("<td style='padding: 18px 0;'>", (market["item"]["market_capital"] ? (market["item"]["market_capital"] + "万亿") : "--"), "</td>");
314
+ if (!market["item"]["pe"] && market["item"]["prev_pe"]) {
315
+ market["item"]["pe"] = market["item"]["prev_pe"];
316
+ }
317
+ _html.push("<td style='padding: 18px 0;'>", (market["item"]["pe"] ? market["item"]["pe"] : "--"), "</td>");
318
+ _html.push("<td style='padding: 18px 0;'>", (market["item"]["volume"] ? (market["item"]["volume"] + "亿股") : "--"), "</td>");
319
+ let amount = "--";
320
+ if (market["item"]["amount"] && market["item"]["amount"] > 0) {
321
+ if (market["item"]["prev_amount"] && market["item"]["prev_amount"] > 0 && market["item"]["amount"] !== market["item"]["prev_amount"]) {
322
+ if (market["item"]["amount"] > market["item"]["prev_amount"]) {
323
+ amount = "<b title='前值: " + market["item"]["prev_amount"] + "亿' class='text-danger'>" + market["item"]["amount"] + "亿</b>";
324
+ } else {
325
+ amount = "<b title='前值: " + market["item"]["prev_amount"] + "亿' class='text-success'>" + market["item"]["amount"] + "亿</b>";
326
+ }
327
+ } else {
328
+ amount = market["item"]["amount"] + "亿";
329
+ }
330
+ }
331
+ _html.push("<td style='padding: 18px 0;'>", amount, "</td>");
318
332
  _html.push("</tr>");
319
333
  }
320
334
  }
321
335
  }
322
336
  $("#market_overview_zone").html(_html.join(""));
323
- if (market_overview_dict["total_amount_data"] && market_overview_dict["total_amount_data"].length === 2 && market_overview_dict["total_amount_data"][0]["amount"] > 0 && market_overview_dict["total_amount_data"][1]["amount"] > 0) {
324
- mo_amount = Util.to_hundred_million(market_overview_dict["total_amount_data"][0]["amount"], 3)
325
- previous_mo_amount = Util.to_hundred_million(market_overview_dict["total_amount_data"][1]["amount"], 3)
337
+ if (market_overview_dict["total_amount_data"] && market_overview_dict["total_amount_data"].length === 2 && market_overview_dict["total_amount_data"][0] > 0 && market_overview_dict["total_amount_data"][1] > 0) {
338
+ mo_amount = Util.to_hundred_million(market_overview_dict["total_amount_data"][0], 3)
339
+ previous_mo_amount = Util.to_hundred_million(market_overview_dict["total_amount_data"][1], 3)
326
340
  }
327
341
  if (mo_amount > previous_mo_amount) {
328
342
  mo_amount_cls = "label-danger";
@@ -331,32 +345,13 @@ $(function () {
331
345
  mo_amount_cls = "label-success";
332
346
  }
333
347
  let mo_amount_obj = $("#market_overview_amount");
334
- mo_amount_obj.attr("title", Util.to_float(previous_mo_amount, 3));
348
+ mo_amount_obj.attr("title", "前值: " + Util.to_float(previous_mo_amount, 3) + "亿");
335
349
  mo_amount_obj.removeClass("label-danger");
336
350
  mo_amount_obj.removeClass("label-success");
337
351
  if (mo_amount_cls.length > 0) {
338
352
  mo_amount_obj.addClass(mo_amount_cls);
339
353
  }
340
354
  mo_amount_obj.html(Util.to_float(mo_amount, 3) + "(" + mo_amount_sign + Util.to_float(mo_amount - previous_mo_amount, 3) + ")");
341
- DailySummary.set_cache("market_overview", market_overview_dict);
342
- },
343
-
344
- pack_mo_item_html: function (market, key, unit) {
345
- let _html = "<td>--</td>";
346
- if (market["item"]) {
347
- let val = market["item"][key];
348
- if (val && val > 0) {
349
- let prev_val = market["item"]["prev_" + key];
350
- let mo_trend = "";
351
- if (val > prev_val) {
352
- mo_trend = "<b class='text-danger'> ↑</b>";
353
- } else if (val < prev_val) {
354
- mo_trend = "<b class='text-success'> ↓</b>";
355
- }
356
- _html = "<td title='" + prev_val + "'>" + val + unit + mo_trend + "</td>";
357
- }
358
- }
359
- return _html;
360
355
  },
361
356
 
362
357
  /**
@@ -541,7 +536,7 @@ $(function () {
541
536
  Modal.render_stock_rate_html();
542
537
  $("#p_change_type").change(function () {
543
538
  if (!Util.is_load) {
544
- Util.set_table_loading("stock_rate_table_body");
539
+ Util.set_table_loading("stock_rate_modal_body_body");
545
540
  Modal.render_stock_rate_modal(obj);
546
541
  }
547
542
  });
@@ -550,10 +545,9 @@ $(function () {
550
545
  },
551
546
 
552
547
  render_stock_rate_html: function() {
553
- let _html = [];
548
+ let _html = [], index = 0;
554
549
  let industry = $("#p_change_industry").val();
555
550
  let area = $("#p_change_area").val();
556
- let index = 0;
557
551
  Modal["p_change_data"].forEach(function (item) {
558
552
  if (Util.is_industry_area(item, industry, area)) {
559
553
  index++;
@@ -570,8 +564,8 @@ $(function () {
570
564
  _html.push("</tr>");
571
565
  }
572
566
  });
573
- Util.render_table_html("stock_rate_table_body", _html);
574
- Util.init_stock_stuff("stock_rate_table_body", [], 0, 0);
567
+ Util.render_table_html("stock_rate_modal_body_body", _html);
568
+ Util.init_stock_stuff("stock_rate_modal_body_body", [], 0, 0);
575
569
  },
576
570
 
577
571
  render_news_modal: function () {
@@ -586,7 +580,7 @@ $(function () {
586
580
  _html.push("<td>", Util.sub_str(item["content"], 40), "</td>");
587
581
  _html.push("</tr>");
588
582
  });
589
- Util.render_table_html("news_modal_table_body", _html);
583
+ Util.render_table_html("news_modal_body_body", _html);
590
584
  Util.hide_tips();
591
585
  });
592
586
  }
@@ -601,8 +595,11 @@ $(function () {
601
595
  $("#market_overview_load_status").html("<tr><td colspan='6'>Loading...</td></tr>");
602
596
  });
603
597
 
598
+ Util.init_modal_skeleton("stock_rate_modal", '');
599
+ $("#stock_rate_modal_title").html("<span id='cp_val'></span>涨跌幅");
604
600
  Util.init_table_skeleton({
605
- "element_id": "stock_rate_table",
601
+ "element_id": "stock_rate_modal_body",
602
+ "caption": "none",
606
603
  "head_cols": [
607
604
  {"name": "序号"},
608
605
  {"name": "代码"},
@@ -627,12 +624,15 @@ $(function () {
627
624
  });
628
625
  srm_obj.on('hidden.bs.modal', function () {
629
626
  $("#cp_val").html("");
627
+ Util.set_table_loading("stock_rate_modal_body_body");
630
628
  Util.hide_tips();
631
- $("#stock_rate_table_body").html("<tr><td colspan='9'>Loading...</td></tr>");
632
629
  });
633
630
 
631
+ Util.init_modal_skeleton("news_modal", '');
632
+ $("#news_modal_title").html(Util.pack_html_link("http://www.pbc.gov.cn/zhengcehuobisi/125207/125213/125431/125475/index.html", "中国人民银行公开市场业务交易公告"));
634
633
  Util.init_table_skeleton({
635
- "element_id": "news_modal_table",
634
+ "element_id": "news_modal_body",
635
+ "caption": "none",
636
636
  "head_cols": [
637
637
  {"name": "标题"},
638
638
  {"name": "时间"},
@@ -644,8 +644,8 @@ $(function () {
644
644
  Modal.render_news_modal();
645
645
  });
646
646
  news_obj.on('hidden.bs.modal', function () {
647
+ Util.set_table_loading("news_modal_body_body");
647
648
  Util.hide_tips();
648
- $("#news_modal_table_body").html("<tr><td colspan='3'>Loading...</td></tr>");
649
649
  });
650
650
 
651
651
  $("#hgt_bound").change(function () {
package/util.js CHANGED
@@ -4197,7 +4197,7 @@ const Util = {
4197
4197
  big_deal_pie: function (element_id, data) {
4198
4198
  let buy = Util.to_unit(data["buy1000"] + data["buy800"] + data["buy600"] + data["buy400"]);
4199
4199
  let sell = Util.to_unit(data["sell1000"] + data["sell800"] + data["sell600"] + data["sell400"]);
4200
- $("#" + element_id + "_tips").html("流入: <b class='text-danger'>" + Util.strip_html(buy) + "</b>,流出: <b class='text-success'>" + Util.strip_html(sell) + "</b>");
4200
+ $("#" + element_id + "_tips").html("流入:<b class='text-danger'>" + Util.strip_html(buy) + "</b>,流出:<b class='text-success'>" + Util.strip_html(sell) + "</b>");
4201
4201
  let bd_data = [
4202
4202
  {name: '超大单流入', value: Util.to_hundred_million(data["buy1000"])},
4203
4203
  {name: '大单流入', value: Util.to_hundred_million(data["buy800"])},