sbd-npm 1.3.94 → 1.3.96
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/constant.js +1 -1
- package/package.json +1 -1
- package/summary_daily.js +20 -1
- package/util.js +97 -0
package/constant.js
CHANGED
package/package.json
CHANGED
package/summary_daily.js
CHANGED
@@ -73,10 +73,13 @@ $(function () {
|
|
73
73
|
return false;
|
74
74
|
}
|
75
75
|
Util.show_loading();
|
76
|
-
Util.post(location.pathname, {date: $("#trade_date").val(), action: "market_overview"}, function (j) {
|
76
|
+
Util.post(location.pathname, {date: $("#trade_date").val(), action: "market_overview", is_init: Util.is_init}, function (j) {
|
77
77
|
DailySummary.pack_market_overview(j["market_overview"]);
|
78
78
|
DailySummary.fetch_statistics_daily();
|
79
79
|
DailySummary.fetch_hsgt_ten(0);
|
80
|
+
if (j["date"] && !Util.is_mobile()) {
|
81
|
+
DailySummary.init_date_component(j["date"]);
|
82
|
+
}
|
80
83
|
});
|
81
84
|
},
|
82
85
|
|
@@ -492,6 +495,22 @@ $(function () {
|
|
492
495
|
$("#index_hist_modal_url").attr("href", c["url"]);
|
493
496
|
}
|
494
497
|
});
|
498
|
+
},
|
499
|
+
|
500
|
+
init_date_component: function(trade_date) {
|
501
|
+
let date_html = [];
|
502
|
+
date_html.push('<ul class="nav navbar-nav" style="margin-top: 10px;"><li class="nav-item">');
|
503
|
+
date_html.push('<div class="form-group">');
|
504
|
+
date_html.push('<label for="trade_date"></label>');
|
505
|
+
date_html.push('<div class="col-md-6 col-sm-6 col-xs-12 form-group" style="width: 200px;">');
|
506
|
+
date_html.push('<input type="text" class="form-control has-feedback-left" id="trade_date" name="trade_date" title="时间" placeholder="时间" value="">');
|
507
|
+
date_html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
|
508
|
+
date_html.push('</div>');
|
509
|
+
date_html.push('</div>');
|
510
|
+
date_html.push('</li></ul>');
|
511
|
+
$('.top_nav .nav_menu nav div.toggle').after(date_html.join(""));
|
512
|
+
$("#trade_date").val(Util.seconds_to_format(trade_date, "%Y-%m-%d"));
|
513
|
+
Util.init_date_range_picker("trade_date", DailySummary.fetch_data);
|
495
514
|
}
|
496
515
|
|
497
516
|
};
|
package/util.js
CHANGED
@@ -3291,6 +3291,103 @@ const Util = {
|
|
3291
3291
|
}
|
3292
3292
|
},
|
3293
3293
|
|
3294
|
+
/**
|
3295
|
+
* 周期时间内的价格涨跌幅
|
3296
|
+
* @param data
|
3297
|
+
*/
|
3298
|
+
render_summary_period_price_up_down: function(data) {
|
3299
|
+
let _html = [];
|
3300
|
+
let price_market_type = $("#price_market_type").val();
|
3301
|
+
data.forEach(function (item) {
|
3302
|
+
_html.push("<tr>");
|
3303
|
+
_html.push("<td>", Util.snowball_url(item["code"]), "</td>");
|
3304
|
+
let stock_name = item["name"];
|
3305
|
+
if (price_market_type !== "cn") {
|
3306
|
+
stock_name = Util.strip_bracket_string(stock_name);
|
3307
|
+
stock_name = stock_name.substr(0, 6);
|
3308
|
+
}
|
3309
|
+
_html.push("<td>", Util.stock_url(item["code"], stock_name), "</td>");
|
3310
|
+
_html.push("<td>", (item["market_capital"] ? (item["market_capital"] + "亿") : "--"), "</td>");
|
3311
|
+
_html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
|
3312
|
+
let p_color = Util.text_color(item["close"], item["open"]);
|
3313
|
+
_html.push("<td><b class='", p_color, "'>", Util.to_float(item["close"], 2), "<b></td>");
|
3314
|
+
let p_change_rate = Util.calc_change_rate(item["close"], item["open"], 4);
|
3315
|
+
p_change_rate = Util.to_float(p_change_rate * 100, 2)
|
3316
|
+
if (p_change_rate > 0) {
|
3317
|
+
p_change_rate = "+" + p_change_rate;
|
3318
|
+
}
|
3319
|
+
_html.push("<td><b class='", p_color, "'>", p_change_rate, "%<b></td>");
|
3320
|
+
_html.push("</tr>");
|
3321
|
+
});
|
3322
|
+
Util.render_table_html("price_up_down_table_body", _html);
|
3323
|
+
},
|
3324
|
+
|
3325
|
+
/**
|
3326
|
+
* 周期时间内的同花顺行业板块涨跌幅
|
3327
|
+
* @param data
|
3328
|
+
*/
|
3329
|
+
render_summary_period_industry_data: function(data) {
|
3330
|
+
let _html = [];
|
3331
|
+
let industry_url = Util.get_url("summary_industry");
|
3332
|
+
data.forEach(function (item) {
|
3333
|
+
_html.push("<tr>");
|
3334
|
+
_html.push("<td>", Util.pack_html_link("http://q.10jqka.com.cn/thshy/detail/code/" + item["code"], item["code"]), "</td>");
|
3335
|
+
_html.push("<td>", Util.pack_html_link(industry_url + "?code=" + item["code"], item["name"]), "</td>");
|
3336
|
+
_html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
|
3337
|
+
_html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
|
3338
|
+
_html.push("</tr>");
|
3339
|
+
});
|
3340
|
+
Util.render_table_html("industry_table_body", _html);
|
3341
|
+
},
|
3342
|
+
|
3343
|
+
/**
|
3344
|
+
* 周期时间内的ETF涨跌幅
|
3345
|
+
* @param data
|
3346
|
+
*/
|
3347
|
+
render_summary_period_etf_data: function(data) {
|
3348
|
+
let _html = [];
|
3349
|
+
data.forEach(function (item) {
|
3350
|
+
_html.push("<tr>");
|
3351
|
+
_html.push("<td>", Util.pack_html_link("https://fund.eastmoney.com/" + item["code"] + ".html", item["code"]), "</td>");
|
3352
|
+
_html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["code"], "'>", item["name"], "</a></td>");
|
3353
|
+
let change_quotient = "--";
|
3354
|
+
if (item["start_quotient"] && item["end_quotient"]) {
|
3355
|
+
let title = Util.strip_html(Util.to_unit(item["start_quotient"], 3)) + " - " + Util.strip_html(Util.to_unit(item["end_quotient"], 3));
|
3356
|
+
if (item["end_quotient"] > item["start_quotient"]) {
|
3357
|
+
change_quotient = "<b title='" + title + "' class='text-danger'>+" + Util.strip_html(Util.to_unit(item["end_quotient"] - item["start_quotient"], 1)) + "</b>";
|
3358
|
+
} else if (item["end_quotient"] < item["start_quotient"]) {
|
3359
|
+
change_quotient = "<b title='" + title + "' class='text-success'>" + Util.strip_html(Util.to_unit(item["end_quotient"] - item["start_quotient"], 1)) + "</b>";
|
3360
|
+
} else {
|
3361
|
+
change_quotient = "<b title='" + title + "'>0.00</b>";
|
3362
|
+
}
|
3363
|
+
}
|
3364
|
+
_html.push("<td>", change_quotient, "</td>");
|
3365
|
+
_html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
|
3366
|
+
_html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
|
3367
|
+
_html.push("</tr>");
|
3368
|
+
});
|
3369
|
+
Util.render_table_html("etf_table_body", _html);
|
3370
|
+
},
|
3371
|
+
|
3372
|
+
/**
|
3373
|
+
* 周期时间内的指数涨跌幅
|
3374
|
+
* @param data
|
3375
|
+
*/
|
3376
|
+
render_summary_period_index_data: function(data) {
|
3377
|
+
let _html = [];
|
3378
|
+
let index_url = Util.get_url("summary_index");
|
3379
|
+
data.forEach(function (item) {
|
3380
|
+
_html.push("<tr>");
|
3381
|
+
_html.push("<td>", Util.pack_html_link(item["url"], item["code"].toUpperCase()), "</td>");
|
3382
|
+
_html.push("<td>", Util.pack_html_link(index_url + "?index_code=" + item["code"], item["name"]), "</td>");
|
3383
|
+
_html.push("<td><b class='", Util.text_color(item["current_close"], item["start_close"]), "'>", Util.to_float(item["current_close"], 2), "</b></td>");
|
3384
|
+
_html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
|
3385
|
+
_html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
|
3386
|
+
_html.push("</tr>");
|
3387
|
+
});
|
3388
|
+
Util.render_table_html("index_table_body", _html);
|
3389
|
+
},
|
3390
|
+
|
3294
3391
|
/**
|
3295
3392
|
* 设置 option 的第 nth 项为默认项
|
3296
3393
|
* @param obj
|