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.
Files changed (3) hide show
  1. package/constant.js +20 -20
  2. package/package.json +1 -1
  3. 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': 'concept_recommend', 'name': '关注', 'url': '/0x62eb78a74b24b6213c64b11e8422a48dc183853d'},
139
- {'key': 'concept_cloud', 'name': '心似白云常自在', 'url': '/0xaacc2078f38307e8a6855ecd96c69af39e1d69d3'},
140
- {'key': 'concept_vegetable', 'name': 'Veget', 'url': '/0xbd14b9e9686c14863ea0849fb60ba90acf4e35eb'},
141
- {'key': 'concept_zan', 'name': 'zangyn', 'url': '/0xbdc27e0a9908ee586033dbb801c57369e687810c'},
142
- {'key': 'concept_follow', 'name': '跟我走吧14', 'url': '/0x70da61572340cef1dd3506f6505b1d2fc8d45156'},
143
- {'key': 'concept_peng', 'name': '吴小朋同学', 'url': '/0x02073ae93ccbbda6e2f6a9d7588ba4f7c30a9af8'},
144
- {'key': 'concept_xiong', 'name': '王朝雄', 'url': '/0x7bf85e4b9a10a5a144cb079425581844d185a52e'},
145
- {'key': 'concept_penny', 'name': '梁斌penny', 'url': '/0xe796e2ec1b573ab027f72072147f8dfddc5d3368'},
146
- {'key': 'concept_wen', 'name': '崇文不尚武', 'url': '/0x3ed0283b64d5c5f90734cbfd438e1e1d92120686'},
147
- {'key': 'concept_patience', 'name': '耐力投资', 'url': '/0x5da86e138afaea0335185b45f00f2f92f3afb5cd'},
148
- {'key': 'concept_star50', 'name': '科创50', 'url': '/0x9b4e2daac43b0391842cb8e62c8b9aa07662d8bd'},
149
- {'key': 'concept_bellwether', 'name': '龙头股', 'url': '/0x4acb881cf7b392df48e10b52fe77115836d4cc10'},
150
- {'key': 'concept_market_situation', 'name': '市值风云', 'url': '/0xa2df531f71114d2001427d83d9955d2ab0a50cdf'},
151
- {'key': 'concept_chip', 'name': '芯片半导体', 'url': '/0xeaae1cab877b70e100512be6dbdb4a9b09afe732'},
152
- {'key': 'concept_auto_intelligent', 'name': '智能电动车', 'url': '/0x4594dd03fe141df964e980080769c5e171243ef0'},
153
- {'key': 'concept_hk', 'name': '港股', 'url': '/0xd63fedf985a711ff5b3b6567ee94e1ba49d3787c'},
154
- {'key': 'concept_us', 'name': '美股', 'url': '/0x77b7acd63bd93517f933bf0a02dafe82260f4791'},
155
- {'key': 'concept_military', 'name': '军工', 'url': '/0xe578dbe70c35bda0813a95ea97abd4a604733ed0'},
156
- {'key': 'concept_ten', 'name': '十倍股', 'url': '/0x8b46e8304b225e4ff0f25216dfcdf217c4a6f720'},
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.12",
3
+ "version": "1.3.14",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
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 obj = e.relatedTarget;
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 obj = e.relatedTarget;
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 obj = e.relatedTarget;
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";