sbd-npm 1.3.92 → 1.3.94

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/summary_daily.js +38 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.92",
3
+ "version": "1.3.94",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -28,6 +28,10 @@ $(function () {
28
28
  mo_gem_chart: false,
29
29
  mo_hk_chart: false,
30
30
  key_cache: "SBD_CACHE",
31
+ index_hist_data: [
32
+ {"code": "ths_all_a", "name": "同花顺全A指数", "url": "https://m.10jqka.com.cn/stockpage/48_883957/"},
33
+ {"code": "000902", "name": "中证流通", "url": "https://xueqiu.com/S/SH000902"},
34
+ ],
31
35
 
32
36
  get_cache: function () {
33
37
  let cache = localStorage[DailySummary.key_cache];
@@ -443,14 +447,21 @@ $(function () {
443
447
  Util.set_table_loading("index_hist_modal_body_body");
444
448
  let payload = {
445
449
  action: "index_hist",
446
- index_code: "ths_all_a",
450
+ index_code: $("#index_hist_modal_code").val(),
447
451
  start_date: $("#index_hist_modal_start_date").val(),
448
452
  end_date: $("#index_hist_modal_end_date").val()
449
453
  };
450
454
  Util.post("/action", payload, function (j) {
451
- let _html = [];
455
+ let _html = [], latest_date = 0;
452
456
  j["data"].forEach(function (item) {
453
- _html.push("<tr>");
457
+ latest_date = Math.max(latest_date, item["date"]);
458
+ });
459
+ j["data"].forEach(function (item) {
460
+ if (item["date"] === latest_date) {
461
+ _html.push("<tr class='info'>");
462
+ } else {
463
+ _html.push("<tr>");
464
+ }
454
465
  _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
455
466
  _html.push("<td>", item["open"], "</td>");
456
467
  _html.push("<td>", item["low"], "</td>");
@@ -472,6 +483,15 @@ $(function () {
472
483
  Util.render_table_html("index_hist_modal_body_body", _html);
473
484
  Util.hide_tips();
474
485
  });
486
+ },
487
+
488
+ init_index_hist_url: function() {
489
+ let index_code = $("#index_hist_modal_code").val();
490
+ DailySummary.index_hist_data.forEach(function (c) {
491
+ if (c["code"] === index_code) {
492
+ $("#index_hist_modal_url").attr("href", c["url"]);
493
+ }
494
+ });
475
495
  }
476
496
 
477
497
  };
@@ -632,7 +652,17 @@ $(function () {
632
652
  });
633
653
 
634
654
  Util.init_modal_skeleton("index_hist_modal", '');
635
- $("#index_hist_modal_title").html(Util.pack_html_link("https://m.10jqka.com.cn/stockpage/48_883957/", "同花顺全A指数"));
655
+ let ihmt_html = [];
656
+ ihmt_html.push("<div class='form-inline'><div class='form-group'>");
657
+ ihmt_html.push("<select id='index_hist_modal_code' class='form-control'>");
658
+ DailySummary.index_hist_data.forEach(function (c) {
659
+ ihmt_html.push("<option value='", c["code"], "'>", c["name"], "</option>");
660
+ });
661
+ ihmt_html.push("</select>");
662
+ ihmt_html.push("&nbsp;<a id='index_hist_modal_url' href='#' target='_blank' rel='noopener noreferrer nofollow'><i class='glyphicon glyphicon-link'></i></a>");
663
+ ihmt_html.push("</div></div>");
664
+ $("#index_hist_modal_title").html(ihmt_html.join(""));
665
+ DailySummary.init_index_hist_url();
636
666
  Util.init_table_skeleton({
637
667
  "element_id": "index_hist_modal_body",
638
668
  "caption": '<caption class="text-right" style="margin-top: -10px; padding-bottom: 10px;"><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>',
@@ -661,6 +691,10 @@ $(function () {
661
691
  mam_obj.on('hidden.bs.modal', function () {
662
692
  Util.hide_tips();
663
693
  });
694
+ $("#index_hist_modal_code").change(function () {
695
+ DailySummary.init_index_hist_url();
696
+ DailySummary.render_index_hist_modal();
697
+ });
664
698
 
665
699
  Util.init_modal_skeleton("stock_rate_modal", '');
666
700
  $("#stock_rate_modal_title").html("<span id='cp_val'></span>涨跌幅");