sbd-npm 1.1.12 → 1.1.16

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 +17 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.12",
3
+ "version": "1.1.16",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -247,8 +247,8 @@ let Util = {
247
247
  * @param obj
248
248
  * @param interval 循环间隔
249
249
  */
250
- refresh_price: function (obj, interval = 0) {
251
- let code_list = Util.get_code_list(obj);
250
+ refresh_price: function (element_id, interval = 0) {
251
+ let code_list = Util.get_code_list($("#" + element_id));
252
252
  if (code_list.length > 0) {
253
253
  $.post("/action", {action: "price", code_list: code_list.join("-")}, function (j) {
254
254
  $.each(j, function (code, item) {
@@ -257,7 +257,7 @@ let Util = {
257
257
  if (interval > 0 && Util.is_trade_time()) {
258
258
  interval = parseInt(interval > 4321 ? interval : 4321);
259
259
  setTimeout(function () {
260
- Util.refresh_price(obj, interval);
260
+ Util.refresh_price(element_id, interval);
261
261
  }, interval);
262
262
  }
263
263
  }, "json");
@@ -616,7 +616,14 @@ let Util = {
616
616
  _html.push('</tr></tbody>');
617
617
  _html.push('</table>');
618
618
  let tz_obj = $("#" + options["table_zone_id"]);
619
- tz_obj.html(_html.join(""));
619
+ if (tz_obj.hasClass("panel")) {
620
+ tz_obj.find("table").each(function () {
621
+ $(this).remove();
622
+ });
623
+ tz_obj.append(_html.join(""));
624
+ } else {
625
+ tz_obj.html(_html.join(""));
626
+ }
620
627
  if (Util.is_mobile() && !tz_obj.hasClass("table-responsive")) {
621
628
  let tz_obj_parent = tz_obj.parent();
622
629
  if (!tz_obj_parent.hasClass("table-responsive")) {
@@ -628,7 +635,7 @@ let Util = {
628
635
  }
629
636
  }
630
637
  if (is_table_sort === 1) {
631
- Util.table_sort();
638
+ Util.table_sort(options["table_zone_id"]);
632
639
  }
633
640
  if (is_tooltip === 1) {
634
641
  $("[data-toggle='tooltip']").tooltip();
@@ -1137,8 +1144,9 @@ let Util = {
1137
1144
  });
1138
1145
  },
1139
1146
 
1140
- table_sort: function () {
1141
- $(".table_sort").each(function () {
1147
+ table_sort: function (element_id = "") {
1148
+ let selector = element_id === "" ? ".table_sort" : ("#" + element_id + " .table_sort");
1149
+ $(selector).each(function () {
1142
1150
  let is_append = 0;
1143
1151
  $(this).find("i").each(function () {
1144
1152
  if ($(this).hasClass("fa")) {
@@ -1328,7 +1336,7 @@ let Util = {
1328
1336
  obj.tooltip();
1329
1337
  },
1330
1338
 
1331
- init_stock_stuff: function (element_id, index_list) {
1339
+ init_stock_stuff: function (element_id, index_list, is_us = 0) {
1332
1340
  let code_list = Util.get_code_list($("#" + element_id));
1333
1341
  if (code_list.length > 0) {
1334
1342
  Util.show_tips("Loading...");
@@ -1363,7 +1371,7 @@ let Util = {
1363
1371
  $("#remark_" + code).html(remark);
1364
1372
  }
1365
1373
  });
1366
- Util.refresh_index_price(element_id, index_list.join("-"));
1374
+ Util.refresh_index_price(element_id, index_list.join("-"), is_us);
1367
1375
  Util.hide_tips();
1368
1376
  }, "json");
1369
1377
  }