sbd-npm 1.3.12 → 1.3.14
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 +20 -20
- package/package.json +1 -1
- package/util.js +49 -9
package/constant.js
CHANGED
@@ -132,28 +132,28 @@ const MenuList = [
|
|
132
132
|
]
|
133
133
|
},
|
134
134
|
{
|
135
|
-
'name': '
|
135
|
+
'name': '组合',
|
136
136
|
'icon': 'retweet',
|
137
137
|
'menu': [
|
138
|
-
{'key': '
|
139
|
-
{'key': '
|
140
|
-
{'key': '
|
141
|
-
{'key': '
|
142
|
-
{'key': '
|
143
|
-
{'key': '
|
144
|
-
{'key': '
|
145
|
-
{'key': '
|
146
|
-
{'key': '
|
147
|
-
{'key': '
|
148
|
-
{'key': '
|
149
|
-
{'key': '
|
150
|
-
{'key': '
|
151
|
-
{'key': '
|
152
|
-
{'key': '
|
153
|
-
{'key': '
|
154
|
-
{'key': '
|
155
|
-
{'key': '
|
156
|
-
{'key': '
|
138
|
+
{'key': 'portfolio_recommend', 'name': '关注', 'url': '/0x2da99e58e28de94b670c4200657ac7e26dd8dceb'},
|
139
|
+
{'key': 'portfolio_cloud', 'name': '心似白云常自在', 'url': '/0x9ea6081b57418a7f987775631043f7f924e25cff'},
|
140
|
+
{'key': 'portfolio_vegetable', 'name': 'Veget', 'url': '/0x671dd9dcfca7dbc220c8164c92a74d2c561c6464'},
|
141
|
+
{'key': 'portfolio_zan', 'name': 'zangyn', 'url': '/0xccb07ddaf4f1219b7b5ae64780e7905206927873'},
|
142
|
+
{'key': 'portfolio_follow', 'name': '跟我走吧14', 'url': '/0x4aa68e74a66297c0ece1bb05fad20c32ee1db9e4'},
|
143
|
+
{'key': 'portfolio_peng', 'name': '吴小朋同学', 'url': '/0x4f1a316c05731e365ec1b7ef454d98206fa973f6'},
|
144
|
+
{'key': 'portfolio_xiong', 'name': '王朝雄', 'url': '/0x343ce49bbb77316cea85c3daa44370d4c808b59d'},
|
145
|
+
{'key': 'portfolio_penny', 'name': '梁斌penny', 'url': '/0x34ec770b56fbd946e2a3467664efbe674d04f6ec'},
|
146
|
+
{'key': 'portfolio_wen', 'name': '崇文不尚武', 'url': '/0xe09c047550390159bda66d6315743427dd7ccae4'},
|
147
|
+
{'key': 'portfolio_patience', 'name': '耐力投资', 'url': '/0x55ecbeeabd7ad78dba8c38a9325b2889798622b3'},
|
148
|
+
{'key': 'portfolio_star50', 'name': '科创50', 'url': '/0x378b2601d83c467f81f1d4e323c8bfbc72f6cc0d'},
|
149
|
+
{'key': 'portfolio_bellwether', 'name': '龙头股', 'url': '/0x7cdfb14131c3693c439a90333790eeb5fce70a12'},
|
150
|
+
{'key': 'portfolio_market_situation', 'name': '市值风云', 'url': '/0x3720c6de05378152ef0e758b56199bfcbc15274b'},
|
151
|
+
{'key': 'portfolio_chip', 'name': '芯片半导体', 'url': '/0x05ad16cc1cc6b9ee1f3bb134e798a83037878de3'},
|
152
|
+
{'key': 'portfolio_auto_intelligent', 'name': '智能电动车', 'url': '/0xa4dd0bd98c5924bf4c9f944ea97a93cbb0a6cb35'},
|
153
|
+
{'key': 'portfolio_hk', 'name': '港股', 'url': '/0x64616c9e7d2445c983368baebc4a19eb71b551d8'},
|
154
|
+
{'key': 'portfolio_us', 'name': '美股', 'url': '/0x86b284830e66126ffe8713f74a80e200fbc0b3e8'},
|
155
|
+
{'key': 'portfolio_military', 'name': '军工', 'url': '/0xb6fbf84b36bd30980b1e500fb0ace21fc71ca6cb'},
|
156
|
+
{'key': 'portfolio_ten', 'name': '十倍股', 'url': '/0x63d3bc4bf21f568a6e490d87be5e09b557e274d9'},
|
157
157
|
]
|
158
158
|
},
|
159
159
|
{
|
package/package.json
CHANGED
package/util.js
CHANGED
@@ -82,6 +82,7 @@ const Util = {
|
|
82
82
|
window.open(Util.array_rand(url_arr), "_blank");
|
83
83
|
}
|
84
84
|
});
|
85
|
+
$("#save_page_content").click(Util.save_page_content_image);
|
85
86
|
|
86
87
|
$('#stock').keyup(function () {
|
87
88
|
let st_obj = $("#search-tips");
|
@@ -181,6 +182,50 @@ const Util = {
|
|
181
182
|
return url;
|
182
183
|
},
|
183
184
|
|
185
|
+
/**
|
186
|
+
* 当前页面内容保存为图片
|
187
|
+
* [html2canvas](https://html2canvas.hertzen.com)
|
188
|
+
*/
|
189
|
+
save_page_content_image: function() {
|
190
|
+
if (!Util.is_load) {
|
191
|
+
Util.is_load = true;
|
192
|
+
Util.show_tips("正在生成中", 0, "alert-danger");
|
193
|
+
Util.show_loading();
|
194
|
+
// 获取要截取的HTML元素
|
195
|
+
let element = document.getElementById('page_content');
|
196
|
+
// 创建canvas元素
|
197
|
+
let canvas = document.createElement("canvas");
|
198
|
+
canvas.width = element.offsetWidth;
|
199
|
+
canvas.height = element.offsetHeight;
|
200
|
+
// 将html元素渲染到canvas上
|
201
|
+
html2canvas(element).then((canvas) => {
|
202
|
+
// 获取Canvas上下文对象
|
203
|
+
//let ctx = canvas.getContext('2d');
|
204
|
+
// 添加水印
|
205
|
+
//ctx.font = '30px Arial';
|
206
|
+
//ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';
|
207
|
+
//let text = 'Stock Big Data';
|
208
|
+
//let textSize = ctx.measureText(text);
|
209
|
+
//let centerX = (canvas.width - textSize.width) / 2;
|
210
|
+
//let centerY = canvas.height / 2;
|
211
|
+
//ctx.fillText(text, centerX, centerY);
|
212
|
+
|
213
|
+
// 创建一个新的图像对象
|
214
|
+
let img = new Image();
|
215
|
+
// 设置图像的源为canvas中的内容
|
216
|
+
img.src = canvas.toDataURL("image/png");
|
217
|
+
// 创建一个下载链接并模拟点击
|
218
|
+
let link = document.createElement("a");
|
219
|
+
link.download = "sbd_page_content_" + Util.now() + ".png";
|
220
|
+
link.href = img.src;
|
221
|
+
link.click();
|
222
|
+
|
223
|
+
Util.is_load = false;
|
224
|
+
Util.hide_tips();
|
225
|
+
});
|
226
|
+
}
|
227
|
+
},
|
228
|
+
|
184
229
|
/**
|
185
230
|
* https://api.jquery.com/jquery.ajax/
|
186
231
|
* $.ajax 方法参数:
|
@@ -1106,8 +1151,7 @@ const Util = {
|
|
1106
1151
|
Util.init_modal_skeleton(component_id, modal_content_html);
|
1107
1152
|
let component_obj = $('#' + component_id);
|
1108
1153
|
component_obj.on('shown.bs.modal', function (e) {
|
1109
|
-
let
|
1110
|
-
let fund_code = $(obj).attr("data-val");
|
1154
|
+
let fund_code = $(e.relatedTarget).attr("data-val");
|
1111
1155
|
Util.fetch_public_fund_detail(fund_code, component_id);
|
1112
1156
|
});
|
1113
1157
|
component_obj.on('hidden.bs.modal', function () {
|
@@ -1344,8 +1388,7 @@ const Util = {
|
|
1344
1388
|
});
|
1345
1389
|
let component_obj = $('#' + component_id);
|
1346
1390
|
component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
|
1347
|
-
let
|
1348
|
-
let currency = $(obj).attr("data-code");
|
1391
|
+
let currency = $(e.relatedTarget).attr("data-code");
|
1349
1392
|
Util.set_table_loading(component_id + "_body_body");
|
1350
1393
|
if ($("#currency_modal_start_date").length <= 0) {
|
1351
1394
|
Util.init_range_date("currency_modal_start_end_date", Util, "render_currency_modal", 60);
|
@@ -1437,8 +1480,7 @@ const Util = {
|
|
1437
1480
|
});
|
1438
1481
|
let component_obj = $('#' + component_id);
|
1439
1482
|
component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
|
1440
|
-
let
|
1441
|
-
let coin = $(obj).attr("data-coin");
|
1483
|
+
let coin = $(e.relatedTarget).attr("data-coin");
|
1442
1484
|
Util.set_table_loading(component_id + "_body_body");
|
1443
1485
|
if ($("#" + component_id + "_start_date").length <= 0) {
|
1444
1486
|
Util.init_range_date(component_id + "_start_end_date", Util, "render_btc_modal", 60);
|
@@ -2666,9 +2708,7 @@ const Util = {
|
|
2666
2708
|
* @returns {string}
|
2667
2709
|
*/
|
2668
2710
|
digit_compare_trend: function (digit, previous_digit) {
|
2669
|
-
let cls = "";
|
2670
|
-
let trend_ratio = "(0)";
|
2671
|
-
let ratio_val = 0;
|
2711
|
+
let cls = "", trend_ratio = "(0)", ratio_val = 0;
|
2672
2712
|
if (digit > 0 && previous_digit > 0) {
|
2673
2713
|
if (digit > previous_digit) {
|
2674
2714
|
cls = "text-danger";
|