sbd-npm 1.2.78 → 1.2.80

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util.js +16 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.78",
3
+ "version": "1.2.80",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -1239,15 +1239,21 @@ const Util = {
1239
1239
  action: "currency_data"
1240
1240
  };
1241
1241
  Util.post(Util.get_url("macro_currency"), payload, function (j) {
1242
- let _html = [];
1243
- let low_exchange_rate = 0;
1244
- let high_exchange_rate = 0;
1242
+ let _html = [], low_exchange_rate = 0, high_exchange_rate = 0;
1245
1243
  j["data"].forEach(function (item) {
1246
- if (low_exchange_rate === 0 || item["low_exchange_rate"] < low_exchange_rate) {
1247
- low_exchange_rate = item["low_exchange_rate"];
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>");
1248
1256
  }
1249
- high_exchange_rate = Math.max(high_exchange_rate, item["high_exchange_rate"]);
1250
- _html.push("<tr>");
1251
1257
  _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1252
1258
  _html.push("<td>", item["exchange_rate"], "</td>");
1253
1259
  _html.push("<td>", item["low_exchange_rate"], "</td>");
@@ -1255,7 +1261,8 @@ const Util = {
1255
1261
  _html.push("</tr>");
1256
1262
  });
1257
1263
  Util.render_table_html("currency_modal_body_body", _html);
1258
- let currency_modal_summary = "最低:<span class='label label-success'>" + low_exchange_rate + "</span> 最高:<span class='label label-danger'>" + high_exchange_rate +
1264
+ let currency_modal_summary = "历史最低:<span class='label label-success'>" + j["hist_low"] +
1265
+ "</span> 历史最高:<span class='label label-danger'>" + j["hist_high"] +
1259
1266
  "</span> 年初至今:" + Util.digit_compare_trend1(j["exchange_rate"], j["year_exchange_rate"]) +
1260
1267
  " 52周最高:" + Util.digit_compare_trend1(j["exchange_rate"], j["week52high"]) +
1261
1268
  " 52周最低:" + Util.digit_compare_trend1(j["exchange_rate"], j["week52low"]);
@@ -2016,7 +2023,7 @@ const Util = {
2016
2023
  sort_cls = "fa-sort-desc";
2017
2024
  }
2018
2025
  table.children('tbody').empty().html(row_arr);
2019
- table.find("i").each(function () {
2026
+ table.children('thead').find("i").each(function () {
2020
2027
  if ($(this).hasClass("fa")) {
2021
2028
  $(this).removeClass("fa-sort-asc");
2022
2029
  $(this).removeClass("fa-sort-desc");