sbd-npm 1.5.20 → 1.5.21
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 +36 -11
- package/stock_basics.js +3 -4
- package/util.js +28 -29
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,46 @@ $(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
|
+
html.push("<td>", login_num, "</td>");
|
|
395
|
+
html.push("<td>", item.user, "</td>");
|
|
396
|
+
html.push("<td>", item.terminal, "</td>");
|
|
397
|
+
html.push("<td>", Status.pack_ip_link(item.ip), "</td>");
|
|
398
|
+
html.push("<td>", Status.map_url(ip_address), "</td>");
|
|
399
|
+
html.push("<td>", item.date, "</td>");
|
|
400
|
+
html.push("</tr>");
|
|
401
|
+
}
|
|
386
402
|
});
|
|
387
403
|
Util.render_table_html("login_log_div_body", html);
|
|
388
|
-
|
|
404
|
+
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> 条";
|
|
405
|
+
$("#login_log_tips").html(login_log_tips).find("a").each(function() {
|
|
406
|
+
$(this).click(function() {
|
|
407
|
+
let filter_type = $(this).attr("data-val");
|
|
408
|
+
Util.show_loading();
|
|
409
|
+
$("#login_log_tips").html("Loading...");
|
|
410
|
+
Util.set_table_loading("login_log_div_body");
|
|
411
|
+
Status.fetch_login_log(filter_type);
|
|
412
|
+
});
|
|
413
|
+
});
|
|
389
414
|
Util.hide_tips();
|
|
390
415
|
});
|
|
391
416
|
},
|
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();
|
package/util.js
CHANGED
|
@@ -2858,9 +2858,9 @@ const Util = {
|
|
|
2858
2858
|
* @returns {string|string}
|
|
2859
2859
|
*/
|
|
2860
2860
|
strip_html: function (str) {
|
|
2861
|
-
let
|
|
2862
|
-
|
|
2863
|
-
return
|
|
2861
|
+
let temporary_object = document.createElement("DIV");
|
|
2862
|
+
temporary_object.innerHTML = str;
|
|
2863
|
+
return temporary_object.textContent || temporary_object.innerText || "";
|
|
2864
2864
|
},
|
|
2865
2865
|
|
|
2866
2866
|
/**
|
|
@@ -2912,30 +2912,30 @@ const Util = {
|
|
|
2912
2912
|
* @param loading 设置加载状态效果表现
|
|
2913
2913
|
*/
|
|
2914
2914
|
show_tips: function (msg, interval = 0, cls = "", loading = 0) {
|
|
2915
|
-
let
|
|
2916
|
-
if (
|
|
2915
|
+
let tips_object = document.getElementById(Util.tips_token);
|
|
2916
|
+
if (tips_object) {
|
|
2917
2917
|
if (loading > 0) {
|
|
2918
2918
|
let origin_msg = msg.replace(/\./g, '');
|
|
2919
|
-
let origin_txt =
|
|
2919
|
+
let origin_txt = tips_object.innerText.replace(/\./g, '');
|
|
2920
2920
|
if (origin_msg === origin_txt) {
|
|
2921
2921
|
loading = loading < 5 ? (loading + 1) : 1;
|
|
2922
2922
|
let load_str = ".".repeat(loading);
|
|
2923
|
-
|
|
2923
|
+
tips_object.innerHTML = origin_msg + load_str;
|
|
2924
2924
|
setTimeout(() => {
|
|
2925
2925
|
Util.show_tips(msg, interval, cls, loading);
|
|
2926
2926
|
}, 300);
|
|
2927
2927
|
}
|
|
2928
2928
|
} else {
|
|
2929
|
-
|
|
2929
|
+
tips_object.innerHTML = msg;
|
|
2930
2930
|
}
|
|
2931
2931
|
} else {
|
|
2932
2932
|
if (loading === 0) {
|
|
2933
|
-
let
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
document.getElementsByTagName('body')[0].appendChild(
|
|
2933
|
+
let tips_object = document.createElement('div');
|
|
2934
|
+
tips_object.id = Util.tips_token;
|
|
2935
|
+
tips_object.className = "alert " + (cls === "" ? "alert-warning" : cls);
|
|
2936
|
+
tips_object.style = "position: fixed; right: 0; top: 0; z-index: 999;";
|
|
2937
|
+
tips_object.innerHTML = msg;
|
|
2938
|
+
document.getElementsByTagName('body')[0].appendChild(tips_object);
|
|
2939
2939
|
if (interval > 0) {
|
|
2940
2940
|
setTimeout(Util.hide_tips, interval);
|
|
2941
2941
|
}
|
|
@@ -2950,23 +2950,22 @@ const Util = {
|
|
|
2950
2950
|
},
|
|
2951
2951
|
|
|
2952
2952
|
hide_tips: function () {
|
|
2953
|
-
let
|
|
2954
|
-
if (
|
|
2955
|
-
|
|
2953
|
+
let tips_object = document.getElementById(Util.tips_token);
|
|
2954
|
+
if (tips_object) {
|
|
2955
|
+
tips_object.remove();
|
|
2956
2956
|
}
|
|
2957
|
-
let
|
|
2958
|
-
if (
|
|
2959
|
-
|
|
2957
|
+
let load_object = document.getElementById(Util.load_token);
|
|
2958
|
+
if (load_object) {
|
|
2959
|
+
load_object.remove();
|
|
2960
2960
|
}
|
|
2961
2961
|
},
|
|
2962
2962
|
|
|
2963
2963
|
show_loading: function () {
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
document.getElementsByTagName('body')[0].appendChild(load_obj);
|
|
2964
|
+
if (!document.getElementById(Util.load_token)) {
|
|
2965
|
+
let load_object = document.createElement('div');
|
|
2966
|
+
load_object.id = Util.load_token;
|
|
2967
|
+
load_object.innerHTML = '<div class="circle"></div><div class="circle"></div><div class="circle"></div>';
|
|
2968
|
+
document.getElementsByTagName('body')[0].appendChild(load_object);
|
|
2970
2969
|
}
|
|
2971
2970
|
},
|
|
2972
2971
|
|
|
@@ -3000,9 +2999,9 @@ const Util = {
|
|
|
3000
2999
|
let code_list = Util.get_code_list(element_id);
|
|
3001
3000
|
if (code_list.length > 0) {
|
|
3002
3001
|
Util.show_loading();
|
|
3003
|
-
let
|
|
3004
|
-
if (
|
|
3005
|
-
|
|
3002
|
+
let tips_object = $("#" + element_id + "_tips");
|
|
3003
|
+
if (tips_object.length) {
|
|
3004
|
+
tips_object.html('共 <span class="label label-info">' + code_list.length + '</span> 家');
|
|
3006
3005
|
}
|
|
3007
3006
|
let payload = {action: "code_detail", code_list: code_list.join("-")};
|
|
3008
3007
|
$("#" + element_id).parent().find('thead td').each(function() {
|