sbd-npm 1.5.20 → 1.5.22
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/status.js +40 -11
- package/stock_basics.js +7 -12
- package/summary_daily.js +1 -1
- package/util.js +50 -52
package/package.json
CHANGED
package/status.js
CHANGED
|
@@ -360,7 +360,7 @@ $(function () {
|
|
|
360
360
|
if (!document.getElementById("login_log_div_body")) {
|
|
361
361
|
Util.init_table_skeleton({
|
|
362
362
|
"element_id": "login_log_div",
|
|
363
|
-
"caption": '<caption class="' + (Util.is_mobile() ? "text-left" : "text-right") + '" id="
|
|
363
|
+
"caption": '<caption class="' + (Util.is_mobile() ? "text-left" : "text-right") + '" id="login_log_tips"></caption>',
|
|
364
364
|
"head_columns": [
|
|
365
365
|
{"name": "序号", "table_sort": 1},
|
|
366
366
|
{"name": "用户"},
|
|
@@ -371,21 +371,50 @@ $(function () {
|
|
|
371
371
|
]
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
+
Status.fetch_login_log(1);
|
|
375
|
+
},
|
|
376
|
+
|
|
377
|
+
fetch_login_log: function (filter_type) {
|
|
374
378
|
Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
|
|
375
|
-
let html = [], login_num = 0;
|
|
379
|
+
let html = [], login_num = 0, anomaly_num = 0;
|
|
376
380
|
j.data.forEach(function (item) {
|
|
377
381
|
login_num++;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
382
|
+
let is_anomaly = 0;
|
|
383
|
+
let ip_address = Status.convert_ip_address(item);
|
|
384
|
+
if (!ip_address.includes("广")) {
|
|
385
|
+
anomaly_num++;
|
|
386
|
+
is_anomaly = 1
|
|
387
|
+
}
|
|
388
|
+
if (filter_type !== "2" || is_anomaly === 1) {
|
|
389
|
+
if (is_anomaly === 1) {
|
|
390
|
+
html.push("<tr class='danger'>");
|
|
391
|
+
} else {
|
|
392
|
+
html.push("<tr", (item.date.includes('logged in') ? " class='info'" : ""), ">");
|
|
393
|
+
}
|
|
394
|
+
if (item.is_block === 1) {
|
|
395
|
+
html.push("<td><span class='label label-default' title='已屏蔽'>", login_num, "</span></td>");
|
|
396
|
+
} else {
|
|
397
|
+
html.push("<td>", login_num, "</td>");
|
|
398
|
+
}
|
|
399
|
+
html.push("<td>", item.user, "</td>");
|
|
400
|
+
html.push("<td>", item.terminal, "</td>");
|
|
401
|
+
html.push("<td>", Status.pack_ip_link(item.ip), "</td>");
|
|
402
|
+
html.push("<td>", Status.map_url(ip_address), "</td>");
|
|
403
|
+
html.push("<td>", item.date, "</td>");
|
|
404
|
+
html.push("</tr>");
|
|
405
|
+
}
|
|
386
406
|
});
|
|
387
407
|
Util.render_table_html("login_log_div_body", html);
|
|
388
|
-
|
|
408
|
+
let login_log_tips = (Util.is_mobile() ? " " : "") + "共 <a data-val='1' href='#' class='label label-info'>" + login_num + "</a> 条,异常 <a data-val='2' href='#' class='label label-danger'>" + anomaly_num + "</a> 条";
|
|
409
|
+
$("#login_log_tips").html(login_log_tips).find("a").each(function() {
|
|
410
|
+
$(this).click(function() {
|
|
411
|
+
let filter_type = $(this).attr("data-val");
|
|
412
|
+
Util.show_loading();
|
|
413
|
+
$("#login_log_tips").html("Loading...");
|
|
414
|
+
Util.set_table_loading("login_log_div_body");
|
|
415
|
+
Status.fetch_login_log(filter_type);
|
|
416
|
+
});
|
|
417
|
+
});
|
|
389
418
|
Util.hide_tips();
|
|
390
419
|
});
|
|
391
420
|
},
|
package/stock_basics.js
CHANGED
|
@@ -283,10 +283,9 @@ let Stock = {
|
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
285
|
if (item.is_retire && item.is_retire === 1) {
|
|
286
|
-
let
|
|
287
|
-
if (!
|
|
288
|
-
|
|
289
|
-
code_a_obj.attr("title", "已退市");
|
|
286
|
+
let code_a_object = $('#code a').first();
|
|
287
|
+
if (!code_a_object.hasClass('label-default')) {
|
|
288
|
+
code_a_object.addClass('label label-default').attr("title", "已退市");
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
291
|
Util.hide_tips();
|
|
@@ -933,10 +932,9 @@ let Stock = {
|
|
|
933
932
|
handle_metrics_statistics: function (metrics, date_type) {
|
|
934
933
|
Stock[metrics + "_bar_chart"] = Util.startup_metrics_statistics(Stock[metrics + "_bar_chart"], metrics, date_type);
|
|
935
934
|
if (metrics === "margin" || metrics === "hkex_holding") {
|
|
936
|
-
let
|
|
937
|
-
if (!
|
|
938
|
-
|
|
939
|
-
t_obj.click(function () {
|
|
935
|
+
let title_object = $("#" + metrics + "_title");
|
|
936
|
+
if (!title_object.hasClass("link_cls")) {
|
|
937
|
+
title_object.addClass("link_cls").click(function () {
|
|
940
938
|
Util.eventFire(metrics, 'click');
|
|
941
939
|
});
|
|
942
940
|
}
|
|
@@ -950,10 +948,7 @@ let Stock = {
|
|
|
950
948
|
interval: interval
|
|
951
949
|
}, function (j) {
|
|
952
950
|
Stock[metrics + "_bar_chart"].hideLoading();
|
|
953
|
-
let date_data = [];
|
|
954
|
-
let value_data = [];
|
|
955
|
-
let price_data = [];
|
|
956
|
-
let color_data = [];
|
|
951
|
+
let date_data = [], value_data = [], price_data = [], color_data = [];
|
|
957
952
|
j.data.forEach(function (item) {
|
|
958
953
|
date_data.push(item.date);
|
|
959
954
|
value_data.push(item.value);
|
package/summary_daily.js
CHANGED
|
@@ -195,7 +195,7 @@ $(function () {
|
|
|
195
195
|
* 沪深股通资金流向
|
|
196
196
|
*/
|
|
197
197
|
pack_hsgt_money_flow: function (hsgt_money_flow_data) {
|
|
198
|
-
if (
|
|
198
|
+
if (document.getElementById("hsgt_money_flow_line")) {
|
|
199
199
|
DailySummary["hsgt_money_flow_chart"].hideLoading();
|
|
200
200
|
let time_array = [], hsmf_data = [], hmf_array = [], smf_array = [], tmf_val = 0, hmf_val = 0, smf_val = 0;
|
|
201
201
|
hsgt_money_flow_data.forEach(function (d) {
|
package/util.js
CHANGED
|
@@ -536,7 +536,7 @@ const Util = {
|
|
|
536
536
|
render_price: function (item) {
|
|
537
537
|
let code = item.code;
|
|
538
538
|
if (item.price) {
|
|
539
|
-
if (
|
|
539
|
+
if (document.getElementById("price_change_" + code)) {
|
|
540
540
|
let price_cls = Util.text_color(item.price, item.previous_price);
|
|
541
541
|
$(".price_" + code).each(function () {
|
|
542
542
|
$(this).html("<b class='" + price_cls + "'>" + Util.to_float(item.price, 2) + "</b>");
|
|
@@ -850,7 +850,7 @@ const Util = {
|
|
|
850
850
|
*/
|
|
851
851
|
pagination: function (data_id, total_num, per_page, current_page, click_func) {
|
|
852
852
|
let page_id = data_id + "_page";
|
|
853
|
-
if (
|
|
853
|
+
if (!document.getElementById(page_id)) {
|
|
854
854
|
$("#" + data_id).parent().after('<div id="' + page_id + '" class="text-center"></div>');
|
|
855
855
|
}
|
|
856
856
|
let html = [];
|
|
@@ -884,9 +884,7 @@ const Util = {
|
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
html.push("</ul>");
|
|
887
|
-
|
|
888
|
-
fg.html(html.join(""));
|
|
889
|
-
fg.find("li").each(function () {
|
|
887
|
+
$("#" + page_id).html(html.join("")).find("li").each(function () {
|
|
890
888
|
let click_page = $(this).attr("data-page");
|
|
891
889
|
if (click_page) {
|
|
892
890
|
$(this).click(function () {
|
|
@@ -902,7 +900,7 @@ const Util = {
|
|
|
902
900
|
* @param modal_content_html
|
|
903
901
|
*/
|
|
904
902
|
init_modal_skeleton: function (modal_id, modal_content_html = "") {
|
|
905
|
-
if (
|
|
903
|
+
if (!document.getElementById(modal_id)) {
|
|
906
904
|
let html = [];
|
|
907
905
|
html.push('<div class="modal fade ', modal_id, '" id="', modal_id, '" tabindex="-1" role="dialog" aria-hidden="true">');
|
|
908
906
|
html.push('<div class="modal-dialog modal-lg modal-xlg"><div class="modal-content">');
|
|
@@ -1789,16 +1787,14 @@ const Util = {
|
|
|
1789
1787
|
{"name": "时间"},
|
|
1790
1788
|
]
|
|
1791
1789
|
});
|
|
1792
|
-
let
|
|
1793
|
-
|
|
1790
|
+
let etm_object = $('#category_top_modal');
|
|
1791
|
+
etm_object.on('shown.bs.modal', function (e) {
|
|
1794
1792
|
Util.render_category_top_modal();
|
|
1795
1793
|
});
|
|
1796
|
-
|
|
1794
|
+
etm_object.on('hidden.bs.modal', function () {
|
|
1797
1795
|
Util.hide_tips();
|
|
1798
1796
|
});
|
|
1799
|
-
|
|
1800
|
-
ctt_obj.val(category_top_type);
|
|
1801
|
-
ctt_obj.change(function() {
|
|
1797
|
+
$("#category_top_type").val(category_top_type).change(function() {
|
|
1802
1798
|
Util.render_category_top_modal();
|
|
1803
1799
|
});
|
|
1804
1800
|
},
|
|
@@ -2858,9 +2854,9 @@ const Util = {
|
|
|
2858
2854
|
* @returns {string|string}
|
|
2859
2855
|
*/
|
|
2860
2856
|
strip_html: function (str) {
|
|
2861
|
-
let
|
|
2862
|
-
|
|
2863
|
-
return
|
|
2857
|
+
let temporary_object = document.createElement("DIV");
|
|
2858
|
+
temporary_object.innerHTML = str;
|
|
2859
|
+
return temporary_object.textContent || temporary_object.innerText || "";
|
|
2864
2860
|
},
|
|
2865
2861
|
|
|
2866
2862
|
/**
|
|
@@ -2912,30 +2908,30 @@ const Util = {
|
|
|
2912
2908
|
* @param loading 设置加载状态效果表现
|
|
2913
2909
|
*/
|
|
2914
2910
|
show_tips: function (msg, interval = 0, cls = "", loading = 0) {
|
|
2915
|
-
let
|
|
2916
|
-
if (
|
|
2911
|
+
let tips_object = document.getElementById(Util.tips_token);
|
|
2912
|
+
if (tips_object) {
|
|
2917
2913
|
if (loading > 0) {
|
|
2918
2914
|
let origin_msg = msg.replace(/\./g, '');
|
|
2919
|
-
let origin_txt =
|
|
2915
|
+
let origin_txt = tips_object.innerText.replace(/\./g, '');
|
|
2920
2916
|
if (origin_msg === origin_txt) {
|
|
2921
2917
|
loading = loading < 5 ? (loading + 1) : 1;
|
|
2922
2918
|
let load_str = ".".repeat(loading);
|
|
2923
|
-
|
|
2919
|
+
tips_object.innerHTML = origin_msg + load_str;
|
|
2924
2920
|
setTimeout(() => {
|
|
2925
2921
|
Util.show_tips(msg, interval, cls, loading);
|
|
2926
2922
|
}, 300);
|
|
2927
2923
|
}
|
|
2928
2924
|
} else {
|
|
2929
|
-
|
|
2925
|
+
tips_object.innerHTML = msg;
|
|
2930
2926
|
}
|
|
2931
2927
|
} else {
|
|
2932
2928
|
if (loading === 0) {
|
|
2933
|
-
let
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
document.getElementsByTagName('body')[0].appendChild(
|
|
2929
|
+
let tips_object = document.createElement('div');
|
|
2930
|
+
tips_object.id = Util.tips_token;
|
|
2931
|
+
tips_object.className = "alert " + (cls === "" ? "alert-warning" : cls);
|
|
2932
|
+
tips_object.style = "position: fixed; right: 0; top: 0; z-index: 999;";
|
|
2933
|
+
tips_object.innerHTML = msg;
|
|
2934
|
+
document.getElementsByTagName('body')[0].appendChild(tips_object);
|
|
2939
2935
|
if (interval > 0) {
|
|
2940
2936
|
setTimeout(Util.hide_tips, interval);
|
|
2941
2937
|
}
|
|
@@ -2950,23 +2946,22 @@ const Util = {
|
|
|
2950
2946
|
},
|
|
2951
2947
|
|
|
2952
2948
|
hide_tips: function () {
|
|
2953
|
-
let
|
|
2954
|
-
if (
|
|
2955
|
-
|
|
2949
|
+
let tips_object = document.getElementById(Util.tips_token);
|
|
2950
|
+
if (tips_object) {
|
|
2951
|
+
tips_object.remove();
|
|
2956
2952
|
}
|
|
2957
|
-
let
|
|
2958
|
-
if (
|
|
2959
|
-
|
|
2953
|
+
let load_object = document.getElementById(Util.load_token);
|
|
2954
|
+
if (load_object) {
|
|
2955
|
+
load_object.remove();
|
|
2960
2956
|
}
|
|
2961
2957
|
},
|
|
2962
2958
|
|
|
2963
2959
|
show_loading: function () {
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
document.getElementsByTagName('body')[0].appendChild(load_obj);
|
|
2960
|
+
if (!document.getElementById(Util.load_token)) {
|
|
2961
|
+
let load_object = document.createElement('div');
|
|
2962
|
+
load_object.id = Util.load_token;
|
|
2963
|
+
load_object.innerHTML = '<div class="circle"></div><div class="circle"></div><div class="circle"></div>';
|
|
2964
|
+
document.getElementsByTagName('body')[0].appendChild(load_object);
|
|
2970
2965
|
}
|
|
2971
2966
|
},
|
|
2972
2967
|
|
|
@@ -3000,9 +2995,9 @@ const Util = {
|
|
|
3000
2995
|
let code_list = Util.get_code_list(element_id);
|
|
3001
2996
|
if (code_list.length > 0) {
|
|
3002
2997
|
Util.show_loading();
|
|
3003
|
-
let
|
|
3004
|
-
if (
|
|
3005
|
-
|
|
2998
|
+
let tips_object = $("#" + element_id + "_tips");
|
|
2999
|
+
if (tips_object.length) {
|
|
3000
|
+
tips_object.html('共 <span class="label label-info">' + code_list.length + '</span> 家');
|
|
3006
3001
|
}
|
|
3007
3002
|
let payload = {action: "code_detail", code_list: code_list.join("-")};
|
|
3008
3003
|
$("#" + element_id).parent().find('thead td').each(function() {
|
|
@@ -3047,16 +3042,17 @@ const Util = {
|
|
|
3047
3042
|
Util.render_money_inflow($(this), item);
|
|
3048
3043
|
});
|
|
3049
3044
|
}
|
|
3050
|
-
|
|
3051
|
-
|
|
3045
|
+
let remark_object = document.getElementById("remark_" + code);
|
|
3046
|
+
if (remark_object) {
|
|
3047
|
+
let remark = [];
|
|
3052
3048
|
if (item.is_bull_trend) {
|
|
3053
|
-
remark
|
|
3049
|
+
remark.push("<b>" + Util.pack_html_link(Util.get_url("trend_bull_trend"), "多头趋势") + "</b><br>");
|
|
3054
3050
|
}
|
|
3055
3051
|
if (item.is_kdj_cross) {
|
|
3056
|
-
remark
|
|
3052
|
+
remark.push("<b>" + Util.pack_html_link(Util.get_url("trend_kdj"), "KDJ金叉") + "</b><br>");
|
|
3057
3053
|
}
|
|
3058
3054
|
if (item.is_macd_cross) {
|
|
3059
|
-
remark
|
|
3055
|
+
remark.push("<b>" + Util.pack_html_link(Util.get_url("trend_macd_cross"), "MACD金叉") + "</b><br>");
|
|
3060
3056
|
}
|
|
3061
3057
|
if (item.kdj_trend && item.kdj_trend > 0) {
|
|
3062
3058
|
let kdj_name = "KDJ金叉";
|
|
@@ -3067,9 +3063,9 @@ const Util = {
|
|
|
3067
3063
|
} else {
|
|
3068
3064
|
kdj_url += "?date_type=2";
|
|
3069
3065
|
}
|
|
3070
|
-
remark
|
|
3066
|
+
remark.push("<b>" + Util.pack_html_link(kdj_url, kdj_name) + "</b><br>");
|
|
3071
3067
|
}
|
|
3072
|
-
|
|
3068
|
+
remark_object.innerHTML = remark.join("");
|
|
3073
3069
|
}
|
|
3074
3070
|
}
|
|
3075
3071
|
if (is_refresh === 1) {
|
|
@@ -3079,18 +3075,20 @@ const Util = {
|
|
|
3079
3075
|
}
|
|
3080
3076
|
let total_num = valid_code_list.length;
|
|
3081
3077
|
if (total_num > 0) { // 涨跌统计
|
|
3082
|
-
|
|
3078
|
+
let tips_object = document.getElementById(element_id + "_tips");
|
|
3079
|
+
if (tips_object) {
|
|
3083
3080
|
let average_change_percent = Math.round((total_change_percent / total_num) * 10000) / 100;
|
|
3084
3081
|
let average_year_change_percent = Math.round((total_year_change_percent / total_num) * 10000) / 100;
|
|
3085
3082
|
let average_d5_change_percent = Math.round((total_d5_change_percent / total_num) * 10000) / 100;
|
|
3086
|
-
|
|
3083
|
+
tips_object.innerHTML = '共 <span class="label label-info">' + total_num + '</span> 家 平均涨跌: ' + Util.parse_ratio(average_change_percent) + " 最近5日: " + Util.parse_ratio(average_d5_change_percent) + " 年初至今: " + Util.parse_ratio(average_year_change_percent);
|
|
3087
3084
|
}
|
|
3088
3085
|
}
|
|
3089
3086
|
Util.hide_tips();
|
|
3090
3087
|
});
|
|
3091
3088
|
} else {
|
|
3092
|
-
|
|
3093
|
-
|
|
3089
|
+
let tips_object = document.getElementById(element_id + "_tips");
|
|
3090
|
+
if (tips_object) {
|
|
3091
|
+
tips_object.innerHTML = '';
|
|
3094
3092
|
}
|
|
3095
3093
|
}
|
|
3096
3094
|
},
|