sbd-npm 1.1.63 → 1.1.67

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/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.63",
3
+ "version": "1.1.67",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -442,10 +442,11 @@ $(document).ready(function () {
442
442
  });
443
443
  // 成交概况数据
444
444
  let Modal = {
445
- data_type: "",
446
445
 
446
+ data_type: "",
447
447
  mo_start_time: 0,
448
448
  mo_end_time: 0,
449
+ p_change_data: [],
449
450
 
450
451
  render_market_overview_line: function (data, key, element_id, title, chart_instance) {
451
452
  let line_id = element_id + "_chart";
@@ -523,25 +524,8 @@ $(document).ready(function () {
523
524
  Util.post(location.pathname, payload, function (j) {
524
525
  Util.render_type_option($("#p_change_industry"), j["data"], "industry", Modal.render_stock_rate_html);
525
526
  Util.render_type_option($("#p_change_area"), j["data"], "area", Modal.render_stock_rate_html);
526
- let _html = [];
527
- let industry = $("#p_change_industry").val();
528
- let area = $("#p_change_area").val();
529
- let index = 0;
530
- j["data"].forEach(function (item) {
531
- if (Util.is_industry_area(item, industry, area)) {
532
- index++;
533
- _html.push("<tr>");
534
- _html.push("<td>", index, "</td>");
535
- _html = Util.stock_basics_html(_html, item);
536
- if (item["continue_top_day"]) {
537
- _html.push("<td title='连续涨停" + item["continue_top_day"] + "天'>", Util.parse_ratio(item["p_change"]), " <span class='badge alert-danger'>" + item["continue_top_day"] + "<span></td>");
538
- } else {
539
- _html.push("<td>", Util.parse_ratio(item["p_change"]), "</td>");
540
- }
541
- _html.push("</tr>");
542
- }
543
- });
544
- Util.render_table_html("stock_rate_table_body", _html);
527
+ Modal["p_change_data"] = j["data"];
528
+ Modal.render_stock_rate_html();
545
529
  $("#p_change_type").change(function () {
546
530
  if (!DailySummary.is_load) {
547
531
  $("#stock_rate_table_body").html("<tr><td colspan='9'>Loading...</td></tr>");
@@ -552,6 +536,31 @@ $(document).ready(function () {
552
536
  });
553
537
  },
554
538
 
539
+ render_stock_rate_html: function() {
540
+ let _html = [];
541
+ let industry = $("#p_change_industry").val();
542
+ let area = $("#p_change_area").val();
543
+ let index = 0;
544
+ Modal["p_change_data"].forEach(function (item) {
545
+ if (Util.is_industry_area(item, industry, area)) {
546
+ index++;
547
+ _html.push("<tr>");
548
+ _html.push("<td>", index, "</td>");
549
+ _html = Util.stock_basics_html(_html, item);
550
+ _html.push("<td>", Util.year_price_rate(item["stock_price"], item["year_price"]), "</td>");
551
+ _html.push("<td class='holder_", item["code"], "'>--</td>");
552
+ if (item["continue_top_day"]) {
553
+ _html.push("<td title='连续涨停" + item["continue_top_day"] + "天'>", Util.parse_ratio(item["p_change"]), " <span class='badge alert-danger'>" + item["continue_top_day"] + "<span></td>");
554
+ } else {
555
+ _html.push("<td>", Util.parse_ratio(item["p_change"]), "</td>");
556
+ }
557
+ _html.push("</tr>");
558
+ }
559
+ });
560
+ Util.render_table_html("stock_rate_table_body", _html);
561
+ Util.init_stock_stuff("stock_rate_table_body", [], 0, 0);
562
+ },
563
+
555
564
  render_news_modal: function () {
556
565
  Util.show_tips("Loading...");
557
566
  Util.post(location.pathname, {action: "pbc_news"}, function (j) {
@@ -591,6 +600,8 @@ $(document).ready(function () {
591
600
  {"name": "行业", "select_id": "p_change_industry"},
592
601
  {"name": "地区", "select_id": "p_change_area"},
593
602
  {"name": "当前价", "table_sort": 1},
603
+ {"name": "年初至今", "table_sort": 1},
604
+ {"name": "股东数", "table_sort": 1},
594
605
  {
595
606
  "name": "类型",
596
607
  "select_id": "p_change_type",
package/util.js CHANGED
@@ -364,11 +364,6 @@ const Util = {
364
364
  $(this).html(Util.year_price_rate(item["price"], item["high_52week"]));
365
365
  });
366
366
  }
367
- if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
368
- $(".holder_" + code).each(function () {
369
- $(this).html(Util.pack_holder_num(item));
370
- });
371
- }
372
367
  }
373
368
  if (item["high"]) {
374
369
  let high_price = Util.digit_compare_trend(item["high"], item["previous_price"]);
@@ -1175,7 +1170,7 @@ const Util = {
1175
1170
  * 一周的哪一天(1-7,星期一:1,星期二:2,...星期日:7)
1176
1171
  * @returns {*|number}
1177
1172
  */
1178
- get_weekday: function() {
1173
+ get_weekday: function () {
1179
1174
  let date = new Date();
1180
1175
  let weekday = date.getDay();
1181
1176
  weekday = weekday > 0 ? weekday : 7; // 星期天是0
@@ -1842,7 +1837,14 @@ const Util = {
1842
1837
  obj.tooltip();
1843
1838
  },
1844
1839
 
1845
- init_stock_stuff: function (element_id, index_list, is_us = 0) {
1840
+ /**
1841
+ * 初始一些数据
1842
+ * @param element_id
1843
+ * @param index_list
1844
+ * @param is_us
1845
+ * @param is_refresh 开市时是否定时刷新,1是0否
1846
+ */
1847
+ init_stock_stuff: function (element_id, index_list, is_us = 0, is_refresh = 1) {
1846
1848
  let code_list = Util.get_code_list(element_id);
1847
1849
  if (code_list.length > 0) {
1848
1850
  Util.show_tips("Loading...");
@@ -1850,6 +1852,11 @@ const Util = {
1850
1852
  Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
1851
1853
  $.each(j, function (code, item) {
1852
1854
  Util.render_price(item);
1855
+ if (item["holder_num"] && item["holder_num"] > 0) {
1856
+ $(".holder_" + code).each(function () {
1857
+ $(this).html(Util.pack_holder_num(item));
1858
+ });
1859
+ }
1853
1860
  if ($("#remark_" + code).length) {
1854
1861
  let remark = "";
1855
1862
  if (parseInt(item["down_day"]) > 0) {
@@ -1877,37 +1884,24 @@ const Util = {
1877
1884
  $("#remark_" + code).html(remark);
1878
1885
  }
1879
1886
  });
1880
- Util.refresh_index_price(element_id, index_list.join("-"), is_us);
1887
+ if (is_refresh === 1) {
1888
+ Util.refresh_index_price(element_id, index_list.join("-"), is_us);
1889
+ } else {
1890
+ Util.refresh_index_price(element_id, index_list.join("-"), is_us, 0);
1891
+ }
1881
1892
  Util.hide_tips();
1882
1893
  });
1883
1894
  }
1884
1895
  },
1885
1896
 
1886
- countdown_func: function (interval, tips_id, callback_func) {
1887
- if (interval > 0) {
1888
- $("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
1889
- setTimeout(function () {
1890
- Util.countdown_func(interval - 1, tips_id, callback_func);
1891
- }, 1000);
1892
- } else {
1893
- $("#" + tips_id).html("刷新中...");
1894
- callback_func();
1895
- }
1896
- },
1897
-
1898
- countdown_refresh_index_price: function (interval, element_id, index_list, is_us, us_market_status) {
1899
- if (interval > 0) {
1900
- $("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
1901
- setTimeout(function () {
1902
- Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, us_market_status);
1903
- }, 1000);
1904
- } else {
1905
- $("#" + element_id + "_tips").html("刷新中...");
1906
- Util.refresh_index_price(element_id, index_list, is_us, us_market_status);
1907
- }
1908
- },
1909
-
1910
- refresh_index_price: function (element_id, index_list, is_us = 0, us_market_status = -1) {
1897
+ /**
1898
+ * 刷新指数和价格数据
1899
+ * @param element_id
1900
+ * @param index_list
1901
+ * @param is_us
1902
+ * @param is_refresh 1刷新,0不刷新,-1美股开市则刷新
1903
+ */
1904
+ refresh_index_price: function (element_id, index_list, is_us = 0, is_refresh = -1) {
1911
1905
  let code_list = Util.get_code_list(element_id);
1912
1906
  if (code_list.length > 0) {
1913
1907
  let payload = {action: "index_price", index_list: index_list, code_list: code_list.join("-")};
@@ -1931,9 +1925,9 @@ const Util = {
1931
1925
  }
1932
1926
  });
1933
1927
  if (is_us === 1) {
1934
- if (us_market_status === 1) {
1935
- Util.countdown_refresh_index_price(5, element_id, index_list, is_us, us_market_status);
1936
- } else if (us_market_status === -1) {
1928
+ if (is_refresh === 1) {
1929
+ Util.countdown_refresh_index_price(5, element_id, index_list, is_us, is_refresh);
1930
+ } else if (is_refresh === -1) { // 美股开市则刷新
1937
1931
  Util.post("/action", {action: "us_market_status"}, function (ums) {
1938
1932
  if (ums === "1") {
1939
1933
  Util.countdown_refresh_index_price(5, element_id, index_list, is_us, 1);
@@ -1941,14 +1935,48 @@ const Util = {
1941
1935
  }, "text");
1942
1936
  }
1943
1937
  } else {
1944
- if (j["is_holiday"] === 0 && Util.is_trade_time()) {
1945
- Util.countdown_refresh_index_price(5, element_id, index_list, is_us, us_market_status);
1938
+ if (is_refresh !== 0 && j["is_holiday"] === 0) {
1939
+ if (Util.is_trade_time()) {
1940
+ Util.countdown_refresh_index_price(5, element_id, index_list, is_us, is_refresh);
1941
+ }
1946
1942
  }
1947
1943
  }
1948
1944
  });
1949
1945
  }
1950
1946
  },
1951
1947
 
1948
+ /**
1949
+ * 指数和价格数据刷新的倒计时
1950
+ * @param interval
1951
+ * @param element_id
1952
+ * @param index_list
1953
+ * @param is_us
1954
+ * @param is_refresh
1955
+ */
1956
+ countdown_refresh_index_price: function (interval, element_id, index_list, is_us, is_refresh) {
1957
+ if (interval > 0) {
1958
+ $("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
1959
+ setTimeout(function () {
1960
+ Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, is_refresh);
1961
+ }, 1000);
1962
+ } else {
1963
+ $("#" + element_id + "_tips").html("刷新中...");
1964
+ Util.refresh_index_price(element_id, index_list, is_us, is_refresh);
1965
+ }
1966
+ },
1967
+
1968
+ countdown_func: function (interval, tips_id, callback_func) {
1969
+ if (interval > 0) {
1970
+ $("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
1971
+ setTimeout(function () {
1972
+ Util.countdown_func(interval - 1, tips_id, callback_func);
1973
+ }, 1000);
1974
+ } else {
1975
+ $("#" + tips_id).html("刷新中...");
1976
+ callback_func();
1977
+ }
1978
+ },
1979
+
1952
1980
  /**
1953
1981
  * 获取页面标题
1954
1982
  * @returns {string}
@@ -2081,10 +2109,11 @@ const Util = {
2081
2109
  * @param item
2082
2110
  * @returns {string}
2083
2111
  */
2084
- pack_holder_num: function(item) {
2085
- if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
2112
+ pack_holder_num: function (item) {
2113
+ if (item["holder_num"] && item["holder_num"] > 0) {
2086
2114
  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"]));
2115
+ let pre_holder_num = item["pre_holder_num"] ? item["pre_holder_num"] : 0;
2116
+ return Util.pack_html_link(url, Util.digit_compare_trend(item["holder_num"], pre_holder_num));
2088
2117
  }
2089
2118
  return "--";
2090
2119
  },