sbd-npm 1.1.58 → 1.1.62

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.
package/menu.js CHANGED
@@ -189,9 +189,9 @@ const MenuList = [
189
189
  'menu': [
190
190
  {'key': 'snowball_trend', 'name': '自选趋势', 'url': '/08c40d908dd87e29a607b6945309edf0'},
191
191
  {'key': 'snowball_user', 'name': '用户列表', 'url': '/97339b8453883dd27e6087ae7db6f62a'},
192
- {'key': 'snowball_tool', 'name': '搜索工具', 'url': '/ac88ee85f27e11aa06f2b8f46b03a0eb'},
193
- {'key': 'snowball_red_packet', 'name': '红包数据', 'url': '/23d88182f12431fe67f658b725cbaf1d'},
194
192
  {'key': 'snowball_tweet', 'name': '推文', 'url': '/9a9aef7fced3f15ff7647de75d70798c'},
193
+ {'key': 'snowball_red_packet', 'name': '红包数据', 'url': '/23d88182f12431fe67f658b725cbaf1d'},
194
+ {'key': 'snowball_tool', 'name': '搜索工具', 'url': '/ac88ee85f27e11aa06f2b8f46b03a0eb'},
195
195
  ]
196
196
  },
197
197
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.58",
3
+ "version": "1.1.62",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -77,25 +77,40 @@ $(document).ready(function () {
77
77
  */
78
78
  pack_index_data: function (index_data) {
79
79
  let _html = [];
80
+ let change_color_data = [];
80
81
  index_data.forEach(function (item) {
81
- let change = item["change"];
82
82
  let cls = "";
83
83
  let sort = "";
84
- if (change > 0) {
84
+ if (item["change"] > 0) {
85
85
  cls = "red";
86
86
  sort = "fa-sort-asc";
87
- } else if (change < 0) {
87
+ } else if (item["change"] < 0) {
88
88
  cls = "green";
89
89
  sort = "fa-sort-desc";
90
90
  }
91
+ let change_rate_id = "change_rate_" + item["key"];
92
+ let change_rate_obj = $("#" + change_rate_id);
93
+ if (change_rate_obj.length) {
94
+ let pre_change_rate = parseFloat(change_rate_obj.text());
95
+ if (item["change_rate"] > pre_change_rate) {
96
+ change_color_data.push({"key": item["key"], "origin": change_rate_obj.css("background-color"), "new": "#FF7B7B"});
97
+ } else if (item["change_rate"] < pre_change_rate) {
98
+ change_color_data.push({"key": item["key"], "origin": change_rate_obj.css("background-color"), "new": "#ADFFAD"});
99
+ }
100
+ }
91
101
  _html.push('<div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">');
92
102
  let index_name = item["href"] ? Util.pack_html_link(item["href"], item["name"]) : item["name"];
93
103
  _html.push('<span class="count_top"><i class="fa"></i> ', index_name, '</span>');
94
104
  _html.push('<div class="count ', cls, '">', item["value"], '</div>');
95
- _html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', change, '(', item["change_rate"], '%)</i></span>');
105
+ _html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', item["change"], '(<span id="', change_rate_id, '">', item["change_rate"], '</span>%)</i></span>');
96
106
  _html.push('</div>');
97
107
  });
98
108
  $("#index_data").html(_html.join(""));
109
+ change_color_data.forEach(function (item) {
110
+ let change_rate_obj = $("#change_rate_" + item["key"]);
111
+ change_rate_obj.css("background-color", item["new"]);
112
+ change_rate_obj.animate({backgroundColor: item["origin"]}, 2000);
113
+ });
99
114
  },
100
115
 
101
116
  /**
package/util.js CHANGED
@@ -366,8 +366,7 @@ const Util = {
366
366
  }
367
367
  if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
368
368
  $(".holder_" + code).each(function () {
369
- let url = Util.get_url("holder_num") + "?code=" + item["code"];
370
- $(this).html(Util.pack_html_link(url, Util.digit_compare_trend(item["holder_num"], item["pre_holder_num"])));
369
+ $(this).html(Util.pack_holder_num(item));
371
370
  });
372
371
  }
373
372
  }
@@ -2077,6 +2076,19 @@ const Util = {
2077
2076
  return index_html;
2078
2077
  },
2079
2078
 
2079
+ /**
2080
+ * 组装股东数据
2081
+ * @param item
2082
+ * @returns {string}
2083
+ */
2084
+ pack_holder_num: function(item) {
2085
+ if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
2086
+ let url = Util.get_url("holder_num") + "?code=" + item["code"];
2087
+ return Util.pack_html_link(url, Util.digit_compare_trend(item["holder_num"], item["pre_holder_num"]));
2088
+ }
2089
+ return "--";
2090
+ },
2091
+
2080
2092
  /**
2081
2093
  * 组装 HTML 超链接
2082
2094
  * @param url
@@ -2216,10 +2228,14 @@ const Util = {
2216
2228
  let option_data = {};
2217
2229
  data.forEach(function (item) {
2218
2230
  if (item[type]) {
2219
- if (option_data[item[type]]) {
2220
- option_data[item[type]] += 1;
2231
+ if (item["num"]) {
2232
+ option_data[item[type]] = item["num"];
2221
2233
  } else {
2222
- option_data[item[type]] = 1
2234
+ if (option_data[item[type]]) {
2235
+ option_data[item[type]] += 1;
2236
+ } else {
2237
+ option_data[item[type]] = 1;
2238
+ }
2223
2239
  }
2224
2240
  }
2225
2241
  });
@@ -2229,7 +2245,7 @@ const Util = {
2229
2245
  html.push('<option value="">', obj.children('option').eq(0).text(), '</option>');
2230
2246
  }
2231
2247
  $.each(option_data, function (val, val_num) {
2232
- html.push('<option value="', val, '">', val, '(', val_num, ')</option>');
2248
+ html.push('<option value="', val, '">', (val.substr(0, 10)), '(', val_num, ')</option>');
2233
2249
  });
2234
2250
  obj.html(html.join(""));
2235
2251
  obj.change(function () {
package/.npmignore DELETED
@@ -1 +0,0 @@
1
- sbd-npm.md