sbd-npm 1.0.93 → 1.0.97

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/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.0.93",
3
+ "version": "1.0.97",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -91,10 +91,7 @@ $(document).ready(function () {
91
91
  sort = "fa-sort-desc";
92
92
  }
93
93
  _html.push('<div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">');
94
- let index_name = item["name"];
95
- if (item["href"]) {
96
- index_name = "<a target='_blank' rel='noopener noreferrer nofollow' href='" + item["href"] + "'>" + index_name + "</a>";
97
- }
94
+ let index_name = item["href"] ? Util.pack_html_link(item["href"], item["name"]) : item["name"];
98
95
  _html.push('<span class="count_top"><i class="fa"></i> ', index_name, '</span>');
99
96
  _html.push('<div class="count ', cls, '">', item["value"], '</div>');
100
97
  _html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', change, '(', item["change_rate"], '%)</i></span>');
@@ -249,7 +246,7 @@ $(document).ready(function () {
249
246
  if (item["is_pbc"] && parseInt(item["is_pbc"]) === 1) {
250
247
  title = "<b class='text-danger'>" + title + "</b>";
251
248
  }
252
- _html.push('<h2 class="title"><a rel="noopener noreferrer nofollow" target="_blank" href="', item["url"], '">', title, '</a></h2>'); // JavaScript 中斜杠和反斜杠的替换
249
+ _html.push('<h2 class="title">' + Util.pack_html_link(item["url"], title) + '</h2>'); // JavaScript 中斜杠和反斜杠的替换
253
250
  _html.push('<div class="byline"><span>', Util.seconds_to_format(item["ctime"]), '</span></div>');
254
251
  _html.push('<p class="excerpt">', item["content"], '</p>');
255
252
  _html.push('</div></div></li>');
@@ -273,17 +270,19 @@ $(document).ready(function () {
273
270
  for (let market_type in market_overview_dict) {
274
271
  if (market_overview_dict.hasOwnProperty(market_type)) {
275
272
  let market = market_overview_dict[market_type];
276
- if (market_type !== 5 && market["item"]) {
277
- previous_mo_amount += market["item"]["prev_amount"];
278
- mo_amount += market["item"]["amount"];
273
+ if (market["item"]) {
274
+ if (market_type !== 5 && market["item"]) {
275
+ previous_mo_amount += market["item"]["prev_amount"];
276
+ mo_amount += market["item"]["amount"];
277
+ }
278
+ _html.push("<tr>");
279
+ _html.push("<td>", Util.pack_html_link(market["url"], market["name"]), "</td>");
280
+ _html.push(DailySummary.pack_mo_item_html(market, "market_capital", "万亿"));
281
+ _html.push(DailySummary.pack_mo_item_html(market, "pe", ""));
282
+ _html.push(DailySummary.pack_mo_item_html(market, "volume", "亿股"));
283
+ _html.push(DailySummary.pack_mo_item_html(market, "amount", "亿"));
284
+ _html.push("</tr>");
279
285
  }
280
- _html.push("<tr>");
281
- _html.push("<td><a target='_blank' rel='noopener noreferrer nofollow' href='", market["url"], "'>", market["name"], "</a></td>");
282
- _html.push(DailySummary.pack_mo_item_html(market, "market_capital", "万亿"));
283
- _html.push(DailySummary.pack_mo_item_html(market, "pe", ""));
284
- _html.push(DailySummary.pack_mo_item_html(market, "volume", "亿股"));
285
- _html.push(DailySummary.pack_mo_item_html(market, "amount", "亿"));
286
- _html.push("</tr>");
287
286
  }
288
287
  }
289
288
  $("#market_overview_zone").html(_html.join(""));
@@ -362,7 +361,7 @@ $(document).ready(function () {
362
361
  let date_format = Util.seconds_to_format(j["date"], "%Y-%m-%d");
363
362
  if (date !== date_format) {
364
363
  $("#hgt_zone_tips").html("(" + date_format + ")");
365
- $("#sgt_zone-tips").html("(" + date_format + ")");
364
+ $("#sgt_zone_tips").html("(" + date_format + ")");
366
365
  }
367
366
  Util.hide_tips();
368
367
  }, "json");
@@ -389,14 +388,14 @@ $(document).ready(function () {
389
388
  return d1["value"] > d2["value"] ? -1 : 1;
390
389
  });
391
390
  new_data.forEach(function (item) {
392
- let stock_url = "<td title='" + item['code'] + "'><a target='_blank' rel='noopener noreferrer nofollow' href='" + url + "?stock_detail=" + item["code"] + "'>" + item["name"] + "</a></td>";
391
+ let stock_url = "<td title='" + item['code'] + "'>" + Util.pack_html_link(url + "?stock_detail=" + item["code"], item["name"]) + "</td>";
393
392
  let buy = "<td title='买入金额-" + item["buy"] + "'>" + Util.to_hundred_million(item["buy"]) + "亿</td>";
394
393
  let sell = "<td title='卖出金额-" + item["sell"] + "'>" + Util.to_hundred_million(item["sell"]) + "亿</td>";
395
394
  let value = "<td>" + Util.to_hundred_million(item["value"]) + "亿</td>";
396
395
  let price_change = "<td>" + Util.digit_compare_trend(item["price"], item["pre_price"]) + "</td>";
397
396
  _html.push("<tr>", stock_url, price_change, buy, sell, value, "</tr>");
398
397
  });
399
- $("#" + market + "_zone").html(_html.join(""));
398
+ $("#" + market + "_table_body").html(_html.join(""));
400
399
  }
401
400
  }
402
401
 
@@ -421,7 +420,7 @@ $(document).ready(function () {
421
420
  render_market_overview_line: function (data, key, element_id, title, chart_handle) {
422
421
  let line_id = element_id + "_chart";
423
422
  if (!chart_handle) {
424
- $("#" + 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:500px;"><div id="' + line_id + '" class="graph_line"></div></div></div>');
423
+ $("#" + 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>');
425
424
  }
426
425
  let date_data = [];
427
426
  let val_data = [];
@@ -512,10 +511,10 @@ $(document).ready(function () {
512
511
  _html.push("</tr>");
513
512
  }
514
513
  });
515
- Util.render_table_html("stock_rate_modal_content", _html);
514
+ Util.render_table_html("stock_rate_table_body", _html);
516
515
  $("#p_change_type").change(function () {
517
516
  if (!DailySummary.is_load) {
518
- $("#stock_rate_modal_content").html("<tr><td colspan='10'>Loading...</td></tr>");
517
+ $("#stock_rate_table_body").html("<tr><td colspan='9'>Loading...</td></tr>");
519
518
  Modal.render_stock_rate_modal(obj);
520
519
  }
521
520
  });
@@ -531,12 +530,12 @@ $(document).ready(function () {
531
530
  j["data"].forEach(function (item) {
532
531
  index++;
533
532
  _html.push("<tr title='", item["content"], "'>");
534
- _html.push('<td><a rel="noopener noreferrer nofollow" target="_blank" href="', item["url"], '">', (item["title"].replace(/\\/g, "")), '</a></td>');
533
+ _html.push('<td>' + Util.pack_html_link(item["url"], item["title"].replace(/\\/g, "")) + '</td>');
535
534
  _html.push("<td>", Util.seconds_to_format(item["ctime"]), "</td>");
536
535
  _html.push("<td>", Util.sub_str(item["content"], 40), "</td>");
537
536
  _html.push("</tr>");
538
537
  });
539
- Util.render_table_html("news_modal_content", _html);
538
+ Util.render_table_html("news_modal_table_body", _html);
540
539
  Util.hide_tips();
541
540
  }, "json");
542
541
  }
@@ -551,6 +550,20 @@ $(document).ready(function () {
551
550
  $("#market_overview_load_status").html("<tr><td colspan='6'>Loading...</td></tr>");
552
551
  });
553
552
 
553
+ Util.init_table_skeleton({
554
+ "table_zone_id": "stock_rate_table",
555
+ "head_cols": [
556
+ {"name": "序号"},
557
+ {"name": "代码"},
558
+ {"name": "名称"},
559
+ {"name": "PE", "title": "市盈率(Price Earnings Ratio)", "table_sort": 1},
560
+ {"name": "总市值", "table_sort": 1},
561
+ {"name": "行业", "select_id": "p_change_industry"},
562
+ {"name": "地区", "select_id": "p_change_area"},
563
+ {"name": "当前价", "table_sort": 1},
564
+ {"name": "类型", "select_id": "p_change_type", "select_options": [{"key": "1", "val": "涨幅"}, {"key": "2", "val": "跌幅"}]},
565
+ ]
566
+ });
554
567
  let srm_obj = $('#stock_rate_modal');
555
568
  srm_obj.on('shown.bs.modal', function (e) {
556
569
  Modal.render_stock_rate_modal(e.relatedTarget);
@@ -558,16 +571,24 @@ $(document).ready(function () {
558
571
  srm_obj.on('hidden.bs.modal', function () {
559
572
  $("#cp_val").html("");
560
573
  Util.hide_tips();
561
- $("#stock_rate_modal_content").html("<tr><td colspan='10'>Loading...</td></tr>");
574
+ $("#stock_rate_table_body").html("<tr><td colspan='9'>Loading...</td></tr>");
562
575
  });
563
576
 
577
+ Util.init_table_skeleton({
578
+ "table_zone_id": "news_modal_table",
579
+ "head_cols": [
580
+ {"name": "标题"},
581
+ {"name": "时间"},
582
+ {"name": "内容"},
583
+ ]
584
+ });
564
585
  let news_obj = $('#news_modal');
565
586
  news_obj.on('shown.bs.modal', function (e) {
566
587
  Modal.render_news_modal();
567
588
  });
568
589
  news_obj.on('hidden.bs.modal', function () {
569
590
  Util.hide_tips();
570
- $("#news_modal_content").html("<tr><td colspan='3'>Loading...</td></tr>");
591
+ $("#news_modal_table_body").html("<tr><td colspan='3'>Loading...</td></tr>");
571
592
  });
572
593
 
573
594
  $("#hgt_bound").change(function () {
@@ -602,6 +623,30 @@ $(document).ready(function () {
602
623
  }, "json");
603
624
  });
604
625
 
626
+ Util.init_table_skeleton({
627
+ "table_zone_id": "hgt_table",
628
+ "table_class": "table table-hover table-striped",
629
+ "caption": "ignore",
630
+ "head_cols": [
631
+ {"name": ""},
632
+ {"name": "价格"},
633
+ {"name": "买入金额"},
634
+ {"name": "卖出金额"},
635
+ {"name": "类型", "select_id": "hgt_type", "select_options": [{"key": "1", "val": "净买入"}, {"key": "2", "val": "总成交"}]},
636
+ ]
637
+ });
638
+ Util.init_table_skeleton({
639
+ "table_zone_id": "sgt_table",
640
+ "table_class": "table table-hover table-striped",
641
+ "caption": "ignore",
642
+ "head_cols": [
643
+ {"name": ""},
644
+ {"name": "价格"},
645
+ {"name": "买入金额"},
646
+ {"name": "卖出金额"},
647
+ {"name": "类型", "select_id": "sgt_type", "select_options": [{"key": "1", "val": "净买入"}, {"key": "2", "val": "总成交"}]},
648
+ ]
649
+ });
605
650
  DailySummary.is_trade_time = parseInt(DailySummary.is_trade_time);
606
651
  DailySummary.load_cache();
607
652
  DailySummary.fetch_data();
package/util.js CHANGED
@@ -561,7 +561,11 @@ let Util = {
561
561
  is_tooltip = 1;
562
562
  tooltip = ' <i class="glyphicon glyphicon-info-sign" data-html="true" data-toggle="tooltip" data-container="body" data-original-title="' + col["tooltip"] + '"></i>';
563
563
  }
564
- _html.push('<td', td_attr, '>', col["name"], tooltip, '</td>');
564
+ if (col["sort_type"]) {
565
+ _html.push('<td', td_attr, '><a class="sort_type" href="#" data-val="', col["sort_type"], '">', col["name"], tooltip, '</a></td>');
566
+ } else {
567
+ _html.push('<td', td_attr, '>', col["name"], tooltip, '</td>');
568
+ }
565
569
  }
566
570
  });
567
571
  _html.push('</tr></thead>');
@@ -2577,6 +2581,20 @@ let Util = {
2577
2581
  {'url': '/9e3d786fe8a63d07e2d2b2cd3118dc4c', 'name': '私募公司排行'},
2578
2582
  ]
2579
2583
  },
2584
+ {
2585
+ 'name': '宏观数据',
2586
+ 'icon': 'globe',
2587
+ 'menu': [
2588
+ {'url': '/f0b5e3da657b53b236e591fdf1fdd7f9', 'name': '十年国债收益率'},
2589
+ {'url': '/e63aadc37bb771ade8c3a58e1673a2cc', 'name': '货币供应量'},
2590
+ {'url': '/39501dfa2cbe6f9813b12e497ee4b7d0', 'name': '货币汇率'},
2591
+ {'url': '/11cc5938d34445d1e68d514b3c64d0b7', 'name': '新增投资者'},
2592
+ {'url': '/4a15ab4a66ba8a256576c1a615fd5deb', 'name': '新增贷款'},
2593
+ {'url': '/99e5df77e73cb87181f508ad9ce8d7aa', 'name': '社会融资规模'},
2594
+ {'url': '/d71e4691f1e51f5433ed2240b7880947', 'name': 'Shibor 拆放利率'},
2595
+ {'url': '/c900ca40929d6da666ced0e71dfa6ff5', 'name': '制造业采购经理指数(PMI)'},
2596
+ ]
2597
+ },
2580
2598
  {
2581
2599
  'name': '排行',
2582
2600
  'icon': 'bar-chart',
@@ -2591,18 +2609,6 @@ let Util = {
2591
2609
  {'url': '/17cabdde7024c4be6952623a22b1e4cf', 'name': '商誉占比'},
2592
2610
  ]
2593
2611
  },
2594
- {
2595
- 'name': '宏观数据',
2596
- 'icon': 'globe',
2597
- 'menu': [
2598
- {'url': '/f0b5e3da657b53b236e591fdf1fdd7f9', 'name': '十年国债收益率'},
2599
- {'url': '/e63aadc37bb771ade8c3a58e1673a2cc', 'name': '货币供应量'},
2600
- {'url': '/39501dfa2cbe6f9813b12e497ee4b7d0', 'name': '货币汇率'},
2601
- {'url': '/11cc5938d34445d1e68d514b3c64d0b7', 'name': '新增投资者'},
2602
- {'url': '/d71e4691f1e51f5433ed2240b7880947', 'name': 'Shibor 拆放利率'},
2603
- {'url': '/c900ca40929d6da666ced0e71dfa6ff5', 'name': '制造业采购经理指数(PMI)'},
2604
- ]
2605
- },
2606
2612
  {
2607
2613
  'name': '其他',
2608
2614
  'icon': 'remove',