sbd-npm 1.2.77 → 1.2.79
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 +17 -8
package/package.json
CHANGED
package/util.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* 通用工具函数
|
3
3
|
* Theme https://colorlib.com/polygon/gentelella/index.html
|
4
|
+
* Font Awesome Icons https://fontawesome.com/v4/icons/
|
4
5
|
* [20 个杀手级 JavaScript 单行代码](https://segmentfault.com/a/1190000040721650)
|
5
6
|
*/
|
6
7
|
|
@@ -1238,15 +1239,21 @@ const Util = {
|
|
1238
1239
|
action: "currency_data"
|
1239
1240
|
};
|
1240
1241
|
Util.post(Util.get_url("macro_currency"), payload, function (j) {
|
1241
|
-
let _html = [];
|
1242
|
-
let low_exchange_rate = 0;
|
1243
|
-
let high_exchange_rate = 0;
|
1242
|
+
let _html = [], low_exchange_rate = 0, high_exchange_rate = 0;
|
1244
1243
|
j["data"].forEach(function (item) {
|
1245
|
-
if (low_exchange_rate === 0 || item["
|
1246
|
-
low_exchange_rate = item["
|
1244
|
+
if (low_exchange_rate === 0 || item["exchange_rate"] < low_exchange_rate) {
|
1245
|
+
low_exchange_rate = item["exchange_rate"];
|
1246
|
+
}
|
1247
|
+
high_exchange_rate = Math.max(high_exchange_rate, item["exchange_rate"]);
|
1248
|
+
});
|
1249
|
+
j["data"].forEach(function (item) {
|
1250
|
+
if (item["exchange_rate"] === high_exchange_rate) {
|
1251
|
+
_html.push("<tr class='danger'>");
|
1252
|
+
} else if (item["exchange_rate"] === low_exchange_rate) {
|
1253
|
+
_html.push("<tr class='success'>");
|
1254
|
+
} else {
|
1255
|
+
_html.push("<tr>");
|
1247
1256
|
}
|
1248
|
-
high_exchange_rate = Math.max(high_exchange_rate, item["high_exchange_rate"]);
|
1249
|
-
_html.push("<tr>");
|
1250
1257
|
_html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
|
1251
1258
|
_html.push("<td>", item["exchange_rate"], "</td>");
|
1252
1259
|
_html.push("<td>", item["low_exchange_rate"], "</td>");
|
@@ -1254,11 +1261,13 @@ const Util = {
|
|
1254
1261
|
_html.push("</tr>");
|
1255
1262
|
});
|
1256
1263
|
Util.render_table_html("currency_modal_body_body", _html);
|
1257
|
-
let currency_modal_summary = "
|
1264
|
+
let currency_modal_summary = "历史最低:<span class='label label-success'>" + j["hist_low"] +
|
1265
|
+
"</span> 历史最高:<span class='label label-danger'>" + j["hist_high"] +
|
1258
1266
|
"</span> 年初至今:" + Util.digit_compare_trend1(j["exchange_rate"], j["year_exchange_rate"]) +
|
1259
1267
|
" 52周最高:" + Util.digit_compare_trend1(j["exchange_rate"], j["week52high"]) +
|
1260
1268
|
" 52周最低:" + Util.digit_compare_trend1(j["exchange_rate"], j["week52low"]);
|
1261
1269
|
let title = j["name"] !== currency ? (j["name"] + "(" + currency.toUpperCase() + ")") : j["name"];
|
1270
|
+
title = '<i class="fa fa-' + currency + '"></i> ' + title;
|
1262
1271
|
title = Util.pack_html_link("https://cn.investing.com/currencies/" + currency + "-cny", title);
|
1263
1272
|
$("#currency_modal_title").html(title + " " + currency_modal_summary);
|
1264
1273
|
Util.hide_tips();
|