sbd-npm 1.2.9 → 1.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.9",
3
+ "version": "1.2.12",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/sbd.css CHANGED
@@ -61,4 +61,75 @@ table a:hover, a.btn {
61
61
  .modal-xlg {
62
62
  width: 90%;
63
63
  }
64
- }
64
+ }
65
+
66
+ #loading_div {
67
+ position: absolute;
68
+ top: 0;
69
+ left: 0;
70
+ right: 0;
71
+ bottom: 0;
72
+ height: 100px;
73
+ text-align: center;
74
+ margin-top: 300px;
75
+ }
76
+
77
+ #loading_div .circle {
78
+ margin: 20px;
79
+ height: 50px;
80
+ width: 50px;
81
+ border-radius: 50%;
82
+ display: inline-block;
83
+ background-color: #4695B8;
84
+ transform: scale(0);
85
+ animation: bulge 2s infinite ease-in-out;
86
+ }
87
+
88
+ #loading_div .circle::after {
89
+ position: absolute;
90
+ display: inline-block;
91
+ content: '';
92
+ height: 100%;
93
+ width: 100%;
94
+ border-radius: 50%;
95
+ background-color: inherit;
96
+ top: 0;
97
+ left: 0;
98
+ z-index: -1;
99
+ transform: scale(1);
100
+ animation: blow 2s infinite ease-in-out;
101
+ }
102
+
103
+ #loading_div .circle:nth-child(1) {
104
+ animation-delay: 0s;
105
+ }
106
+
107
+ #loading_div .circle:nth-child(2) {
108
+ animation-delay: .25s;
109
+ }
110
+
111
+ #loading_div .circle:nth-child(3) {
112
+ animation-delay: .50s;
113
+ }
114
+
115
+ @keyframes bulge {
116
+ 50% {
117
+ transform: scale(1);
118
+ }
119
+ }
120
+
121
+ @keyframes blow {
122
+ 25% {
123
+ opacity: 0.5;
124
+ }
125
+ 50% {
126
+ opacity: 0.5;
127
+ }
128
+ 90% {
129
+ opacity: 0;
130
+ }
131
+ 100% {
132
+ transform: scale(2);
133
+ opacity: 0;
134
+ }
135
+ }
package/stock_basics.js CHANGED
@@ -35,7 +35,7 @@ let Stock = {
35
35
  if (Stock.data.hasOwnProperty(active_div)) {
36
36
  return false;
37
37
  }
38
- Util.show_tips("Loading...");
38
+ Util.show_loading();
39
39
  switch (active_div) {
40
40
  case "base":
41
41
  Stock.fetch_base();
@@ -274,7 +274,7 @@ let Stock = {
274
274
  },
275
275
 
276
276
  fetch_hist_data: function () {
277
- Util.show_tips("Loading...");
277
+ Util.show_loading();
278
278
  let hist_type = $("#hist_type").val();
279
279
  let payload = {
280
280
  sort_type: Stock.sort_type,
@@ -344,7 +344,7 @@ let Stock = {
344
344
 
345
345
  fetch_big_deal: function () {
346
346
  if ($("#big_deal_table_body").length <= 0) {
347
- Util.show_tips("Loading...");
347
+ Util.show_loading();
348
348
  Util.init_table_skeleton({
349
349
  "element_id": "big_deal_summary_table",
350
350
  "head_cols": [
@@ -429,7 +429,7 @@ let Stock = {
429
429
  },
430
430
 
431
431
  fetch_rps_data: function () {
432
- Util.show_tips("Loading...");
432
+ Util.show_loading();
433
433
  Util.post("/stock/" + Stock.code, {action: "rps"}, function (j) {
434
434
  let _html = [];
435
435
  j["data"].forEach(function (item) {
@@ -460,7 +460,7 @@ let Stock = {
460
460
  },
461
461
 
462
462
  fetch_holder_top: function () {
463
- Util.show_tips("Loading...");
463
+ Util.show_loading();
464
464
  Util.init_table_skeleton({
465
465
  "element_id": "circulation_holder_table",
466
466
  "head_cols": [
@@ -571,7 +571,7 @@ let Stock = {
571
571
  },
572
572
 
573
573
  fetch_finance: function () {
574
- Util.show_tips("Loading...");
574
+ Util.show_loading();
575
575
  Util.init_table_skeleton({
576
576
  "element_id": "cash_flow_table",
577
577
  "head_cols": [
@@ -812,7 +812,7 @@ let Stock = {
812
812
  },
813
813
 
814
814
  fetch_notice: function () {
815
- Util.show_tips("Loading...");
815
+ Util.show_loading();
816
816
  Util.init_table_skeleton({
817
817
  "element_id": "notice_table",
818
818
  "head_cols": [
@@ -859,7 +859,7 @@ let Stock = {
859
859
 
860
860
  // 机构研究报告数据
861
861
  fetch_report_organization: function () {
862
- Util.show_tips("Loading...");
862
+ Util.show_loading();
863
863
  Util.init_table_skeleton({
864
864
  "element_id": "report_organization_table",
865
865
  "head_cols": [
@@ -890,7 +890,7 @@ let Stock = {
890
890
 
891
891
  // 公募持股
892
892
  fetch_public_fund: function () {
893
- Util.show_tips("Loading...");
893
+ Util.show_loading();
894
894
  Util.init_table_skeleton({
895
895
  "element_id": "public_fund_table",
896
896
  "head_cols": [
@@ -1120,7 +1120,7 @@ let Stock = {
1120
1120
  },
1121
1121
 
1122
1122
  fetch_bias_data: function () {
1123
- Util.show_tips("Loading...");
1123
+ Util.show_loading();
1124
1124
  Util.post("/stock/" + Stock["code"], {action: "bias"}, function (j) {
1125
1125
  let date_data = [];
1126
1126
  let bias20_data = [];
package/summary_daily.js CHANGED
@@ -74,7 +74,7 @@ $(document).ready(function () {
74
74
  return false;
75
75
  }
76
76
  DailySummary.is_load = true;
77
- Util.show_tips("Loading...");
77
+ Util.show_loading();
78
78
  Util.post(location.pathname, {date: $("#trade_date").val(), action: "market_overview"}, function (j) {
79
79
  DailySummary.pack_market_overview(j["market_overview"]);
80
80
  DailySummary.fetch_statistics_daily();
@@ -400,7 +400,7 @@ $(document).ready(function () {
400
400
  * 沪深港股通每日十大成交活跃股数据
401
401
  */
402
402
  fetch_hsgt_ten: function (hsgt_type) {
403
- Util.show_tips("Loading...");
403
+ Util.show_loading();
404
404
  let date = $("#trade_date").val();
405
405
  Util.post(location.pathname, {date: date, action: "hsgt_stock", "hsgt_type": hsgt_type}, function (j) {
406
406
  DailySummary.pack_hsgt_ten(j["data"], "hgt", j["url"]);
@@ -488,7 +488,7 @@ $(document).ready(function () {
488
488
  if (Modal.mo_end_time === 0) {
489
489
  Modal.init_market_overview_time(obj);
490
490
  } else {
491
- Util.show_tips("Loading...");
491
+ Util.show_loading();
492
492
  let data_type = $(obj).attr("id");
493
493
  let payload = {
494
494
  date: $("#trade_date").val(),
@@ -531,7 +531,7 @@ $(document).ready(function () {
531
531
  },
532
532
 
533
533
  render_stock_rate_modal: function (obj) {
534
- Util.show_tips("Loading...");
534
+ Util.show_loading();
535
535
  let cp = $(obj).attr("data-cp");
536
536
  let payload = {date: $("#trade_date").val(), action: "p_change", p_change_type: $("#p_change_type").val()};
537
537
  if (cp) {
@@ -579,7 +579,7 @@ $(document).ready(function () {
579
579
  },
580
580
 
581
581
  render_news_modal: function () {
582
- Util.show_tips("Loading...");
582
+ Util.show_loading();
583
583
  Util.post(location.pathname, {action: "pbc_news"}, function (j) {
584
584
  let _html = [];
585
585
  let index = 0;
@@ -671,7 +671,7 @@ $(document).ready(function () {
671
671
  });
672
672
 
673
673
  $("#news_type").change(function () {
674
- Util.show_tips("Loading...");
674
+ Util.show_loading();
675
675
  let news_type = parseInt($("#news_type").val());
676
676
  let payload = {action: "news", limit_num: DailySummary.limit_num(), news_type: news_type};
677
677
  Util.post(location.pathname, payload, function (j) {
package/util.js CHANGED
@@ -22,6 +22,7 @@
22
22
  const Util = {
23
23
 
24
24
  tips_token: "util-tips-div",
25
+ load_token: "loading_div",
25
26
  interval_timer: null,
26
27
  stock_timer_id: 0,
27
28
  // 1年的天数
@@ -46,7 +47,7 @@ const Util = {
46
47
  },
47
48
 
48
49
  sbd_init: function () {
49
- Util.show_tips("Loading...");
50
+ Util.show_loading();
50
51
 
51
52
  Util.init_menu();
52
53
 
@@ -88,7 +89,7 @@ const Util = {
88
89
  clearTimeout(Util.stock_timer_id);
89
90
  st_obj.css("display", "none");
90
91
  Util.stock_timer_id = setTimeout(function () {
91
- Util.show_tips("Loading...");
92
+ Util.show_loading();
92
93
  Util.post("/action", {action: "search", key_word: key_word}, function (j) {
93
94
  let key_word = $("#stock").val();
94
95
  if (key_word) {
@@ -252,7 +253,7 @@ const Util = {
252
253
  let name = item["cname"] ? item["cname"] : (item["name"] ? item["name"].substr(0, 10) : symbol);
253
254
  html.push("<td>", Util.snowball_url(symbol), "</td>");
254
255
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
255
- html.push("<td>", (item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), "</td>");
256
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
256
257
  html.push("<td>", (item["market_capital"] ? (Util.to_float(item["market_capital"], 2) + "亿") : "--"), "</td>");
257
258
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
258
259
  html.push("<td>", Util.map_url((item["province_city"] && item["province_city"] !== "None") ? item["province_city"] : item["area"]), "</td>");
@@ -444,7 +445,7 @@ const Util = {
444
445
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
445
446
  html.push("<td class='hk_industry'>", item["industry"], "</td>");
446
447
  html.push("<td>", Util.map_url(item["province_city"]), "</td>");
447
- html.push("<td>", item["pe"], "</td>");
448
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
448
449
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
449
450
  html.push("<td>", market_capital_hkd, "亿(", market_capital_cny, "亿)</td>");
450
451
  html.push("<td>", item["chairman"], "</td>");
@@ -469,7 +470,7 @@ const Util = {
469
470
  html.push("<td>", (item["sector"] ? item["sector"] : "--"), "</td>");
470
471
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
471
472
  html.push("<td>", Util.map_url(item["registered"]), "</td>");
472
- html.push("<td>", item["pe"], "</td>");
473
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
473
474
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
474
475
  html.push("<td>", Util.to_float(item["market_capital"], 3), "亿</td>");
475
476
  html.push("<td class='price_", item["code"].toLowerCase(), "'>", item["price"], "</td>");
@@ -837,7 +838,7 @@ const Util = {
837
838
  * @param alert_tips
838
839
  */
839
840
  init_stock_category_data: function (stock_category, table_id, alert_tips = "") {
840
- Util.show_tips("Loading...");
841
+ Util.show_loading();
841
842
  let head_cols = [
842
843
  {"name": "代码"},
843
844
  {"name": "名称"},
@@ -1008,7 +1009,7 @@ const Util = {
1008
1009
  * @param component_id
1009
1010
  */
1010
1011
  fetch_public_fund_stock: function (fund_code, date, component_id) {
1011
- Util.show_tips("Loading...");
1012
+ Util.show_loading();
1012
1013
  let component_tr = component_id + "_tr";
1013
1014
  $("." + component_tr).each(function () {
1014
1015
  $(this).remove();
@@ -1110,7 +1111,7 @@ const Util = {
1110
1111
  if (!currency) {
1111
1112
  return false;
1112
1113
  }
1113
- Util.show_tips("Loading...");
1114
+ Util.show_loading();
1114
1115
  let payload = {
1115
1116
  currency: currency,
1116
1117
  start_date: $("#currency_modal_start_date").val(),
@@ -1212,7 +1213,7 @@ const Util = {
1212
1213
  * @param element_id
1213
1214
  * @param profile
1214
1215
  */
1215
- init_profile_component: function(element_id, profile) {
1216
+ init_profile_component: function (element_id, profile) {
1216
1217
  if (profile && profile.length > 0) {
1217
1218
  let modal_id = element_id + "_modal";
1218
1219
  Util.init_modal_skeleton(modal_id);
@@ -1712,13 +1713,15 @@ const Util = {
1712
1713
  }
1713
1714
  $(this).click(function () {
1714
1715
  if (!Util.is_loading()) {
1715
- $(this).parent().parent().find("i").each(function () {
1716
+ let this_parent = $(this).parent();
1717
+ this_parent.parent().find("i").each(function () {
1716
1718
  if ($(this).hasClass("fa")) {
1717
1719
  $(this).removeClass("fa-sort-asc");
1718
1720
  $(this).removeClass("fa-sort-desc");
1719
1721
  if (!$(this).hasClass("fa-sort")) {
1720
1722
  $(this).addClass("fa-sort");
1721
1723
  }
1724
+ $(this).parent().removeClass("info");
1722
1725
  }
1723
1726
  });
1724
1727
  let sort_type = $(this).attr("data-val").toString();
@@ -1729,12 +1732,13 @@ const Util = {
1729
1732
  Obj[sort_order] = Obj[sort_order] === 0 ? 1 : 0;
1730
1733
  }
1731
1734
  let sort_cls = Obj[sort_order] === 0 ? "fa-sort-desc" : "fa-sort-asc";
1732
- $(this).parent().find("i").each(function () {
1735
+ this_parent.find("i").each(function () {
1733
1736
  if ($(this).hasClass("fa")) {
1734
1737
  $(this).removeClass("fa-sort");
1735
1738
  $(this).addClass(sort_cls);
1736
1739
  }
1737
1740
  });
1741
+ this_parent.addClass("info");
1738
1742
  callback_func(1);
1739
1743
  }
1740
1744
  return false;
@@ -1819,6 +1823,7 @@ const Util = {
1819
1823
  if (!$(this).hasClass("fa-sort")) {
1820
1824
  $(this).addClass("fa-sort");
1821
1825
  }
1826
+ $(this).parent().removeClass("info");
1822
1827
  }
1823
1828
  });
1824
1829
  $(this).find("i").each(function () {
@@ -1827,6 +1832,7 @@ const Util = {
1827
1832
  $(this).addClass(sort_cls);
1828
1833
  }
1829
1834
  });
1835
+ $(this).addClass("info");
1830
1836
  });
1831
1837
  });
1832
1838
  },
@@ -1927,9 +1933,23 @@ const Util = {
1927
1933
  },
1928
1934
 
1929
1935
  hide_tips: function () {
1930
- let obj = $('#' + Util.tips_token);
1931
- if (obj.length) {
1932
- obj.remove();
1936
+ let tips_obj = $('#' + Util.tips_token);
1937
+ if (tips_obj.length) {
1938
+ tips_obj.remove();
1939
+ }
1940
+ let load_obj = $('#' + Util.load_token);
1941
+ if (load_obj.length) {
1942
+ load_obj.remove();
1943
+ }
1944
+ },
1945
+
1946
+ show_loading: function () {
1947
+ let load_obj = document.getElementById(Util.load_token);
1948
+ if (!load_obj) {
1949
+ let load_obj = document.createElement('div');
1950
+ load_obj.id = Util.load_token;
1951
+ load_obj.innerHTML = '<div class="circle"></div><div class="circle"></div><div class="circle"></div>';
1952
+ document.getElementsByTagName('body')[0].appendChild(load_obj);
1933
1953
  }
1934
1954
  },
1935
1955
 
@@ -1938,7 +1958,7 @@ const Util = {
1938
1958
  * @returns {boolean}
1939
1959
  */
1940
1960
  is_loading: function () {
1941
- return $("#" + Util.tips_token).length > 0;
1961
+ return $("#" + Util.load_token).length > 0;
1942
1962
  },
1943
1963
 
1944
1964
  tooltip: function (element_id, tip) {
@@ -1966,7 +1986,7 @@ const Util = {
1966
1986
  init_stock_stuff: function (element_id, index_list, is_us = 0, is_refresh = 1) {
1967
1987
  let code_list = Util.get_code_list(element_id);
1968
1988
  if (code_list.length > 0) {
1969
- Util.show_tips("Loading...");
1989
+ Util.show_loading();
1970
1990
  //获取股票详情数据
1971
1991
  Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
1972
1992
  let valid_code_list = [];
@@ -2280,13 +2300,16 @@ const Util = {
2280
2300
  * @param item
2281
2301
  * @returns {string}
2282
2302
  */
2283
- pack_snowball_follower: function(item) {
2303
+ pack_snowball_follower: function (item) {
2284
2304
  if (item["snowball_follower"] && item["snowball_follower"] > 0) {
2285
2305
  let snowball_follower_rank = Util.to_unit(item["snowball_follower"]) + "(" + item["snowball_follower_rank"] + ")";
2286
2306
  let market_type = Util.is_hk(item["code"]) ? "hk" : "cn";
2287
- snowball_follower_rank = Util.pack_html_link(Util.get_url("rank_holder") + "?sort_type=snowball_follower&market_type=" + market_type, snowball_follower_rank);
2307
+ let url = Util.get_url("rank_holder") + "?sort_type=snowball_follower&market_type=" + market_type;
2308
+ if (item["code"]) {
2309
+ url += "&code=" + item["code"];
2310
+ }
2288
2311
  let tooltip = item["snowball_follower"] + " 人关注,关注排名第 " + item["snowball_follower_rank"] + " 位";
2289
- $("#snowball_follower").html(snowball_follower_rank + ' <i class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="top" data-original-title="' + tooltip + '"></i>');
2312
+ $("#snowball_follower").html(Util.pack_html_link(url, snowball_follower_rank) + ' <i class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="top" data-original-title="' + tooltip + '"></i>');
2290
2313
  $("[data-toggle='tooltip']").tooltip();
2291
2314
  }
2292
2315
  },
@@ -2831,7 +2854,7 @@ const Util = {
2831
2854
  * @returns {*|jQuery|void}
2832
2855
  */
2833
2856
  show_chart_loading: function (chart_instance, element_id) {
2834
- Util.show_tips("Loading...");
2857
+ Util.show_loading();
2835
2858
  if (!chart_instance) {
2836
2859
  chart_instance = Util.init_chart_instance(element_id);
2837
2860
  }
@@ -3414,4 +3437,3 @@ Object.size = function (obj) {
3414
3437
  console.log(Notification.permission);
3415
3438
  break;
3416
3439
  }*/
3417
-