sbd-npm 1.4.94 → 1.4.96

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/summary_daily.js CHANGED
@@ -76,8 +76,8 @@ $(function () {
76
76
  Util.post(location.pathname, {date: $("#trade_date").val(), action: "market_overview", is_init: Util.is_init}, function (j) {
77
77
  DailySummary.pack_market_overview(j["market_overview"]);
78
78
  DailySummary.fetch_statistics_daily();
79
- if (j["date"] && !Util.is_mobile()) {
80
- DailySummary.init_date_component(j["date"]);
79
+ if (j.date && !Util.is_mobile()) {
80
+ DailySummary.init_date_component(j.date);
81
81
  }
82
82
  DailySummary.fetch_hsgt_ten(0);
83
83
  });
@@ -97,26 +97,26 @@ $(function () {
97
97
  cls = "green";
98
98
  sort = "fa-sort-desc";
99
99
  }
100
- let change_rate_id = "change_rate_" + item["key"];
100
+ let change_rate_id = "change_rate_" + item.key;
101
101
  let change_rate_obj = $("#" + change_rate_id);
102
102
  if (change_rate_obj.length) {
103
103
  let pre_change_rate = parseFloat(change_rate_obj.text());
104
- if (item["change_rate"] > pre_change_rate) {
105
- change_color_data.push({"key": item["key"], "origin": change_rate_obj.css("background-color"), "new": "#FF7B7B"});
106
- } else if (item["change_rate"] < pre_change_rate) {
107
- change_color_data.push({"key": item["key"], "origin": change_rate_obj.css("background-color"), "new": "#ADFFAD"});
104
+ if (item.change_rate > pre_change_rate) {
105
+ change_color_data.push({"key": item.key, "origin": change_rate_obj.css("background-color"), "new": "#FF7B7B"});
106
+ } else if (item.change_rate < pre_change_rate) {
107
+ change_color_data.push({"key": item.key, "origin": change_rate_obj.css("background-color"), "new": "#ADFFAD"});
108
108
  }
109
109
  }
110
110
  html.push('<div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">');
111
- let index_name = item["href"] ? Util.pack_html_link(item["href"], item["name"]) : item["name"];
111
+ let index_name = item.href ? Util.pack_html_link(item.href, item.name) : item.name;
112
112
  html.push('<span class="count_top"><i class="fa"></i> ', index_name, '</span>');
113
- html.push('<div class="count ', cls, '">', item["value"], '</div>');
114
- html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', item["change"], '(<span id="', change_rate_id, '">', Util.to_float(item["change_rate"], 2), '</span>%)</i></span>');
113
+ html.push('<div class="count ', cls, '">', item.value, '</div>');
114
+ html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', item["change"], '(<span id="', change_rate_id, '">', Util.to_float(item.change_rate, 2), '</span>%)</i></span>');
115
115
  html.push('</div>');
116
116
  });
117
117
  $("#index_summary_data").html(html.join(""));
118
118
  change_color_data.forEach(function (item) {
119
- let change_rate_obj = $("#change_rate_" + item["key"]);
119
+ let change_rate_obj = $("#change_rate_" + item.key);
120
120
  change_rate_obj.css("background-color", item["new"]);
121
121
  change_rate_obj.animate({backgroundColor: item["origin"]}, 2000);
122
122
  });
@@ -269,12 +269,12 @@ $(function () {
269
269
  let html = [];
270
270
  news_data.forEach(function (item) {
271
271
  html.push('<li><div class="block"><div class="block_content">');
272
- let title = item["title"].replace(/\\/g, ""); // JavaScript 中斜杠和反斜杠的替换
272
+ let title = item.title.replace(/\\/g, ""); // JavaScript 中斜杠和反斜杠的替换
273
273
  if (item["is_pbc"] && parseInt(item["is_pbc"]) === 1) {
274
274
  title = "<b class='text-danger'>" + title + "</b>";
275
275
  }
276
- html.push('<h2 class="title">', Util.pack_html_link(item["url"], title), '</h2>');
277
- html.push('<div class="byline"><span>', Util.seconds_to_format(item["ctime"]), '</span></div>');
276
+ html.push('<h2 class="title">', Util.pack_html_link(item.url, title), '</h2>');
277
+ html.push('<div class="byline"><span>', Util.seconds_to_format(item.ctime), '</span></div>');
278
278
  html.push('<p class="excerpt">', item["content"], '</p>');
279
279
  html.push('</div></div></li>');
280
280
  });
@@ -362,12 +362,12 @@ $(function () {
362
362
  };
363
363
  Util.post(location.pathname, payload, function (j) {
364
364
  DailySummary.pack_index_summary_data(j["index"]);
365
- DailySummary.pack_change_percent(j["change_percent"]);
365
+ DailySummary.pack_change_percent(j.change_percent);
366
366
  DailySummary.pack_big_deal(j["big_deal"], j["big_deal_date"]);
367
367
  DailySummary.pack_hsgt_money_flow(j["hmf"]);
368
368
  DailySummary.pack_news_data(j["news"]);
369
369
  DailySummary.set_cache("index", j["index"]);
370
- DailySummary.set_cache("change_percent", j["change_percent"]);
370
+ DailySummary.set_cache("change_percent", j.change_percent);
371
371
  DailySummary.set_cache("news", j["news"]);
372
372
  Util.hide_tips();
373
373
  if (DailySummary.is_trade_time === 1) {
@@ -387,9 +387,9 @@ $(function () {
387
387
  Util.show_loading();
388
388
  let date = $("#trade_date").val();
389
389
  Util.post(location.pathname, {date: date, action: "hsgt_stock", "hsgt_type": hsgt_type}, function (j) {
390
- DailySummary.pack_hsgt_ten(j["data"], "hgt", j["url"]);
391
- DailySummary.pack_hsgt_ten(j["data"], "sgt", j["url"]);
392
- let date_format = Util.seconds_to_format(j["date"], "%Y-%m-%d");
390
+ DailySummary.pack_hsgt_ten(j.data, "hgt", j["url"]);
391
+ DailySummary.pack_hsgt_ten(j.data, "sgt", j["url"]);
392
+ let date_format = Util.seconds_to_format(j.date, "%Y-%m-%d");
393
393
  if (date !== date_format) {
394
394
  $("#hgt_zone_tips").html("(" + date_format + ")");
395
395
  $("#sgt_zone_tips").html("(" + date_format + ")");
@@ -403,13 +403,13 @@ $(function () {
403
403
  let new_data = [];
404
404
  data.forEach(function (item) {
405
405
  if (calc_type === 1) {
406
- item["value"] = item["buy"] - item["sell"];
406
+ item.value = item.buy - item.sell;
407
407
  } else {
408
- item["value"] = item["buy"] + item["sell"];
408
+ item.value = item.buy + item.sell;
409
409
  }
410
- if (market == "hgt" && (item["type"] === 1 || item["type"] === 3)) {
410
+ if (market == "hgt" && (item.type === 1 || item.type === 3)) {
411
411
  new_data.push(item);
412
- } else if (market == "sgt" && (item["type"] === 2 || item["type"] === 4)) {
412
+ } else if (market == "sgt" && (item.type === 2 || item.type === 4)) {
413
413
  new_data.push(item);
414
414
  }
415
415
  });
@@ -419,11 +419,11 @@ $(function () {
419
419
  return d1["value"] > d2["value"] ? -1 : 1;
420
420
  });
421
421
  new_data.forEach(function (item) {
422
- let stock_url = "<td title='" + item['code'] + "'><a href='#' data-code='" + item["code"] + "' data-toggle='modal' data-target='.hsgt_stock_detail_modal'>" + item["name"] + "</a></td>";
423
- let buy = "<td title='买入金额-" + item["buy"] + "'>" + Util.to_hundred_million(item["buy"]) + "亿</td>";
424
- let sell = "<td title='卖出金额-" + item["sell"] + "'>" + Util.to_hundred_million(item["sell"]) + "亿</td>";
425
- let value = "<td>" + Util.to_hundred_million(item["value"]) + "亿</td>";
426
- let price_change = "<td>" + Util.digit_compare_trend(item["price"], item["pre_price"]) + "</td>";
422
+ let stock_url = "<td title='" + item['code'] + "'><a href='#' data-code='" + item.code + "' data-toggle='modal' data-target='.hsgt_stock_detail_modal'>" + item.name + "</a></td>";
423
+ let buy = "<td title='买入金额-" + item.buy + "'>" + Util.to_hundred_million(item.buy) + "亿</td>";
424
+ let sell = "<td title='卖出金额-" + item.sell + "'>" + Util.to_hundred_million(item.sell) + "亿</td>";
425
+ let value = "<td>" + Util.to_hundred_million(item.value) + "亿</td>";
426
+ let price_change = "<td>" + Util.digit_compare_trend(item.price, item.pre_price) + "</td>";
427
427
  html.push("<tr>", stock_url, price_change, buy, sell, value, "</tr>");
428
428
  });
429
429
  Util.render_table_html(market + "_table_body", html);
@@ -442,31 +442,31 @@ $(function () {
442
442
  };
443
443
  Util.post("/action", payload, function (j) {
444
444
  let html = [], latest_date = 0;
445
- j["data"].forEach(function (item) {
446
- latest_date = Math.max(latest_date, item["date"]);
445
+ j.data.forEach(function (item) {
446
+ latest_date = Math.max(latest_date, item.date);
447
447
  });
448
- j["data"].forEach(function (item) {
449
- if (item["date"] === latest_date) {
448
+ j.data.forEach(function (item) {
449
+ if (item.date === latest_date) {
450
450
  html.push("<tr class='info'>");
451
451
  } else {
452
452
  html.push("<tr>");
453
453
  }
454
- html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
455
- html.push("<td>", item["open"], "</td>");
456
- html.push("<td>", item["low"], "</td>");
457
- html.push("<td>", item["high"], "</td>");
458
- html.push("<td data-val='", item["close"], "'><b class='", Util.text_color(item["p_change_rate"]), "'>", item["close"], "</b></td>");
454
+ html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
455
+ html.push("<td>", item.open, "</td>");
456
+ html.push("<td>", item.low, "</td>");
457
+ html.push("<td>", item.high, "</td>");
458
+ html.push("<td data-val='", item.close, "'><b class='", Util.text_color(item["p_change_rate"]), "'>", item.close, "</b></td>");
459
459
  html.push("<td>", Util.parse_ratio(item["p_change_rate"]), "</td>");
460
- html.push("<td data-val='", item["volume"], "'>", Util.to_unit(item["volume"]), "股</td>");
461
- let amount = Util.to_unit(item["amount"], 3);
460
+ html.push("<td data-val='", item.volume, "'>", Util.to_unit(item.volume), "股</td>");
461
+ let amount = Util.to_unit(item.amount, 3);
462
462
  if (item["pre_amount"]) {
463
- if (item["amount"] > item["pre_amount"]) {
464
- amount += "<b class='text-danger'>(+" + Util.to_unit(item["amount"] - item["pre_amount"], 3) + ")</b>";
465
- } else if (item["amount"] < item["pre_amount"]) {
466
- amount += "<b class='text-success'>(" + Util.to_unit(item["amount"] - item["pre_amount"], 3) + ")</b>";
463
+ if (item.amount > item["pre_amount"]) {
464
+ amount += "<b class='text-danger'>(+" + Util.to_unit(item.amount - item["pre_amount"], 3) + ")</b>";
465
+ } else if (item.amount < item["pre_amount"]) {
466
+ amount += "<b class='text-success'>(" + Util.to_unit(item.amount - item["pre_amount"], 3) + ")</b>";
467
467
  }
468
468
  }
469
- html.push("<td data-val='", item["amount"], "'>", amount, "</td>");
469
+ html.push("<td data-val='", item.amount, "'>", amount, "</td>");
470
470
  html.push("</tr>");
471
471
  });
472
472
  Util.render_table_html("index_hist_modal_body_body", html);
@@ -519,7 +519,7 @@ $(function () {
519
519
  let date_data = [], val_data = [];
520
520
  data.forEach(function (item) {
521
521
  if (item[key] && item[key] > 0) {
522
- date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
522
+ date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
523
523
  val_data.push(Util.to_float(item[key], 2));
524
524
  }
525
525
  });
@@ -547,17 +547,17 @@ $(function () {
547
547
  $("#market_overview_load_status").html("");
548
548
  if (data_type === "amount") {
549
549
  let total_data = [];
550
- j["data"].forEach(function (item) {
550
+ j.data.forEach(function (item) {
551
551
  let total_val = Util.to_float(item["sh"] + item["szm"] + item["sme"] + item["gem"], 2);
552
- total_data.push({"date": item["date"], "total": total_val});
552
+ total_data.push({"date": item.date, "total": total_val});
553
553
  });
554
554
  DailySummary.mo_total_chart = Modal.render_market_overview_line(total_data, "total", "market_overview_total", "总" + title, DailySummary.mo_total_chart);
555
555
  }
556
- DailySummary.mo_sh_chart = Modal.render_market_overview_line(j["data"], "sh", "market_overview_sh", "沪市A股", DailySummary.mo_sh_chart);
557
- DailySummary.mo_szm_chart = Modal.render_market_overview_line(j["data"], "szm", "market_overview_szm", "深市主板", DailySummary.mo_szm_chart);
558
- DailySummary.mo_sme_chart = Modal.render_market_overview_line(j["data"], "sme", "market_overview_sme", "中小企业板", DailySummary.mo_sme_chart);
559
- DailySummary.mo_gem_chart = Modal.render_market_overview_line(j["data"], "gem", "market_overview_gem", "创业板", DailySummary.mo_gem_chart);
560
- DailySummary.mo_hk_chart = Modal.render_market_overview_line(j["data"], "hk", "market_overview_hk", "港股", DailySummary.mo_hk_chart);
556
+ DailySummary.mo_sh_chart = Modal.render_market_overview_line(j.data, "sh", "market_overview_sh", "沪市A股", DailySummary.mo_sh_chart);
557
+ DailySummary.mo_szm_chart = Modal.render_market_overview_line(j.data, "szm", "market_overview_szm", "深市主板", DailySummary.mo_szm_chart);
558
+ DailySummary.mo_sme_chart = Modal.render_market_overview_line(j.data, "sme", "market_overview_sme", "中小企业板", DailySummary.mo_sme_chart);
559
+ DailySummary.mo_gem_chart = Modal.render_market_overview_line(j.data, "gem", "market_overview_gem", "创业板", DailySummary.mo_gem_chart);
560
+ DailySummary.mo_hk_chart = Modal.render_market_overview_line(j.data, "hk", "market_overview_hk", "港股", DailySummary.mo_hk_chart);
561
561
  Util.hide_tips();
562
562
  });
563
563
  }
@@ -584,9 +584,9 @@ $(function () {
584
584
  $("#cp_val").html(cp);
585
585
  }
586
586
  Util.post(location.pathname, payload, function (j) {
587
- Util.render_type_option($("#p_change_industry"), j["data"], "industry", Modal.render_stock_rate_html);
588
- Util.render_type_option($("#p_change_area"), j["data"], "area", Modal.render_stock_rate_html);
589
- Modal["p_change_data"] = j["data"] ? j["data"] : [];
587
+ Util.render_type_option($("#p_change_industry"), j.data, "industry", Modal.render_stock_rate_html);
588
+ Util.render_type_option($("#p_change_area"), j.data, "area", Modal.render_stock_rate_html);
589
+ Modal["p_change_data"] = j.data ? j.data : [];
590
590
  Modal.render_stock_rate_html();
591
591
  $("#p_change_type").change(function () {
592
592
  if (!Util.is_load) {
@@ -608,12 +608,12 @@ $(function () {
608
608
  html.push("<tr>");
609
609
  html.push("<td>", index, "</td>");
610
610
  html = Util.stock_basics_html(html, item);
611
- html.push("<td>", Util.year_price_rate(item["stock_price"], item["year_price"]), "</td>");
612
- html.push("<td class='holder_", item["code"], "'>--</td>");
611
+ html.push("<td>", Util.year_price_rate(item.stock_price, item.year_price), "</td>");
612
+ html.push("<td class='holder_", item.code, "'>--</td>");
613
613
  if (item["continue_top_day"]) {
614
- html.push("<td title='连续涨停" + item["continue_top_day"] + "天'>", Util.parse_ratio(item["p_change"]), " <span class='badge alert-danger'>" + item["continue_top_day"] + "<span></td>");
614
+ html.push("<td title='连续涨停" + item["continue_top_day"] + "天'>", Util.parse_ratio(item.p_change), " <span class='badge alert-danger'>" + item["continue_top_day"] + "<span></td>");
615
615
  } else {
616
- html.push("<td>", Util.parse_ratio(item["p_change"]), "</td>");
616
+ html.push("<td>", Util.parse_ratio(item.p_change), "</td>");
617
617
  }
618
618
  html.push("</tr>");
619
619
  }
@@ -626,11 +626,11 @@ $(function () {
626
626
  Util.show_loading();
627
627
  Util.post(location.pathname, {action: "pbc_news"}, function (j) {
628
628
  let html = [], index = 0;
629
- j["data"].forEach(function (item) {
629
+ j.data.forEach(function (item) {
630
630
  index++;
631
631
  html.push("<tr title='", item["content"], "'>");
632
- html.push('<td>' + Util.pack_html_link(item["url"], item["title"].replace(/\\/g, "")) + '</td>');
633
- html.push("<td>", Util.seconds_to_format(item["ctime"]), "</td>");
632
+ html.push('<td>' + Util.pack_html_link(item.url, item.title.replace(/\\/g, "")) + '</td>');
633
+ html.push("<td>", Util.seconds_to_format(item.ctime), "</td>");
634
634
  html.push("<td>", Util.substring(item["content"], 40), "</td>");
635
635
  html.push("</tr>");
636
636
  });