sbd-npm 1.2.16 → 1.2.19

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/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
package/constant.js CHANGED
@@ -224,7 +224,7 @@ const MenuList = [
224
224
  {'key': 'other_bond', 'name': '地方债数据', 'url': '/fbe79af9b125b8952d05801dcf1ea4c1'},
225
225
  {'key': 'other_convertible_bond', 'name': '可转债数据', 'url': '/cf21d0fe6fe66c94488dab9cfef16c0a'},
226
226
  {'key': 'other_fortune500', 'name': '财富500强', 'url': '/04d4033d33ea4c0cdd0d874dde23ef2c'},
227
- {'key': 'other_material', 'name': '资料', 'url': '/384dd1f2f7cbfc1739f78d047ef22350'},
227
+ {'key': 'other_material', 'name': 'wiki', 'url': '/384dd1f2f7cbfc1739f78d047ef22350'},
228
228
  ]
229
229
  },
230
230
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.16",
3
+ "version": "1.2.19",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -354,7 +354,7 @@ const Util = {
354
354
  if ($("#price_change_" + code).length) {
355
355
  let price_cls = Util.text_color(item["price"], item["previous_price"]);
356
356
  $(".price_" + code).each(function () {
357
- $(this).html("<b class='" + price_cls + "'>" + item["price"] + "</b>");
357
+ $(this).html("<b class='" + price_cls + "'>" + Util.to_float(item["price"], 2) + "</b>");
358
358
  });
359
359
  $("#price_change_" + code).html(Util.year_price_rate(item["price"], item["previous_price"]));
360
360
  } else {
@@ -1241,6 +1241,41 @@ const Util = {
1241
1241
  }
1242
1242
  },
1243
1243
 
1244
+ /**
1245
+ * 初始板块组件
1246
+ * @param component_id
1247
+ */
1248
+ init_classify_component: function (component_id) {
1249
+ let element_id = component_id.replace("_div", "");
1250
+ let html = [];
1251
+ html.push('<label for="', element_id, '"></label>');
1252
+ html.push('<select id="', element_id, '" class="form-control">');
1253
+ html.push('<option value="">板块</option>');
1254
+ ClassifyList.forEach(function (classify) {
1255
+ html.push('<option value="', classify, '">', classify, '</option>');
1256
+ });
1257
+ html.push('</select>');
1258
+ $("#" + component_id).html(html.join(""));
1259
+ },
1260
+
1261
+ /**
1262
+ * 数量限制组件
1263
+ * @param component_id
1264
+ */
1265
+ init_limit_num_component: function (component_id) {
1266
+ let element_id = component_id.replace("_div", "");
1267
+ let html = [];
1268
+ html.push('<label for="', element_id, '"></label>');
1269
+ html.push('<select id="', element_id, '" class="form-control">');
1270
+ html.push('<option value="50">50</option>');
1271
+ html.push('<option value="100" selected>100</option>');
1272
+ html.push('<option value="200">200</option>');
1273
+ html.push('<option value="500">500</option>');
1274
+ html.push('<option value="1000">1000</option>');
1275
+ html.push('</select>');
1276
+ $("#" + component_id).html(html.join(""));
1277
+ },
1278
+
1244
1279
  /**
1245
1280
  * 当前时间戳
1246
1281
  * @returns {number}
@@ -2610,7 +2645,18 @@ const Util = {
2610
2645
  to_float: function (digit, fraction = 2) {
2611
2646
  if (digit) {
2612
2647
  fraction = Math.pow(10, fraction);
2613
- return Math.round(digit * fraction) / fraction;
2648
+ digit = Math.round(digit * fraction) / fraction;
2649
+ if (fraction === 100) {
2650
+ let digit_arr = digit.toString().split(".");
2651
+ if (digit_arr.length > 1) {
2652
+ if (digit_arr[1].length === 1) {
2653
+ return (digit + "0");
2654
+ }
2655
+ } else {
2656
+ return (digit + ".00");
2657
+ }
2658
+ }
2659
+ return digit;
2614
2660
  }
2615
2661
  return 0;
2616
2662
  },