sbd-npm 1.1.67 → 1.1.68

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/menu.js +0 -1
  2. package/package.json +1 -1
  3. package/util.js +43 -26
  4. package/.npmignore +0 -1
package/menu.js CHANGED
@@ -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
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.67",
3
+ "version": "1.1.68",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -793,8 +793,8 @@ const Util = {
793
793
  {"name": "名称"},
794
794
  {"name": "PE", "title": "市盈率(Price Earnings Ratio)", "table_sort": 1},
795
795
  {"name": "总市值", "table_sort": 1},
796
- {"name": "行业"},
797
- {"name": "地区"},
796
+ {"name": "行业", "select_id": "stock_category_industry"},
797
+ {"name": "地区", "select_id": "stock_category_area"},
798
798
  {"name": "当前价", "table_sort": 1},
799
799
  {"name": "最高价"},
800
800
  {"name": "最低价"},
@@ -805,7 +805,7 @@ const Util = {
805
805
  head_cols.push({"name": "成交金额", "table_sort": 1});
806
806
  head_cols.push({"name": "成交均价", "table_sort": 1});
807
807
  head_cols.push({"name": "股东数", "table_sort": 1});
808
- head_cols.push({"name": "备注", "id": "remark_title"});
808
+ head_cols.push({"name": "备注", "id": "stock_category_remark_title"});
809
809
  }
810
810
  let table_options = {
811
811
  "element_id": table_id,
@@ -816,30 +816,14 @@ const Util = {
816
816
  table_options["alert"] = alert_tips;
817
817
  }
818
818
  Util.init_table_skeleton(table_options);
819
+ Util["stock_category_table_id"] = table_id;
819
820
  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> 家');
821
+ Util["stock_category_data"] = j["data"];
822
+ Util.render_type_option($("#stock_category_industry"), j["data"], "industry", Util.render_stock_category_html);
823
+ Util.render_type_option($("#stock_category_area"), j["data"], "area", Util.render_stock_category_html);
824
+ Util.render_stock_category_html();
841
825
  if (j["concept_url"]) {
842
- $("#remark_title").html(Util.pack_html_link(j["concept_url"], "备注<i class='glyphicon glyphicon-link'></i>"));
826
+ $("#stock_category_remark_title").html(Util.pack_html_link(j["concept_url"], "备注<i class='glyphicon glyphicon-link'></i>"));
843
827
  }
844
828
  Util.hide_tips();
845
829
  let index_list = j["index_list"] ? j["index_list"] : [];
@@ -848,6 +832,39 @@ const Util = {
848
832
  });
849
833
  },
850
834
 
835
+ render_stock_category_html: function() {
836
+ if (Util["stock_category_table_id"]) {
837
+ let _html = [];
838
+ let total_num = 0;
839
+ if (Util["stock_category_data"]) {
840
+ let industry = $("#stock_category_industry").val();
841
+ let area = $("#stock_category_area").val();
842
+ let is_us = $("#stock_category_remark_title").length === 0 ? 1 : 0;
843
+ Util["stock_category_data"].forEach(function (item) {
844
+ if (Util.is_industry_area(item, industry, area)) {
845
+ total_num++;
846
+ _html.push("<tr>");
847
+ item["code"] = item["code"].toLowerCase();
848
+ _html = Util.stock_basics_html(_html, item);
849
+ _html.push("<td id='high_", item["code"], "'>0</td>");
850
+ _html.push("<td id='low_", item["code"], "'>0</td>");
851
+ _html.push("<td data-val='", item["year_price"], "' class='year_price_", item["code"], "'>--</td>");
852
+ _html.push("<td class='high_52week_", item["code"], "'>--</td>");
853
+ if (is_us === 0) {
854
+ _html.push("<td id='amount_", item["code"], "'>--</td>");
855
+ _html.push("<td id='average_", item["code"], "'>--</td>");
856
+ _html.push("<td class='holder_", item["code"], "'>--</td>");
857
+ _html.push("<td id='remark_", item["code"], "'></td>");
858
+ }
859
+ _html.push("</tr>");
860
+ }
861
+ });
862
+ }
863
+ Util.render_table_html(Util["stock_category_table_id"] + "_body", _html);
864
+ $("#" + Util["stock_category_table_id"] + "_body_tips").html('共 <span class="label label-info">' + total_num + '</span> 家');
865
+ }
866
+ },
867
+
851
868
  /**
852
869
  * 初始公募基金组件
853
870
  * @param component_id
@@ -2274,7 +2291,7 @@ const Util = {
2274
2291
  html.push('<option value="">', obj.children('option').eq(0).text(), '</option>');
2275
2292
  }
2276
2293
  $.each(option_data, function (val, val_num) {
2277
- html.push('<option value="', val, '">', (val.substr(0, 10)), '(', val_num, ')</option>');
2294
+ html.push('<option value="', val, '">', (val.substr(0, 6)), '(', val_num, ')</option>');
2278
2295
  });
2279
2296
  obj.html(html.join(""));
2280
2297
  obj.change(function () {
package/.npmignore DELETED
@@ -1 +0,0 @@
1
- sbd-npm.md