sbd-npm 1.4.13 → 1.4.15

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 (3) hide show
  1. package/package.json +1 -1
  2. package/status.js +1 -1
  3. package/util.js +27 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/status.js CHANGED
@@ -667,7 +667,7 @@ $(function () {
667
667
  $("#client_action_add").click(function() {
668
668
  let action_type = 1, worker_key = "1";
669
669
  if ($("#action_worker_div").css("display") === "block") {
670
- action_type == 2;
670
+ action_type = 2;
671
671
  worker_key = $("#client_action_worker").val();
672
672
  }
673
673
  if (worker_key) {
package/util.js CHANGED
@@ -1478,7 +1478,7 @@ const Util = {
1478
1478
  }
1479
1479
  });
1480
1480
  component_obj.on('hidden.bs.modal', function () {
1481
- $("#" + component_id + "_body_body").html("<tr><td colspan='14'>Loading...</td></tr>");
1481
+ $("#" + component_id + "_body_body").html("<tr><td colspan='15'>Loading...</td></tr>");
1482
1482
  if (localStorage["modal_public_fund_code"]) {
1483
1483
  localStorage.removeItem("modal_public_fund_code");
1484
1484
  }
@@ -1495,7 +1495,7 @@ const Util = {
1495
1495
  if (!fund_code) {
1496
1496
  return;
1497
1497
  }
1498
- $("#" + component_id + "_body_body").html("<tr><td colspan='14'>Loading...</td></tr>");
1498
+ $("#" + component_id + "_body_body").html("<tr><td colspan='15'>Loading...</td></tr>");
1499
1499
  $("#" + component_id + "_title").html(fund_code);
1500
1500
  Util.post(Util.get_url("fund_public"), {action: "public_fund_detail", fund_code: fund_code}, function (j) {
1501
1501
  let _html = [];
@@ -1512,20 +1512,20 @@ const Util = {
1512
1512
  let assets = j["assets"] > 0 ? (j["assets"] + "亿") : "--";
1513
1513
  let public_date = j["public_date"] > 0 ? Util.seconds_to_format(j["public_date"], "%Y-%m-%d") : "--";
1514
1514
  let issue_date = j["issue_date"] > 0 ? Util.seconds_to_format(j["issue_date"], "%Y-%m-%d") : "--";
1515
- _html.push("<tr title='最后更新时间: ", Util.seconds_to_format(j["update_time"], "%Y-%m-%d"), "' class='info'><th colspan='14' style='text-align: center;'>基金概况</th></tr>");
1516
- _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='4'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j["fund_code"] + '.html', j["fund_name"]), "</td></tr>");
1517
- _html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", j["fund_type"], "</td><td colspan='3'>投资类型</td><td colspan='4'>", j["invest_type"], "</td></tr>");
1518
- _html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='4'>", assets, "</td></tr>");
1519
- _html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='4'>", issue_date, "</td></tr>");
1520
- _html.push("<tr><td colspan='3'>基金管理公司</td><td colspan='4'>", Util.pack_fund_administrator(j), "</td><td colspan='3'>基金经理</td><td colspan='4'>", Util.pack_fund_manager(j), "</td></tr>");
1521
- _html.push("<tr><td colspan='3'>基金托管人</td><td colspan='4'>", (j["custodian"] ? j["custodian"] : "--"), "</td><td colspan='3'>经办律师事务所</td><td colspan='4'>", (j["lawyer"] ? j["lawyer"] : "--"), "</td></tr>");
1522
- _html.push("<tr><td colspan='3'>会计师事务所</td><td colspan='4'>", (j["accounting"] ? j["accounting"] : "--"), "</td><td colspan='3'>注册地址</td><td colspan='4'>", Util.map_url(j["location"], j["location"]), "</td></tr>");
1523
- _html.push("<tr><td colspan='3'>近一周</td><td colspan='4'>", Util.parse_ratio(j["one_week_change"]), "</td><td colspan='3'>近一月</td><td colspan='4'>", Util.parse_ratio(j["one_month_change"]), "</td></tr>");
1524
- _html.push("<tr><td colspan='3'>近一年</td><td colspan='4'>", Util.parse_ratio(j["one_year_change"]), "</td><td colspan='3'>年初至今</td><td colspan='4'>", Util.pack_html_link('https://fundf10.eastmoney.com/jdzf_' + j["fund_code"] + '.html', Util.parse_ratio(j["ytd_change"])), "</td></tr>");
1525
- _html.push("<tr><td colspan='5'>成立以来</td><td colspan='9'>", Util.parse_ratio(j["establish_change"]), "</td></tr>");
1526
- _html.push("<tr class='info'><th colspan='14' style='text-align: center;'>", Util.pack_html_link("http://fund.eastmoney.com/f10/ccmx_" + j["fund_code"] + ".html", "持股明细"), " <span id='fund_stock_date_zone'></span></th></tr>");
1527
- _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></tr>");
1528
- _html.push("<tr class='" + component_id + "_tr'><td colspan='14'>暂无数据</td></tr>");
1515
+ _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>");
1516
+ _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>");
1517
+ _html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", j["fund_type"], "</td><td colspan='3'>投资类型</td><td colspan='5'>", j["invest_type"], "</td></tr>");
1518
+ _html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='5'>", assets, "</td></tr>");
1519
+ _html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='5'>", issue_date, "</td></tr>");
1520
+ _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>");
1521
+ _html.push("<tr><td colspan='3'>基金托管人</td><td colspan='4'>", (j["custodian"] ? j["custodian"] : "--"), "</td><td colspan='3'>经办律师事务所</td><td colspan='5'>", (j["lawyer"] ? j["lawyer"] : "--"), "</td></tr>");
1522
+ _html.push("<tr><td colspan='3'>会计师事务所</td><td colspan='4'>", (j["accounting"] ? j["accounting"] : "--"), "</td><td colspan='3'>注册地址</td><td colspan='5'>", Util.map_url(j["location"], j["location"]), "</td></tr>");
1523
+ _html.push("<tr><td colspan='3'>近一周</td><td colspan='4'>", Util.parse_ratio(j["one_week_change"]), "</td><td colspan='3'>近一月</td><td colspan='5'>", Util.parse_ratio(j["one_month_change"]), "</td></tr>");
1524
+ _html.push("<tr><td colspan='3'>近一年</td><td colspan='4'>", Util.parse_ratio(j["one_year_change"]), "</td><td colspan='3'>年初至今</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jdzf_' + j["fund_code"] + '.html', Util.parse_ratio(j["ytd_change"])), "</td></tr>");
1525
+ _html.push("<tr><td colspan='5'>成立以来</td><td colspan='10'>", Util.parse_ratio(j["establish_change"]), "</td></tr>");
1526
+ _html.push("<tr class='info'><th colspan='15' style='text-align: center;'>", Util.pack_html_link("http://fund.eastmoney.com/f10/ccmx_" + j["fund_code"] + ".html", "持股明细"), " <span id='fund_stock_date_zone'></span></th></tr>");
1527
+ _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>");
1528
+ _html.push("<tr class='" + component_id + "_tr'><td colspan='15'>暂无数据</td></tr>");
1529
1529
  Util.render_table_html(component_id + "_body_body", _html);
1530
1530
  if (j["date_list"]) {
1531
1531
  _html = [];
@@ -1542,7 +1542,7 @@ const Util = {
1542
1542
  Util.fetch_public_fund_stock(j["fund_code"], fsd_obj.val(), component_id);
1543
1543
  }
1544
1544
  } else {
1545
- _html.push("<tr><td colspan='14'>暂无数据</td></tr>");
1545
+ _html.push("<tr><td colspan='15'>暂无数据</td></tr>");
1546
1546
  Util.render_table_html(component_id + "_body_body", _html);
1547
1547
  }
1548
1548
  });
@@ -1560,7 +1560,7 @@ const Util = {
1560
1560
  $("." + component_tr).each(function () {
1561
1561
  $(this).remove();
1562
1562
  });
1563
- $("<tr class='" + component_tr + "'><td colspan='14'>Loading...</td></tr>").insertAfter("#" + component_id + "_head");
1563
+ $("<tr class='" + component_tr + "'><td colspan='15'>Loading...</td></tr>").insertAfter("#" + component_id + "_head");
1564
1564
  let pre_date = 0;
1565
1565
  date = parseInt(date);
1566
1566
  $("#fund_stock_date").find("option").each(function () {
@@ -1600,18 +1600,22 @@ const Util = {
1600
1600
  }
1601
1601
  }
1602
1602
  _html.push("<td>", Util.to_unit(item["stock_num"]), stock_num_tips, "</td>");
1603
- let rate_tips = "";
1603
+ let rate_tips = "", rate_change = "--";
1604
1604
  if (item["rate"] > 0 && item["rate"] > item["pre_rate"]) {
1605
1605
  rate_tips = "<b class='text-danger'>(+" + Util.to_float(item["rate"] - item["pre_rate"], 2) + "%)</b>";
1606
1606
  } else if (item["pre_rate"] > 0 && item["pre_rate"] > item["rate"]) {
1607
1607
  rate_tips = "<b class='text-success'>(" + Util.to_float(item["rate"] - item["pre_rate"], 2) + "%)</b>";
1608
1608
  }
1609
+ if (item["pre_rate"] && item["pre_rate"] > 0) {
1610
+ rate_change = Util.year_price_rate(item["rate"], item["pre_rate"], 1);
1611
+ }
1609
1612
  _html.push("<td>", item["rate"], "%", rate_tips, "</td>");
1613
+ _html.push("<td>", rate_change, "</td>");
1610
1614
  _html.push("<td>", Util.to_unit(item["fund_market_capital"]), "</td>");
1611
1615
  _html.push("</tr>");
1612
1616
  });
1613
1617
  } else {
1614
- _html.push("<tr class='" + component_tr + "'><td colspan='14'>暂无数据</td></tr>");
1618
+ _html.push("<tr class='" + component_tr + "'><td colspan='15'>暂无数据</td></tr>");
1615
1619
  }
1616
1620
  $(_html.join("")).insertAfter("#" + component_id + "_head");
1617
1621
  Util.hide_tips();
@@ -3195,6 +3199,9 @@ const Util = {
3195
3199
  */
3196
3200
  pack_html_link: function (url, title) {
3197
3201
  if (url) {
3202
+ if (!url.startsWith("http")) {
3203
+ url = "http://" + url;
3204
+ }
3198
3205
  return "<a target='_blank' class='link_cls' rel='noopener noreferrer nofollow' href='" + url + "'>" + title + "</a>";
3199
3206
  }
3200
3207
  return title;