sbd-npm 1.2.98 → 1.2.100
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/util.js +95 -4
package/package.json
CHANGED
package/util.js
CHANGED
@@ -570,6 +570,16 @@ const Util = {
|
|
570
570
|
return Util.is_us(code) ? "US" : (Util.is_hk(code) ? "HK" : (Util.is_sh(code) ? "SH" : "SZ"));
|
571
571
|
},
|
572
572
|
|
573
|
+
/**
|
574
|
+
* 基金前缀
|
575
|
+
* @param code
|
576
|
+
* @returns {string}
|
577
|
+
*/
|
578
|
+
code_to_fund_symbol: function(code) {
|
579
|
+
let prefix = code.substr(0, 1) === "5" ? "SH": "SZ";
|
580
|
+
return prefix + code;
|
581
|
+
},
|
582
|
+
|
573
583
|
/**
|
574
584
|
* 是否交易时间
|
575
585
|
* @returns {boolean}
|
@@ -1105,7 +1115,8 @@ const Util = {
|
|
1105
1115
|
let public_date = j["public_date"] > 0 ? Util.seconds_to_format(j["public_date"], "%Y-%m-%d") : "--";
|
1106
1116
|
let issue_date = j["issue_date"] > 0 ? Util.seconds_to_format(j["issue_date"], "%Y-%m-%d") : "--";
|
1107
1117
|
_html.push("<tr title='最后更新时间: ", Util.seconds_to_format(j["update_time"], "%Y-%m-%d"), "' class='info'><th colspan='14' text-align='center'>基金概况</th></tr>");
|
1108
|
-
_html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://fund.eastmoney.com/' + j["fund_code"] + '.html', j["fund_code"]), "</td><td colspan='3'>基金名</td><td colspan='4'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j["fund_code"] + '.html', j["fund_name"]), "</td></tr>");
|
1118
|
+
//_html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://fund.eastmoney.com/' + j["fund_code"] + '.html', j["fund_code"]), "</td><td colspan='3'>基金名</td><td colspan='4'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j["fund_code"] + '.html', j["fund_name"]), "</td></tr>");
|
1119
|
+
_html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://xueqiu.com/S/' + Util.code_to_fund_symbol(j["fund_code"]), j["fund_code"]), "</td><td colspan='3'>基金名</td><td colspan='4'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j["fund_code"] + '.html', j["fund_name"]), "</td></tr>");
|
1109
1120
|
_html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", j["fund_type"], "</td><td colspan='3'>投资类型</td><td colspan='4'>", j["invest_type"], "</td></tr>");
|
1110
1121
|
_html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='4'>", assets, "</td></tr>");
|
1111
1122
|
_html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='4'>", issue_date, "</td></tr>");
|
@@ -1216,6 +1227,76 @@ const Util = {
|
|
1216
1227
|
});
|
1217
1228
|
},
|
1218
1229
|
|
1230
|
+
init_category_top_modal: function(category_top_type) {
|
1231
|
+
Util.init_modal_skeleton("category_top_modal", '');
|
1232
|
+
$("#category_top_modal_title").html("<select id='category_top_type'><option value='1'>行业ETF</option><option value='2'>同花顺行业</option><option value='3'>申万行业</option></select> 每日涨幅第一的时间统计分析(时间为过去一年内)");
|
1233
|
+
Util.init_table_skeleton({
|
1234
|
+
"element_id": "category_top_modal_body",
|
1235
|
+
"caption": '<caption class="text-right"><span class="label label-info">次数</span>: 时间期间内每日涨幅第一的上榜次数, <span class="label label-info">间隔</span>: 每两次上榜之间的平均天数间隔, <span class="label label-info">距差</span>: 当前时间距离最近一次涨幅第一的间隔天数</caption>',
|
1236
|
+
"head_cols": [
|
1237
|
+
{"name": "名称"},
|
1238
|
+
{"name": "次数", "table_sort": 1},
|
1239
|
+
{"name": "间隔", "table_sort": 1, "class": "info"},
|
1240
|
+
{"name": "距差", "table_sort": 1},
|
1241
|
+
{"name": "时间"},
|
1242
|
+
]
|
1243
|
+
});
|
1244
|
+
let etm_obj = $('#category_top_modal');
|
1245
|
+
etm_obj.on('shown.bs.modal', function (e) {
|
1246
|
+
Util.render_category_top_modal();
|
1247
|
+
});
|
1248
|
+
etm_obj.on('hidden.bs.modal', function () {
|
1249
|
+
Util.hide_tips();
|
1250
|
+
});
|
1251
|
+
let ctt_obj = $("#category_top_type");
|
1252
|
+
ctt_obj.find("option[value='" + category_top_type + "']").attr("selected", true);
|
1253
|
+
ctt_obj.change(function() {
|
1254
|
+
Util.render_category_top_modal();
|
1255
|
+
});
|
1256
|
+
},
|
1257
|
+
|
1258
|
+
render_category_top_modal: function() {
|
1259
|
+
Util.show_loading();
|
1260
|
+
Util.post(location.pathname, {"action": "category_top_statistics", "type": $("#category_top_type").val()}, function (j) {
|
1261
|
+
let _html = [];
|
1262
|
+
j["data"].forEach(function (item) {
|
1263
|
+
let date_data = [], cole_url = "";
|
1264
|
+
_html.push("<tr>");
|
1265
|
+
item["name"] = item["name"] + "(" + item["code"] + ")";
|
1266
|
+
if (category_top_type === 2) {
|
1267
|
+
cole_url = "http://q.10jqka.com.cn/thshy/detail/code/" + item["code"];
|
1268
|
+
} else if (category_top_type === 3) {
|
1269
|
+
cole_url = "https://www.swsresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=" + item["code"] + "&name=" + item["code"];
|
1270
|
+
} else {
|
1271
|
+
cole_url = "https://xueqiu.com/S/" + Util.code_to_fund_symbol(item["code"]);
|
1272
|
+
}
|
1273
|
+
_html.push("<td>", Util.pack_html_link(cole_url, item["name"]), "</td>");
|
1274
|
+
_html.push("<td>", item["num"], "</td>");
|
1275
|
+
_html.push("<td data-val='", item["interval_day"], "'>", (item["interval_day"] < 10000 ? (item["interval_day"] + "天") : "--"), "</td>");
|
1276
|
+
if (item["dist_day"] < item["interval_day"]) {
|
1277
|
+
_html.push("<td data-val='", item["dist_day"], "'>", item["dist_day"], "天</td>");
|
1278
|
+
} else {
|
1279
|
+
_html.push("<td class='danger' data-val='", item["dist_day"], "'>", item["dist_day"], "天</td>");
|
1280
|
+
}
|
1281
|
+
item["data"].forEach(function (d) {
|
1282
|
+
let date_format = Util.seconds_to_format(d["date"], "%Y-%m-%d");
|
1283
|
+
if (d["date"] === j["latest_date"]) {
|
1284
|
+
date_format = "<span class='label label-info'>" + date_format + " </span>";
|
1285
|
+
}
|
1286
|
+
date_data.push(date_format + "(" + Util.parse_ratio(d["p_change"]) + ") ");
|
1287
|
+
});
|
1288
|
+
date_data = date_data.join("")
|
1289
|
+
if (item["num"] > 6) {
|
1290
|
+
date_data += "...";
|
1291
|
+
}
|
1292
|
+
_html.push("<td class='text-left'>", date_data, "</td>");
|
1293
|
+
_html.push("</tr>");
|
1294
|
+
});
|
1295
|
+
Util.render_table_html("category_top_modal_body_body", _html);
|
1296
|
+
Util.hide_tips();
|
1297
|
+
});
|
1298
|
+
},
|
1299
|
+
|
1219
1300
|
/**
|
1220
1301
|
* 初始货币汇率组件
|
1221
1302
|
* @param component_id
|
@@ -2683,9 +2764,19 @@ const Util = {
|
|
2683
2764
|
*/
|
2684
2765
|
pack_holder_num: function (item) {
|
2685
2766
|
if (item["holder_num"] && item["holder_num"] > 0) {
|
2686
|
-
let
|
2687
|
-
let
|
2688
|
-
|
2767
|
+
let holder_url = Util.get_url("holder_num") + "?code=" + item["code"];
|
2768
|
+
let holder_info = "";
|
2769
|
+
if (item["pre_holder_num"] && item["pre_holder_num"] > 0) {
|
2770
|
+
let rate = item["holder_num"] / item["pre_holder_num"];
|
2771
|
+
if (rate > 9) {
|
2772
|
+
holder_info = '<b data-val="900" title="' + item["pre_holder_num"] + '" class="text-danger">' + item["holder_num"] + '(+900%)</b>';
|
2773
|
+
} else {
|
2774
|
+
holder_info = Util.digit_compare_trend(item["holder_num"], item["pre_holder_num"]);
|
2775
|
+
}
|
2776
|
+
} else {
|
2777
|
+
holder_info = Util.digit_compare_trend(item["holder_num"], 0);
|
2778
|
+
}
|
2779
|
+
return Util.pack_html_link(holder_url, holder_info);
|
2689
2780
|
}
|
2690
2781
|
return "--";
|
2691
2782
|
},
|