sbd-npm 1.3.63 → 1.3.65

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/util.js +27 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.63",
3
+ "version": "1.3.65",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -482,6 +482,7 @@ const Util = {
482
482
  $("#price_change_" + code).html(Util.year_price_rate(item["price"], item["previous_price"]));
483
483
  } else {
484
484
  let price = Util.digit_compare_trend(item["price"], item["previous_price"]);
485
+ let price_change_rate = Util.calc_change_rate(item["price"], item["previous_price"], 4);
485
486
  $(".price_" + code).each(function () {
486
487
  if ($(this).attr("data-color")) {
487
488
  let pre_price = parseFloat(Util.strip_bracket_string($(this).text()));
@@ -496,6 +497,7 @@ const Util = {
496
497
  $(this).attr("data-color", $(this).css("background-color"));
497
498
  }
498
499
  $(this).html(price);
500
+ $(this).attr("data-val", price_change_rate);
499
501
  });
500
502
  }
501
503
  $(".year_price_" + code).each(function () {
@@ -1104,18 +1106,24 @@ const Util = {
1104
1106
  });
1105
1107
  }
1106
1108
  if ($("#public_fund_date").length === 0) {
1109
+ let fund_len = j["data"] ? j["data"].length : 0;
1107
1110
  Util.post("/stock/" + code, {action: "public_fund_date"}, function (j) {
1108
- let _html = [];
1109
- _html.push('<select id="public_fund_date">');
1111
+ let html = [], date_len = 0;
1112
+ html.push('<select id="public_fund_date">');
1110
1113
  j["data"].forEach(function (item) {
1114
+ date_len ++;
1111
1115
  let date_format = Util.seconds_to_format(item["date"], "%Y-%m-%d");
1112
- _html.push('<option value="', date_format, '">', date_format, '(', item["num"], ')</option>');
1116
+ html.push('<option value="', date_format, '">', date_format, '(', item["num"], ')</option>');
1113
1117
  });
1114
- _html.push('</select>');
1115
- $("#public_fund_date_zone").html(_html.join(""));
1118
+ html.push('</select>');
1119
+ $("#public_fund_date_zone").html(html.join(""));
1116
1120
  $("#public_fund_date").change(function () {
1117
1121
  Util.fetch_public_fund(code);
1118
1122
  });
1123
+ if (fund_len === 0 && date_len > 0) {
1124
+ Util.fetch_public_fund(code);
1125
+ }
1126
+ // 1跟上一季比新增的基金、2跟上一季比减少的基金
1119
1127
  $(".public_fund_difference").each(function() {
1120
1128
  $(this).click(function() {
1121
1129
  let public_fund_date = $("#public_fund_date").val();
@@ -1428,7 +1436,7 @@ const Util = {
1428
1436
  _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>");
1429
1437
  _html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='4'>", assets, "</td></tr>");
1430
1438
  _html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='4'>", issue_date, "</td></tr>");
1431
- _html.push("<tr><td colspan='3'>基金管理公司</td><td colspan='4'>", Util.pack_fund_administrator(j), "</td><td colspan='3'>基金经理</td><td colspan='4'>", j["managers"], "</td></tr>");
1439
+ _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>");
1432
1440
  _html.push("<tr><td colspan='5'>基金托管人</td><td colspan='9'>", (j["custodian"] ? j["custodian"] : "--"), "</td></tr>");
1433
1441
  _html.push("<tr><td colspan='5'>经办律师事务所</td><td colspan='9'>", (j["lawyer"] ? j["lawyer"] : "--"), "</td></tr>");
1434
1442
  _html.push("<tr><td colspan='5'>会计师事务所</td><td colspan='9'>", (j["accounting"] ? j["accounting"] : "--"), "</td></tr>");
@@ -3157,6 +3165,19 @@ const Util = {
3157
3165
  return "--";
3158
3166
  },
3159
3167
 
3168
+ /**
3169
+ * 组装基金经理数据
3170
+ * @param item
3171
+ * @returns {string}
3172
+ */
3173
+ pack_fund_manager: function (item) {
3174
+ if (item["managers"]) {
3175
+ let managers = item["managers"].replace(/、/g, " ");
3176
+ return Util.pack_html_link("https://www.howbuy.com/search/quicksearch.htm?skey=" + managers, item["managers"]);
3177
+ }
3178
+ return "--";
3179
+ },
3180
+
3160
3181
  /**
3161
3182
  * 雪球人数关注排名数据
3162
3183
  * @param item