sbd-npm 1.5.4 → 1.5.6

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 +1 -1
  2. package/package.json +1 -1
  3. package/util.js +15 -15
package/constant.js CHANGED
@@ -160,11 +160,11 @@ const MenuList = [
160
160
  'icon': 'retweet',
161
161
  'menu': [
162
162
  {'key': 'portfolio_recommend', 'name': '关注', 'url': '/0x2da99e58e28de94b670c4200657ac7e26dd8dceb'},
163
+ {'key': 'portfolio_gao', 'name': '高大侠', 'url': '/0x44fe5ef98b6802a9e7a893a1dcc231031ef8683d'},
163
164
  {'key': 'portfolio_chen', 'name': '陈营长极品投资', 'url': '/0x3f8cbeeeb38138a626e935017a4cc25f47ce3dbe'},
164
165
  {'key': 'portfolio_stratagem', 'name': '上兵伐谋zgz', 'url': '/0x622a4a04d7a04e3b28c85a36500371ba28edea83'},
165
166
  {'key': 'portfolio_zeng', 'name': '老曾阿牛', 'url': '/0x2cf53b473b916e1d8b9998de00bb782171bb2630'},
166
167
  {'key': 'portfolio_dao', 'name': '专注成长的股事笔记', 'url': '/0xf9d3664538c43bf7f886674abe7af9710aab82ec'},
167
- {'key': 'portfolio_vegetable', 'name': 'Veget', 'url': '/0x671dd9dcfca7dbc220c8164c92a74d2c561c6464'},
168
168
  {'key': 'portfolio_tianjin', 'name': '天津股侠', 'url': '/0xb8428e42237a7485a787e2ab1b5ae0f057258f18'},
169
169
  {'key': 'portfolio_junk', 'name': 'HK破烂王', 'url': '/0xfa43c30e5399feb566fb9a8181c175b0af0dff7f'},
170
170
  {'key': 'portfolio_star50', 'name': '科创50', 'url': '/0x378b2601d83c467f81f1d4e323c8bfbc72f6cc0d'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/util.js CHANGED
@@ -146,8 +146,7 @@ const Util = {
146
146
  }
147
147
  }
148
148
 
149
- let document_html = document.documentElement.innerHTML;
150
- let version_match = document_html.match(/\/sbd-npm@(\d+\.\d+\.\d+)\//);
149
+ let version_match = document.documentElement.innerHTML.match(/\/sbd-npm@(\d+\.\d+\.\d+)\//);
151
150
  if (version_match) {
152
151
  Util.version = version_match[1];
153
152
  }
@@ -223,17 +222,16 @@ const Util = {
223
222
  * @returns {string}
224
223
  */
225
224
  get_url: function (key) {
226
- let url = location.pathname;
227
225
  if (typeof MenuList != "undefined") {
228
- MenuList.forEach(function (menu) {
229
- menu["menu"].forEach(function (m) {
226
+ for (const menu of MenuList) {
227
+ for (const m of menu["menu"]) {
230
228
  if (m["key"] === key) {
231
- url = m["url"];
229
+ return m["url"];
232
230
  }
233
- });
234
- });
231
+ }
232
+ }
235
233
  }
236
- return url;
234
+ return location.pathname;
237
235
  },
238
236
 
239
237
  /**
@@ -323,7 +321,11 @@ const Util = {
323
321
  },
324
322
  error: function (jqXHR, textStatus, errorThrown) {
325
323
  Util.hide_tips();
326
- if (!errorThrown) {
324
+ if (errorThrown) {
325
+ if (jqXHR.status) {
326
+ errorThrown += '(HTTP ' + jqXHR.status + ')';
327
+ }
328
+ } else {
327
329
  if ((textStatus === 'error' && jqXHR.status === 0) || !navigator.onLine) {
328
330
  errorThrown = "网络异常";
329
331
  } else if (textStatus === 'timeout') {
@@ -331,13 +333,12 @@ const Util = {
331
333
  } else if (textStatus === 'abort') {
332
334
  errorThrown = "请求被中止";
333
335
  } else if (jqXHR.status) {
334
- errorThrown = '请求失败(HTTP ' + jqXHR.status + '';
336
+ errorThrown = '请求失败(HTTP ' + jqXHR.status + ')';
335
337
  } else {
336
338
  errorThrown = "未知错误";
337
339
  }
338
340
  }
339
- let msg = "[" + textStatus + "] " + errorThrown;
340
- Util.show_tips(msg, 0, "alert-danger");
341
+ Util.show_tips(`[${textStatus.toUpperCase()}] ${errorThrown}`, 0, "alert-danger");
341
342
  }
342
343
  //timeout: 5000
343
344
  })
@@ -2611,8 +2612,7 @@ const Util = {
2611
2612
  let result = "";
2612
2613
  if (time > 1000) {
2613
2614
  let second = Math.round(time / 1000);
2614
- let minute = 0;
2615
- let hour = 0;
2615
+ let minute = 0, hour = 0;
2616
2616
  if (second > 60) {
2617
2617
  minute = Math.round(second / 60);
2618
2618
  second = Math.round(second % 60);