sbd-npm 1.3.68 → 1.3.70

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/summary_daily.js +29 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.68",
3
+ "version": "1.3.70",
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
  }
@@ -300,9 +298,7 @@ $(function () {
300
298
  * 市场成交概况
301
299
  */
302
300
  pack_market_overview: function (market_overview_dict) {
303
- let _html = [];
304
- let previous_mo_amount = 0;
305
- let mo_amount = 0;
301
+ let _html = [], previous_mo_amount = 0, mo_amount = 0, mo_amount_cls = "", mo_amount_sign = "";
306
302
  for (let market_type in market_overview_dict) {
307
303
  if (market_overview_dict.hasOwnProperty(market_type)) {
308
304
  let market = market_overview_dict[market_type];
@@ -312,33 +308,48 @@ $(function () {
312
308
  mo_amount += market["item"]["amount"];
313
309
  }
314
310
  _html.push("<tr>");
315
- _html.push("<td>", Util.pack_html_link(market["url"], market["name"]), "</td>");
316
- _html.push(DailySummary.pack_mo_item_html(market, "market_capital", "万亿"));
317
- _html.push(DailySummary.pack_mo_item_html(market, "pe", ""));
318
- _html.push(DailySummary.pack_mo_item_html(market, "volume", "亿股"));
319
- _html.push(DailySummary.pack_mo_item_html(market, "amount", "亿"));
311
+ _html.push("<td style='padding: 18px 0;'>", Util.pack_html_link(market["url"], market["name"]), "</td>");
312
+ _html.push("<td style='padding: 18px 0;'>", (market["item"]["market_capital"] ? (market["item"]["market_capital"] + "万亿") : "--"), "</td>");
313
+ _html.push("<td style='padding: 18px 0;'>", (market["item"]["pe"] ? market["item"]["pe"] : "--"), "</td>");
314
+ _html.push("<td style='padding: 18px 0;'>", (market["item"]["volume"] ? (market["item"]["volume"] + "亿股") : "--"), "</td>");
315
+ let amount = "--";
316
+ if (market["item"]["amount"] && market["item"]["amount"] > 0) {
317
+ if (market["item"]["prev_amount"] && market["item"]["prev_amount"] > 0) {
318
+ if (market["item"]["amount"] > market["item"]["prev_amount"]) {
319
+ amount = "<b title='前值: " + market["item"]["prev_amount"] + "亿' class='text-danger'>" + market["item"]["amount"] + "亿</b>";
320
+ } else if (market["item"]["amount"] < market["item"]["prev_amount"]) {
321
+ amount = "<b title='前值: " + market["item"]["prev_amount"] + "亿' class='text-success'>" + market["item"]["amount"] + "亿</b>";
322
+ } else {
323
+ amount = market["item"]["amount"] + "亿";
324
+ }
325
+ } else {
326
+ amount = market["item"]["amount"] + "亿";
327
+ }
328
+ }
329
+ _html.push("<td style='padding: 18px 0;'>", amount, "</td>");
320
330
  _html.push("</tr>");
321
331
  }
322
332
  }
323
333
  }
324
334
  $("#market_overview_zone").html(_html.join(""));
325
- let mo_amount_cls = "";
326
- let mo_amount_sign = "";
327
- let dist_amount = Util.to_float(mo_amount - previous_mo_amount, 3);
328
- if (dist_amount > 0) {
335
+ 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) {
336
+ mo_amount = Util.to_hundred_million(market_overview_dict["total_amount_data"][0], 3)
337
+ previous_mo_amount = Util.to_hundred_million(market_overview_dict["total_amount_data"][1], 3)
338
+ }
339
+ if (mo_amount > previous_mo_amount) {
329
340
  mo_amount_cls = "label-danger";
330
341
  mo_amount_sign = "+";
331
- } else if (dist_amount < 0) {
342
+ } else if (mo_amount < previous_mo_amount) {
332
343
  mo_amount_cls = "label-success";
333
344
  }
334
345
  let mo_amount_obj = $("#market_overview_amount");
335
- mo_amount_obj.attr("title", Util.to_float(previous_mo_amount, 3));
346
+ mo_amount_obj.attr("title", "前值: " + Util.to_float(previous_mo_amount, 3) + "亿");
336
347
  mo_amount_obj.removeClass("label-danger");
337
348
  mo_amount_obj.removeClass("label-success");
338
349
  if (mo_amount_cls.length > 0) {
339
350
  mo_amount_obj.addClass(mo_amount_cls);
340
351
  }
341
- mo_amount_obj.html(Util.to_float(mo_amount, 3) + "(" + mo_amount_sign + dist_amount + ")");
352
+ mo_amount_obj.html(Util.to_float(mo_amount, 3) + "(" + mo_amount_sign + Util.to_float(mo_amount - previous_mo_amount, 3) + ")");
342
353
  DailySummary.set_cache("market_overview", market_overview_dict);
343
354
  },
344
355