sbd-npm 1.4.22 → 1.4.24

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/util.js CHANGED
@@ -132,23 +132,25 @@ const Util = {
132
132
  * 初始目录
133
133
  */
134
134
  init_menu: function () {
135
- let _html = [];
136
- _html.push('<div class="menu_section">');
137
- _html.push('<ul class="nav side-menu">');
135
+ let html = [];
136
+ html.push('<div class="menu_section">');
137
+ html.push('<ul class="nav side-menu">');
138
138
  if (typeof MenuList != "undefined") {
139
139
  MenuList.forEach(function (menu) {
140
- _html.push('<li><a><i class="fa fa-', menu["icon"], '"></i> ', menu["name"], ' <span class="fa fa-chevron-down"></span></a>');
141
- _html.push('<ul class="nav child_menu">');
140
+ html.push('<li><a><i class="fa fa-', menu["icon"], '"></i> ', menu["name"], ' <span class="fa fa-chevron-down"></span></a>');
141
+ html.push('<ul class="nav child_menu">');
142
142
  menu["menu"].forEach(function (m) {
143
- _html.push('<li><a href="', m["url"], '">', m["name"], '</a></li>');
143
+ if (!("is_hide" in m)) {
144
+ html.push('<li><a href="', m["url"], '">', m["name"], '</a></li>');
145
+ }
144
146
  });
145
- _html.push('</ul>');
146
- _html.push('</li>');
147
+ html.push('</ul>');
148
+ html.push('</li>');
147
149
  });
148
150
  }
149
- _html.push('</div>');
150
- _html.push('</div>');
151
- $("#sidebar-menu").html(_html.join(""));
151
+ html.push('</div>');
152
+ html.push('</div>');
153
+ $("#sidebar-menu").html(html.join(""));
152
154
  },
153
155
 
154
156
  /**
@@ -277,6 +279,7 @@ const Util = {
277
279
  $.ajax({
278
280
  url: url,
279
281
  headers: {
282
+ 'Cache-Control': 'no-cache',
280
283
  'X-CSRF-TOKEN': Util.get_cookie('_csrf_token')
281
284
  },
282
285
  async: true,
@@ -803,39 +806,39 @@ const Util = {
803
806
  if (!$("#" + page_id).length) {
804
807
  $("#" + data_id).parent().after('<div id="' + page_id + '" class="text-center"></div>');
805
808
  }
806
- let _html = [];
809
+ let html = [];
807
810
  let total_page = Math.ceil(total_num / per_page);
808
- _html.push("<ul class='pagination'>");
811
+ html.push("<ul class='pagination'>");
809
812
  if (total_num > 0) {
810
- _html.push("<li class='disabled'><a href='#'><b>共 ", total_num, " 条,", total_page, " 页</b></a></li>");
813
+ html.push("<li class='disabled'><a href='#'><b>共 ", total_num, " 条,", total_page, " 页</b></a></li>");
811
814
  current_page = current_page ? current_page : 1;
812
815
  let range = 5;
813
816
  let show_items = (range * 2) + 1;
814
817
  if (current_page > 2 && current_page - range > 1) {
815
- _html.push("<li data-page='1'><a href='#'>最前</a></li>");
818
+ html.push("<li data-page='1'><a href='#'>最前</a></li>");
816
819
  }
817
820
  if (current_page > 1 && show_items < total_page) {
818
- _html.push("<li data-page='", current_page - 1, "'><a href='#'>上一页</a></li>");
821
+ html.push("<li data-page='", current_page - 1, "'><a href='#'>上一页</a></li>");
819
822
  }
820
823
  for (let i = 1; i <= total_page; i++) {
821
824
  if (1 !== total_page && (!(i >= current_page + range + 1 || i <= current_page - range - 1) || total_page <= show_items)) {
822
825
  if (current_page === i) {
823
- _html.push("<li class='active'><a href='#'>", i, "</a></li>");
826
+ html.push("<li class='active'><a href='#'>", i, "</a></li>");
824
827
  } else {
825
- _html.push("<li data-page='", i, "'><a href='#'>", i, "</a></li>");
828
+ html.push("<li data-page='", i, "'><a href='#'>", i, "</a></li>");
826
829
  }
827
830
  }
828
831
  }
829
832
  if (current_page < total_page && show_items < total_page) {
830
- _html.push("<li data-page='", current_page + 1, "'><a href='#'>下一页</a></li>");
833
+ html.push("<li data-page='", current_page + 1, "'><a href='#'>下一页</a></li>");
831
834
  }
832
835
  if (current_page < total_page - 1 && current_page + range - 1 < total_page && show_items < total_page) {
833
- _html.push("<li data-page='", total_page, "'><a href='#'>最后</a></li>");
836
+ html.push("<li data-page='", total_page, "'><a href='#'>最后</a></li>");
834
837
  }
835
838
  }
836
- _html.push("</ul>");
839
+ html.push("</ul>");
837
840
  let fg = $("#" + page_id);
838
- fg.html(_html.join(""));
841
+ fg.html(html.join(""));
839
842
  fg.find("li").each(function () {
840
843
  let click_page = $(this).attr("data-page");
841
844
  if (click_page) {
@@ -853,23 +856,23 @@ const Util = {
853
856
  */
854
857
  init_modal_skeleton: function (modal_id, modal_content_html = "") {
855
858
  if (!$("#" + modal_id).length) {
856
- let _html = [];
857
- _html.push('<div class="modal fade ', modal_id, '" id="', modal_id, '" tabindex="-1" role="dialog" aria-hidden="true">');
858
- _html.push('<div class="modal-dialog modal-lg modal-xlg"><div class="modal-content">');
859
- _html.push('<div class="modal-header">');
860
- _html.push('<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>');
861
- _html.push('<h4 class="modal-title" id="', modal_id, '_title">Loading...</h4>');
862
- _html.push('</div>');
859
+ let html = [];
860
+ html.push('<div class="modal fade ', modal_id, '" id="', modal_id, '" tabindex="-1" role="dialog" aria-hidden="true">');
861
+ html.push('<div class="modal-dialog modal-lg modal-xlg"><div class="modal-content">');
862
+ html.push('<div class="modal-header">');
863
+ html.push('<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>');
864
+ html.push('<h4 class="modal-title" id="', modal_id, '_title">Loading...</h4>');
865
+ html.push('</div>');
863
866
  if (Util.is_mobile()) {
864
- _html.push('<div id="', modal_id, '_body" class="modal-body table-responsive">');
867
+ html.push('<div id="', modal_id, '_body" class="modal-body table-responsive">');
865
868
  } else {
866
- _html.push('<div id="', modal_id, '_body" class="modal-body">');
869
+ html.push('<div id="', modal_id, '_body" class="modal-body">');
867
870
  }
868
- _html.push(modal_content_html);
869
- _html.push('</div>');
870
- _html.push('</div></div>');
871
- _html.push('</div>');
872
- $("body").append(_html.join(""));
871
+ html.push(modal_content_html);
872
+ html.push('</div>');
873
+ html.push('</div></div>');
874
+ html.push('</div>');
875
+ $("body").append(html.join(""));
873
876
  }
874
877
  },
875
878
 
@@ -879,26 +882,26 @@ const Util = {
879
882
  */
880
883
  init_table_skeleton: function (options) {
881
884
  if (options["head_cols"]) {
882
- let is_table_sort = 0, is_tooltip = 0, _html = [];
885
+ let is_table_sort = 0, is_tooltip = 0, html = [];
883
886
  let head_length = options["head_cols"].length;
884
887
  if (options["alert"]) {
885
- _html.push('<div class="alert alert-info" role="alert">');
886
- _html.push(options["alert"]);
887
- _html.push('</div>');
888
+ html.push('<div class="alert alert-info" role="alert">');
889
+ html.push(options["alert"]);
890
+ html.push('</div>');
888
891
  }
889
892
  let table_class = options["table_class"] ? options["table_class"] : "table table-bordered table-hover table-striped text-center";
890
- _html.push('<table class="' + table_class + '">');
893
+ html.push('<table class="' + table_class + '">');
891
894
  if (options["caption"]) {
892
895
  if (/<[^>]+>$/.test(options["caption"])) { // 正则匹配所有HTML闭合(<caption></caption>)标签内容
893
- _html.push(options["caption"]);
896
+ html.push(options["caption"]);
894
897
  }
895
898
  } else {
896
- _html.push("<caption></caption>");
899
+ html.push("<caption></caption>");
897
900
  }
898
901
  if (options["head_id"]) {
899
- _html.push('<thead id="', options["head_id"], '"><tr>');
902
+ html.push('<thead id="', options["head_id"], '"><tr>');
900
903
  } else {
901
- _html.push('<thead><tr>');
904
+ html.push('<thead><tr>');
902
905
  }
903
906
  options["head_cols"].forEach(function (col) {
904
907
  let td_attr = "", td_class = [];
@@ -932,7 +935,7 @@ const Util = {
932
935
  if (td_class.length > 0) {
933
936
  td_attr += ' class="' + td_class.join(" ") + '"';
934
937
  }
935
- _html.push('<td', td_attr, '><label for="' + col["select_id"] + '"></label><select id="' + col["select_id"] + '">' + option_html + '</select></td>');
938
+ html.push('<td', td_attr, '><label for="' + col["select_id"] + '"></label><select id="' + col["select_id"] + '">' + option_html + '</select></td>');
936
939
  } else {
937
940
  if (col["table_sort"]) {
938
941
  is_table_sort = 1;
@@ -954,25 +957,25 @@ const Util = {
954
957
  tooltip = ' <i class="glyphicon glyphicon-info-sign" data-html="true" data-toggle="tooltip" data-container="body" data-original-title="' + col["tooltip"] + '"></i>';
955
958
  }
956
959
  if (col["sort_type"]) {
957
- _html.push('<td', td_attr, '><a class="sort_type" href="#" data-val="', col["sort_type"], '">', col["name"], tooltip, '</a></td>');
960
+ html.push('<td', td_attr, '><a class="sort_type" href="#" data-val="', col["sort_type"], '">', col["name"], tooltip, '</a></td>');
958
961
  } else {
959
- _html.push('<td', td_attr, '>', col["name"], tooltip, '</td>');
962
+ html.push('<td', td_attr, '>', col["name"], tooltip, '</td>');
960
963
  }
961
964
  }
962
965
  });
963
- _html.push('</tr></thead>');
964
- _html.push('<tbody id="', options["element_id"], '_body"><tr>');
965
- _html.push('<td class="text-center" colspan="', head_length, '">', (options["body_tips"] ? options["body_tips"] : "Loading..."), '</td>');
966
- _html.push('</tr></tbody>');
967
- _html.push('</table>');
966
+ html.push('</tr></thead>');
967
+ html.push('<tbody id="', options["element_id"], '_body"><tr>');
968
+ html.push('<td class="text-center" colspan="', head_length, '">', (options["body_tips"] ? options["body_tips"] : "Loading..."), '</td>');
969
+ html.push('</tr></tbody>');
970
+ html.push('</table>');
968
971
  let tz_obj = $("#" + options["element_id"]);
969
972
  if (tz_obj.hasClass("panel")) {
970
973
  tz_obj.find("table").each(function () {
971
974
  $(this).remove();
972
975
  });
973
- tz_obj.append(_html.join(""));
976
+ tz_obj.append(html.join(""));
974
977
  } else {
975
- tz_obj.html(_html.join(""));
978
+ tz_obj.html(html.join(""));
976
979
  }
977
980
  if ((Util.is_mobile() || Util.is_small_screen()) && !tz_obj.hasClass("table-responsive")) {
978
981
  if (tz_obj.hasClass("panel")) {
@@ -1031,17 +1034,17 @@ const Util = {
1031
1034
  * @param callback_func
1032
1035
  */
1033
1036
  render_classify_html: function (classify_id, classify_data, callback_func) {
1034
- let _html = [];
1035
- _html.push('<option value="0">板块</option>');
1037
+ let html = [];
1038
+ html.push('<option value="0">板块</option>');
1036
1039
  classify_data.forEach(function (d) {
1037
1040
  let num = "";
1038
1041
  if (d["num"] > 0) {
1039
1042
  num = "(" + d["num"] + ")";
1040
1043
  }
1041
- _html.push('<option value="', d["name"], '">', d["name"], num, '</option>');
1044
+ html.push('<option value="', d["name"], '">', d["name"], num, '</option>');
1042
1045
  });
1043
1046
  let classify_obj = $("#" + classify_id);
1044
- classify_obj.html(_html.join(""));
1047
+ classify_obj.html(html.join(""));
1045
1048
  classify_obj.change(function () {
1046
1049
  callback_func();
1047
1050
  return false;
@@ -1100,19 +1103,19 @@ const Util = {
1100
1103
  });
1101
1104
  }
1102
1105
  Util.post("/stock/" + code, {action: "rps"}, function (j) {
1103
- let _html = [];
1106
+ let html = [];
1104
1107
  j["data"].forEach(function (item) {
1105
- _html.push("<tr>");
1106
- _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1107
- _html.push("<td style='background-color: ", item["rps20_color"], "'>", item["rps20"], "</td>");
1108
- _html.push("<td>", Util.parse_ratio(item["change_percent20"] * 100, 2), "</td>");
1109
- _html.push("<td style='background-color: ", item["rps60_color"], "'>", item["rps60"], "</td>");
1110
- _html.push("<td>", Util.parse_ratio(item["change_percent60"] * 100, 2), "</td>");
1111
- _html.push("<td style='background-color: ", item["rps120_color"], "'>", item["rps120"], "</td>");
1112
- _html.push("<td>", Util.parse_ratio(item["change_percent120"] * 100, 2), "</td>");
1113
- _html.push("</tr>");
1108
+ html.push("<tr>");
1109
+ html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1110
+ html.push("<td style='background-color: ", item["rps20_color"], "'>", item["rps20"], "</td>");
1111
+ html.push("<td>", Util.parse_ratio(item["change_percent20"] * 100, 2), "</td>");
1112
+ html.push("<td style='background-color: ", item["rps60_color"], "'>", item["rps60"], "</td>");
1113
+ html.push("<td>", Util.parse_ratio(item["change_percent60"] * 100, 2), "</td>");
1114
+ html.push("<td style='background-color: ", item["rps120_color"], "'>", item["rps120"], "</td>");
1115
+ html.push("<td>", Util.parse_ratio(item["change_percent120"] * 100, 2), "</td>");
1116
+ html.push("</tr>");
1114
1117
  });
1115
- Util.render_table_html("rps_table_body", _html);
1118
+ Util.render_table_html("rps_table_body", html);
1116
1119
  Util.hide_tips();
1117
1120
  });
1118
1121
  },
@@ -1217,7 +1220,7 @@ const Util = {
1217
1220
  * 基金数据渲染
1218
1221
  */
1219
1222
  render_public_fund: function(j) {
1220
- let _html = [], total_public_fund = 0, total_stock_num = 0, total_market_capital = 0;
1223
+ let html = [], total_public_fund = 0, total_stock_num = 0, total_market_capital = 0;
1221
1224
  j["data"] = j["data"] ? j["data"] : [];
1222
1225
  j["data"].forEach(function (item) {
1223
1226
  total_public_fund++;
@@ -1232,22 +1235,22 @@ const Util = {
1232
1235
  if (cls !== "") {
1233
1236
  net = "<b class='" + cls + "'>" + net + "(" + Util.to_float(item["change_percent"], 2) + "%)</b>";
1234
1237
  }
1235
- _html.push("<tr class='", (($.inArray(item["fund_code"], j["etf_code_list"]) > -1) ? "danger" : ""), "'>");
1236
- _html.push("<td>", total_public_fund, "</td>");
1237
- _html.push("<td>", Util.pack_html_link('https://fund.eastmoney.com/' + item["fund_code"] + '.html', item["fund_code"]), "</td>");
1238
- _html.push("<td title='基金概况'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + item["fund_code"] + '.html', item["fund_name"]), "</td>");
1239
- _html.push("<td>", net, "</td>");
1240
- _html.push("<td>", item["assets"], "亿</td>");
1241
- _html.push("<td>", item["fund_type"], "</td>");
1242
- _html.push("<td>", item["invest_type"], "</td>");
1243
- _html.push("<td>", Util.pack_fund_manager(item), "</td>");
1244
- _html.push("<td>", public_date, "</td>");
1245
- _html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
1246
- _html.push("<td data-val='", item["market_capital"], "' title='", item["market_capital"], "'>", Util.to_unit(item["market_capital"], 3), "</td>");
1247
- _html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["fund_code"], "'>详细</a></td>");
1248
- _html.push("</tr>");
1238
+ html.push("<tr class='", (($.inArray(item["fund_code"], j["etf_code_list"]) > -1) ? "danger" : ""), "'>");
1239
+ html.push("<td>", total_public_fund, "</td>");
1240
+ html.push("<td>", Util.pack_html_link('https://fund.eastmoney.com/' + item["fund_code"] + '.html', item["fund_code"]), "</td>");
1241
+ html.push("<td title='基金概况'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + item["fund_code"] + '.html', item["fund_name"]), "</td>");
1242
+ html.push("<td>", net, "</td>");
1243
+ html.push("<td>", item["assets"], "亿</td>");
1244
+ html.push("<td>", item["fund_type"], "</td>");
1245
+ html.push("<td>", item["invest_type"], "</td>");
1246
+ html.push("<td>", Util.pack_fund_manager(item), "</td>");
1247
+ html.push("<td>", public_date, "</td>");
1248
+ html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
1249
+ html.push("<td data-val='", item["market_capital"], "' title='", item["market_capital"], "'>", Util.to_unit(item["market_capital"], 3), "</td>");
1250
+ html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["fund_code"], "'>详细</a></td>");
1251
+ html.push("</tr>");
1249
1252
  });
1250
- Util.render_table_html("public_fund_table_body", _html);
1253
+ Util.render_table_html("public_fund_table_body", html);
1251
1254
  let public_fund_tips = "";
1252
1255
  if (j["cur_fund_num"]) {
1253
1256
  total_public_fund = Util.pack_html_link(Util.get_url("trend_fund_hold"), '<span class="label label-info">' + j["cur_fund_num"] + '</span>');
@@ -1304,7 +1307,7 @@ const Util = {
1304
1307
  }
1305
1308
  Util.post("/stock/" + code, {action: "public_fund_change"}, function (j) {
1306
1309
  Util["pfc_stock_chart"].hideLoading();
1307
- let date_data = [], fund_num_data = [], stock_num_data = [], value_data = [], price_data = [], _html = [], is_fund10_num = 0;
1310
+ let date_data = [], fund_num_data = [], stock_num_data = [], value_data = [], price_data = [], html = [], is_fund10_num = 0;
1308
1311
  if ($("#is_fund10_num").length > 0) {
1309
1312
  is_fund10_num = $("#is_fund10_num").prop("checked") ? 1 : 0;
1310
1313
  }
@@ -1320,30 +1323,30 @@ const Util = {
1320
1323
  let hold_value = Util.to_hundred_million(item["hold_value"], 3);
1321
1324
  value_data.push(hold_value);
1322
1325
  price_data.push(item["price"]);
1323
- _html.push("<tr>");
1324
- _html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/zlsj/detail/" + date_format + "-1-" + code + ".html", date_format), "</td>");
1326
+ html.push("<tr>");
1327
+ html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/zlsj/detail/" + date_format + "-1-" + code + ".html", date_format), "</td>");
1325
1328
  if (item["pre_price"]) {
1326
- _html.push("<td>", Util.digit_compare_trend(item["price"], item["pre_price"]), "</td>");
1329
+ html.push("<td>", Util.digit_compare_trend(item["price"], item["pre_price"]), "</td>");
1327
1330
  } else {
1328
- _html.push("<td>", item["price"], "</td>");
1331
+ html.push("<td>", item["price"], "</td>");
1329
1332
  }
1330
1333
  let stock_num_rate = "";
1331
1334
  if (item["pre_stock_num"]) {
1332
1335
  stock_num_rate = "(" + Util.year_price_rate(item["stock_num"], item["pre_stock_num"], 1) + ")";
1333
1336
  }
1334
- _html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股", stock_num_rate, "</td>");
1337
+ html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股", stock_num_rate, "</td>");
1335
1338
  let fund_num_rate = "";
1336
1339
  if (item["pre_fund_num"]) {
1337
1340
  fund_num_rate = "(" + Util.year_price_rate(item["fund_num"], item["pre_fund_num"], 1) + ")";
1338
1341
  }
1339
- _html.push("<td data-val='", item["fund_num"], "'>", item["fund_num"], fund_num_rate, "</td>");
1342
+ html.push("<td data-val='", item["fund_num"], "'>", item["fund_num"], fund_num_rate, "</td>");
1340
1343
  let fund_rank_num_rate = "";
1341
1344
  if (item["pre_fund_rank_num"]) {
1342
1345
  fund_rank_num_rate = "(" + Util.year_price_rate(item["fund_rank_num"], item["pre_fund_rank_num"], 1) + ")";
1343
1346
  }
1344
- _html.push("<td data-val='", item["fund_rank_num"], "'>", item["fund_rank_num"], fund_rank_num_rate, "</td>");
1345
- _html.push("<td data-val='", item["hold_value"], "' title='", item["hold_value"], "'>", hold_value, "亿</td>");
1346
- _html.push("</tr>");
1347
+ html.push("<td data-val='", item["fund_rank_num"], "'>", item["fund_rank_num"], fund_rank_num_rate, "</td>");
1348
+ html.push("<td data-val='", item["hold_value"], "' title='", item["hold_value"], "'>", hold_value, "亿</td>");
1349
+ html.push("</tr>");
1347
1350
  });
1348
1351
  date_data = date_data.reverse();
1349
1352
  fund_num_data = fund_num_data.reverse();
@@ -1370,7 +1373,7 @@ const Util = {
1370
1373
  $("#pfc_value_tips").html("(当前持仓市值: <b class='text-info'>" + Util.to_unit(cur_value_num) + "</b>, 环比: " + Util.year_price_rate(cur_value_num, pre_value_num) + ")");
1371
1374
  }
1372
1375
  }
1373
- Util.render_table_html("pfc_fund_table_body", _html);
1376
+ Util.render_table_html("pfc_fund_table_body", html);
1374
1377
  Util.hide_tips();
1375
1378
  });
1376
1379
  },
@@ -1431,7 +1434,7 @@ const Util = {
1431
1434
 
1432
1435
  render_portfolio_html: function () {
1433
1436
  if (Util["portfolio_table_id"]) {
1434
- let _html = [], total_num = 0;
1437
+ let html = [], total_num = 0;
1435
1438
  let is_us = $("#portfolio_remark_title").length === 0 ? 1 : 0;
1436
1439
  if (Util["portfolio_data"]) {
1437
1440
  let industry = $("#portfolio_industry").val();
@@ -1439,30 +1442,30 @@ const Util = {
1439
1442
  Util["portfolio_data"].forEach(function (item) {
1440
1443
  if (Util.is_industry_area(item, industry, area)) {
1441
1444
  total_num++;
1442
- _html.push("<tr>");
1445
+ html.push("<tr>");
1443
1446
  item["code"] = item["code"].toLowerCase();
1444
1447
  if (is_us === 1) {
1445
- _html.push('<td>', Util.us_logo_html(item["code"]), '</td>');
1448
+ html.push('<td>', Util.us_logo_html(item["code"]), '</td>');
1446
1449
  }
1447
- _html = Util.stock_basics_html(_html, item);
1448
- _html.push("<td id='high_", item["code"], "'>0</td>");
1449
- _html.push("<td id='low_", item["code"], "'>0</td>");
1450
- _html.push("<td class='year_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["year_price"]) : "--"), "</td>");
1451
- _html.push("<td class='d5_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["d5_price"]) : "--"), "</td>");
1452
- _html.push("<td class='high_52week_", item["code"], "'>--</td>");
1450
+ html = Util.stock_basics_html(html, item);
1451
+ html.push("<td id='high_", item["code"], "'>0</td>");
1452
+ html.push("<td id='low_", item["code"], "'>0</td>");
1453
+ html.push("<td class='year_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["year_price"]) : "--"), "</td>");
1454
+ html.push("<td class='d5_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["d5_price"]) : "--"), "</td>");
1455
+ html.push("<td class='high_52week_", item["code"], "'>--</td>");
1453
1456
  if (is_us === 0) {
1454
- _html.push("<td id='amount_", item["code"], "'>--</td>");
1455
- _html.push("<td id='average_", item["code"], "'>--</td>");
1456
- _html.push("<td class='holder_", item["code"], "'>--</td>");
1457
- _html.push("<td class='fund_", item["code"], "'>--</td>");
1458
- _html.push("<td id='remark_", item["code"], "'></td>");
1457
+ html.push("<td id='amount_", item["code"], "'>--</td>");
1458
+ html.push("<td id='average_", item["code"], "'>--</td>");
1459
+ html.push("<td class='holder_", item["code"], "'>--</td>");
1460
+ html.push("<td class='fund_", item["code"], "'>--</td>");
1461
+ html.push("<td id='remark_", item["code"], "'></td>");
1459
1462
  }
1460
- _html.push("</tr>");
1463
+ html.push("</tr>");
1461
1464
  }
1462
1465
  });
1463
1466
  }
1464
1467
  let table_body_id = Util["portfolio_table_id"] + "_body";
1465
- Util.render_table_html(table_body_id, _html);
1468
+ Util.render_table_html(table_body_id, html);
1466
1469
  if (is_us === 1) {
1467
1470
  $("img").on("error", function () {
1468
1471
  $(this).attr("src", "https://storage.googleapis.com/iex/api/logos/LI.png");
@@ -1518,7 +1521,7 @@ const Util = {
1518
1521
  $("#" + component_id + "_body_body").html("<tr><td colspan='15'>Loading...</td></tr>");
1519
1522
  $("#" + component_id + "_title").html(fund_code);
1520
1523
  Util.post(Util.get_url("fund_public"), {action: "public_fund_detail", fund_code: fund_code}, function (j) {
1521
- let _html = [];
1524
+ let html = [];
1522
1525
  if (j["fund_code"]) {
1523
1526
  $("#" + component_id + "_title").html(Util.pack_html_link("http://fundf10.eastmoney.com/jbgk_" + j["fund_code"] + ".html", j["fund_name"]));
1524
1527
  let net = "--";
@@ -1532,29 +1535,29 @@ const Util = {
1532
1535
  let assets = j["assets"] > 0 ? (j["assets"] + "亿") : "--";
1533
1536
  let public_date = j["public_date"] > 0 ? Util.seconds_to_format(j["public_date"], "%Y-%m-%d") : "--";
1534
1537
  let issue_date = j["issue_date"] > 0 ? Util.seconds_to_format(j["issue_date"], "%Y-%m-%d") : "--";
1535
- _html.push("<tr title='最后更新时间: ", Util.seconds_to_format(j["update_time"], "%Y-%m-%d"), "' class='info'><th colspan='15' style='text-align: center;'>基金概况</th></tr>");
1536
- _html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://xueqiu.com/S/' + Util.code_to_fund_symbol(j["fund_code"]), j["fund_code"]), "</td><td colspan='3'>基金名</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j["fund_code"] + '.html', j["fund_name"]), "</td></tr>");
1537
- _html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", j["fund_type"], "</td><td colspan='3'>投资类型</td><td colspan='5'>", j["invest_type"], "</td></tr>");
1538
- _html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='5'>", assets, "</td></tr>");
1539
- _html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='5'>", issue_date, "</td></tr>");
1540
- _html.push("<tr><td colspan='3'>基金管理公司</td><td colspan='4'>", Util.pack_fund_administrator(j), "</td><td colspan='3'>基金经理</td><td colspan='5'>", Util.pack_fund_manager(j), "</td></tr>");
1541
- _html.push("<tr><td colspan='3'>基金托管人</td><td colspan='4'>", (j["custodian"] ? j["custodian"] : "--"), "</td><td colspan='3'>经办律师事务所</td><td colspan='5'>", (j["lawyer"] ? j["lawyer"] : "--"), "</td></tr>");
1542
- _html.push("<tr><td colspan='3'>会计师事务所</td><td colspan='4'>", (j["accounting"] ? j["accounting"] : "--"), "</td><td colspan='3'>注册地址</td><td colspan='5'>", Util.map_url(j["location"], j["location"]), "</td></tr>");
1543
- _html.push("<tr><td colspan='3'>近一周</td><td colspan='4'>", Util.parse_ratio(j["one_week_change"]), "</td><td colspan='3'>近一月</td><td colspan='5'>", Util.parse_ratio(j["one_month_change"]), "</td></tr>");
1544
- _html.push("<tr><td colspan='3'>近一年</td><td colspan='4'>", Util.parse_ratio(j["one_year_change"]), "</td><td colspan='3'>年初至今</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jdzf_' + j["fund_code"] + '.html', Util.parse_ratio(j["ytd_change"])), "</td></tr>");
1545
- _html.push("<tr><td colspan='5'>成立以来</td><td colspan='10'>", Util.parse_ratio(j["establish_change"]), "</td></tr>");
1546
- _html.push("<tr class='info'><th colspan='15' style='text-align: center;'>", Util.pack_html_link("http://fund.eastmoney.com/f10/ccmx_" + j["fund_code"] + ".html", "持股明细"), " <span id='fund_stock_date_zone'></span></th></tr>");
1547
- _html.push("<tr id='" + component_id + "_head'><th>序号</th><th>股票代码</th><th>股票名</th><th>PE</th><th>总市值</th><th>行业</th><th>地区</th><th>价格</th><th>年初至今</th><th>近5日</th><th>股东数</th><th>持有量</th><th class='info'>占比</th><th>占比变化</th><th>持仓市值</th></tr>");
1548
- _html.push("<tr class='" + component_id + "_tr'><td colspan='15'>暂无数据</td></tr>");
1549
- Util.render_table_html(component_id + "_body_body", _html);
1538
+ html.push("<tr title='最后更新时间: ", Util.seconds_to_format(j["update_time"], "%Y-%m-%d"), "' class='info'><th colspan='15' style='text-align: center;'>基金概况</th></tr>");
1539
+ html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://xueqiu.com/S/' + Util.code_to_fund_symbol(j["fund_code"]), j["fund_code"]), "</td><td colspan='3'>基金名</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j["fund_code"] + '.html', j["fund_name"]), "</td></tr>");
1540
+ html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", j["fund_type"], "</td><td colspan='3'>投资类型</td><td colspan='5'>", j["invest_type"], "</td></tr>");
1541
+ html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='5'>", assets, "</td></tr>");
1542
+ html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='5'>", issue_date, "</td></tr>");
1543
+ html.push("<tr><td colspan='3'>基金管理公司</td><td colspan='4'>", Util.pack_fund_administrator(j), "</td><td colspan='3'>基金经理</td><td colspan='5'>", Util.pack_fund_manager(j), "</td></tr>");
1544
+ html.push("<tr><td colspan='3'>基金托管人</td><td colspan='4'>", (j["custodian"] ? j["custodian"] : "--"), "</td><td colspan='3'>经办律师事务所</td><td colspan='5'>", (j["lawyer"] ? j["lawyer"] : "--"), "</td></tr>");
1545
+ html.push("<tr><td colspan='3'>会计师事务所</td><td colspan='4'>", (j["accounting"] ? j["accounting"] : "--"), "</td><td colspan='3'>注册地址</td><td colspan='5'>", Util.map_url(j["location"], j["location"]), "</td></tr>");
1546
+ html.push("<tr><td colspan='3'>近一周</td><td colspan='4'>", Util.parse_ratio(j["one_week_change"]), "</td><td colspan='3'>近一月</td><td colspan='5'>", Util.parse_ratio(j["one_month_change"]), "</td></tr>");
1547
+ html.push("<tr><td colspan='3'>近一年</td><td colspan='4'>", Util.parse_ratio(j["one_year_change"]), "</td><td colspan='3'>年初至今</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jdzf_' + j["fund_code"] + '.html', Util.parse_ratio(j["ytd_change"])), "</td></tr>");
1548
+ html.push("<tr><td colspan='5'>成立以来</td><td colspan='10'>", Util.parse_ratio(j["establish_change"]), "</td></tr>");
1549
+ html.push("<tr class='info'><th colspan='15' style='text-align: center;'>", Util.pack_html_link("http://fund.eastmoney.com/f10/ccmx_" + j["fund_code"] + ".html", "持股明细"), " <span id='fund_stock_date_zone'></span></th></tr>");
1550
+ html.push("<tr id='" + component_id + "_head'><th>序号</th><th>股票代码</th><th>股票名</th><th>PE</th><th>总市值</th><th>行业</th><th>地区</th><th>价格</th><th>年初至今</th><th>近5日</th><th>股东数</th><th>持有量</th><th class='info'>占比</th><th>占比变化</th><th>持仓市值</th></tr>");
1551
+ html.push("<tr class='" + component_id + "_tr'><td colspan='15'>暂无数据</td></tr>");
1552
+ Util.render_table_html(component_id + "_body_body", html);
1550
1553
  if (j["date_list"]) {
1551
- _html = [];
1552
- _html.push("<select id='fund_stock_date'>");
1554
+ html = [];
1555
+ html.push("<select id='fund_stock_date'>");
1553
1556
  j["date_list"].forEach(function (date) {
1554
- _html.push("<option value='", date, "'>", Util.seconds_to_format(date, "%Y-%m-%d"), "</option>");
1557
+ html.push("<option value='", date, "'>", Util.seconds_to_format(date, "%Y-%m-%d"), "</option>");
1555
1558
  });
1556
- _html.push("</select>");
1557
- $("#fund_stock_date_zone").html(_html.join(""));
1559
+ html.push("</select>");
1560
+ $("#fund_stock_date_zone").html(html.join(""));
1558
1561
  let fsd_obj = $("#fund_stock_date");
1559
1562
  fsd_obj.change(function () {
1560
1563
  Util.fetch_public_fund_stock(j["fund_code"], $("#fund_stock_date").val(), component_id);
@@ -1562,8 +1565,8 @@ const Util = {
1562
1565
  Util.fetch_public_fund_stock(j["fund_code"], fsd_obj.val(), component_id);
1563
1566
  }
1564
1567
  } else {
1565
- _html.push("<tr><td colspan='15'>暂无数据</td></tr>");
1566
- Util.render_table_html(component_id + "_body_body", _html);
1568
+ html.push("<tr><td colspan='15'>暂无数据</td></tr>");
1569
+ Util.render_table_html(component_id + "_body_body", html);
1567
1570
  }
1568
1571
  });
1569
1572
  },
@@ -1601,15 +1604,15 @@ const Util = {
1601
1604
  $("." + component_tr).each(function () {
1602
1605
  $(this).remove();
1603
1606
  });
1604
- let _html = [];
1607
+ let html = [];
1605
1608
  if (j["data"]) {
1606
1609
  j["data"].forEach(function (item, index) {
1607
- _html.push("<tr class='" + component_tr + "'>");
1608
- _html.push("<td>", index + 1, "</td>");
1609
- _html = Util.stock_basics_html(_html, item);
1610
- _html.push("<td>", Util.year_price_rate(item["stock_price"], item["year_price"]), "</td>");
1611
- _html.push("<td>", Util.year_price_rate(item["stock_price"], item["d5_price"]), "</td>");
1612
- _html.push("<td>", Util.pack_holder_num(item), "</td>");
1610
+ html.push("<tr class='" + component_tr + "'>");
1611
+ html.push("<td>", index + 1, "</td>");
1612
+ html = Util.stock_basics_html(html, item);
1613
+ html.push("<td>", Util.year_price_rate(item["stock_price"], item["year_price"]), "</td>");
1614
+ html.push("<td>", Util.year_price_rate(item["stock_price"], item["d5_price"]), "</td>");
1615
+ html.push("<td>", Util.pack_holder_num(item), "</td>");
1613
1616
  let stock_num_tips = "";
1614
1617
  if (item["stock_num"] > 0 && item["pre_stock_num"] > 0) {
1615
1618
  let gap_stock_num = item["stock_num"] - item["pre_stock_num"];
@@ -1619,7 +1622,7 @@ const Util = {
1619
1622
  stock_num_tips = "<b class='text-success'>(" + Util.to_unit(gap_stock_num) + ")</b>";
1620
1623
  }
1621
1624
  }
1622
- _html.push("<td>", Util.to_unit(item["stock_num"]), stock_num_tips, "</td>");
1625
+ html.push("<td>", Util.to_unit(item["stock_num"]), stock_num_tips, "</td>");
1623
1626
  let rate_tips = "", rate_change = "--";
1624
1627
  if (item["rate"] > 0 && item["rate"] > item["pre_rate"]) {
1625
1628
  rate_tips = "<b class='text-danger'>(+" + Util.to_float(item["rate"] - item["pre_rate"], 2) + "%)</b>";
@@ -1629,15 +1632,15 @@ const Util = {
1629
1632
  if (item["pre_rate"] && item["pre_rate"] > 0) {
1630
1633
  rate_change = Util.year_price_rate(item["rate"], item["pre_rate"], 1);
1631
1634
  }
1632
- _html.push("<td>", item["rate"], "%", rate_tips, "</td>");
1633
- _html.push("<td>", rate_change, "</td>");
1634
- _html.push("<td>", Util.to_unit(item["fund_market_capital"]), "</td>");
1635
- _html.push("</tr>");
1635
+ html.push("<td>", item["rate"], "%", rate_tips, "</td>");
1636
+ html.push("<td>", rate_change, "</td>");
1637
+ html.push("<td>", Util.to_unit(item["fund_market_capital"]), "</td>");
1638
+ html.push("</tr>");
1636
1639
  });
1637
1640
  } else {
1638
- _html.push("<tr class='" + component_tr + "'><td colspan='15'>暂无数据</td></tr>");
1641
+ html.push("<tr class='" + component_tr + "'><td colspan='15'>暂无数据</td></tr>");
1639
1642
  }
1640
- $(_html.join("")).insertAfter("#" + component_id + "_head");
1643
+ $(html.join("")).insertAfter("#" + component_id + "_head");
1641
1644
  Util.hide_tips();
1642
1645
  if (j["data"]) {
1643
1646
  Util.refresh_price(component_id + "_body");
@@ -1677,10 +1680,10 @@ const Util = {
1677
1680
  Util.show_loading();
1678
1681
  let category_top_type = parseInt($("#category_top_type").val());
1679
1682
  Util.post(location.pathname, {"action": "category_top_statistics", "type": category_top_type}, function (j) {
1680
- let _html = [];
1683
+ let html = [];
1681
1684
  j["data"].forEach(function (item) {
1682
1685
  let date_data = [], cole_url = "";
1683
- _html.push("<tr>");
1686
+ html.push("<tr>");
1684
1687
  item["name"] = item["name"] + "(" + item["code"] + ")";
1685
1688
  if (category_top_type === 2) {
1686
1689
  cole_url = "http://q.10jqka.com.cn/thshy/detail/code/" + item["code"];
@@ -1689,13 +1692,13 @@ const Util = {
1689
1692
  } else {
1690
1693
  cole_url = "https://xueqiu.com/S/" + Util.code_to_fund_symbol(item["code"]);
1691
1694
  }
1692
- _html.push("<td>", Util.pack_html_link(cole_url, item["name"]), "</td>");
1693
- _html.push("<td>", item["num"], "</td>");
1694
- _html.push("<td data-val='", item["interval_day"], "'>", (item["interval_day"] < 10000 ? (item["interval_day"] + "天") : "--"), "</td>");
1695
+ html.push("<td>", Util.pack_html_link(cole_url, item["name"]), "</td>");
1696
+ html.push("<td>", item["num"], "</td>");
1697
+ html.push("<td data-val='", item["interval_day"], "'>", (item["interval_day"] < 10000 ? (item["interval_day"] + "天") : "--"), "</td>");
1695
1698
  if (item["dist_day"] < item["interval_day"]) {
1696
- _html.push("<td data-val='", item["dist_day"], "'>", item["dist_day"], "天</td>");
1699
+ html.push("<td data-val='", item["dist_day"], "'>", item["dist_day"], "天</td>");
1697
1700
  } else {
1698
- _html.push("<td class='danger' data-val='", item["dist_day"], "'>", item["dist_day"], "天</td>");
1701
+ html.push("<td class='danger' data-val='", item["dist_day"], "'>", item["dist_day"], "天</td>");
1699
1702
  }
1700
1703
  item["data"].forEach(function (d) {
1701
1704
  let date_format = Util.seconds_to_format(d["date"], "%Y-%m-%d");
@@ -1708,10 +1711,10 @@ const Util = {
1708
1711
  if (item["num"] > 6) {
1709
1712
  date_data += "...";
1710
1713
  }
1711
- _html.push("<td class='text-left'>", date_data, "</td>");
1712
- _html.push("</tr>");
1714
+ html.push("<td class='text-left'>", date_data, "</td>");
1715
+ html.push("</tr>");
1713
1716
  });
1714
- Util.render_table_html("category_top_modal_body_body", _html);
1717
+ Util.render_table_html("category_top_modal_body_body", html);
1715
1718
  Util.hide_tips();
1716
1719
  });
1717
1720
  },
@@ -1769,7 +1772,7 @@ const Util = {
1769
1772
  action: "currency_data"
1770
1773
  };
1771
1774
  Util.post(Util.get_url("macro_currency"), payload, function (j) {
1772
- let _html = [], low_exchange_rate = 0, high_exchange_rate = 0;
1775
+ let html = [], low_exchange_rate = 0, high_exchange_rate = 0;
1773
1776
  j["data"].forEach(function (item) {
1774
1777
  if (low_exchange_rate === 0 || item["exchange_rate"] < low_exchange_rate) {
1775
1778
  low_exchange_rate = item["exchange_rate"];
@@ -1778,19 +1781,19 @@ const Util = {
1778
1781
  });
1779
1782
  j["data"].forEach(function (item) {
1780
1783
  if (item["exchange_rate"] === high_exchange_rate) {
1781
- _html.push("<tr class='danger'>");
1784
+ html.push("<tr class='danger'>");
1782
1785
  } else if (item["exchange_rate"] === low_exchange_rate) {
1783
- _html.push("<tr class='success'>");
1786
+ html.push("<tr class='success'>");
1784
1787
  } else {
1785
- _html.push("<tr>");
1788
+ html.push("<tr>");
1786
1789
  }
1787
- _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1788
- _html.push("<td>", item["exchange_rate"], "</td>");
1789
- _html.push("<td>", item["low_exchange_rate"], "</td>");
1790
- _html.push("<td>", item["high_exchange_rate"], "</td>");
1791
- _html.push("</tr>");
1790
+ html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1791
+ html.push("<td>", item["exchange_rate"], "</td>");
1792
+ html.push("<td>", item["low_exchange_rate"], "</td>");
1793
+ html.push("<td>", item["high_exchange_rate"], "</td>");
1794
+ html.push("</tr>");
1792
1795
  });
1793
- Util.render_table_html("currency_modal_body_body", _html);
1796
+ Util.render_table_html("currency_modal_body_body", html);
1794
1797
  let currency_modal_summary = "历史最低:<span class='label label-success'>" + j["hist_low"] +
1795
1798
  "</span> 历史最高:<span class='label label-danger'>" + j["hist_high"] +
1796
1799
  "</span> 年初至今:" + Util.digit_compare_trend1(j["exchange_rate"], j["year_exchange_rate"]) +
@@ -1862,7 +1865,7 @@ const Util = {
1862
1865
  "currency_type": $("#currency_type").val()
1863
1866
  };
1864
1867
  Util.post(Util.get_url("coin_price"), payload, function (j) {
1865
- let _html = [], low_price = 0, high_price = 0;
1868
+ let html = [], low_price = 0, high_price = 0;
1866
1869
  j["data"].forEach(function (item) {
1867
1870
  if (low_price === 0 || item["price"] < low_price) {
1868
1871
  low_price = item["price"];
@@ -1871,23 +1874,23 @@ const Util = {
1871
1874
  });
1872
1875
  j["data"].forEach(function (item) {
1873
1876
  if (item["price"] === high_price) {
1874
- _html.push("<tr class='danger'>");
1877
+ html.push("<tr class='danger'>");
1875
1878
  } else if (item["price"] === low_price) {
1876
- _html.push("<tr class='success'>");
1879
+ html.push("<tr class='success'>");
1877
1880
  } else {
1878
- _html.push("<tr>");
1881
+ html.push("<tr>");
1879
1882
  }
1880
- _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1881
- _html.push("<td>", item["open"], "</td>");
1882
- _html.push("<td>", item["low"], "</td>");
1883
- _html.push("<td>", item["high"], "</td>");
1884
- _html.push("<td>", item["price"], "</td>");
1885
- _html.push("<td>", Util.parse_ratio(item["p_change"]), "</td>");
1886
- _html.push("<td>", Util.to_unit(item["amount"]), "</td>");
1887
- _html.push("<td>", Util.to_unit(item["market_capital"]), "</td>");
1888
- _html.push("</tr>");
1883
+ html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1884
+ html.push("<td>", item["open"], "</td>");
1885
+ html.push("<td>", item["low"], "</td>");
1886
+ html.push("<td>", item["high"], "</td>");
1887
+ html.push("<td>", item["price"], "</td>");
1888
+ html.push("<td>", Util.parse_ratio(item["p_change"]), "</td>");
1889
+ html.push("<td>", Util.to_unit(item["amount"]), "</td>");
1890
+ html.push("<td>", Util.to_unit(item["market_capital"]), "</td>");
1891
+ html.push("</tr>");
1889
1892
  });
1890
- Util.render_table_html("btc_modal_body_body", _html);
1893
+ Util.render_table_html("btc_modal_body_body", html);
1891
1894
  let btc_title = j["cn_name"] + "(" + Util.pack_html_link('https://www.binance.com/zh-CN/trade/' + j["short_name"] + '_USDT?theme=dark', j["short_name"]) + ", " + Util.pack_html_link("https://www.feixiaohao.com/currencies/" + j["coin"], j["coin"]) + ")";
1892
1895
  btc_title += "&nbsp;&nbsp;<small>历史最低:<span class='label label-success'>" + j["hist_low"] + "</span> 历史最高:<span class='label label-danger'>" + j["hist_high"] +
1893
1896
  "</span> 年初至今:" + Util.digit_compare_trend1(j["price"], j["year_price"]) +
@@ -1927,7 +1930,7 @@ const Util = {
1927
1930
  end_date: $("#statistics_end_date").val(),
1928
1931
  };
1929
1932
  Util.post(Util.get_url("hsgt_trade_stock"), payload, function (j) {
1930
- let _html = [];
1933
+ let html = [];
1931
1934
  let summary_inflow = 0;
1932
1935
  let buy_times = 0;
1933
1936
  let sell_times = 0;
@@ -1941,16 +1944,16 @@ const Util = {
1941
1944
  }
1942
1945
  let inflow = item["buy"] - item["sell"];
1943
1946
  summary_inflow += inflow;
1944
- _html.push("<tr>");
1945
- _html.push("<td>", total_times, "</td>");
1946
- _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1947
- _html.push("<td title='", item["buy"], "'>", Util.to_unit(item["buy"]), "</td>");
1948
- _html.push("<td title='", item["sell"], "'>", Util.to_unit(item["sell"]), "</td>");
1949
- _html.push("<td title='", inflow, "'><b class='", Util.text_color(inflow), "'>", Util.to_unit(inflow), "</b></td>");
1950
- _html.push("<td>", Util.to_unit(item["buy"] + item["sell"]), "</td>");
1951
- _html.push("</tr>");
1947
+ html.push("<tr>");
1948
+ html.push("<td>", total_times, "</td>");
1949
+ html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1950
+ html.push("<td title='", item["buy"], "'>", Util.to_unit(item["buy"]), "</td>");
1951
+ html.push("<td title='", item["sell"], "'>", Util.to_unit(item["sell"]), "</td>");
1952
+ html.push("<td title='", inflow, "'><b class='", Util.text_color(inflow), "'>", Util.to_unit(inflow), "</b></td>");
1953
+ html.push("<td>", Util.to_unit(item["buy"] + item["sell"]), "</td>");
1954
+ html.push("</tr>");
1952
1955
  });
1953
- Util.render_table_html(component_id + "_body_body", _html);
1956
+ Util.render_table_html(component_id + "_body_body", html);
1954
1957
  $("#" + component_id + "_title").html("[" + Util.stock_url(code, j["stock_name"]) + "]资金流向明细(<span>净买入:<b title='" + summary_inflow + "' class='" + Util.text_color(summary_inflow) + "'>" + Util.to_unit(summary_inflow) + "</b>, 上榜次数:<b class='text-info'>" + total_times + "</b>, 买入次数:<b class='text-danger'>" + buy_times + "</b>, 卖出次数:<b class='text-success'>" + sell_times + "</b></span>)");
1955
1958
  });
1956
1959
  }
@@ -1975,13 +1978,13 @@ const Util = {
1975
1978
  $("#" + element_id).html(show_profile);
1976
1979
  $('#' + modal_id).on('shown.bs.modal', function () {
1977
1980
  let p_arr = profile.split("。");
1978
- let _html = [];
1981
+ let html = [];
1979
1982
  p_arr.forEach(function (p) {
1980
1983
  if (p.length > 0) {
1981
- _html.push("<p>", p.replace(/,/g, ","), "。</p>");
1984
+ html.push("<p>", p.replace(/,/g, ","), "。</p>");
1982
1985
  }
1983
1986
  });
1984
- Util.render_table_html(modal_id + "_body", _html);
1987
+ Util.render_table_html(modal_id + "_body", html);
1985
1988
  });
1986
1989
  }
1987
1990
  },
@@ -2266,23 +2269,23 @@ const Util = {
2266
2269
 
2267
2270
  init_time_select_range: function (Obj, select_id, start_id, end_id, callback_func) {
2268
2271
  let select_obj = $("#" + select_id);
2269
- let _html = [];
2270
- _html.push('<option value="0">时间区间选择</option>');
2271
- _html.push('<option value="1">这周</option>');
2272
- _html.push('<option value="2">这月</option>');
2273
- _html.push('<option value="3">上一周</option>');
2274
- _html.push('<option value="4">上一月</option>');
2275
- _html.push('<option value="5">年初至今</option>');
2276
- _html.push('<option value="6">最近7日</option>');
2277
- _html.push('<option value="7">最近30日</option>');
2278
- _html.push('<option value="8">最近60日</option>');
2279
- _html.push('<option value="9">最近90日</option>');
2280
- _html.push('<option value="10">最近半年</option>');
2281
- _html.push('<option value="11">最近一年</option>');
2282
- _html.push('<option value="99">所有时间</option>');
2283
- _html.push('<option value="100">还原</option>');
2284
- _html.push('<option value="101">置空</option>');
2285
- select_obj.html(_html.join(""));
2272
+ let html = [];
2273
+ html.push('<option value="0">时间区间选择</option>');
2274
+ html.push('<option value="1">这周</option>');
2275
+ html.push('<option value="2">这月</option>');
2276
+ html.push('<option value="3">上一周</option>');
2277
+ html.push('<option value="4">上一月</option>');
2278
+ html.push('<option value="5">年初至今</option>');
2279
+ html.push('<option value="6">最近7日</option>');
2280
+ html.push('<option value="7">最近30日</option>');
2281
+ html.push('<option value="8">最近60日</option>');
2282
+ html.push('<option value="9">最近90日</option>');
2283
+ html.push('<option value="10">最近半年</option>');
2284
+ html.push('<option value="11">最近一年</option>');
2285
+ html.push('<option value="99">所有时间</option>');
2286
+ html.push('<option value="100">还原</option>');
2287
+ html.push('<option value="101">置空</option>');
2288
+ select_obj.html(html.join(""));
2286
2289
  select_obj.change(function () {
2287
2290
  let select_val = $("#" + select_id).val();
2288
2291
  let sd_obj = $('#' + start_id);
@@ -2453,11 +2456,11 @@ const Util = {
2453
2456
  },
2454
2457
 
2455
2458
  /**
2456
- * 时间花费
2459
+ * 计算执行过程中所花费的时间
2457
2460
  * @param time
2458
2461
  * @returns {string}
2459
2462
  */
2460
- count_down_time: function (time) {
2463
+ calculate_execution_time: function (time) {
2461
2464
  let result = "";
2462
2465
  if (time > 1000) {
2463
2466
  let second = Math.round(time / 1000);
@@ -3172,7 +3175,7 @@ const Util = {
3172
3175
  * @returns {string}
3173
3176
  */
3174
3177
  parse_index_data: function (index_data) {
3175
- let _html = [];
3178
+ let html = [];
3176
3179
  if (index_data) {
3177
3180
  let is_small = Util.is_small_screen();
3178
3181
  index_data.forEach(function (item) {
@@ -3187,12 +3190,12 @@ const Util = {
3187
3190
  if (item["code"]) {
3188
3191
  title = item["name"] + "(" + item["code"] + ")";
3189
3192
  }
3190
- _html.push("<span title='", title, "'>", short_name, ":");
3191
- _html.push(Util.pack_index_data(item["value"], item["change_rate"]));
3192
- _html.push("</span> ");
3193
+ html.push("<span title='", title, "'>", short_name, ":");
3194
+ html.push(Util.pack_index_data(item["value"], item["change_rate"]));
3195
+ html.push("</span> ");
3193
3196
  });
3194
3197
  }
3195
- return _html.join("");
3198
+ return html.join("");
3196
3199
  },
3197
3200
 
3198
3201
  /**
@@ -3382,30 +3385,30 @@ const Util = {
3382
3385
  * @param data
3383
3386
  */
3384
3387
  render_summary_period_price_up_down: function(data) {
3385
- let _html = [];
3388
+ let html = [];
3386
3389
  let price_market_type = $("#price_market_type").val();
3387
3390
  data.forEach(function (item) {
3388
- _html.push("<tr>");
3389
- _html.push("<td>", Util.snowball_url(item["code"]), "</td>");
3391
+ html.push("<tr>");
3392
+ html.push("<td>", Util.snowball_url(item["code"]), "</td>");
3390
3393
  let stock_name = item["name"];
3391
3394
  if (price_market_type !== "cn") {
3392
3395
  stock_name = Util.strip_bracket_string(stock_name);
3393
3396
  stock_name = stock_name.substring(0, 6);
3394
3397
  }
3395
- _html.push("<td>", Util.stock_url(item["code"], stock_name), "</td>");
3396
- _html.push("<td>", (item["market_capital"] ? (item["market_capital"] + "亿") : "--"), "</td>");
3397
- _html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
3398
+ html.push("<td>", Util.stock_url(item["code"], stock_name), "</td>");
3399
+ html.push("<td>", (item["market_capital"] ? (item["market_capital"] + "亿") : "--"), "</td>");
3400
+ html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
3398
3401
  let p_color = Util.text_color(item["close"], item["open"]);
3399
- _html.push("<td><b class='", p_color, "'>", Util.to_float(item["close"], 2), "<b></td>");
3402
+ html.push("<td><b class='", p_color, "'>", Util.to_float(item["close"], 2), "<b></td>");
3400
3403
  let p_change_rate = Util.calc_change_rate(item["close"], item["open"], 4);
3401
3404
  p_change_rate = Util.to_float(p_change_rate * 100, 2)
3402
3405
  if (p_change_rate > 0) {
3403
3406
  p_change_rate = "+" + p_change_rate;
3404
3407
  }
3405
- _html.push("<td><b class='", p_color, "'>", p_change_rate, "%<b></td>");
3406
- _html.push("</tr>");
3408
+ html.push("<td><b class='", p_color, "'>", p_change_rate, "%<b></td>");
3409
+ html.push("</tr>");
3407
3410
  });
3408
- Util.render_table_html("price_up_down_table_body", _html);
3411
+ Util.render_table_html("price_up_down_table_body", html);
3409
3412
  },
3410
3413
 
3411
3414
  /**
@@ -3413,17 +3416,17 @@ const Util = {
3413
3416
  * @param data
3414
3417
  */
3415
3418
  render_summary_period_industry_data: function(data) {
3416
- let _html = [];
3419
+ let html = [];
3417
3420
  let industry_url = Util.get_url("summary_industry");
3418
3421
  data.forEach(function (item) {
3419
- _html.push("<tr>");
3420
- _html.push("<td>", Util.pack_html_link("http://q.10jqka.com.cn/thshy/detail/code/" + item["code"], item["code"]), "</td>");
3421
- _html.push("<td>", Util.pack_html_link(industry_url + "?code=" + item["code"], item["name"]), "</td>");
3422
- _html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3423
- _html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3424
- _html.push("</tr>");
3422
+ html.push("<tr>");
3423
+ html.push("<td>", Util.pack_html_link("http://q.10jqka.com.cn/thshy/detail/code/" + item["code"], item["code"]), "</td>");
3424
+ html.push("<td>", Util.pack_html_link(industry_url + "?code=" + item["code"], item["name"]), "</td>");
3425
+ html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3426
+ html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3427
+ html.push("</tr>");
3425
3428
  });
3426
- Util.render_table_html("industry_table_body", _html);
3429
+ Util.render_table_html("industry_table_body", html);
3427
3430
  },
3428
3431
 
3429
3432
  /**
@@ -3431,11 +3434,11 @@ const Util = {
3431
3434
  * @param data
3432
3435
  */
3433
3436
  render_summary_period_etf_data: function(data) {
3434
- let _html = [];
3437
+ let html = [];
3435
3438
  data.forEach(function (item) {
3436
- _html.push("<tr>");
3437
- _html.push("<td>", Util.pack_html_link("https://fund.eastmoney.com/" + item["code"] + ".html", item["code"]), "</td>");
3438
- _html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["code"], "'>", item["name"], "</a></td>");
3439
+ html.push("<tr>");
3440
+ html.push("<td>", Util.pack_html_link("https://fund.eastmoney.com/" + item["code"] + ".html", item["code"]), "</td>");
3441
+ html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["code"], "'>", item["name"], "</a></td>");
3439
3442
  let change_quotient = "--";
3440
3443
  if (item["start_quotient"] && item["end_quotient"]) {
3441
3444
  let title = Util.strip_html(Util.to_unit(item["start_quotient"], 3)) + " - " + Util.strip_html(Util.to_unit(item["end_quotient"], 3));
@@ -3447,12 +3450,12 @@ const Util = {
3447
3450
  change_quotient = "<b title='" + title + "'>0.00</b>";
3448
3451
  }
3449
3452
  }
3450
- _html.push("<td>", change_quotient, "</td>");
3451
- _html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3452
- _html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3453
- _html.push("</tr>");
3453
+ html.push("<td>", change_quotient, "</td>");
3454
+ html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3455
+ html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3456
+ html.push("</tr>");
3454
3457
  });
3455
- Util.render_table_html("etf_table_body", _html);
3458
+ Util.render_table_html("etf_table_body", html);
3456
3459
  },
3457
3460
 
3458
3461
  /**
@@ -3460,18 +3463,18 @@ const Util = {
3460
3463
  * @param data
3461
3464
  */
3462
3465
  render_summary_period_index_data: function(data) {
3463
- let _html = [];
3466
+ let html = [];
3464
3467
  let index_url = Util.get_url("summary_index");
3465
3468
  data.forEach(function (item) {
3466
- _html.push("<tr>");
3467
- _html.push("<td>", Util.pack_html_link(item["url"], item["code"].toUpperCase()), "</td>");
3468
- _html.push("<td>", Util.pack_html_link(index_url + "?index_code=" + item["code"], item["name"]), "</td>");
3469
- _html.push("<td><b class='", Util.text_color(item["current_close"], item["start_close"]), "'>", Util.to_float(item["current_close"], 2), "</b></td>");
3470
- _html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3471
- _html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3472
- _html.push("</tr>");
3469
+ html.push("<tr>");
3470
+ html.push("<td>", Util.pack_html_link(item["url"], item["code"].toUpperCase()), "</td>");
3471
+ html.push("<td>", Util.pack_html_link(index_url + "?index_code=" + item["code"], item["name"]), "</td>");
3472
+ html.push("<td><b class='", Util.text_color(item["current_close"], item["start_close"]), "'>", Util.to_float(item["current_close"], 2), "</b></td>");
3473
+ html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3474
+ html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3475
+ html.push("</tr>");
3473
3476
  });
3474
- Util.render_table_html("index_table_body", _html);
3477
+ Util.render_table_html("index_table_body", html);
3475
3478
  },
3476
3479
 
3477
3480
  /**
@@ -3526,26 +3529,26 @@ const Util = {
3526
3529
  if (!Util.regexp_date_yyyy_mm_dd(end_date)) {
3527
3530
  end_date = "";
3528
3531
  }
3529
- let _html = [];
3530
- _html.push('<div class="form-group">');
3531
- _html.push('<label for="', select_id, '"></label>');
3532
- _html.push('<select id="', select_id, '" class="form-control"></select>');
3533
- _html.push('</div>');
3534
- _html.push('<div class="form-group">');
3535
- _html.push('<label for="', start_id, '"></label>');
3536
- _html.push('<div class="col-md-6 col-sm-6 col-xs-12 form-group">');
3537
- _html.push('<input type="text" class="form-control has-feedback-left" id="', start_id, '" name="', start_id, '" title="开始时间" placeholder="开始时间" value="', start_date, '">');
3538
- _html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
3539
- _html.push('</div>');
3540
- _html.push('</div>');
3541
- _html.push('<div class="form-group" style="margin-left: -15px;">');
3542
- _html.push('<label for="', end_id, '"></label>');
3543
- _html.push('<div class="col-md-6 col-sm-6 col-xs-12 form-group">');
3544
- _html.push('<input type="text" class="form-control has-feedback-left" id="', end_id, '" name="', end_id, '" title="结束时间" placeholder="结束时间" value="', end_date, '">');
3545
- _html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
3546
- _html.push('</div>');
3547
- _html.push('</div>');
3548
- $("#" + element_id).html(_html.join(""));
3532
+ let html = [];
3533
+ html.push('<div class="form-group">');
3534
+ html.push('<label for="', select_id, '"></label>');
3535
+ html.push('<select id="', select_id, '" class="form-control"></select>');
3536
+ html.push('</div>');
3537
+ html.push('<div class="form-group">');
3538
+ html.push('<label for="', start_id, '"></label>');
3539
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12 form-group">');
3540
+ html.push('<input type="text" class="form-control has-feedback-left" id="', start_id, '" name="', start_id, '" title="开始时间" placeholder="开始时间" value="', start_date, '">');
3541
+ html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
3542
+ html.push('</div>');
3543
+ html.push('</div>');
3544
+ html.push('<div class="form-group" style="margin-left: -15px;">');
3545
+ html.push('<label for="', end_id, '"></label>');
3546
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12 form-group">');
3547
+ html.push('<input type="text" class="form-control has-feedback-left" id="', end_id, '" name="', end_id, '" title="结束时间" placeholder="结束时间" value="', end_date, '">');
3548
+ html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
3549
+ html.push('</div>');
3550
+ html.push('</div>');
3551
+ $("#" + element_id).html(html.join(""));
3549
3552
  Util.init_range_picker_date(start_id, end_id, nth_day);
3550
3553
  Util.init_time_select_range(Obj, select_id, start_id, end_id, callback_func);
3551
3554
  },
@@ -3865,16 +3868,16 @@ const Util = {
3865
3868
  init_metrics_statistics: function (metrics, title, callback_func) {
3866
3869
  let metrics_drop_down_id = metrics + "_time_drop_down";
3867
3870
  if ($("#" + metrics_drop_down_id).length === 0) {
3868
- let _html = [];
3869
- _html.push('<div class="x_panel">');
3870
- _html.push('<div class="x_title"><div class="form-inline">');
3871
- _html.push('<div class="form-group"><h2 class="form-control-static" id="' + metrics + '_title">' + title + '<small id="' + metrics + '_tips"></small></h2></div>');
3872
- _html.push('<div class="form-group pull-right" id="' + metrics_drop_down_id + '" style="margin-right: 25px;">');
3873
- _html.push('</div>');
3874
- _html.push('</div><div class="clearfix"></div></div>');
3875
- _html.push('<div class="x_content" style="height:350px;"><div id="' + metrics + '_bar_canvas"></div></div>');
3876
- _html.push('</div>');
3877
- $("#metrics_" + metrics).html(_html.join(""));
3871
+ let html = [];
3872
+ html.push('<div class="x_panel">');
3873
+ html.push('<div class="x_title"><div class="form-inline">');
3874
+ html.push('<div class="form-group"><h2 class="form-control-static" id="' + metrics + '_title">' + title + '<small id="' + metrics + '_tips"></small></h2></div>');
3875
+ html.push('<div class="form-group pull-right" id="' + metrics_drop_down_id + '" style="margin-right: 25px;">');
3876
+ html.push('</div>');
3877
+ html.push('</div><div class="clearfix"></div></div>');
3878
+ html.push('<div class="x_content" style="height:350px;"><div id="' + metrics + '_bar_canvas"></div></div>');
3879
+ html.push('</div>');
3880
+ $("#metrics_" + metrics).html(html.join(""));
3878
3881
  Util.init_time_drop_down(metrics, metrics_drop_down_id, "daily", callback_func);
3879
3882
  Util.init_time_drop_down(metrics, metrics_drop_down_id, "week", callback_func);
3880
3883
  Util.init_time_drop_down(metrics, metrics_drop_down_id, "month", callback_func);
@@ -3895,16 +3898,16 @@ const Util = {
3895
3898
  time_arr = ["20日", "60日", "120日", "200日"];
3896
3899
  }
3897
3900
  let default_time = (date_type === "daily" || date_type === "week") ? time_arr[1] : time_arr[0];
3898
- let _html = [];
3899
- _html.push('<div class="btn-group">');
3900
- _html.push('<button id="' + metrics_drop_down_btn_id + '" data-val="' + date_type + '" type="button" class="btn btn-default ' + metrics + '_bar_btn">' + default_time + '</button>');
3901
- _html.push('<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></button>');
3902
- _html.push('<ul style="margin-top: 5px;" class="dropdown-menu" id="' + metrics_drop_down_type_id + '">');
3901
+ let html = [];
3902
+ html.push('<div class="btn-group">');
3903
+ html.push('<button id="' + metrics_drop_down_btn_id + '" data-val="' + date_type + '" type="button" class="btn btn-default ' + metrics + '_bar_btn">' + default_time + '</button>');
3904
+ html.push('<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></button>');
3905
+ html.push('<ul style="margin-top: 5px;" class="dropdown-menu" id="' + metrics_drop_down_type_id + '">');
3903
3906
  time_arr.forEach(function (t) {
3904
- _html.push('<li><a href="javacript:void(0);">', t, '</a></li>');
3907
+ html.push('<li><a href="javacript:void(0);">', t, '</a></li>');
3905
3908
  });
3906
- _html.push('</ul></div>&nbsp;');
3907
- $("#" + metrics_drop_down_id).append(_html.join(""));
3909
+ html.push('</ul></div>&nbsp;');
3910
+ $("#" + metrics_drop_down_id).append(html.join(""));
3908
3911
  $("#" + metrics_drop_down_type_id + " li a").click(function () {
3909
3912
  $("#" + metrics_drop_down_btn_id).text($(this).text());
3910
3913
  callback_func(metrics, date_type);