sbd-npm 1.4.17 → 1.4.18
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 +22 -5
package/package.json
CHANGED
package/util.js
CHANGED
@@ -1135,19 +1135,28 @@ const Util = {
|
|
1135
1135
|
{"name": ""},
|
1136
1136
|
]
|
1137
1137
|
});
|
1138
|
-
|
1138
|
+
let payload = {
|
1139
|
+
action: "public_fund",
|
1140
|
+
public_fund_date: $("#public_fund_date").val(),
|
1141
|
+
is_fund_rank10: $("#is_fund_rank10").prop("checked") ? 1 : 0
|
1142
|
+
};
|
1143
|
+
Util.post("/stock/" + code, payload, function (j) {
|
1139
1144
|
Util.render_public_fund(j);
|
1140
1145
|
if (j["date"] && j["date"] > 0) {
|
1141
1146
|
$("#public_fund_title").find("a").each(function() {
|
1142
1147
|
let t_text = $(this).text();
|
1143
|
-
if (t_text.indexOf("
|
1148
|
+
if (t_text.indexOf("基金明细") > -1) {
|
1144
1149
|
$(this).attr("href", "https://data.eastmoney.com/zlsj/detail/" + Util.seconds_to_format(j["date"], "%Y-%m-%d") + "-1-" + code + ".html");
|
1145
1150
|
}
|
1146
1151
|
});
|
1147
1152
|
}
|
1148
1153
|
if ($("#public_fund_date").length === 0) {
|
1149
1154
|
let fund_len = j["data"] ? j["data"].length : 0;
|
1150
|
-
|
1155
|
+
let payload = {
|
1156
|
+
action: "public_fund_date",
|
1157
|
+
is_fund_rank10: $("#is_fund_rank10").prop("checked") ? 1 : 0
|
1158
|
+
};
|
1159
|
+
Util.post("/stock/" + code, payload, function (j) {
|
1151
1160
|
let html = [], date_len = 0;
|
1152
1161
|
html.push('<select id="public_fund_date">');
|
1153
1162
|
j["data"].forEach(function (item) {
|
@@ -1160,6 +1169,12 @@ const Util = {
|
|
1160
1169
|
$("#public_fund_date").change(function () {
|
1161
1170
|
Util.fetch_public_fund(code);
|
1162
1171
|
});
|
1172
|
+
$("[data-toggle='tooltip']").tooltip();
|
1173
|
+
$("#is_fund_rank10").click(function () {
|
1174
|
+
$("#public_fund_date").remove();
|
1175
|
+
$("#public_fund_tips").html("Loading...");
|
1176
|
+
Util.fetch_public_fund(code);
|
1177
|
+
});
|
1163
1178
|
if (fund_len === 0 && date_len > 0) {
|
1164
1179
|
Util.fetch_public_fund(code);
|
1165
1180
|
}
|
@@ -3796,14 +3811,16 @@ const Util = {
|
|
3796
3811
|
|
3797
3812
|
/**
|
3798
3813
|
* 字符串按长度截断( substr 方法已被标记为过时(deprecated),建议使用 substring() 或者字符串切片语法(str.slice())来代替)
|
3814
|
+
* substring(start, end) 接受两个参数,分别是起始位置和结束位置;substring() 方法会将负数参数视为 0。
|
3815
|
+
* slice(start, end) 也接受两个参数,但是同样是起始位置和结束位置,其中结束位置可以为负数,表示从末尾开始计算;slice() 方法会将负数参数视为从末尾开始的索引。
|
3799
3816
|
* @param str
|
3800
3817
|
* @param len
|
3801
3818
|
* @returns {*}
|
3802
3819
|
*/
|
3803
3820
|
substring: function (str, len) {
|
3804
3821
|
if (str.length > len) {
|
3805
|
-
|
3806
|
-
str = str.substring(0, len) + "...";
|
3822
|
+
str = str.slice(0, len) + "...";
|
3823
|
+
//str = str.substring(0, len) + "...";
|
3807
3824
|
}
|
3808
3825
|
return str
|
3809
3826
|
},
|