sbd-npm 1.1.91 → 1.1.94
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 +29 -19
package/package.json
CHANGED
package/util.js
CHANGED
@@ -651,6 +651,7 @@ const Util = {
|
|
651
651
|
if (options["head_cols"]) {
|
652
652
|
let is_table_sort = 0;
|
653
653
|
let is_tooltip = 0;
|
654
|
+
let head_length = options["head_cols"].length;
|
654
655
|
let _html = [];
|
655
656
|
if (options["alert"]) {
|
656
657
|
_html.push('<div class="alert alert-info" role="alert">');
|
@@ -698,6 +699,9 @@ const Util = {
|
|
698
699
|
td_class.push(col["class"]);
|
699
700
|
}
|
700
701
|
if (col["colspan"]) {
|
702
|
+
if (col["colspan"] > 1) {
|
703
|
+
head_length += (col["colspan"] - 1);
|
704
|
+
}
|
701
705
|
td_attr += ' colspan="' + col["colspan"] + '"';
|
702
706
|
}
|
703
707
|
if (col["table_sort"]) {
|
@@ -728,7 +732,7 @@ const Util = {
|
|
728
732
|
});
|
729
733
|
_html.push('</tr></thead>');
|
730
734
|
_html.push('<tbody id="', options["element_id"], '_body"><tr>');
|
731
|
-
_html.push('<td class="text-center" colspan="',
|
735
|
+
_html.push('<td class="text-center" colspan="', head_length, '">', (options["body_tips"] ? options["body_tips"] : "Loading..."), '</td>');
|
732
736
|
_html.push('</tr></tbody>');
|
733
737
|
_html.push('</table>');
|
734
738
|
let tz_obj = $("#" + options["element_id"]);
|
@@ -829,6 +833,7 @@ const Util = {
|
|
829
833
|
{"name": "最高价"},
|
830
834
|
{"name": "最低价"},
|
831
835
|
{"name": "年初至今", "table_sort": 1},
|
836
|
+
{"name": "近5日", "table_sort": 1},
|
832
837
|
{"name": "52周最高", "table_sort": 1}
|
833
838
|
];
|
834
839
|
if (stock_category !== "us") {
|
@@ -879,6 +884,7 @@ const Util = {
|
|
879
884
|
_html.push("<td id='high_", item["code"], "'>0</td>");
|
880
885
|
_html.push("<td id='low_", item["code"], "'>0</td>");
|
881
886
|
_html.push("<td class='year_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["year_price"]) : "--"), "</td>");
|
887
|
+
_html.push("<td class='d5_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["d5_price"]) : "--"), "</td>");
|
882
888
|
_html.push("<td class='high_52week_", item["code"], "'>--</td>");
|
883
889
|
if (is_us === 0) {
|
884
890
|
_html.push("<td id='amount_", item["code"], "'>--</td>");
|
@@ -1711,27 +1717,31 @@ const Util = {
|
|
1711
1717
|
let td_index = $(this).index();
|
1712
1718
|
let get_td_value = function (row) {
|
1713
1719
|
let td_obj = $(row).children('td').eq(td_index);
|
1714
|
-
|
1715
|
-
|
1716
|
-
if (Util.regexp_date_yyyy_mm_dd(td_val)) {
|
1717
|
-
return Util.format_to_second(td_val);
|
1720
|
+
if (td_obj.attr("data-val")) {
|
1721
|
+
return td_obj.attr("data-val");
|
1718
1722
|
} else {
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
if (match_arr.length >= 2) {
|
1724
|
-
return match_arr[1];
|
1725
|
-
}
|
1726
|
-
return 0;
|
1723
|
+
let td_val = td_obj.text();
|
1724
|
+
// 2017-12-7 这种时间格式
|
1725
|
+
if (Util.regexp_date_yyyy_mm_dd(td_val)) {
|
1726
|
+
return Util.format_to_second(td_val);
|
1727
1727
|
} else {
|
1728
|
-
//
|
1729
|
-
let
|
1730
|
-
match_arr =
|
1731
|
-
if ($.isArray(match_arr)
|
1732
|
-
|
1728
|
+
// 174.36(+0.79%) 括号里的数字
|
1729
|
+
let bracket_re = /\(([-+]?\d*\.?\d+|[-+]?\d+|\d+)\%?\)/;
|
1730
|
+
let match_arr = bracket_re.exec(td_val);
|
1731
|
+
if ($.isArray(match_arr)) {
|
1732
|
+
if (match_arr.length >= 2) {
|
1733
|
+
return match_arr[1];
|
1734
|
+
}
|
1735
|
+
return 0;
|
1736
|
+
} else {
|
1737
|
+
// 匹配数字
|
1738
|
+
let digit_re = /([-+]?\d*\.?\d+|[-+]?\d+|\d+)/;
|
1739
|
+
match_arr = digit_re.exec(td_val);
|
1740
|
+
if ($.isArray(match_arr) && match_arr[0]) {
|
1741
|
+
return match_arr[0];
|
1742
|
+
}
|
1743
|
+
return Util.filter_chinese(td_val).replace("%", "");
|
1733
1744
|
}
|
1734
|
-
return Util.filter_chinese(td_val).replace("%", "");
|
1735
1745
|
}
|
1736
1746
|
}
|
1737
1747
|
};
|