sbd-npm 1.1.55 → 1.1.59

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
@@ -125,10 +125,10 @@ const MenuList = [
125
125
  'name': '概念股',
126
126
  'icon': 'retweet',
127
127
  'menu': [
128
- {'key': 'concept_week_recommend', 'name': '每周精选', 'url': '/9c3fbc44e6ad96fbd8a57b227771eea0'},
129
128
  {'key': 'concept_recommend', 'name': '关注', 'url': '/27ca098faad33a8e4d109efe0112fd16'},
130
129
  {'key': 'concept_bellwether', 'name': '龙头股', 'url': '/2995afdea420471e00c536182e711bef'},
131
130
  {'key': 'concept_market_situation', 'name': '市值风云', 'url': '/02fdaf4d66cdecb092bcd65f569aa493'},
131
+ {'key': 'concept_down_top', 'name': '15-21年的超跌股', 'url': '/ae3bbf97a358392cfaa0ceb35cb3fb57'},
132
132
  {'key': 'concept_cannon', 'name': '黄家礼炮', 'url': '/d6128a3ad91d545f2920fa2e324c37e1'},
133
133
  {'key': 'concept_cloud', 'name': '心似白云常自在', 'url': '/1d883188398a3a8c743748c5eb81fe7b'},
134
134
  {'key': 'concept_niu', 'name': '老曾阿牛', 'url': '/0f4a2714971424024c1ddd8651c26569'},
@@ -139,7 +139,6 @@ const MenuList = [
139
139
  {'key': 'concept_us', 'name': '美股', 'url': '/f986a81550e4d8a902f8bc0ef07757a6'},
140
140
  {'key': 'concept_chip', 'name': '芯片', 'url': '/491de7096b1cb9355766e5ffdd7018b6'},
141
141
  {'key': 'concept_military', 'name': '军工', 'url': '/1eb37c30e6be05148ba47c8ca6498a48'},
142
- {'key': 'concept_msci', 'name': 'MSCI', 'url': '/ff6c00cf10a8f17ae0e4fb1ca444f7fc'},
143
142
  {'key': 'concept_hkscc', 'name': '港交所', 'url': '/f23d044c3944d827d799f77da41a911e'},
144
143
  {'key': 'concept_ah', 'name': 'AH股', 'url': '/16f12053b288726b5d4720de879c3b5c'},
145
144
  {'key': 'concept_st', 'name': 'ST股', 'url': '/e0eb8a51da63f7ceb16a769d7d20bada'},
@@ -190,8 +189,9 @@ const MenuList = [
190
189
  'menu': [
191
190
  {'key': 'snowball_trend', 'name': '自选趋势', 'url': '/08c40d908dd87e29a607b6945309edf0'},
192
191
  {'key': 'snowball_user', 'name': '用户列表', 'url': '/97339b8453883dd27e6087ae7db6f62a'},
193
- {'key': 'snowball_tool', 'name': '搜索工具', 'url': '/ac88ee85f27e11aa06f2b8f46b03a0eb'},
192
+ {'key': 'snowball_tweet', 'name': '推文', 'url': '/9a9aef7fced3f15ff7647de75d70798c'},
194
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.55",
3
+ "version": "1.1.59",
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
@@ -502,8 +502,12 @@ const Util = {
502
502
  */
503
503
  is_trade_time: function () {
504
504
  let date = new Date();
505
- let hour = date.getHours();
506
- return hour >= 9 && hour < 15 && hour !== 12;
505
+ let weekday = date.getDay();
506
+ if (weekday > 0 && weekday < 6) {
507
+ let hour = date.getHours();
508
+ return hour >= 9 && hour < 15 && hour !== 12;
509
+ }
510
+ return false;
507
511
  },
508
512
 
509
513
  /**
@@ -639,6 +643,11 @@ const Util = {
639
643
  let is_table_sort = 0;
640
644
  let is_tooltip = 0;
641
645
  let _html = [];
646
+ if (options["alert"]) {
647
+ _html.push('<div class="alert alert-info" role="alert">');
648
+ _html.push(options["alert"]);
649
+ _html.push('</div>');
650
+ }
642
651
  let table_class = options["table_class"] ? options["table_class"] : "table table-bordered table-hover table-striped text-center";
643
652
  _html.push('<table class="' + table_class + '">');
644
653
  if (options["caption"]) {
@@ -781,8 +790,9 @@ const Util = {
781
790
  * 初始分类股票的显示表格
782
791
  * @param stock_category
783
792
  * @param table_id
793
+ * @param alert_tips
784
794
  */
785
- init_stock_category_data: function (stock_category, table_id) {
795
+ init_stock_category_data: function (stock_category, table_id, alert_tips = "") {
786
796
  Util.show_tips("Loading...");
787
797
  let head_cols = [
788
798
  {"name": "代码"},
@@ -803,11 +813,15 @@ const Util = {
803
813
  head_cols.push({"name": "股东数", "table_sort": 1});
804
814
  head_cols.push({"name": "备注", "id": "remark_title"});
805
815
  }
806
- Util.init_table_skeleton({
816
+ let table_options = {
807
817
  "element_id": table_id,
808
818
  "caption": '<caption><span id="index_data"></span><div class="pull-right" id="' + table_id + '_body_tips"></div></caption>',
809
819
  "head_cols": head_cols
810
- });
820
+ };
821
+ if (alert_tips.length > 0) {
822
+ table_options["alert"] = alert_tips;
823
+ }
824
+ Util.init_table_skeleton(table_options);
811
825
  Util.post(location.pathname, {active_div: stock_category}, function (j) {
812
826
  let _html = [];
813
827
  let total_num = 0;
@@ -1158,6 +1172,17 @@ const Util = {
1158
1172
  return parseInt(seconds_to_format(seconds, "%Y"));
1159
1173
  },
1160
1174
 
1175
+ /**
1176
+ * 一周的哪一天(1-7,星期一:1,星期二:2,...星期日:7)
1177
+ * @returns {*|number}
1178
+ */
1179
+ get_weekday: function() {
1180
+ let date = new Date();
1181
+ let weekday = date.getDay();
1182
+ weekday = weekday > 0 ? weekday : 7; // 星期天是0
1183
+ return weekday;
1184
+ },
1185
+
1161
1186
  /**
1162
1187
  * 获取 cookie 的值(X-CSRFToken Cross-Site Request Forgery Token)
1163
1188
  * @param name
@@ -1278,9 +1303,7 @@ const Util = {
1278
1303
  let ed_obj = $('#' + end_id);
1279
1304
  sd_obj.attr("disabled", false);
1280
1305
  ed_obj.attr("disabled", false);
1281
- let date = new Date();
1282
- let weekday = date.getDay();
1283
- weekday = weekday > 0 ? weekday : 7; // 星期天是0
1306
+ let weekday = Util.get_weekday();
1284
1307
  let year = date.getFullYear();
1285
1308
  let month = date.getMonth() + 1;
1286
1309
  let current_month_format = year + "-" + (month < 10 ? '0' + month : month) + "-01";