sbd-npm 1.2.5 → 1.2.8
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/package.json +1 -1
- package/stock_basics.js +1 -20
- package/util.js +30 -2
package/package.json
CHANGED
package/stock_basics.js
CHANGED
@@ -27,7 +27,6 @@ let Stock = {
|
|
27
27
|
hist_type: "",
|
28
28
|
hist_start_date: "",
|
29
29
|
hist_end_date: "",
|
30
|
-
profile: "",
|
31
30
|
data: {},
|
32
31
|
profit_data: [], // 盈利数据
|
33
32
|
|
@@ -171,25 +170,7 @@ let Stock = {
|
|
171
170
|
cf_obj.html(Util.strip_html(Util.to_unit(cf_obj.attr("title"))));
|
172
171
|
//获取股票详情数据
|
173
172
|
Util.post("/stock/" + Stock["code"], {action: "code_detail"}, function (item) {
|
174
|
-
|
175
|
-
// 简介
|
176
|
-
Util.init_modal_skeleton("profile_modal");
|
177
|
-
$("#profile_modal_title").html("简介");
|
178
|
-
Stock.profile = item["intro"];
|
179
|
-
let profile = Util.sub_str(Stock.profile, 250);
|
180
|
-
profile += " <a class='unfold text-info' data-toggle='modal' data-target='.profile_modal' href='#'>展开</a>";
|
181
|
-
$("#profile").html(profile);
|
182
|
-
$('#profile_modal').on('shown.bs.modal', function () {
|
183
|
-
let p_arr = Stock.profile.split("。");
|
184
|
-
let _html = [];
|
185
|
-
p_arr.forEach(function (p) {
|
186
|
-
if (p.length > 0) {
|
187
|
-
_html.push("<p>", p.replace(/,/g, ","), "。</p>");
|
188
|
-
}
|
189
|
-
});
|
190
|
-
Util.render_table_html("profile_modal_body", _html);
|
191
|
-
});
|
192
|
-
}
|
173
|
+
Util.init_profile_component("profile", item["intro"]);
|
193
174
|
if (item["latest_date"] && !Stock.hist_end_date) {
|
194
175
|
Stock.hist_end_date = Util.seconds_to_format(item["latest_date"], "%Y-%m-%d");
|
195
176
|
Stock.hist_start_date = Util.seconds_to_format(item["latest_date"] - 60 * Util.one_day_second, "%Y-%m-%d");
|
package/util.js
CHANGED
@@ -1207,6 +1207,31 @@ const Util = {
|
|
1207
1207
|
});
|
1208
1208
|
},
|
1209
1209
|
|
1210
|
+
/**
|
1211
|
+
* 沪深港股通成交股统计
|
1212
|
+
* @param element_id
|
1213
|
+
* @param profile
|
1214
|
+
*/
|
1215
|
+
init_profile_component: function(element_id, profile) {
|
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 += " <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 () {
|
1223
|
+
let p_arr = profile.split("。");
|
1224
|
+
let _html = [];
|
1225
|
+
p_arr.forEach(function (p) {
|
1226
|
+
if (p.length > 0) {
|
1227
|
+
_html.push("<p>", p.replace(/,/g, ","), "。</p>");
|
1228
|
+
}
|
1229
|
+
});
|
1230
|
+
Util.render_table_html("profile_modal_body", _html);
|
1231
|
+
});
|
1232
|
+
}
|
1233
|
+
},
|
1234
|
+
|
1210
1235
|
/**
|
1211
1236
|
* 当前时间戳
|
1212
1237
|
* @returns {number}
|
@@ -2248,8 +2273,11 @@ const Util = {
|
|
2248
2273
|
*/
|
2249
2274
|
pack_snowball_follower: function(item) {
|
2250
2275
|
if (item["snowball_follower"] && item["snowball_follower"] > 0) {
|
2251
|
-
let
|
2252
|
-
|
2276
|
+
let snowball_follower_rank = Util.to_unit(item["snowball_follower"]) + "(" + item["snowball_follower_rank"] + ")";
|
2277
|
+
let market_type = Util.is_hk(item["code"]) ? "hk" : "cn";
|
2278
|
+
snowball_follower_rank = Util.pack_html_link(Util.get_url("rank_holder") + "?sort_type=snowball_follower&market_type=" + market_type, snowball_follower_rank);
|
2279
|
+
let tooltip = item["snowball_follower"] + " 人关注,关注排名第 " + item["snowball_follower_rank"] + " 位";
|
2280
|
+
$("#snowball_follower").html(snowball_follower_rank + ' <i class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="top" data-original-title="' + tooltip + '"></i>');
|
2253
2281
|
$("[data-toggle='tooltip']").tooltip();
|
2254
2282
|
}
|
2255
2283
|
},
|