sbd-npm 1.2.8 → 1.2.9

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/.npmignore +1 -0
  2. package/package.json +1 -1
  3. package/util.js +18 -9
package/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -1208,18 +1208,19 @@ const Util = {
1208
1208
  },
1209
1209
 
1210
1210
  /**
1211
- * 沪深港股通成交股统计
1211
+ * 初始简介组件
1212
1212
  * @param element_id
1213
1213
  * @param profile
1214
1214
  */
1215
1215
  init_profile_component: function(element_id, profile) {
1216
1216
  if (profile && profile.length > 0) {
1217
- Util.init_modal_skeleton("profile_modal");
1218
- $("#profile_modal_title").html("简介");
1219
- let sub_profile = Util.sub_str(profile, 250);
1220
- sub_profile += "&nbsp;&nbsp;&nbsp;<a class='unfold text-info' data-toggle='modal' data-target='.profile_modal' href='#'>展开</a>";
1221
- $("#" + element_id).html(sub_profile);
1222
- $('#profile_modal').on('shown.bs.modal', function () {
1217
+ let modal_id = element_id + "_modal";
1218
+ Util.init_modal_skeleton(modal_id);
1219
+ $("#" + modal_id + "_title").html("简介");
1220
+ let show_profile = Util.sub_str(profile, 250);
1221
+ show_profile += "&nbsp;&nbsp;&nbsp;<a class='unfold text-info' data-toggle='modal' data-target='." + modal_id + "' href='#'>展开</a>";
1222
+ $("#" + element_id).html(show_profile);
1223
+ $('#' + modal_id).on('shown.bs.modal', function () {
1223
1224
  let p_arr = profile.split("。");
1224
1225
  let _html = [];
1225
1226
  p_arr.forEach(function (p) {
@@ -1227,7 +1228,7 @@ const Util = {
1227
1228
  _html.push("<p>", p.replace(/,/g, ","), "。</p>");
1228
1229
  }
1229
1230
  });
1230
- Util.render_table_html("profile_modal_body", _html);
1231
+ Util.render_table_html(modal_id + "_body", _html);
1231
1232
  });
1232
1233
  }
1233
1234
  },
@@ -2213,12 +2214,20 @@ const Util = {
2213
2214
  parse_index_data: function (index_data) {
2214
2215
  let _html = [];
2215
2216
  if (index_data) {
2217
+ let is_small = Util.is_small_screen();
2216
2218
  index_data.forEach(function (item) {
2217
2219
  let short_name = item["name"];
2220
+ if (is_small) {
2221
+ short_name = short_name.replace("指数", "").replace("成指", "").replace("板指", "");
2222
+ }
2218
2223
  if (item["href"]) {
2219
2224
  short_name = "<a style='text-decoration: none;' href='" + item["href"] + "' target='_blank' rel='noopener noreferrer nofollow'>" + short_name + "</a>";
2220
2225
  }
2221
- _html.push("<span title='", item["name"], "'>", short_name, ":");
2226
+ let title = item["name"];
2227
+ if (item["code"]) {
2228
+ title = item["name"] + "(" + item["code"] + ")";
2229
+ }
2230
+ _html.push("<span title='", title, "'>", short_name, ":");
2222
2231
  _html.push(Util.pack_index_data(item["value"], item["change_rate"]));
2223
2232
  _html.push("</span> ");
2224
2233
  });