sbd-npm 1.2.72 → 1.2.73

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 (3) hide show
  1. package/package.json +1 -1
  2. package/stock_basics.js +11 -7
  3. package/util.js +30 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.72",
3
+ "version": "1.2.73",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -243,12 +243,16 @@ let Stock = {
243
243
  let ma_deduction_html = [];
244
244
  item["ma_deduction"].forEach(function (ma) {
245
245
  if (ma["deduction_price"] > 0) {
246
+ let day_ma_str = ma["day"] + "日均线";
247
+ if (ma["day"] === 20 || ma["day"] === 60 || ma["day"] === 120) {
248
+ day_ma_str = "<span class='label label-info'>" + day_ma_str + "</span>";
249
+ }
246
250
  let deduction_cls = Util.text_color(item["price"], ma["deduction_price"]);
247
251
  let ma_cls = Util.text_color(item["price"], ma["ma"]);
248
- ma_deduction_html.push(ma["day"] + "日均线:<b class='" + ma_cls + "'>" + ma["ma"] + "</b>(<b class='" + deduction_cls + "'>" + ma["deduction_price"] + "</b>)");
252
+ ma_deduction_html.push(day_ma_str + ":<b class='" + ma_cls + "'>" + ma["ma"] + "</b>(<b class='" + deduction_cls + "'>" + ma["deduction_price"] + "</b>)");
249
253
  }
250
254
  });
251
- $("#ma_deduction").html(ma_deduction_html.join(""));
255
+ $("#ma_deduction").html(ma_deduction_html.join("&nbsp;&nbsp;"));
252
256
  }
