sbd-npm 1.3.70 → 1.3.72
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 +1 -1
- package/summary_daily.js +98 -53
- package/util.js +9 -4
package/package.json
CHANGED
package/summary_daily.js
CHANGED
@@ -50,7 +50,7 @@ $(function () {
|
|
50
50
|
Util.set_table_loading("market_overview_zone");
|
51
51
|
let cache = DailySummary.get_cache();
|
52
52
|
if (cache.hasOwnProperty("index")) {
|
53
|
-
DailySummary.
|
53
|
+
DailySummary.pack_index_summary_data(cache["index"]);
|
54
54
|
}
|
55
55
|
if (cache.hasOwnProperty("change_percent")) {
|
56
56
|
DailySummary.pack_change_percent(cache["change_percent"]);
|
@@ -85,12 +85,10 @@ $(function () {
|
|
85
85
|
/**
|
86
86
|
* 当前行情指数
|
87
87
|
*/
|
88
|
-
|
89
|
-
let _html = [];
|
90
|
-
let change_color_data = [];
|
88
|
+
pack_index_summary_data: function (index_data) {
|
89
|
+
let _html = [], change_color_data = [];
|
91
90
|
index_data.forEach(function (item) {
|
92
|
-
let cls = "";
|
93
|
-
let sort = "";
|
91
|
+
let cls = "", sort = "";
|
94
92
|
if (item["change"] > 0) {
|
95
93
|
cls = "red";
|
96
94
|
sort = "fa-sort-asc";
|
@@ -115,7 +113,7 @@ $(function () {
|
|
115
113
|
_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>');
|
116
114
|
_html.push('</div>');
|
117
115
|
});
|
118
|
-
$("#
|
116
|
+
$("#index_summary_data").html(_html.join(""));
|
119
117
|
change_color_data.forEach(function (item) {
|
120
118
|
let change_rate_obj = $("#change_rate_" + item["key"]);
|
121
119
|
change_rate_obj.css("background-color", item["new"]);
|
@@ -145,7 +143,7 @@ $(function () {
|
|
145
143
|
_stock_rate_html.push('<span class="sr-only">', rate_width, '% Complete</span>');
|
146
144
|
_stock_rate_html.push('</div>');
|
147
145
|
_stock_rate_html.push('</div></div>');
|
148
|
-
_stock_rate_html.push('<div class="w_right w_20"><span><a href="#" data-toggle="modal" data-target=".
|
146
|
+
_stock_rate_html.push('<div class="w_right w_20"><span><a href="#" data-toggle="modal" data-target=".stock_rate_modal" data-cp="', rate_range, '">', rate, '</a></span></div>');
|
149
147
|
_stock_rate_html.push('</div>');
|
150
148
|
return _stock_rate_html.join("");
|
151
149
|
};
|
@@ -161,8 +159,8 @@ $(function () {
|
|
161
159
|
$("#stock_rate_bar").html(stock_rate_html.join(""));
|
162
160
|
let up_num = pr["r0_3"] + pr["r3_5"] + pr["r5_7"] + pr["r7_10"];
|
163
161
|
let down_num = pr["r10_7"] + pr["r7_5"] + pr["r5_3"] + pr["r3_0"];
|
164
|
-
let stock_rate_tips = '涨: <b style="color: #FFF;" class="label label-danger">' + up_num + '</b> (涨停:<b><a style="text-decoration: underline;" class="text-danger" href="#" data-toggle="modal" data-target=".
|
165
|
-
stock_rate_tips += '跌: <b style="color: #FFF;" class="label label-success">' + down_num + '</b> (跌停:<b><a style="text-decoration: underline;" class="text-success" href="#" data-toggle="modal" data-target=".
|
162
|
+
let stock_rate_tips = '涨: <b style="color: #FFF;" class="label label-danger">' + up_num + '</b> (涨停:<b><a style="text-decoration: underline;" class="text-danger" href="#" data-toggle="modal" data-target=".stock_rate_modal" data-cp="10% ~ 10%">' + pr["r10"] + '</a></b>), ';
|
163
|
+
stock_rate_tips += '跌: <b style="color: #FFF;" class="label label-success">' + down_num + '</b> (跌停:<b><a style="text-decoration: underline;" class="text-success" href="#" data-toggle="modal" data-target=".stock_rate_modal" data-cp="-10% ~ -10%">' + pr["r_10"] + '</a></b>), ';
|
166
164
|
stock_rate_tips += '涨跌比: <b style="color: #FFF;" class="label label-info">' + Util.to_float(up_num / down_num, 2) + '</b>';
|
167
165
|
$("#stock_rate_tips").html(stock_rate_tips);
|
168
166
|
},
|
@@ -176,7 +174,7 @@ $(function () {
|
|
176
174
|
let bd_obj = $('#big_deal_pie');
|
177
175
|
if (bd_obj.length) {
|
178
176
|
if (big_deal_date > 0) {
|
179
|
-
$("#big_deal_date").html("(" + Util.seconds_to_format(big_deal_date, "%Y-%m-%d") + ")
|
177
|
+
$("#big_deal_date").html("(" + Util.seconds_to_format(big_deal_date, "%Y-%m-%d") + ")");
|
180
178
|
}
|
181
179
|
if (DailySummary.big_deal === {} || DailySummary.big_deal["buy1000"] !== bd["buy1000"] || DailySummary.big_deal["buy800"] !== bd["buy800"]
|
182
180
|
|| DailySummary.big_deal["buy600"] !== bd["buy600"] || DailySummary.big_deal["buy400"] !== bd["buy400"]
|
@@ -309,18 +307,22 @@ $(function () {
|
|
309
307
|
}
|
310
308
|
_html.push("<tr>");
|
311
309
|
_html.push("<td style='padding: 18px 0;'>", Util.pack_html_link(market["url"], market["name"]), "</td>");
|
310
|
+
if (!market["item"]["market_capital"] && market["item"]["prev_market_capital"]) {
|
311
|
+
market["item"]["market_capital"] = market["item"]["prev_market_capital"];
|
312
|
+
}
|
312
313
|
_html.push("<td style='padding: 18px 0;'>", (market["item"]["market_capital"] ? (market["item"]["market_capital"] + "万亿") : "--"), "</td>");
|
314
|
+
if (!market["item"]["pe"] && market["item"]["prev_pe"]) {
|
315
|
+
market["item"]["pe"] = market["item"]["prev_pe"];
|
316
|
+
}
|
313
317
|
_html.push("<td style='padding: 18px 0;'>", (market["item"]["pe"] ? market["item"]["pe"] : "--"), "</td>");
|
314
318
|
_html.push("<td style='padding: 18px 0;'>", (market["item"]["volume"] ? (market["item"]["volume"] + "亿股") : "--"), "</td>");
|
315
319
|
let amount = "--";
|
316
320
|
if (market["item"]["amount"] && market["item"]["amount"] > 0) {
|
317
|
-
if (market["item"]["prev_amount"] && market["item"]["prev_amount"] > 0) {
|
321
|
+
if (market["item"]["prev_amount"] && market["item"]["prev_amount"] > 0 && market["item"]["amount"] !== market["item"]["prev_amount"]) {
|
318
322
|
if (market["item"]["amount"] > market["item"]["prev_amount"]) {
|
319
323
|
amount = "<b title='前值: " + market["item"]["prev_amount"] + "亿' class='text-danger'>" + market["item"]["amount"] + "亿</b>";
|
320
|
-
} else if (market["item"]["amount"] < market["item"]["prev_amount"]) {
|
321
|
-
amount = "<b title='前值: " + market["item"]["prev_amount"] + "亿' class='text-success'>" + market["item"]["amount"] + "亿</b>";
|
322
324
|
} else {
|
323
|
-
amount = market["item"]["
|
325
|
+
amount = "<b title='前值: " + market["item"]["prev_amount"] + "亿' class='text-success'>" + market["item"]["amount"] + "亿</b>";
|
324
326
|
}
|
325
327
|
} else {
|
326
328
|
amount = market["item"]["amount"] + "亿";
|
@@ -350,41 +352,20 @@ $(function () {
|
|
350
352
|
mo_amount_obj.addClass(mo_amount_cls);
|
351
353
|
}
|
352
354
|
mo_amount_obj.html(Util.to_float(mo_amount, 3) + "(" + mo_amount_sign + Util.to_float(mo_amount - previous_mo_amount, 3) + ")");
|
353
|
-
DailySummary.set_cache("market_overview", market_overview_dict);
|
354
|
-
},
|
355
|
-
|
356
|
-
pack_mo_item_html: function (market, key, unit) {
|
357
|
-
let _html = "<td>--</td>";
|
358
|
-
if (market["item"]) {
|
359
|
-
let val = market["item"][key];
|
360
|
-
if (val && val > 0) {
|
361
|
-
let prev_val = market["item"]["prev_" + key];
|
362
|
-
let mo_trend = "";
|
363
|
-
if (val > prev_val) {
|
364
|
-
mo_trend = "<b class='text-danger'> ↑</b>";
|
365
|
-
} else if (val < prev_val) {
|
366
|
-
mo_trend = "<b class='text-success'> ↓</b>";
|
367
|
-
}
|
368
|
-
_html = "<td title='" + prev_val + "'>" + val + unit + mo_trend + "</td>";
|
369
|
-
}
|
370
|
-
}
|
371
|
-
return _html;
|
372
355
|
},
|
373
356
|
|
374
357
|
/**
|
375
358
|
* 一些统计数据
|
376
359
|
*/
|
377
360
|
fetch_statistics_daily: function () {
|
378
|
-
let date = $("#trade_date").val();
|
379
|
-
let news_type = $("#news_type").val();
|
380
361
|
let payload = {
|
381
|
-
date:
|
362
|
+
date: $("#trade_date").val(),
|
382
363
|
action: "statistics_daily",
|
383
364
|
limit_num: DailySummary.limit_num(),
|
384
|
-
news_type: news_type
|
365
|
+
news_type: $("#news_type").val()
|
385
366
|
};
|
386
367
|
Util.post(location.pathname, payload, function (j) {
|
387
|
-
DailySummary.
|
368
|
+
DailySummary.pack_index_summary_data(j["index"]);
|
388
369
|
DailySummary.pack_change_percent(j["change_percent"]);
|
389
370
|
DailySummary.pack_big_deal(j["big_deal"], j["big_deal_date"]);
|
390
371
|
DailySummary.pack_hsgt_money_flow(j["hmf"]);
|
@@ -452,6 +433,34 @@ $(function () {
|
|
452
433
|
});
|
453
434
|
Util.render_table_html(market + "_table_body", _html);
|
454
435
|
}
|
436
|
+
},
|
437
|
+
|
438
|
+
// 指数历史行情数据
|
439
|
+
render_index_hist_modal: function() {
|
440
|
+
Util.show_loading();
|
441
|
+
let payload = {
|
442
|
+
action: "index_hist",
|
443
|
+
index_code: "ths_all_a",
|
444
|
+
start_date: $("#index_hist_modal_start_date").val(),
|
445
|
+
end_date: $("#index_hist_modal_end_date").val()
|
446
|
+
};
|
447
|
+
Util.post("/action", payload, function (j) {
|
448
|
+
let _html = [];
|
449
|
+
j["data"].forEach(function (item) {
|
450
|
+
_html.push("<tr>");
|
451
|
+
_html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
|
452
|
+
_html.push("<td>", item["open"], "</td>");
|
453
|
+
_html.push("<td>", item["close"], "</td>");
|
454
|
+
_html.push("<td>", item["low"], "</td>");
|
455
|
+
_html.push("<td>", item["high"], "</td>");
|
456
|
+
_html.push("<td>", Util.parse_ratio(item["p_change_rate"]), "</td>");
|
457
|
+
_html.push("<td data-val='", item["volume"], "'>", Util.to_unit(item["volume"]), "股</td>");
|
458
|
+
_html.push("<td data-val='", item["amount"], "'>", Util.to_unit(item["amount"]), "</td>");
|
459
|
+
_html.push("</tr>");
|
460
|
+
});
|
461
|
+
Util.render_table_html("index_hist_modal_body_body", _html);
|
462
|
+
Util.hide_tips();
|
463
|
+
});
|
455
464
|
}
|
456
465
|
|
457
466
|
};
|
@@ -478,8 +487,7 @@ $(function () {
|
|
478
487
|
if (!chart_instance) {
|
479
488
|
$("#" + element_id).html('<div class="x_panel"><div class="x_title"><h2>' + title + '</h2><div class="clearfix"></div></div><div class="x_content2" style="height:450px;"><div id="' + line_id + '" class="graph_line"></div></div></div>');
|
480
489
|
}
|
481
|
-
let date_data = [];
|
482
|
-
let val_data = [];
|
490
|
+
let date_data = [], val_data = [];
|
483
491
|
data.forEach(function (item) {
|
484
492
|
if (item[key] && item[key] > 0) {
|
485
493
|
date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
|
@@ -492,7 +500,7 @@ $(function () {
|
|
492
500
|
render_market_overview_modal: function (obj) {
|
493
501
|
let title = $.trim($(obj).text());
|
494
502
|
$("#at_title").html("[" + title + "]数据");
|
495
|
-
|
503
|
+
Util.set_table_loading("market_overview_load_status");
|
496
504
|
if (Modal.mo_end_time === 0) {
|
497
505
|
Modal.init_market_overview_time(obj);
|
498
506
|
} else {
|
@@ -553,7 +561,7 @@ $(function () {
|
|
553
561
|
Modal.render_stock_rate_html();
|
554
562
|
$("#p_change_type").change(function () {
|
555
563
|
if (!Util.is_load) {
|
556
|
-
Util.set_table_loading("
|
564
|
+
Util.set_table_loading("stock_rate_modal_body_body");
|
557
565
|
Modal.render_stock_rate_modal(obj);
|
558
566
|
}
|
559
567
|
});
|
@@ -562,10 +570,9 @@ $(function () {
|
|
562
570
|
},
|
563
571
|
|
564
572
|
render_stock_rate_html: function() {
|
565
|
-
let _html = [];
|
573
|
+
let _html = [], index = 0;
|
566
574
|
let industry = $("#p_change_industry").val();
|
567
575
|
let area = $("#p_change_area").val();
|
568
|
-
let index = 0;
|
569
576
|
Modal["p_change_data"].forEach(function (item) {
|
570
577
|
if (Util.is_industry_area(item, industry, area)) {
|
571
578
|
index++;
|
@@ -582,8 +589,8 @@ $(function () {
|
|
582
589
|
_html.push("</tr>");
|
583
590
|
}
|
584
591
|
});
|
585
|
-
Util.render_table_html("
|
586
|
-
Util.init_stock_stuff("
|
592
|
+
Util.render_table_html("stock_rate_modal_body_body", _html);
|
593
|
+
Util.init_stock_stuff("stock_rate_modal_body_body", [], 0, 0);
|
587
594
|
},
|
588
595
|
|
589
596
|
render_news_modal: function () {
|
@@ -598,7 +605,7 @@ $(function () {
|
|
598
605
|
_html.push("<td>", Util.sub_str(item["content"], 40), "</td>");
|
599
606
|
_html.push("</tr>");
|
600
607
|
});
|
601
|
-
Util.render_table_html("
|
608
|
+
Util.render_table_html("news_modal_body_body", _html);
|
602
609
|
Util.hide_tips();
|
603
610
|
});
|
604
611
|
}
|
@@ -609,12 +616,46 @@ $(function () {
|
|
609
616
|
Modal.render_market_overview_modal(e.relatedTarget);
|
610
617
|
});
|
611
618
|
mom_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
|
619
|
+
Util.set_table_loading("market_overview_load_status");
|
620
|
+
Util.hide_tips();
|
621
|
+
});
|
622
|
+
|
623
|
+
Util.init_modal_skeleton("index_hist_modal", '');
|
624
|
+
$("#index_hist_modal_title").html(Util.pack_html_link("https://m.10jqka.com.cn/stockpage/48_883957/", "同花顺全A指数"));
|
625
|
+
Util.init_table_skeleton({
|
626
|
+
"element_id": "index_hist_modal_body",
|
627
|
+
"caption": '<caption class="text-right"><div class="form-inline"><div class="form-group" id="index_hist_modal_start_end_date"></div><button class="btn btn-default" id="index_hist_modal_query">查 询</button></div></caption>',
|
628
|
+
"head_cols": [
|
629
|
+
{"name": "日期", "table_sort": 1},
|
630
|
+
{"name": "开盘价", "table_sort": 1},
|
631
|
+
{"name": "收盘价", "table_sort": 1},
|
632
|
+
{"name": "最低价", "table_sort": 1},
|
633
|
+
{"name": "最高价", "table_sort": 1},
|
634
|
+
{"name": "涨跌", "table_sort": 1},
|
635
|
+
{"name": "成交量", "table_sort": 1},
|
636
|
+
{"name": "成交额", "table_sort": 1},
|
637
|
+
]
|
638
|
+
});
|
639
|
+
let mam_obj = $('#index_hist_modal');
|
640
|
+
mam_obj.on('shown.bs.modal', function (e) {
|
641
|
+
Util.set_table_loading("index_hist_modal_body_body");
|
642
|
+
if ($("#index_hist_modal_start_date").length <= 0) {
|
643
|
+
Util.init_range_date("index_hist_modal_start_end_date", DailySummary, "render_index_hist_modal");
|
644
|
+
}
|
645
|
+
$("#index_hist_modal_query").click(function () {
|
646
|
+
DailySummary.render_index_hist_modal();
|
647
|
+
});
|
648
|
+
DailySummary.render_index_hist_modal();
|
649
|
+
});
|
650
|
+
mam_obj.on('hidden.bs.modal', function () {
|
612
651
|
Util.hide_tips();
|
613
|
-
$("#market_overview_load_status").html("<tr><td colspan='6'>Loading...</td></tr>");
|
614
652
|
});
|
615
653
|
|
654
|
+
Util.init_modal_skeleton("stock_rate_modal", '');
|
655
|
+
$("#stock_rate_modal_title").html("<span id='cp_val'></span>涨跌幅");
|
616
656
|
Util.init_table_skeleton({
|
617
|
-
"element_id": "
|
657
|
+
"element_id": "stock_rate_modal_body",
|
658
|
+
"caption": '<caption class="text-right" id="stock_rate_modal_body_body_tips"></caption>',
|
618
659
|
"head_cols": [
|
619
660
|
{"name": "序号"},
|
620
661
|
{"name": "代码"},
|
@@ -639,12 +680,16 @@ $(function () {
|
|
639
680
|
});
|
640
681
|
srm_obj.on('hidden.bs.modal', function () {
|
641
682
|
$("#cp_val").html("");
|
683
|
+
$("#stock_rate_modal_body_body_tips").html("");
|
684
|
+
Util.set_table_loading("stock_rate_modal_body_body");
|
642
685
|
Util.hide_tips();
|
643
|
-
$("#stock_rate_table_body").html("<tr><td colspan='9'>Loading...</td></tr>");
|
644
686
|
});
|
645
687
|
|
688
|
+
Util.init_modal_skeleton("news_modal", '');
|
689
|
+
$("#news_modal_title").html(Util.pack_html_link("http://www.pbc.gov.cn/zhengcehuobisi/125207/125213/125431/125475/index.html", "中国人民银行公开市场业务交易公告"));
|
646
690
|
Util.init_table_skeleton({
|
647
|
-
"element_id": "
|
691
|
+
"element_id": "news_modal_body",
|
692
|
+
"caption": "none",
|
648
693
|
"head_cols": [
|
649
694
|
{"name": "标题"},
|
650
695
|
{"name": "时间"},
|
@@ -656,8 +701,8 @@ $(function () {
|
|
656
701
|
Modal.render_news_modal();
|
657
702
|
});
|
658
703
|
news_obj.on('hidden.bs.modal', function () {
|
704
|
+
Util.set_table_loading("news_modal_body_body");
|
659
705
|
Util.hide_tips();
|
660
|
-
$("#news_modal_table_body").html("<tr><td colspan='3'>Loading...</td></tr>");
|
661
706
|
});
|
662
707
|
|
663
708
|
$("#hgt_bound").change(function () {
|
package/util.js
CHANGED
@@ -1738,8 +1738,8 @@ const Util = {
|
|
1738
1738
|
});
|
1739
1739
|
let component_obj = $('#' + component_id);
|
1740
1740
|
component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
|
1741
|
-
let coin = $(e.relatedTarget).attr("data-coin");
|
1742
1741
|
Util.set_table_loading(component_id + "_body_body");
|
1742
|
+
let coin = $(e.relatedTarget).attr("data-coin");
|
1743
1743
|
if ($("#" + component_id + "_start_date").length <= 0) {
|
1744
1744
|
Util.init_range_date(component_id + "_start_end_date", Util, "render_btc_modal", 60);
|
1745
1745
|
}
|
@@ -1752,7 +1752,6 @@ const Util = {
|
|
1752
1752
|
Util.render_btc_modal();
|
1753
1753
|
});
|
1754
1754
|
component_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
|
1755
|
-
Util.set_table_loading(component_id + "_body_body");
|
1756
1755
|
Util.hide_tips();
|
1757
1756
|
});
|
1758
1757
|
},
|
@@ -1767,7 +1766,13 @@ const Util = {
|
|
1767
1766
|
return false;
|
1768
1767
|
}
|
1769
1768
|
Util.show_loading();
|
1770
|
-
let payload = {
|
1769
|
+
let payload = {
|
1770
|
+
coin: coin,
|
1771
|
+
start_date: $("#btc_modal_start_date").val(),
|
1772
|
+
end_date: $("#btc_modal_end_date").val(),
|
1773
|
+
action: "btc_data",
|
1774
|
+
"currency_type": $("#currency_type").val()
|
1775
|
+
};
|
1771
1776
|
Util.post(Util.get_url("coin_price"), payload, function (j) {
|
1772
1777
|
let _html = [], low_price = 0, high_price = 0;
|
1773
1778
|
j["data"].forEach(function (item) {
|
@@ -4197,7 +4202,7 @@ const Util = {
|
|
4197
4202
|
big_deal_pie: function (element_id, data) {
|
4198
4203
|
let buy = Util.to_unit(data["buy1000"] + data["buy800"] + data["buy600"] + data["buy400"]);
|
4199
4204
|
let sell = Util.to_unit(data["sell1000"] + data["sell800"] + data["sell600"] + data["sell400"]);
|
4200
|
-
$("#" + element_id + "_tips").html("
|
4205
|
+
$("#" + element_id + "_tips").html("流入:<b class='text-danger'>" + Util.strip_html(buy) + "</b>,流出:<b class='text-success'>" + Util.strip_html(sell) + "</b>");
|
4201
4206
|
let bd_data = [
|
4202
4207
|
{name: '超大单流入', value: Util.to_hundred_million(data["buy1000"])},
|
4203
4208
|
{name: '大单流入', value: Util.to_hundred_million(data["buy800"])},
|