sbd-npm 1.3.37 → 1.3.39

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 +27 -2
  3. package/util.js +10 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.37",
3
+ "version": "1.3.39",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -329,7 +329,25 @@ let Stock = {
329
329
  Util.parse_value_trend("sell_amount-td");
330
330
  Util.parse_value_trend("rzmre-td");
331
331
  Util.parse_value_trend("rzye-td");
332
- $("#stock_hist_summary").html("<b>时间区间内总成交额: <span class='label label-info'>" + Util.to_unit(total_amount) + "</span>, 总成交量: <span class='label label-info'>" + Util.to_unit(total_volume) + "</span> 股, 平均成交价: <span class='label label-warning'>" + Util.to_float(total_amount / total_volume, 2) + "</span></b>");
332
+ let stock_hist_summary = "";
333
+ if (j["high_amount"] && j["high_amount"] > 0) {
334
+ stock_hist_summary += "<b>历史最高成交额(<a class='hist_summary_link' href='#'>" + Util.seconds_to_format(j["high_amount_date"], "%Y-%m-%d") + "</a>):<span class='label label-danger'>" + Util.to_unit(j["high_amount"]) + "</span></b>,";
335
+ }
336
+ if (j["high_volume"] && j["high_volume"] > 0) {
337
+ stock_hist_summary += "<b>历史最高成交量(<a class='hist_summary_link' href='#'>" + Util.seconds_to_format(j["high_volume_date"], "%Y-%m-%d") + "</a>):<span class='label label-danger'>" + Util.to_unit(j["high_volume"]) + "手</span></b>,";
338
+ }
339
+ stock_hist_summary += "<b>时间区间内总成交额: <span class='label label-info'>" + Util.to_unit(total_amount) + "</span>,总成交量: <span class='label label-info'>" + Util.to_unit(total_volume) + "</span> 股,平均成交价: <span class='label label-warning'>" + Util.to_float(total_amount / total_volume, 2) + "</span></b>";
340
+ $("#stock_hist_summary").html(stock_hist_summary);
341
+ $("#stock_hist_summary .hist_summary_link").each(function() {
342
+ $(this).click(function() {
343
+ let summary_date = $(this).text();
344
+ if (Util.regexp_date_yyyy_mm_dd(summary_date)) {
345
+ $("#hist_start_date").val(summary_date);
346
+ $("#hist_end_date").val(summary_date);
347
+ Stock.fetch_hist_data();
348
+ }
349
+ });
350
+ });
333
351
  Util.hide_tips();
334
352
  });
335
353
  },
@@ -1112,6 +1130,11 @@ let Stock = {
1112
1130
 
1113
1131
  fetch_margin: function () {
1114
1132
  Stock["rzye_chart"] = Util.show_chart_loading(Stock["rzye_chart"], "rzye_line_canvas");
1133
+ let margin_url = "http://www.szse.cn/disclosure/margin/margin/index.html";
1134
+ if (Util.is_sh(Stock["code"])) {
1135
+ margin_url = "http://www.sse.com.cn/market/othersdata/margin/detail/";
1136
+ }
1137
+ $("#margin_panel_title").html(Util.pack_html_link(margin_url, "[" + Stock.name + "]融资余额"));
1115
1138
  let payload = {
1116
1139
  action: "margin",
1117
1140
  date_type: $("#margin_date_type").val(),
@@ -1131,7 +1154,6 @@ let Stock = {
1131
1154
  rqye_data.push(Util.to_float(item["rqye"], 2));
1132
1155
  price_data.push(item["price"]);
1133
1156
  });
1134
- $("#margin_title").html(Util.pack_html_link(j["url"], "[" + Stock.name + "]融资余额"));
1135
1157
  let margin_summary = "";
1136
1158
  if (j["latest"].length > 0) {
1137
1159
  if (j["latest"].length === 1) {
@@ -1156,6 +1178,9 @@ let Stock = {
1156
1178
  if (j["low"] && j["low"]["date"] && j["low"]["date"] > 0) {
1157
1179
  margin_summary += ' 历史最低: ' + Util.to_unit(j["low"]["rzye"], 3) + '(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')';
1158
1180
  }
1181
+ if (j["less_rate"]) {
1182
+ margin_summary += '&nbsp;&nbsp;当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j["less_rate"] + '%</span> 分位水平';
1183
+ }
1159
1184
  $("#margin_summary").html(margin_summary);
1160
1185
  Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额(单位:亿)', rzye_data, '股价', price_data);
1161
1186
  let flow_data = [], color_data = [];
package/util.js CHANGED
@@ -922,12 +922,16 @@ const Util = {
922
922
  tz_obj.html(_html.join(""));
923
923
  }
924
924
  if ((Util.is_mobile() || Util.is_small_screen()) && !tz_obj.hasClass("table-responsive")) {
925
- let tz_obj_parent = tz_obj.parent();
926
- if (!tz_obj_parent.hasClass("table-responsive")) {
927
- if (tz_obj_parent.hasClass("row")) {
928
- tz_obj_parent.addClass("table-responsive");
929
- } else {
930
- tz_obj.addClass("table-responsive");
925
+ if (tz_obj.hasClass("panel")) {
926
+ tz_obj.addClass("table-responsive");
927
+ } else {
928
+ let tz_obj_parent = tz_obj.parent();
929
+ if (!tz_obj_parent.hasClass("table-responsive")) {
930
+ if (tz_obj_parent.hasClass("row")) {
931
+ tz_obj_parent.addClass("table-responsive");
932
+ } else {
933
+ tz_obj.addClass("table-responsive");
934
+ }
931
935
  }
932
936
  }
933
937
  }