253
257
  if (item["boll_up"] && item["boll_up"] > 0 && item["boll_down"] && item["boll_down"] > 0) {
254
258
  $("#boll").html("<a title='当前上轨线 / 当前下轨线' target='_blank' rel='noopener noreferrer nofollow' href='" + Util.get_url("trend_boll") + "'><b class='text-danger'>" + Util.to_float(item["boll_up"], 2) + "</b> / <b class='text-success'>" + Util.to_float(item["boll_down"], 2) + "</b></a>");
@@ -400,11 +404,11 @@ let Stock = {
400
404
  Util.render_table_html("big_deal_table_body", _html);
401
405
  _html = [];
402
406
  _html.push("<tr>");
403
- _html.push("<td><b class='", Util.text_color(total_net_inflow), "'>", Util.to_unit(total_net_inflow), "</b></td>");
404
- _html.push("<td><b class='", Util.text_color(day20_net_inflow), "'>", Util.to_unit(day20_net_inflow), "</b></td>");
405
- _html.push("<td><b class='", Util.text_color(day10_net_inflow), "'>", Util.to_unit(day10_net_inflow), "</b></td>");
406
- _html.push("<td><b class='", Util.text_color(day5_net_inflow), "'>", Util.to_unit(day5_net_inflow), "</b></td>");
407
- _html.push("<td><b class='", Util.text_color(day3_net_inflow), "'>", Util.to_unit(day3_net_inflow), "</b></td>");
407
+ _html.push("<td><b class='", Util.text_color(total_net_inflow), "'>", Util.to_unit(total_net_inflow, 4), "</b></td>");
408
+ _html.push("<td><b class='", Util.text_color(day20_net_inflow), "'>", Util.to_unit(day20_net_inflow, 4), "</b></td>");
409
+ _html.push("<td><b class='", Util.text_color(day10_net_inflow), "'>", Util.to_unit(day10_net_inflow, 4), "</b></td>");
410
+ _html.push("<td><b class='", Util.text_color(day5_net_inflow), "'>", Util.to_unit(day5_net_inflow, 4), "</b></td>");
411
+ _html.push("<td><b class='", Util.text_color(day3_net_inflow), "'>", Util.to_unit(day3_net_inflow, 4), "</b></td>");
408
412
  _html.push("</tr>");
409
413
  Util.render_table_html("big_deal_summary_table_body", _html);
410
414
  }
package/util.js CHANGED
@@ -144,15 +144,17 @@ const Util = {
144
144
  let _html = [];
145
145
  _html.push('<div class="menu_section">');
146
146
  _html.push('<ul class="nav side-menu">');
147
- MenuList.forEach(function (menu) {
148
- _html.push('<li><a><i class="fa fa-', menu["icon"], '"></i> ', menu["name"], ' <span class="fa fa-chevron-down"></span></a>');
149
- _html.push('<ul class="nav child_menu">');
150
- menu["menu"].forEach(function (m) {
151
- _html.push('<li><a href="', m["url"], '">', m["name"], '</a></li>');
147
+ if (typeof MenuList != "undefined") {
148
+ MenuList.forEach(function (menu) {
149
+ _html.push('<li><a><i class="fa fa-', menu["icon"], '"></i> ', menu["name"], ' <span class="fa fa-chevron-down"></span></a>');
150
+ _html.push('<ul class="nav child_menu">');
151
+ menu["menu"].forEach(function (m) {
152
+ _html.push('<li><a href="', m["url"], '">', m["name"], '</a></li>');
153
+ });
154
+ _html.push('</ul>');
155
+ _html.push('</li>');
152
156
  });
153
- _html.push('</ul>');
154
- _html.push('</li>');
155
- });
157
+ }
156
158
  _html.push('</div>');
157
159
  _html.push('</div>');
158
160
  $("#sidebar-menu").html(_html.join(""));
@@ -165,13 +167,15 @@ const Util = {
165
167
  */
166
168
  get_url: function (key) {
167
169
  let url = location.pathname;
168
- MenuList.forEach(function (menu) {
169
- menu["menu"].forEach(function (m) {
170
- if (m["key"] === key) {
171
- url = m["url"];
172
- }
170
+ if (typeof MenuList != "undefined") {
171
+ MenuList.forEach(function (menu) {
172
+ menu["menu"].forEach(function (m) {
173
+ if (m["key"] === key) {
174
+ url = m["url"];
175
+ }
176
+ });
173
177
  });
174
- });
178
+ }
175
179
  return url;
176
180
  },
177
181
 
@@ -1321,9 +1325,11 @@ const Util = {
1321
1325
  html.push('<label for="', element_id, '"></label>');
1322
1326
  html.push('<select id="', element_id, '" class="form-control">');
1323
1327
  html.push('<option value="">指数板块</option>');
1324
- ClassifyList.forEach(function (classify) {
1325
- html.push('<option value="', classify, '">', classify, '</option>');
1326
- });
1328
+ if (typeof ClassifyList != "undefined") {
1329
+ ClassifyList.forEach(function (classify) {
1330
+ html.push('<option value="', classify, '">', classify, '</option>');
1331
+ });
1332
+ }
1327
1333
  html.push('</select>');
1328
1334
  $("#" + component_id).html(html.join(""));
1329
1335
  },
@@ -1360,11 +1366,13 @@ const Util = {
1360
1366
  if (is_select !== 1) {
1361
1367
  html.push('<option value="">指数</option>');
1362
1368
  }
1363
- IndexList.forEach(function (item) {
1364
- if (index_type === 0 || (index_type === 1 && item["is_industry"] === 1) || (index_type === 2 && item["is_key"] === 1)) {
1365
- html.push('<option ', ((item["code"] === "SH000906" && is_select === 1) ? "selected" : ""), ' value="', item["code"], '">', item["name"], '</option>');
1366
- }
1367
- });
1369
+ if (typeof IndexList != "undefined") {
1370
+ IndexList.forEach(function (item) {
1371
+ if (index_type === 0 || (index_type === 1 && item["is_industry"] === 1) || (index_type === 2 && item["is_key"] === 1)) {
1372
+ html.push('<option ', ((item["code"] === "SH000906" && is_select === 1) ? "selected" : ""), ' value="', item["code"], '">', item["name"], '</option>');
1373
+ }
1374
+ });
1375
+ }
1368
1376
  html.push('</select>');
1369
1377
  $("#" + component_id).html(html.join(""));
1370
1378
  },