sbd-npm 1.1.96 → 1.1.99

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/package.json +1 -1
  2. package/stock_basics.js +4 -4
  3. package/util.js +19 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.96",
3
+ "version": "1.1.99",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -356,10 +356,10 @@ let Stock = {
356
356
  Util.init_table_skeleton({
357
357
  "element_id": "big_deal_summary_table",
358
358
  "head_cols": [
359
- {"name": "20日主力净流入", "table_sort": 1},
360
- {"name": "10日主力净流入", "table_sort": 1},
361
- {"name": "5日主力净流入", "table_sort": 1},
362
- {"name": "3日主力净流入", "table_sort": 1},
359
+ {"name": "20日主力净流入"},
360
+ {"name": "10日主力净流入"},
361
+ {"name": "5日主力净流入"},
362
+ {"name": "3日主力净流入"},
363
363
  ]
364
364
  });
365
365
  Util.init_table_skeleton({
package/util.js CHANGED
@@ -262,7 +262,7 @@ const Util = {
262
262
  return location;
263
263
  }
264
264
  if (location_name === "") {
265
- location_name = location.length > 10 ? location.substr(0, 10) : location;
265
+ location_name = location.length > 20 ? location.substr(0, 20) : location;
266
266
  }
267
267
  return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://map.baidu.com/m?fr=ps01000&word=" + location + "'>" + location_name + "</a>";
268
268
  }
@@ -281,7 +281,7 @@ const Util = {
281
281
  return location;
282
282
  }
283
283
  if (location_name === "") {
284
- location_name = location.length > 10 ? location.substr(0, 10) : location;
284
+ location_name = location.length > 20 ? location.substr(0, 20) : location;
285
285
  }
286
286
  return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://www.google.com/maps?&hl=zh-Hans&q=" + location + "'>" + location_name + "</a>";
287
287
  }
@@ -1350,6 +1350,8 @@ const Util = {
1350
1350
  _html.push('<option value="10">半年前</option>');
1351
1351
  _html.push('<option value="11">一年前</option>');
1352
1352
  _html.push('<option value="99">所有时间</option>');
1353
+ _html.push('<option value="100">还原</option>');
1354
+ _html.push('<option value="101">置空</option>');
1353
1355
  select_obj.html(_html.join(""));
1354
1356
  select_obj.change(function () {
1355
1357
  let select_val = $("#" + select_id).val();
@@ -1358,6 +1360,7 @@ const Util = {
1358
1360
  sd_obj.attr("disabled", false);
1359
1361
  ed_obj.attr("disabled", false);
1360
1362
  let weekday = Util.get_weekday();
1363
+ let date = new Date();
1361
1364
  let year = date.getFullYear();
1362
1365
  let month = date.getMonth() + 1;
1363
1366
  let current_month_format = year + "-" + (month < 10 ? '0' + month : month) + "-01";
@@ -1426,6 +1429,14 @@ const Util = {
1426
1429
  sd_obj.attr("disabled", true);
1427
1430
  ed_obj.attr("disabled", true);
1428
1431
  break;
1432
+ case "100": // 还原
1433
+ sd_obj.val(Obj.start_date);
1434
+ ed_obj.val(Obj.end_date);
1435
+ break;
1436
+ case "101": // 置空
1437
+ sd_obj.val("");
1438
+ ed_obj.val("");
1439
+ break;
1429
1440
  }
1430
1441
  Util.init_range_picker_date(start_id, end_id);
1431
1442
  if (select_val === "0") { // 记录之前的时间
@@ -1917,6 +1928,7 @@ const Util = {
1917
1928
  let valid_code_list = [];
1918
1929
  let total_change_percent = 0;
1919
1930
  let total_year_change_percent = 0;
1931
+ let total_d5_change_percent = 0;
1920
1932
  $.each(j, function (code, item) {
1921
1933
  if (item["price"] && item["previous_price"] && item["price"] > 0 && item["previous_price"] > 0) {
1922
1934
  valid_code_list.push(item["code"]);
@@ -1924,6 +1936,9 @@ const Util = {
1924
1936
  if (item["year_price"] && item["year_price"] > 0) {
1925
1937
  total_year_change_percent += ((item["price"] - item["year_price"]) / item["year_price"]);
1926
1938
  }
1939
+ if (item["d5_price"] && item["d5_price"] > 0) {
1940
+ total_d5_change_percent += ((item["price"] - item["d5_price"]) / item["d5_price"]);
1941
+ }
1927
1942
  }
1928
1943
  Util.render_price(item);
1929
1944
  if (item["holder_num"] && item["holder_num"] > 0) {
@@ -1968,29 +1983,8 @@ const Util = {
1968
1983
  if ($("#" + element_id + "_tips").length) {
1969
1984
  let average_change_percent = Math.round((total_change_percent / total_num) * 10000) / 100;
1970
1985
  let average_year_change_percent = Math.round((total_year_change_percent / total_num) * 10000) / 100;
1971
- let week_tips_id = element_id + "week_tips";
1972
- $("#" + element_id + "_tips").html('共 <span class="label label-info">' + total_num + '</span> 家 平均涨跌: ' + Util.parse_ratio(average_change_percent) + "<span id='" + week_tips_id + "'></span> 年初至今: " + Util.parse_ratio(average_year_change_percent));
1973
- let code_price_dict = {};
1974
- valid_code_list.forEach(function (code) {
1975
- code_price_dict[code] = j[code]["price"];
1976
- });
1977
- Util.post("/action", {action: "code_d5_price", code_list: code_list.join("-")}, function (j) {
1978
- let total_num = 0;
1979
- let total_week_change_percent = 0;
1980
- $.each(j, function (code, d5_price) {
1981
- if (d5_price > 0 && code_price_dict[code]) {
1982
- total_num += 1;
1983
- total_week_change_percent += ((code_price_dict[code] - d5_price) / d5_price);
1984
- $(".d5_price_" + code).each(function () {
1985
- $(this).html(Util.year_price_rate(code_price_dict[code], d5_price));
1986
- });
1987
- }
1988
- });
1989
- if (total_num > 0) {
1990
- let average_week_change_percent = Math.round((total_week_change_percent / total_num) * 10000) / 100;
1991
- $("#" + week_tips_id).html(" 最近5日: " + Util.parse_ratio(average_week_change_percent));
1992
- }
1993
- });
1986
+ let average_d5_change_percent = Math.round((total_d5_change_percent / total_num) * 10000) / 100;
1987
+ $("#" + element_id + "_tips").html('共 <span class="label label-info">' + total_num + '</span> 家 平均涨跌: ' + Util.parse_ratio(average_change_percent) + " 最近5日: " + Util.parse_ratio(average_d5_change_percent) + " 年初至今: " + Util.parse_ratio(average_year_change_percent));
1994
1988
  }
1995
1989
  }
1996
1990
  Util.hide_tips();