sbd-npm 1.4.96 → 1.4.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/summary_daily.js CHANGED
@@ -90,10 +90,10 @@ $(function () {
90
90
  let html = [], change_color_data = [];
91
91
  index_data.forEach(function (item) {
92
92
  let cls = "", sort = "";
93
- if (item["change"] > 0) {
93
+ if (item.change > 0) {
94
94
  cls = "red";
95
95
  sort = "fa-sort-asc";
96
- } else if (item["change"] < 0) {
96
+ } else if (item.change < 0) {
97
97
  cls = "green";
98
98
  sort = "fa-sort-desc";
99
99
  }
@@ -111,14 +111,14 @@ $(function () {
111
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
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>');
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
119
  let change_rate_obj = $("#change_rate_" + item.key);
120
120
  change_rate_obj.css("background-color", item["new"]);
121
- change_rate_obj.animate({backgroundColor: item["origin"]}, 2000);
121
+ change_rate_obj.animate({backgroundColor: item.origin}, 2000);
122
122
  });
123
123
  },
124
124
 
@@ -270,12 +270,12 @@ $(function () {
270
270
  news_data.forEach(function (item) {
271
271
  html.push('<li><div class="block"><div class="block_content">');
272
272
  let title = item.title.replace(/\\/g, ""); // JavaScript 中斜杠和反斜杠的替换
273
- if (item["is_pbc"] && parseInt(item["is_pbc"]) === 1) {
273
+ if (item.is_pbc && parseInt(item.is_pbc) === 1) {
274
274
  title = "<b class='text-danger'>" + title + "</b>";
275
275
  }
276
276
  html.push('<h2 class="title">', Util.pack_html_link(item.url, title), '</h2>');
277
277
  html.push('<div class="byline"><span>', Util.seconds_to_format(item.ctime), '</span></div>');
278
- html.push('<p class="excerpt">', item["content"], '</p>');
278
+ html.push('<p class="excerpt">', item.content, '</p>');
279
279
  html.push('</div></div></li>');
280
280
  });
281
281
  $("#news_list").html(html.join(""));
@@ -387,8 +387,8 @@ $(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"]);
390
+ DailySummary.pack_hsgt_ten(j.data, "hgt", j.url);
391
+ DailySummary.pack_hsgt_ten(j.data, "sgt", j.url);
392
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 + ")");
@@ -419,7 +419,7 @@ $(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>";
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
423
  let buy = "<td title='买入金额-" + item.buy + "'>" + Util.to_hundred_million(item.buy) + "亿</td>";
424
424
  let sell = "<td title='卖出金额-" + item.sell + "'>" + Util.to_hundred_million(item.sell) + "亿</td>";
425
425
  let value = "<td>" + Util.to_hundred_million(item.value) + "亿</td>";
@@ -455,15 +455,15 @@ $(function () {
455
455
  html.push("<td>", item.open, "</td>");
456
456
  html.push("<td>", item.low, "</td>");
457
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
- html.push("<td>", Util.parse_ratio(item["p_change_rate"]), "</td>");
458
+ html.push("<td data-val='", item.close, "'><b class='", Util.text_color(item.p_change_rate), "'>", item.close, "</b></td>");
459
+ html.push("<td>", Util.parse_ratio(item.p_change_rate), "</td>");
460
460
  html.push("<td data-val='", item.volume, "'>", Util.to_unit(item.volume), "股</td>");
461
461
  let amount = Util.to_unit(item.amount, 3);
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>";
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>";
467
467
  }
468
468
  }
469
469
  html.push("<td data-val='", item.amount, "'>", amount, "</td>");
@@ -548,7 +548,7 @@ $(function () {
548
548
  if (data_type === "amount") {
549
549
  let total_data = [];
550
550
  j.data.forEach(function (item) {
551
- let total_val = Util.to_float(item["sh"] + item["szm"] + item["sme"] + item["gem"], 2);
551
+ let total_val = Util.to_float(item.sh + item.szm + item.sme + item.gem, 2);
552
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);
@@ -610,8 +610,8 @@ $(function () {
610
610
  html = Util.stock_basics_html(html, item);
611
611
  html.push("<td>", Util.year_price_rate(item.stock_price, item.year_price), "</td>");
612
612
  html.push("<td class='holder_", item.code, "'>--</td>");
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>");
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>");
615
615
  } else {
616
616
  html.push("<td>", Util.parse_ratio(item.p_change), "</td>");
617
617
  }
@@ -628,10 +628,10 @@ $(function () {
628
628
  let html = [], index = 0;
629
629
  j.data.forEach(function (item) {
630
630
  index++;
631
- html.push("<tr title='", item["content"], "'>");
631
+ html.push("<tr title='", item.content, "'>");
632
632
  html.push('<td>' + Util.pack_html_link(item.url, item.title.replace(/\\/g, "")) + '</td>');
633
633
  html.push("<td>", Util.seconds_to_format(item.ctime), "</td>");
634
- html.push("<td>", Util.substring(item["content"], 40), "</td>");
634
+ html.push("<td>", Util.substring(item.content, 40), "</td>");
635
635
  html.push("</tr>");
636
636
  });
637
637
  Util.render_table_html("news_modal_body_body", html);
package/util.js CHANGED
@@ -85,8 +85,8 @@ const Util = {
85
85
  }
86
86
  } else {
87
87
  Util.post("/action", {action: "rand_stock", stock_type: "cn"}, function (j) {
88
- if (j["code"]) {
89
- window.open("/stock/" + j["code"], "_blank");
88
+ if (j.code) {
89
+ window.open("/stock/" + j.code, "_blank");
90
90
  }
91
91
  });
92
92
  }
@@ -186,7 +186,7 @@ const Util = {
186
186
  Util.post("/action", {action: "search", key_word: $("#stock").val()}, function (j) {
187
187
  let key_word = $("#stock").val().trim();
188
188
  if (key_word) {
189
- if (key_word === j["key_word"]) {
189
+ if (key_word === j.key_word) {
190
190
  let html = [];
191
191
  html.push('<div class="list-group">');
192
192
  if (j.data && j.data.length > 0) {
@@ -666,8 +666,8 @@ const Util = {
666
666
  $(this).attr("disabled", true);
667
667
  Util.post("/action", {action: "rand_stock", stock_type: stock_type}, function (j) {
668
668
  $("#" + rand_btn_id).attr("disabled", false);
669
- if (j["code"]) {
670
- window.open("/stock/" + j["code"], "_blank");
669
+ if (j.code) {
670
+ window.open("/stock/" + j.code, "_blank");
671
671
  }
672
672
  });
673
673
  return false;
@@ -1591,9 +1591,9 @@ const Util = {
1591
1591
  let assets = j["assets"] > 0 ? (j["assets"] + "亿") : "--";
1592
1592
  let public_date = j["public_date"] > 0 ? Util.seconds_to_format(j["public_date"], "%Y-%m-%d") : "--";
1593
1593
  let issue_date = j["issue_date"] > 0 ? Util.seconds_to_format(j["issue_date"], "%Y-%m-%d") : "--";
1594
- html.push("<tr title='最后更新时间: ", Util.seconds_to_format(j["update_time"], "%Y-%m-%d"), "' class='info'><th colspan='15' style='text-align: center;'>基金概况</th></tr>");
1594
+ html.push("<tr title='最后更新时间: ", Util.seconds_to_format(j.update_time, "%Y-%m-%d"), "' class='info'><th colspan='15' style='text-align: center;'>基金概况</th></tr>");
1595
1595
  html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://xueqiu.com/S/' + Util.code_to_fund_symbol(j.fund_code), j.fund_code), "</td><td colspan='3'>基金名</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j.fund_code + '.html', j["fund_name"]), "</td></tr>");
1596
- html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", (j["fund_type"] ? j["fund_type"] : "--"), "</td><td colspan='3'>投资类型</td><td colspan='5'>", (j["invest_type"] ? j["invest_type"] : "--"), "</td></tr>");
1596
+ html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", (j.fund_type ? j.fund_type : "--"), "</td><td colspan='3'>投资类型</td><td colspan='5'>", (j["invest_type"] ? j["invest_type"] : "--"), "</td></tr>");
1597
1597
  html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='5'>", assets, "</td></tr>");
1598
1598
  html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='5'>", issue_date, "</td></tr>");
1599
1599
  html.push("<tr><td colspan='3'>基金管理公司</td><td colspan='4'>", Util.pack_fund_administrator(j), "</td><td colspan='3'>基金经理</td><td colspan='5'>", Util.pack_fund_manager(j), "</td></tr>");
@@ -1606,10 +1606,10 @@ const Util = {
1606
1606
  html.push("<tr id='" + component_id + "_head'><th>序号</th><th>股票代码</th><th>股票名</th><th>PE</th><th>总市值</th><th>行业</th><th>地区</th><th>价格</th><th>年初至今</th><th>近5日</th><th>股东数</th><th>持有量</th><th class='info'>占比</th><th>占比变化</th><th>持仓市值</th></tr>");
1607
1607
  html.push("<tr class='" + component_id + "_tr'><td colspan='15'>暂无数据</td></tr>");
1608
1608
  Util.render_table_html(component_id + "_body_body", html);
1609
- if (j["date_list"]) {
1609
+ if (j.date_list) {
1610
1610
  html = [];
1611
1611
  html.push("<select id='fund_stock_date'>");
1612
- j["date_list"].forEach(function (date) {
1612
+ j.date_list.forEach(function (date) {
1613
1613
  html.push("<option value='", date, "'>", Util.seconds_to_format(date, "%Y-%m-%d"), "</option>");
1614
1614
  });
1615
1615
  html.push("</select>");
@@ -1929,7 +1929,7 @@ const Util = {
1929
1929
  "</span> 年初至今:" + Util.digit_compare_trend1(j.exchange_rate, j["year_exchange_rate"]) +
1930
1930
  " 52周最高:" + Util.digit_compare_trend1(j.exchange_rate, j["week52high"]) +
1931
1931
  " 52周最低:" + Util.digit_compare_trend1(j.exchange_rate, j["week52low"]);
1932
- let title = j["name"] !== currency ? (j["name"] + "(" + currency.toUpperCase() + ")") : j["name"];
1932
+ let title = j.name !== currency ? (j.name + "(" + currency.toUpperCase() + ")") : j.name;
1933
1933
  title = '<i class="fa fa-' + currency + '"></i> ' + title;
1934
1934
  title = Util.pack_html_link("https://cn.investing.com/currencies/" + currency + "-cny", title);
1935
1935
  $("#currency_modal_title").html(title + "&nbsp;&nbsp;" + currency_modal_summary);