sbd-npm 1.1.67 → 1.1.71

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/menu.js +2 -2
  2. package/package.json +1 -1
  3. package/util.js +74 -42
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'},
@@ -191,7 +191,6 @@ const MenuList = [
191
191
  {'key': 'snowball_trend', 'name': '自选趋势', 'url': '/08c40d908dd87e29a607b6945309edf0'},
192
192
  {'key': 'snowball_user', 'name': '用户列表', 'url': '/97339b8453883dd27e6087ae7db6f62a'},
193
193
  {'key': 'snowball_tweet', 'name': '推文', 'url': '/9a9aef7fced3f15ff7647de75d70798c'},
194
- {'key': 'snowball_red_packet', 'name': '红包数据', 'url': '/23d88182f12431fe67f658b725cbaf1d'},
195
194
  {'key': 'snowball_tool', 'name': '搜索工具', 'url': '/ac88ee85f27e11aa06f2b8f46b03a0eb'},
196
195
  ]
197
196
  },
@@ -229,6 +228,7 @@ const MenuList = [
229
228
  {'key': 'other_bond', 'name': '地方债数据', 'url': '/fbe79af9b125b8952d05801dcf1ea4c1'},
230
229
  {'key': 'other_convertible_bond', 'name': '可转债数据', 'url': '/cf21d0fe6fe66c94488dab9cfef16c0a'},
231
230
  {'key': 'other_fortune500', 'name': '财富500强', 'url': '/04d4033d33ea4c0cdd0d874dde23ef2c'},
231
+ {'key': 'other_material', 'name': '资料', 'url': '/384dd1f2f7cbfc1739f78d047ef22350'},
232
232
  ]
233
233
  },
