sbd-npm 1.1.68 → 1.1.72

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 (4) hide show
  1. package/.npmignore +1 -0
  2. package/menu.js +2 -1
  3. package/package.json +1 -1
  4. package/util.js +41 -16
package/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
package/menu.js CHANGED
@@ -53,7 +53,7 @@ const MenuList = [
53
53
  {'key': 'trend_fund_hold', 'name': '基金持股变化', 'url': '/067740976f85ec14ddae02b51829ce35'},
54
54
  {'key': 'trend_week_minimum', 'name': '周成交低点', 'url': '/722d94429b8e689fe78dca1cf67a4c67'},
55
55
  {'key': 'trend_margin', 'name': '融资融券余额涨幅', 'url': '/1964a6bc56dc3ce6825b23667c7fb588'},
56
- {'key': 'trend_price', 'name': '股价升跌幅度', 'url': '/43ef6aeb36475f8f8f44d477b1990390'},
56
+ {'key': 'trend_price', 'name': '股价涨跌幅度', 'url': '/43ef6aeb36475f8f8f44d477b1990390'},
57
57
  {'key': 'trend_down', 'name': '当前连跌个股', 'url': '/07fb907c7e7572fbeae98bacf5c44593'},
58
58
  {'key': 'trend_down_analysis', 'name': '连跌反弹概率', 'url': '/e9a32e4601fca33a9c3b68103f61c3bc'},
59
59
  {'key': 'trend_index_month', 'name': '指数每年月份涨跌', 'url': '/86691e421938098bab7679e43bea67a6'},
@@ -228,6 +228,7 @@ const MenuList = [
228
228
  {'key': 'other_bond', 'name': '地方债数据', 'url': '/fbe79af9b125b8952d05801dcf1ea4c1'},
229
229
  {'key': 'other_convertible_bond', 'name': '可转债数据', 'url': '/cf21d0fe6fe66c94488dab9cfef16c0a'},
230
230
  {'key': 'other_fortune500', 'name': '财富500强', 'url': '/04d4033d33ea4c0cdd0d874dde23ef2c'},
231
+ {'key': 'other_material', 'name': '资料', 'url': '/384dd1f2f7cbfc1739f78d047ef22350'},
231
232
  ]
232
233
  },
233
234
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.68",
3
+ "version": "1.1.72",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -333,22 +333,30 @@ const Util = {
333
333
  render_price: function (item) {
334
334
  let code = item["code"];
335
335
  if (item["price"]) {
336
- let price = Util.digit_compare_trend(item["price"], item["previous_price"]);
337
- $(".price_" + code).each(function () {
338
- if ($(this).attr("data-color")) {
339
- let pre_price = parseFloat(Util.strip_bracket_string($(this).text()));
340
- if (item["price"] > pre_price && pre_price > 0) {
341
- $(this).css("background-color", "#FF7B7B");
342
- $(this).animate({backgroundColor: $(this).attr("data-color")}, 2000);
343
- } else if (item["price"] > 0 && item["price"] < pre_price) {
344
- $(this).css("background-color", "#ADFFAD");
345
- $(this).animate({backgroundColor: $(this).attr("data-color")}, 2000);
336
+ if ($("#price_change_" + code).length) {
337
+ let price_cls = Util.text_color(item["price"], item["previous_price"]);
338
+ $(".price_" + code).each(function () {
339
+ $(this).html("<b class='" + price_cls + "'>" + item["price"] + "</b>");
340
+ });
341
+ $("#price_change_" + code).html(Util.year_price_rate(item["price"], item["previous_price"]));
342
+ } else {
343
+ let price = Util.digit_compare_trend(item["price"], item["previous_price"]);
344
+ $(".price_" + code).each(function () {
345
+ if ($(this).attr("data-color")) {
346
+ let pre_price = parseFloat(Util.strip_bracket_string($(this).text()));
347
+ if (item["price"] > pre_price && pre_price > 0) {
348
+ $(this).css("background-color", "#FF7B7B");
349
+ $(this).animate({backgroundColor: $(this).attr("data-color")}, 2000);
350
+ } else if (item["price"] > 0 && item["price"] < pre_price) {
351
+ $(this).css("background-color", "#ADFFAD");
352
+ $(this).animate({backgroundColor: $(this).attr("data-color")}, 2000);
353
+ }
354
+ } else {
355
+ $(this).attr("data-color", $(this).css("background-color"));
346
356
  }
347
- } else {
348
- $(this).attr("data-color", $(this).css("background-color"));
349
- }
350
- $(this).html(price);
351
- });
357
+ $(this).html(price);
358
+ });
359
+ }
352
360
  $(".year_price_" + code).each(function () {
353
361
  if (item["year_price"]) {
354
362
  $(this).html(Util.year_price_rate(item["price"], item["year_price"]));
@@ -756,6 +764,16 @@ const Util = {
756
764
  }
757
765
  },
758
766
 
767
+ /**
768
+ * 表格加载状态
769
+ * @param element_id
770
+ */
771
+ set_table_loading: function(element_id) {
772
+ let obj = $("#" + element_id);
773
+ let td_num = obj.parent().find('thead td').length;
774
+ obj.html('<tr><td colspan="' + td_num + '">Loading...</td></tr>');
775
+ },
776
+
759
777
  /**
760
778
  * 渲染板块内容
761
779
  * @param classify_id
@@ -899,7 +917,14 @@ const Util = {
899
917
  let _html = [];
900
918
  if (j["fund_code"]) {
901
919
  $("#" + component_id + "_title").html(Util.pack_html_link("http://fundf10.eastmoney.com/jbgk_" + j["fund_code"] + ".html", j["fund_name"]));
902
- let net = j["net"] > 0 ? j["net"] : "--";
920
+ let net = "--";
921
+ if (j["net"] > 0) {
922
+ net = j["net"];
923
+ let net_cls = Util.text_color(j["change_percent"]);
924
+ if (net_cls !== "") {
925
+ net = "<b class='" + net_cls + "'>" + net + "(" + Util.to_float(j["change_percent"], 2) + "%)</b>";
926
+ }
927
+ }
903
928
  let assets = j["assets"] > 0 ? (j["assets"] + "亿") : "--";
904
929
  let public_date = j["public_date"] > 0 ? Util.seconds_to_format(j["public_date"], "%Y-%m-%d") : "--";
905
930
  let issue_date = j["issue_date"] > 0 ? Util.seconds_to_format(j["issue_date"], "%Y-%m-%d") : "--";