sbd-npm 1.1.60 → 1.1.64

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 +1 -0
  2. package/package.json +1 -1
  3. package/util.js +79 -39
package/menu.js CHANGED
@@ -50,6 +50,7 @@ const MenuList = [
50
50
  {'key': 'trend_doji', 'name': '十字星', 'url': '/718eac2cccaef1c7968f2d121b5f3070'},
51
51
  {'key': 'trend_ma510', 'name': '突破5、10日均线', 'url': '/4d6d7ee173c87b1f939fa454093a63c7'},
52
52
  {'key': 'trend_holder_minimum', 'name': '股东数历史最少', 'url': '/a9e45d918bc565afd76047cafea25824'},
53
+ {'key': 'trend_fund_hold', 'name': '基金持股变化', 'url': '/067740976f85ec14ddae02b51829ce35'},
53
54
  {'key': 'trend_week_minimum', 'name': '周成交低点', 'url': '/722d94429b8e689fe78dca1cf67a4c67'},
54
55
  {'key': 'trend_margin', 'name': '融资融券余额涨幅', 'url': '/1964a6bc56dc3ce6825b23667c7fb588'},
55
56
  {'key': 'trend_price', 'name': '股价升跌幅度', 'url': '/43ef6aeb36475f8f8f44d477b1990390'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.60",
3
+ "version": "1.1.64",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -364,12 +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
- 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"])));
371
- });
372
- }
373
367
  }
374
368
  if (item["high"]) {
375
369
  let high_price = Util.digit_compare_trend(item["high"], item["previous_price"]);
@@ -1176,7 +1170,7 @@ const Util = {
1176
1170
  * 一周的哪一天(1-7,星期一:1,星期二:2,...星期日:7)
1177
1171
  * @returns {*|number}
1178
1172
  */
1179
- get_weekday: function() {
1173
+ get_weekday: function () {
1180
1174
  let date = new Date();
1181
1175
  let weekday = date.getDay();
1182
1176
  weekday = weekday > 0 ? weekday : 7; // 星期天是0
@@ -1843,7 +1837,14 @@ const Util = {
1843
1837
  obj.tooltip();
1844
1838
  },
1845
1839
 
1846
- 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) {
1847
1848
  let code_list = Util.get_code_list(element_id);
1848
1849
  if (code_list.length > 0) {
1849
1850
  Util.show_tips("Loading...");
@@ -1851,6 +1852,11 @@ const Util = {
1851
1852
  Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
1852
1853
  $.each(j, function (code, item) {
1853
1854
  Util.render_price(item);
1855
+ if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
1856
+ $(".holder_" + code).each(function () {
1857
+ $(this).html(Util.pack_holder_num(item));
1858
+ });
1859
+ }
1854
1860
  if ($("#remark_" + code).length) {
1855
1861
  let remark = "";
1856
1862
  if (parseInt(item["down_day"]) > 0) {
@@ -1878,37 +1884,24 @@ const Util = {
1878
1884
  $("#remark_" + code).html(remark);
1879
1885
  }
1880
1886
  });
1881
- 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
+ }
1882
1892
  Util.hide_tips();
1883
1893
  });
1884
1894
  }
1885
1895
  },
1886
1896
 
1887
- countdown_func: function (interval, tips_id, callback_func) {
1888
- if (interval > 0) {
1889
- $("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
1890
- setTimeout(function () {
1891
- Util.countdown_func(interval - 1, tips_id, callback_func);
1892
- }, 1000);
1893
- } else {
1894
- $("#" + tips_id).html("刷新中...");
1895
- callback_func();
1896
- }
1897
- },
1898
-
1899
- countdown_refresh_index_price: function (interval, element_id, index_list, is_us, us_market_status) {
1900
- if (interval > 0) {
1901
- $("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
1902
- setTimeout(function () {
1903
- Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, us_market_status);
1904
- }, 1000);
1905
- } else {
1906
- $("#" + element_id + "_tips").html("刷新中...");
1907
- Util.refresh_index_price(element_id, index_list, is_us, us_market_status);
1908
- }
1909
- },
1910
-
1911
- 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) {
1912
1905
  let code_list = Util.get_code_list(element_id);
1913
1906
  if (code_list.length > 0) {
1914
1907
  let payload = {action: "index_price", index_list: index_list, code_list: code_list.join("-")};
@@ -1932,9 +1925,9 @@ const Util = {
1932
1925
  }
1933
1926
  });
1934
1927
  if (is_us === 1) {
1935
- if (us_market_status === 1) {
1936
- Util.countdown_refresh_index_price(5, element_id, index_list, is_us, us_market_status);
1937
- } 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) { // 美股开市则刷新
1938
1931
  Util.post("/action", {action: "us_market_status"}, function (ums) {
1939
1932
  if (ums === "1") {
1940
1933
  Util.countdown_refresh_index_price(5, element_id, index_list, is_us, 1);
@@ -1942,14 +1935,48 @@ const Util = {
1942
1935
  }, "text");
1943
1936
  }
1944
1937
  } else {
1945
- if (j["is_holiday"] === 0 && Util.is_trade_time()) {
1946
- 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
+ }
1947
1942
  }
1948
1943
  }
1949
1944
  });
1950
1945
  }
1951
1946
  },
1952
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
+
1953
1980
  /**
1954
1981
  * 获取页面标题
1955
1982
  * @returns {string}
@@ -2077,6 +2104,19 @@ const Util = {
2077
2104
  return index_html;
2078
2105
  },
2079
2106
 
2107
+ /**
2108
+ * 组装股东数据
2109
+ * @param item
2110
+ * @returns {string}
2111
+ */
2112
+ pack_holder_num: function (item) {
2113
+ if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
2114
+ let url = Util.get_url("holder_num") + "?code=" + item["code"];
2115
+ return Util.pack_html_link(url, Util.digit_compare_trend(item["holder_num"], item["pre_holder_num"]));
2116
+ }
2117
+ return "--";
2118
+ },
2119
+
2080
2120
  /**
2081
2121
  * 组装 HTML 超链接
2082
2122
  * @param url