234
234
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.67",
3
+ "version": "1.1.71",
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"]));
@@ -793,8 +801,8 @@ const Util = {
793
801
  {"name": "名称"},
794
802
  {"name": "PE", "title": "市盈率(Price Earnings Ratio)", "table_sort": 1},
795
803
  {"name": "总市值", "table_sort": 1},
796
- {"name": "行业"},
797
- {"name": "地区"},
804
+ {"name": "行业", "select_id": "stock_category_industry"},
805
+ {"name": "地区", "select_id": "stock_category_area"},
798
806
  {"name": "当前价", "table_sort": 1},
799
807
  {"name": "最高价"},
800
808
  {"name": "最低价"},
@@ -805,7 +813,7 @@ const Util = {
805
813
  head_cols.push({"name": "成交金额", "table_sort": 1});
806
814
  head_cols.push({"name": "成交均价", "table_sort": 1});
807
815
  head_cols.push({"name": "股东数", "table_sort": 1});
808
- head_cols.push({"name": "备注", "id": "remark_title"});
816
+ head_cols.push({"name": "备注", "id": "stock_category_remark_title"});
809
817
  }
810
818
  let table_options = {
811
819
  "element_id": table_id,
@@ -816,30 +824,14 @@ const Util = {
816
824
  table_options["alert"] = alert_tips;
817
825
  }
818
826
  Util.init_table_skeleton(table_options);
827
+ Util["stock_category_table_id"] = table_id;
819
828
  Util.post(location.pathname, {active_div: stock_category}, function (j) {
820
- let _html = [];
821
- let total_num = 0;
822
- j["data"].forEach(function (item) {
823
- total_num++;
824
- _html.push("<tr>");
825
- item["code"] = item["code"].toLowerCase();
826
- _html = Util.stock_basics_html(_html, item);
827
- _html.push("<td id='high_", item["code"], "'>0</td>");
828
- _html.push("<td id='low_", item["code"], "'>0</td>");
829
- _html.push("<td data-val='", item["year_price"], "' class='year_price_", item["code"], "'>--</td>");
830
- _html.push("<td class='high_52week_", item["code"], "'>--</td>");
831
- if (stock_category !== "us") {
832
- _html.push("<td id='amount_", item["code"], "'>--</td>");
833
- _html.push("<td id='average_", item["code"], "'>--</td>");
834
- _html.push("<td class='holder_", item["code"], "'>--</td>");
835
- _html.push("<td id='remark_", item["code"], "'></td>");
836
- }
837
- _html.push("</tr>");
838
- });
839
- Util.render_table_html(table_id + "_body", _html);
840
- $("#" + table_id + "_body_tips").html('共 <span class="label label-info">' + total_num + '</span> 家');
829
+ Util["stock_category_data"] = j["data"];
830
+ Util.render_type_option($("#stock_category_industry"), j["data"], "industry", Util.render_stock_category_html);
831
+ Util.render_type_option($("#stock_category_area"), j["data"], "area", Util.render_stock_category_html);
832
+ Util.render_stock_category_html();
841
833
  if (j["concept_url"]) {
842
- $("#remark_title").html(Util.pack_html_link(j["concept_url"], "备注<i class='glyphicon glyphicon-link'></i>"));
834
+ $("#stock_category_remark_title").html(Util.pack_html_link(j["concept_url"], "备注<i class='glyphicon glyphicon-link'></i>"));
843
835
  }
844
836
  Util.hide_tips();
845
837
  let index_list = j["index_list"] ? j["index_list"] : [];
@@ -848,6 +840,39 @@ const Util = {
848
840
  });
849
841
  },
850
842
 
843
+ render_stock_category_html: function() {
844
+ if (Util["stock_category_table_id"]) {
845
+ let _html = [];
846
+ let total_num = 0;
847
+ if (Util["stock_category_data"]) {
848
+ let industry = $("#stock_category_industry").val();
849
+ let area = $("#stock_category_area").val();
850
+ let is_us = $("#stock_category_remark_title").length === 0 ? 1 : 0;
851
+ Util["stock_category_data"].forEach(function (item) {
852
+ if (Util.is_industry_area(item, industry, area)) {
853
+ total_num++;
854
+ _html.push("<tr>");
855
+ item["code"] = item["code"].toLowerCase();
856
+ _html = Util.stock_basics_html(_html, item);
857
+ _html.push("<td id='high_", item["code"], "'>0</td>");
858
+ _html.push("<td id='low_", item["code"], "'>0</td>");
859
+ _html.push("<td data-val='", item["year_price"], "' class='year_price_", item["code"], "'>--</td>");
860
+ _html.push("<td class='high_52week_", item["code"], "'>--</td>");
861
+ if (is_us === 0) {
862
+ _html.push("<td id='amount_", item["code"], "'>--</td>");
863
+ _html.push("<td id='average_", item["code"], "'>--</td>");
864
+ _html.push("<td class='holder_", item["code"], "'>--</td>");
865
+ _html.push("<td id='remark_", item["code"], "'></td>");
866
+ }
867
+ _html.push("</tr>");
868
+ }
869
+ });
870
+ }
871
+ Util.render_table_html(Util["stock_category_table_id"] + "_body", _html);
872
+ $("#" + Util["stock_category_table_id"] + "_body_tips").html('共 <span class="label label-info">' + total_num + '</span> 家');
873
+ }
874
+ },
875
+
851
876
  /**
852
877
  * 初始公募基金组件
853
878
  * @param component_id
@@ -882,7 +907,14 @@ const Util = {
882
907
  let _html = [];
883
908
  if (j["fund_code"]) {
884
909
  $("#" + component_id + "_title").html(Util.pack_html_link("http://fundf10.eastmoney.com/jbgk_" + j["fund_code"] + ".html", j["fund_name"]));
885
- let net = j["net"] > 0 ? j["net"] : "--";
910
+ let net = "--";
911
+ if (j["net"] > 0) {
912
+ net = j["net"];
913
+ let net_cls = Util.text_color(j["change_percent"]);
914
+ if (net_cls !== "") {
915
+ net = "<b class='" + net_cls + "'>" + net + "(" + Util.to_float(j["change_percent"], 2) + "%)</b>";
916
+ }
917
+ }
886
918
  let assets = j["assets"] > 0 ? (j["assets"] + "亿") : "--";
887
919
  let public_date = j["public_date"] > 0 ? Util.seconds_to_format(j["public_date"], "%Y-%m-%d") : "--";
888
920
  let issue_date = j["issue_date"] > 0 ? Util.seconds_to_format(j["issue_date"], "%Y-%m-%d") : "--";
@@ -2274,7 +2306,7 @@ const Util = {
2274
2306
  html.push('<option value="">', obj.children('option').eq(0).text(), '</option>');
2275
2307
  }
2276
2308
  $.each(option_data, function (val, val_num) {
2277
- html.push('<option value="', val, '">', (val.substr(0, 10)), '(', val_num, ')</option>');
2309
+ html.push('<option value="', val, '">', (val.substr(0, 6)), '(', val_num, ')</option>');
2278
2310
  });
2279
2311
  obj.html(html.join(""));
2280
2312
  obj.change(function () {