component-shipinlv 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -0
  3. package/dist/AuthClient/index.d.ts +10 -0
  4. package/dist/AuthClient/index.js +24 -0
  5. package/dist/AuthClient/login-reg.d.ts +9 -0
  6. package/dist/AuthClient/login-reg.js +62 -0
  7. package/dist/AuthClient/login-reg.less +13 -0
  8. package/dist/AuthClient/login.d.ts +7 -0
  9. package/dist/AuthClient/login.js +159 -0
  10. package/dist/AuthClient/login.less +52 -0
  11. package/dist/AuthClient/qr/index.d.ts +13 -0
  12. package/dist/AuthClient/qr/index.js +315 -0
  13. package/dist/AuthClient/qr/index.less +84 -0
  14. package/dist/AuthClient/qr/typings.d.ts +22 -0
  15. package/dist/AuthClient/qr/ws.d.ts +20 -0
  16. package/dist/AuthClient/qr/ws.js +253 -0
  17. package/dist/AuthClient/reg.d.ts +7 -0
  18. package/dist/AuthClient/reg.js +170 -0
  19. package/dist/AuthClient/reg.less +3 -0
  20. package/dist/Buy/index.d.ts +14 -0
  21. package/dist/Buy/index.js +91 -0
  22. package/dist/Buy/index.less +26 -0
  23. package/dist/Buy/qr.d.ts +11 -0
  24. package/dist/Buy/qr.js +185 -0
  25. package/dist/Buy/qr.less +69 -0
  26. package/dist/Login/index.d.ts +2 -0
  27. package/dist/Login/index.js +5 -0
  28. package/dist/Product/index.d.ts +4 -0
  29. package/dist/Product/index.js +34 -0
  30. package/dist/Product/index.less +84 -0
  31. package/dist/UI/DialogDrawer.d.ts +8 -0
  32. package/dist/UI/DialogDrawer.js +67 -0
  33. package/dist/UI/DialogDrawer.less +10 -0
  34. package/dist/UI/DialogDrawerFooter.d.ts +7 -0
  35. package/dist/UI/DialogDrawerFooter.js +23 -0
  36. package/dist/UI/DialogDrawerFooter.less +19 -0
  37. package/dist/UI/LoadError.d.ts +10 -0
  38. package/dist/UI/LoadError.js +37 -0
  39. package/dist/UI/LoadError.less +18 -0
  40. package/dist/UI/PageContentWarp.d.ts +16 -0
  41. package/dist/UI/PageContentWarp.js +46 -0
  42. package/dist/UI/PageContentWarp.less +11 -0
  43. package/dist/VipCompare/commend.d.ts +7 -0
  44. package/dist/VipCompare/commend.js +29 -0
  45. package/dist/VipCompare/commend.less +7 -0
  46. package/dist/VipCompare/index.d.ts +9 -0
  47. package/dist/VipCompare/index.js +320 -0
  48. package/dist/VipCompare/index.less +26 -0
  49. package/dist/component/product-dict.d.ts +10 -0
  50. package/dist/component/product-dict.js +11 -0
  51. package/dist/component/product-type.d.ts +6 -0
  52. package/dist/component/product-type.js +19 -0
  53. package/dist/component/websocket/index.d.ts +22 -0
  54. package/dist/component/websocket/index.js +139 -0
  55. package/dist/config/apiUrls.d.ts +9 -0
  56. package/dist/config/apiUrls.js +25 -0
  57. package/dist/index.d.ts +5 -0
  58. package/dist/index.js +5 -0
  59. package/dist/lib/Tool.d.ts +201 -0
  60. package/dist/lib/Tool.js +1086 -0
  61. package/dist/lib/call-mini-url.d.ts +2 -0
  62. package/dist/lib/call-mini-url.js +8 -0
  63. package/dist/lib/getApiUrl.d.ts +5 -0
  64. package/dist/lib/getApiUrl.js +56 -0
  65. package/dist/lib/goAuth.d.ts +1 -0
  66. package/dist/lib/goAuth.js +28 -0
  67. package/dist/lib/js-error.d.ts +2 -0
  68. package/dist/lib/js-error.js +27 -0
  69. package/dist/lib/notification.d.ts +9 -0
  70. package/dist/lib/notification.js +42 -0
  71. package/dist/lib/platform.d.ts +12 -0
  72. package/dist/lib/platform.js +48 -0
  73. package/dist/lib/postMessage.d.ts +3 -0
  74. package/dist/lib/postMessage.js +8 -0
  75. package/dist/lib/request.d.ts +3 -0
  76. package/dist/lib/request.js +97 -0
  77. package/dist/service/api/AuthController.d.ts +16 -0
  78. package/dist/service/api/AuthController.js +75 -0
  79. package/dist/service/api/JsErrorController.d.ts +5 -0
  80. package/dist/service/api/JsErrorController.js +27 -0
  81. package/dist/service/api/ProductController.d.ts +7 -0
  82. package/dist/service/api/ProductController.js +53 -0
  83. package/dist/service/api/TradeController.d.ts +7 -0
  84. package/dist/service/api/TradeController.js +52 -0
  85. package/dist/service/api/UserController.d.ts +2 -0
  86. package/dist/service/api/UserController.js +52 -0
  87. package/dist/service/api/VipController.d.ts +6 -0
  88. package/dist/service/api/VipController.js +50 -0
  89. package/dist/service/typing.d.ts +12 -0
  90. package/dist/typings/Product.d.ts +25 -0
  91. package/dist/typings/Product.js +0 -0
  92. package/dist/typings/Trade.d.ts +29 -0
  93. package/dist/typings/Trade.js +0 -0
  94. package/dist/typings/User.d.ts +54 -0
  95. package/dist/typings/User.js +0 -0
  96. package/dist/typings/Vip.d.ts +15 -0
  97. package/dist/typings/Vip.js +0 -0
  98. package/dist/typings.d.ts +66 -0
  99. package/dist/window.d.ts +9 -0
  100. package/package.json +88 -0
@@ -0,0 +1,1086 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
+ // @ts-nocheck
6
+
7
+ import { Modal, message, Tooltip } from 'antd';
8
+ var JrQrcode = require('jr-qrcode');
9
+
10
+ // import { history } from 'umi';
11
+
12
+ import ReactDOM from 'react-dom';
13
+ import { useRequest } from '@umijs/hooks';
14
+ import moment from 'moment';
15
+ import DialogDrawer from "../UI/DialogDrawer";
16
+ import notification from "./notification";
17
+ import JsError from "./js-error";
18
+ import PostMessage from "./postMessage";
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ var packageJson = require("../../package.json");
21
+ var store = {
22
+ get: function get(name) {
23
+ var getData;
24
+ try {
25
+ getData = window.localStorage.getItem('__shan__' + name);
26
+ if (getData) {
27
+ getData = JSON.parse(getData);
28
+ }
29
+ } catch (e) {
30
+ console.error('LocalStorage get error:', e);
31
+ }
32
+ var out;
33
+ if (!getData) {
34
+ out = '';
35
+ } else {
36
+ out = getData.value;
37
+ }
38
+ return out;
39
+ },
40
+ set: function set(name, value) {
41
+ value = typeof value === 'undefined' ? '' : value;
42
+ var saveData = {
43
+ value: value
44
+ };
45
+ try {
46
+ window.localStorage.setItem('__shan__' + name, JSON.stringify(saveData));
47
+ } catch (e) {
48
+ console.error('LocalStorage set Error:', e);
49
+ }
50
+ }
51
+ };
52
+ var Tool = _objectSpread(_objectSpread({
53
+ version: packageJson.version,
54
+ useRequest: useRequest,
55
+ // 保存全局数据
56
+ GData: {
57
+ userInfo: {}
58
+ },
59
+ //window._GData,
60
+ data: function data(key, value) {
61
+ if (typeof value === 'undefined') {
62
+ this.GData[key] = value;
63
+ return;
64
+ }
65
+ return this.GData[key];
66
+ },
67
+ getInviteUserId: function getInviteUserId() {
68
+ return parseInt(Tool.store.get('inviteUserId')) || Tool.getLocalSiteInfo().dealerId || 1;
69
+ },
70
+ getLocalUserInfo: function getLocalUserInfo() {
71
+ var storageUserInfo = _objectSpread({
72
+ id: 0,
73
+ sid: '',
74
+ shareId: '',
75
+ name: '',
76
+ isLogin: false,
77
+ avatarUrl: '',
78
+ canWithdraw: 0,
79
+ douzhuliId36: ''
80
+ }, store.get('userInfo'));
81
+ storageUserInfo.avatarUrl = storageUserInfo.avatarUrl || 'https://douzhuli.oss-cn-hangzhou.aliyuncs.com/avatar/1-10.png';
82
+ return storageUserInfo;
83
+ },
84
+ setLocalUserInfo: function setLocalUserInfo() {
85
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
86
+ var userInfo = _objectSpread(_objectSpread({}, this.getLocalUserInfo()), data);
87
+ store.set('userInfo', userInfo);
88
+ return userInfo;
89
+ },
90
+ getLocalSiteInfo: function getLocalSiteInfo() {
91
+ var storageUserInfo = _objectSpread({
92
+ dealerId: 1,
93
+ weContactQrUrl: '',
94
+ isIDealer: false,
95
+ icp: '浙ICP备16011722号',
96
+ wechatAppId: '',
97
+ domainTitle: '',
98
+ webTitle: '',
99
+ sitePause: {
100
+ isPause: false,
101
+ reason: ''
102
+ }
103
+ }, store.get('site-info'));
104
+ return storageUserInfo;
105
+ }
106
+ }, notification), {}, {
107
+ event: {
108
+ run: function run(name, data) {
109
+ console.log('Reg event run:', name, data);
110
+ if (!name) {
111
+ return;
112
+ }
113
+ this.events.forEach(function (item) {
114
+ // 命中 子集事件
115
+ if (item.name === name || "".concat(item.name, ".").indexOf(name) === 0) {
116
+ item.fn(data);
117
+ }
118
+ });
119
+ },
120
+ on: function on(name, fn) {
121
+ var isGlobalOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
122
+ console.log('Reg event do:', name);
123
+ var eventItem = {
124
+ name: name,
125
+ fn: fn
126
+ };
127
+ this.events.push(eventItem);
128
+ },
129
+ // 只绑定一次,但会运行多次;
130
+ one: function one(name, fn) {
131
+ var isBind = false;
132
+ this.events.forEach(function (items) {
133
+ if (items.name === name) {
134
+ isBind = true;
135
+ }
136
+ });
137
+ if (isBind) {
138
+ console.log('event bind:', name);
139
+ return;
140
+ }
141
+ this.on(name, fn);
142
+ },
143
+ // 删除事件
144
+ off: function off(name) {
145
+ var _this = this;
146
+ this.events.forEach(function (item, index) {
147
+ var isDel;
148
+ // 匹配到子集事件
149
+ if ("".concat(item.name, ".").indexOf(name) > -1) {
150
+ isDel = true;
151
+ } else if (name === item.name) {
152
+ // 一级,子集的子集
153
+ isDel = true;
154
+ }
155
+ if (isDel) {
156
+ item.fn = function () {};
157
+ _this.events.splice(index, 1);
158
+ }
159
+ });
160
+ },
161
+ // 记录
162
+ events: []
163
+ },
164
+ formatTime: function formatTime(time) {
165
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
166
+ if (!time) {
167
+ return '';
168
+ }
169
+ if (typeof time === 'number') {
170
+ if (String(time).length === 10) {
171
+ time = time * 1000;
172
+ }
173
+ }
174
+ return moment(time).format(format);
175
+ },
176
+ openWindow: function openWindow(url) {
177
+ var _this2 = this;
178
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
179
+ var $link;
180
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
181
+ while (1) switch (_context.prev = _context.next) {
182
+ case 0:
183
+ $link = document.createElement('a');
184
+ $link.href = url;
185
+ $link.target = "_blank";
186
+ document.body.append($link);
187
+ $link.click();
188
+ _context.next = 7;
189
+ return _this2.sleep(500);
190
+ case 7:
191
+ $link.remove();
192
+ case 8:
193
+ case "end":
194
+ return _context.stop();
195
+ }
196
+ }, _callee);
197
+ }))();
198
+ },
199
+ getFriendlyTime: function getFriendlyTime() {
200
+ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
201
+ var now = arguments.length > 1 ? arguments[1] : undefined;
202
+ if (!str) {
203
+ return '';
204
+ }
205
+ if (typeof str === 'number' || /^\d{10}$/.test(str)) {
206
+ if (String(str).length === 10) {
207
+ str *= 1000;
208
+ }
209
+ }
210
+ var currentTime = now ? new Date(now) : new Date();
211
+ var oldTime;
212
+ var delta;
213
+ var getWidthString = function getWidthString(num) {
214
+ return num < 10 ? "0".concat(num) : num;
215
+ };
216
+ oldTime = new Date(moment(str).valueOf());
217
+ delta = currentTime.getTime() - oldTime.getTime();
218
+ if (delta < 0) {
219
+ return this.getFriendlyTimeFuture(delta);
220
+ } else if (delta <= 20000) {
221
+ return '刚才';
222
+ }
223
+ if (delta <= 60000) {
224
+ return '1分钟内';
225
+ }
226
+ if (delta < 60 * 60 * 1000) {
227
+ return "".concat(Math.floor(delta / (60 * 1000)), "\u5206\u949F\u524D");
228
+ }
229
+ if (delta < 24 * 60 * 60 * 1000) {
230
+ return "".concat(Math.floor(delta / (60 * 60 * 1000)), "\u5C0F\u65F6\u524D");
231
+ }
232
+ if (delta < 3 * 24 * 60 * 60 * 1000) {
233
+ return "".concat(Math.floor(delta / (24 * 60 * 60 * 1000)), "\u5929\u524D");
234
+ }
235
+ if (currentTime.getFullYear() !== oldTime.getFullYear()) {
236
+ return [getWidthString(oldTime.getFullYear()), getWidthString(oldTime.getMonth() + 1), getWidthString(oldTime.getDate())].join('-');
237
+ }
238
+ return [getWidthString(oldTime.getMonth() + 1), getWidthString(oldTime.getDate())].join('-');
239
+ },
240
+ getFriendlyTimeFuture: function getFriendlyTimeFuture() {
241
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
242
+ // 换算为 秒
243
+ time = Math.abs(time) * 0.001;
244
+ var out = '';
245
+ if (time < 60 * 60) {
246
+ out = "".concat((time / 60).toFixed(0), "\u5206\u949F");
247
+ } else if (time < 24 * 3600) {
248
+ out = "".concat((time / 3600).toFixed(0), "\u5C0F\u65F6");
249
+ } else if (time < 30 * 24 * 3600) {
250
+ out = "".concat((time / (24 * 3600)).toFixed(0), "\u5929");
251
+ } else if (time < 12 * 30 * 24 * 3600) {
252
+ out = "".concat((time / (30 * 24 * 3600)).toFixed(0), "\u4E2A\u6708");
253
+ } else {
254
+ out = "".concat((time / (12 * 30 * 24 * 3600)).toFixed(1), "\u5E74");
255
+ }
256
+ return out + '后';
257
+ },
258
+ /**
259
+ * 天 级别
260
+ * @param str 指定的时间字符串,如yyyy-MM-dd HH:mm:ss
261
+ * @param now 当前时间,允许时间戳,GMT时间,如果该参数为undefined,则使用浏览器时间。
262
+ */
263
+ getFriendlyDay: function getFriendlyDay(dayString) {
264
+ var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
265
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'YYYY-MM-DD';
266
+ if (!dayString) {
267
+ return '';
268
+ }
269
+ if (typeof now === 'string') {
270
+ now = now.replace(/-/g, '/');
271
+ }
272
+ if (typeof dayString === 'string') {
273
+ if ((dayString || '').length <= 7) {
274
+ return dayString;
275
+ }
276
+ dayString = dayString.replace(/-/g, '/');
277
+ }
278
+ if (typeof dayString === 'number') {
279
+ if (String(dayString).length === 10) {
280
+ dayString *= 1000;
281
+ }
282
+ }
283
+ if (typeof now === 'number') {
284
+ if (String(now).length === 10) {
285
+ now *= 1000;
286
+ }
287
+ }
288
+ var currentDate = now ? new Date(now) : new Date();
289
+ var oldTime;
290
+ var currentTime = currentDate.getTime();
291
+ oldTime = new Date(dayString);
292
+
293
+ // delta = currentTime - oldTime.getTime();
294
+
295
+ var out = '';
296
+ if (moment(currentTime).format('YYYY/MM/DD') === moment(oldTime).format('YYYY/MM/DD')) {
297
+ out = '今天';
298
+ } else if (moment(currentTime - 86400000).format('YYYY/MM/DD') === moment(oldTime).format('YYYY/MM/DD')) {
299
+ out = '昨天';
300
+ } else if (moment(currentTime - 86400000 * 2).format('YYYY/MM/DD') === moment(oldTime).format('YYYY/MM/DD')) {
301
+ out = '前天';
302
+ } else if (moment(currentTime + 86400000).format('YYYY/MM/DD') === moment(oldTime).format('YYYY/MM/DD')) {
303
+ out = '明天';
304
+ } else if (moment(currentTime + 86400000 * 2).format('YYYY/MM/DD') === moment(oldTime).format('YYYY/MM/DD')) {
305
+ out = '后天';
306
+ } else {
307
+ // 如果是今年,就不展示年
308
+ if (moment(oldTime).format('YYYY') === moment(currentTime).format('YYYY')) {
309
+ out = moment(oldTime).format(format.replace(/^YYYY[-\/]/g, ''));
310
+ } else {
311
+ out = moment(oldTime).format(format);
312
+ }
313
+ }
314
+ return out;
315
+ },
316
+ //参数:变量名,url为空则表从当前页面的url中取
317
+ getQuery: function getQuery(name) {
318
+ var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
319
+ var u = arguments[1] || window.location.search.replace('?', '') || document.location.hash.replace('#', ''),
320
+ reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'),
321
+ r = u.substr(u.indexOf('?') + 1).match(reg);
322
+ return r != null ? decodeURIComponent(r[2]) : '';
323
+ },
324
+ getQueryAll: function getQueryAll() {
325
+ var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
326
+ var theRequest = {};
327
+ var str = url || window.location.search.replace('?', '') || document.location.hash.replace('#', '');
328
+ if (url.indexOf('?') !== -1) {
329
+ str = url.substr(url.indexOf('?') + 1);
330
+ }
331
+ var strs = str.split('&');
332
+ for (var i = 0; i < strs.length; i++) {
333
+ theRequest[strs[i].split('=')[0]] = decodeURIComponent(strs[i].split('=')[1]);
334
+ }
335
+ return theRequest;
336
+ },
337
+ extend: function extend(arg1, arg2) {
338
+ //# 对象扩展
339
+ var target = arguments[0] || {},
340
+ i = 1,
341
+ length = arguments.length,
342
+ options;
343
+ if (_typeof(target) !== 'object' && typeof target !== 'function') target = {};
344
+ for (; i < length; i++) {
345
+ if ((options = arguments[i]) != null) {
346
+ for (var _name in options) {
347
+ var copy = options[_name];
348
+ if (target === copy) {
349
+ continue;
350
+ }
351
+ if (copy !== undefined) {
352
+ target[_name] = copy;
353
+ }
354
+ }
355
+ }
356
+ }
357
+ return target;
358
+ },
359
+ string: {
360
+ //# 字符串
361
+ //重复字符串
362
+ repeat: function repeat(word) {
363
+ var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
364
+ var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
365
+ //# 重复字符串
366
+ end = end || ''; //加在末位
367
+ length = ~~length;
368
+ return new Array(length * 1 + 1).join(word) + '' + end;
369
+ },
370
+ //增加前缀
371
+ addPre: function addPre(pre, word, size) {
372
+ //# 补齐。如给数字前 加 0
373
+ pre = pre || '0';
374
+ size = parseInt(size) || 0;
375
+ word = String(word || '');
376
+ var length = Math.max(0, size - word.length);
377
+ return this.repeat(pre, length, word);
378
+ },
379
+ //去除两边空格
380
+ trim: function trim(text) {
381
+ //# 去除两边空格
382
+ return (text || '').replace(/^\s+|\s$/, '');
383
+ },
384
+ //字符串替换
385
+ replace: function replace(str, re) {
386
+ //# 字符串替换
387
+ str = str || '';
388
+ for (var key in re) {
389
+ replace(key, re[key]);
390
+ }
391
+ function replace(a, b) {
392
+ var arr = str.split(a);
393
+ str = arr.join(b);
394
+ }
395
+ return str;
396
+ }
397
+ },
398
+ math: {
399
+ //随机整数
400
+ //生成从num1到num2(不包括num2)之间的随机数,若只传递一个参数,则生成0到该数之间的随机数
401
+ randInt: function randInt(num1, num2) {
402
+ //# 随机整数
403
+ if (num2 === undefined) {
404
+ num2 = num1;
405
+ num1 = 0;
406
+ }
407
+ return Math.floor(Math.random() * (num2 - num1) + num1);
408
+ },
409
+ // 生成随机字符串
410
+ //@len 长度
411
+ randWord: function randWord(wordLen) {
412
+ var baseWord = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
413
+ //# 随机字符串
414
+ var words = baseWord || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
415
+ length = words.length,
416
+ len = parseInt("".concat(wordLen)) || 0,
417
+ //输出单词长度
418
+ out = [],
419
+ //记录字符
420
+ pos = 0; // 记录位置
421
+ while (len--) {
422
+ pos = this.randInt(0, length);
423
+ out.push(words[pos]);
424
+ }
425
+ return out.join('');
426
+ },
427
+ /**加法运算
428
+ * @说明:解决两个浮点数相加时会出现误差的问题
429
+ * @参数1: number n1
430
+ * @参数2: number n2
431
+ * @示例:add(n1,n2)
432
+ * @返回:string n1+n2
433
+ */
434
+ add: function add(n1, n2) {
435
+ //# 加法运算
436
+ var oT = this.preAddSubtract(n1, n2),
437
+ out = !(oT === oT) ? oT : ((oT.n1 + oT.n2) / Math.pow(10, Math.max(oT.d1, oT.d2))).toFixed(Math.max(oT.d1, oT.d2));
438
+ return parseFloat(out);
439
+ },
440
+ /**减法运算
441
+ * @说明:解决两个浮点数相减时会出现误差的问题
442
+ * @参数1: number n1
443
+ * @参数2: number n2
444
+ * @示例:subtract(n1,n2)
445
+ * @返回:string n1-n2
446
+ */
447
+ subtract: function subtract(n1, n2) {
448
+ //# 减法运算
449
+ var oT = this.preAddSubtract(n1, n2),
450
+ out = !(oT === oT) ? oT : ((oT.n1 - oT.n2) / Math.pow(10, Math.max(oT.d1, oT.d2))).toFixed(Math.max(oT.d1, oT.d2));
451
+ return parseFloat(out);
452
+ },
453
+ /**乘法运算
454
+ * @说明:解决两个浮点数相乘时会出现误差的问题
455
+ * @参数1: number n1
456
+ * @参数2: number n2
457
+ * @示例:multiply(n1,n2)
458
+ * @返回:string n1*n2
459
+ */
460
+ multiply: function multiply(n1, n2) {
461
+ //# 乘法运算
462
+ var oT = this.preHandle(n1, n2),
463
+ out = !(oT === oT) ? oT : (oT.n1 * oT.n2 / Math.pow(10, oT.d1 + oT.d2)).toFixed(oT.d1 + oT.d2);
464
+ return parseFloat(out);
465
+ },
466
+ /**除法运算
467
+ * @说明:解决两个浮点数相除时会出现误差的问题
468
+ * @参数1: number n1
469
+ * @参数2: number n2
470
+ * @示例:divide(n1,n2)
471
+ * @返回:number n1/n2
472
+ */
473
+ divide: function divide(n1, n2) {
474
+ //# 除法运算
475
+ var oT = this.preHandle(n1, n2),
476
+ out = !(oT === oT) ? oT : oT.n1 / oT.n2 / Math.pow(10, oT.d1 - oT.d2);
477
+ return parseFloat(out);
478
+ },
479
+ /**预处理加减运算 , 外界不调用
480
+ * @参数1: number n1
481
+ * @参数2: number n2
482
+ * @示例:preAddSubtract (n1,n2)
483
+ * @返回:object
484
+ */
485
+ preAddSubtract: function preAddSubtract(n1, n2) {
486
+ //#noadd
487
+ var oT = this.preHandle(n1, n2);
488
+ return !(oT === oT) ? oT : function () {
489
+ //右补齐0
490
+ if (oT.d1 - oT.d2 > 0) {
491
+ oT.s2 = oT.s2 + new Array(oT.d1 - oT.d2 + 1).join('0');
492
+ } else {
493
+ oT.s1 = oT.s1 + new Array(oT.d2 - oT.d1 + 1).join('0');
494
+ }
495
+ return {
496
+ s1: oT.s1,
497
+ s2: oT.s2,
498
+ n1: parseInt(oT.s1, 10),
499
+ n2: parseInt(oT.s2, 10),
500
+ d1: oT.d1,
501
+ d2: oT.d2
502
+ };
503
+ }();
504
+ },
505
+ //////
506
+ /**预处理四则运算参数 , 外界不调用
507
+ * @参数1: number n1
508
+ * @参数2: number n2
509
+ * @示例:preHandle(n1,n2)
510
+ * @返回:object
511
+ */
512
+ preHandle: function preHandle(n1, n2) {
513
+ //#noadd
514
+ if (!((typeof n1 === 'number' || typeof n1 === 'string' && /^[\d]+(\.[\d]+)?$/g.test(n1)) && (typeof n2 === 'number' || typeof n2 === 'string' && /^[\d]+(\.[\d]+)?$/g.test(n2)))) {
515
+ return NaN;
516
+ }
517
+ var s1 = n1.toString(),
518
+ s2 = n2.toString(),
519
+ a1 = s1.split('.'),
520
+ a2 = s2.split('.');
521
+ s1 = s1.replace('.', '');
522
+ s2 = s2.replace('.', '');
523
+ return {
524
+ s1: s1,
525
+ s2: s2,
526
+ n1: parseInt(s1, 10),
527
+ n2: parseInt(s2, 10),
528
+ d1: a1.length > 1 ? a1[1].length : 0,
529
+ //小数部分长度
530
+ d2: a2.length > 1 ? a2[1].length : 0 //小数部分长度
531
+ };
532
+ }
533
+ },
534
+
535
+ store: store,
536
+ toast: function toast() {
537
+ var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
538
+ var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
539
+ var onClose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
540
+ return content && message.info(content, duration, onClose);
541
+ },
542
+ toastError: function toastError() {
543
+ var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
544
+ var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
545
+ var onClose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
546
+ return content && message.error(content, duration, onClose);
547
+ },
548
+ pageDialogBox: [],
549
+ // 一整页 ,覆盖页面
550
+ pageDialog: function pageDialog(opt) {
551
+ opt = this.extend({
552
+ icon: ' ',
553
+ isFullPage: false,
554
+ closable: true,
555
+ // 似乎无效了
556
+ isHideClose: false,
557
+ maskStyle: {},
558
+ keyboard: true,
559
+ cancelText: '',
560
+ className: ' ',
561
+ content: '',
562
+ maskClosable: false,
563
+ destroyOnClose: true,
564
+ okText: '',
565
+ title: '',
566
+ width: '100%',
567
+ onCancel: function onCancel() {},
568
+ onOk: function onOk() {}
569
+ }, opt);
570
+ if (opt.isFullPage) {
571
+ opt.className += ' _page_dialog_full_ ';
572
+ // opt.maskStyle.display = 'none';
573
+ // opt.closable = false;
574
+ opt.keyboard = false;
575
+ }
576
+ if (opt.isHideClose) {
577
+ opt.className += ' _page_dialog_full_ _hide_close_ ';
578
+ }
579
+ opt.className += ' _page_dialog_ ';
580
+ if (!opt.okText && !opt.cancelText) {
581
+ opt.className += ' no-confirm-btns ';
582
+ }
583
+ var box = Modal.info(opt);
584
+ this.pageDialogBox.push(box);
585
+ return box;
586
+ },
587
+ //关掉所有
588
+ pageDialogCloseAll: function pageDialogCloseAll() {
589
+ this.pageDialogBox.forEach(function (item) {
590
+ if (item && item.destroy) {
591
+ item.destroy();
592
+ }
593
+ item = null;
594
+ });
595
+ },
596
+ param: function param() {
597
+ var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
598
+ var queryString = [];
599
+ for (var i in query) {
600
+ queryString.push("".concat(i, "=").concat(encodeURIComponent(query[i])));
601
+ }
602
+ return queryString.join('&');
603
+ },
604
+ // go(path: string | number = '', param = {}) {
605
+ // if (typeof path === 'number') {
606
+ // history.go(path);
607
+ // return '';
608
+ // } else if (!path) {
609
+ // path = document.location.pathname;
610
+ // }
611
+ //
612
+ // if (this.param(param)) {
613
+ // path = path + (path.indexOf('?') === -1 ? '?' : '&') + this.param(param);
614
+ // }
615
+ //
616
+ // history.push(path);
617
+ // return path;
618
+ // },
619
+ /*
620
+ * 下载图片
621
+ *
622
+ * */
623
+ downloadImage: function downloadImage(url) {
624
+ var iframe = document.createElement('iframe');
625
+ iframe.src = url;
626
+ iframe.style.display = 'none';
627
+ document.body.append(iframe);
628
+ },
629
+ getFileExt: function getFileExt(fileUrl) {
630
+ var url = (fileUrl || '').split('?')[0].match(/\.([a-z0-9]+)$/i) || [];
631
+ return url[1] || '';
632
+ },
633
+ // inArray, 返回位置 布尔值;
634
+ inArray: function inArray(t, arr) {
635
+ //# 返回当前值所在数组的位置
636
+ // if( arr.indexOf ){
637
+ // return arr.indexOf(t);
638
+ // }
639
+ for (var i = arr.length; i--;) {
640
+ if (arr[i] === t) {
641
+ return true; //i*1;
642
+ }
643
+ }
644
+
645
+ return false;
646
+ },
647
+ inArrayIndex: function inArrayIndex(t) {
648
+ var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
649
+ //# 返回当前值所在数组的位置
650
+ for (var i = arr.length; i--;) {
651
+ if (arr[i] === t) {
652
+ return i; //i*1;
653
+ }
654
+ }
655
+
656
+ return -1;
657
+ },
658
+ // 金额的简略写法
659
+ moneySimple: function moneySimple() {
660
+ var money = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
661
+ var isTip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
662
+ var out;
663
+ if (money >= 100000000) {
664
+ out = parseFloat((money / 100000000).toFixed(2)) + '亿';
665
+ } else if (money >= 10000) {
666
+ out = parseFloat((money / 10000).toFixed(2)) + '万';
667
+ } else {
668
+ out = money;
669
+ }
670
+ if (isTip) {
671
+ return /*#__PURE__*/_jsx(Tooltip, {
672
+ title: money + '元',
673
+ children: out
674
+ });
675
+ }
676
+ return out;
677
+ },
678
+ isLowIe9: function isLowIe9() {
679
+ var out = false,
680
+ ieVersion = this.iEVersion();
681
+ if (ieVersion < 9) {
682
+ out = true;
683
+ }
684
+ return out;
685
+ },
686
+ iEVersion: function iEVersion() {
687
+ var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
688
+ var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; //判断是否IE<11浏览器
689
+ var isEdge = userAgent.indexOf('Edge') > -1 && !isIE; //判断是否IE的Edge浏览器
690
+ var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf('rv:11.0') > -1;
691
+ var version = 0;
692
+ if (isIE) {
693
+ var reIE = new RegExp('MSIE (\\d+\\.\\d+);');
694
+ reIE.test(userAgent);
695
+ var fIEVersion = parseFloat(RegExp['$1']);
696
+ if (fIEVersion === 7) {
697
+ version = 7;
698
+ } else if (fIEVersion === 8) {
699
+ version = 8;
700
+ } else if (fIEVersion === 9) {
701
+ version = 9;
702
+ } else if (fIEVersion === 10) {
703
+ version = 10;
704
+ } else {
705
+ version = 6; //IE版本<=7
706
+ }
707
+ } else if (isEdge) {
708
+ version = 12; // 'edge';//edge
709
+ } else if (isIE11) {
710
+ version = 11; //IE11
711
+ } else {
712
+ version = 1000; //不是ie浏览器
713
+ }
714
+
715
+ return version;
716
+ },
717
+ /*
718
+ * 制作数组字典, 以 某个 key 变换输入
719
+ *
720
+ * $keyLevel1 : 第一层
721
+ * $itemName1 : 第一层 属性的名字
722
+ * */
723
+ arrayDictionary: function arrayDictionary($lists, $keyLevel1, $itemName1, $keyLevel2) {
724
+ $keyLevel1 = $keyLevel1 || 'id';
725
+ var $outLists = {},
726
+ $item1;
727
+ for (var i = 0, len = $lists.length; i < len; i++) {
728
+ $item1 = $lists[i];
729
+ $outLists[$item1[$keyLevel1]] = $item1;
730
+ if ($itemName1 && $item1[$itemName1] && _typeof($item1[$itemName1]) === 'object') {
731
+ var $item1Lists = [];
732
+ for (var ii = 0, iiLen = $item1[$itemName1].length; ii < len; ii++) {
733
+ var $item2 = $item1[$itemName1][iiLen];
734
+ $item1Lists[$item2[$keyLevel2]] = $item2;
735
+ }
736
+ $outLists[$item1[$keyLevel1]][$itemName1] = $item1Lists;
737
+ }
738
+ }
739
+ return $outLists;
740
+ },
741
+ /*
742
+ *
743
+ * */
744
+ dictionaryArray: function dictionaryArray($object) {
745
+ var keyName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_key';
746
+ var valueName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
747
+ var outData = [],
748
+ item = {};
749
+ for (var i in $object) {
750
+ item = {};
751
+ if (valueName) {
752
+ item[keyName] = i;
753
+ item[valueName] = $object[i];
754
+ } else {
755
+ item = $object[i];
756
+ item[keyName] = i;
757
+ }
758
+ outData.push(item);
759
+ }
760
+ return outData;
761
+ },
762
+ stringToIntArray: function stringToIntArray() {
763
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
764
+ var splitWord = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
765
+ var delZero = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
766
+ var data = value.split(splitWord),
767
+ itemValue = 0,
768
+ out = [];
769
+ data.forEach(function (item) {
770
+ itemValue = parseInt(item, 10);
771
+ if (delZero && itemValue === 0) {} else {
772
+ out.push(itemValue);
773
+ }
774
+ });
775
+ return out;
776
+ },
777
+ getHashShow: function getHashShow() {
778
+ var hash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
779
+ var showLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
780
+ var $dotCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
781
+ if (hash.length <= showLength) {
782
+ return hash;
783
+ }
784
+
785
+ // console.log('ddddd:', hash);
786
+
787
+ var startLength = ~~showLength * 0.5,
788
+ dot = new Array($dotCount + 1).join('·'),
789
+ afterLength = -(showLength - startLength);
790
+ return hash.slice(0, startLength) + dot + (afterLength < 0 ? hash.slice(afterLength) : '');
791
+ },
792
+ //本地时间差异
793
+ localTimePos: 0,
794
+ getLocalTimePos: function getLocalTimePos() {
795
+ var serverTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
796
+ console.log('serverTime', serverTime);
797
+ if (serverTime > 0) {
798
+ this.localTimePos = serverTime * 1000 - new Date().getTime();
799
+ }
800
+ },
801
+ getNow: function getNow() {
802
+ var time = new Date().getTime() + this.localTimePos;
803
+ // console.log( 'time 1:', time , this.localTimePos );
804
+ return new Date(time).getTime();
805
+ },
806
+ sitesConfig: null,
807
+ //本地时间,币服务器时间少多少
808
+ getClientLowServerTime: function getClientLowServerTime(serverTime) {},
809
+ array: {
810
+ //# 数组方法
811
+ // inArray, 返回位置! 不存在则返回 -1;
812
+ index: function index(t, arr) {
813
+ //# 返回当前值所在数组的位置
814
+ if (arr.indexOf) {
815
+ return arr.indexOf(t);
816
+ }
817
+ for (var i = arr.length; i--;) {
818
+ if (arr[i] === t) {
819
+ return i * 1;
820
+ }
821
+ }
822
+ return -1;
823
+ },
824
+ //返回对象 的 键值! 返回值 类型为数组。
825
+ getKey: function getKey(data) {
826
+ //# 返回对象所有的键值
827
+ var arr = [],
828
+ k;
829
+ for (k in data) {
830
+ arr.push(k);
831
+ }
832
+ return arr;
833
+ },
834
+ //从数组中 随机取出 一个值
835
+ random: function random(arrays) {
836
+ //# 从数组中 随机取出 一个值
837
+ arrays = arrays || [];
838
+ var len = arrays.length,
839
+ index = Tool.math.randInt(0, len - 1);
840
+ return arrays[index] || '';
841
+ },
842
+ // 一维 数组去重
843
+ unique: function unique(array) {
844
+ //#一维数组去重
845
+ array = array || [];
846
+ for (var i = 0, len = array.length; i < len; i++) {
847
+ for (var j = i + 1; j < array.length; j++) {
848
+ if (array[i] === array[j]) {
849
+ array.splice(j, 1);
850
+ j--;
851
+ }
852
+ }
853
+ }
854
+ return array;
855
+ },
856
+ // max , 数组中最大的项
857
+ max: function max(array) {
858
+ //#求数组中最大的项
859
+ return Math.max.apply(null, array);
860
+ },
861
+ // min , 数组中最小的项
862
+ min: function min(array) {
863
+ //#求数组中最小的项
864
+ return Math.min.apply(null, array);
865
+ },
866
+ // remove , 移除
867
+ remove: function remove(array, value) {
868
+ //#移除数组中某值
869
+ var length = array.length;
870
+ while (length--) {
871
+ if (value === array[length]) {
872
+ array.splice(length, 1);
873
+ }
874
+ }
875
+ return array;
876
+ },
877
+ //清空数组
878
+ empty: function empty(array) {
879
+ //# 清空数组
880
+ (array || []).length = 0;
881
+ return array;
882
+ },
883
+ // removeAt ,删除指定位置的 值
884
+ //@index , 索引. 不传递 index ,会删除第一个
885
+ removeAt: function removeAt(array, index) {
886
+ //#删除数组中 指定位置的值
887
+ array.splice(index, 1);
888
+ return array;
889
+ },
890
+ //打乱数组排序
891
+ shuffle: function shuffle(arr) {
892
+ //#打乱数组排序
893
+ var array = (arr || []).concat(),
894
+ length = array.length,
895
+ i = length,
896
+ //遍历
897
+ tmp = null,
898
+ // 临时
899
+ rand = Tool.math.randInt,
900
+ //位置
901
+ pos = 0;
902
+ while (i--) {
903
+ pos = rand(0, length);
904
+ //交换随机位置
905
+ tmp = array[pos];
906
+ array[pos] = array[i];
907
+ array[i] = tmp;
908
+ }
909
+ return array;
910
+ }
911
+ },
912
+ siteCode: function siteCode(webview, fnName, detailData) {
913
+ var query = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
914
+ var param = "window.___sitBridge.call( '".concat(fnName, "', ").concat(JSON.stringify(detailData), ", ").concat(JSON.stringify(query), " ) ");
915
+ console.log('siteCode:', webview, fnName, detailData, query);
916
+ console.log('siteCode 2:', param);
917
+ webview.executeJavaScript(param, false, function (e) {
918
+ console.log('siteCode 121:', e);
919
+ });
920
+ },
921
+ clearLocalLogin: function clearLocalLogin() {
922
+ var userInfo = Tool.GData.userInfo || {};
923
+ userInfo.isLogin = false;
924
+ delete userInfo.sid;
925
+ Tool.GData.userInfo = userInfo;
926
+ Tool.store.set('userInfo', userInfo);
927
+ },
928
+ onWindowError: function onWindowError() {
929
+ JsError();
930
+ },
931
+ // 抽屉
932
+ drawer: function drawer() {
933
+ var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
934
+ // 搞一个 放抽屉的 容器
935
+ var drawer = document.createElement('div');
936
+ var id = "__drawer__".concat(new Date().getTime());
937
+ drawer.id = id;
938
+ query.id = id;
939
+ document.body.appendChild(drawer);
940
+ ReactDOM.render( /*#__PURE__*/_jsx(DialogDrawer, _objectSpread({}, query)), document.getElementById(id));
941
+ var outData = {
942
+ // onClose(){
943
+ //
944
+ // },
945
+ // 销毁
946
+ destroy: function destroy() {
947
+ Tool.event.run("drawer-close.".concat(id));
948
+ }
949
+ };
950
+
951
+ // Tool.event.on( `drawer-close.${id}`, () => {
952
+ // outData.onClose();
953
+ // });
954
+
955
+ return outData;
956
+ },
957
+ drawerAllClose: function drawerAllClose() {
958
+ Tool.event.run("drawer-close");
959
+ },
960
+ sleep: function sleep(second) {
961
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
962
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
963
+ while (1) switch (_context2.prev = _context2.next) {
964
+ case 0:
965
+ return _context2.abrupt("return", new Promise(function (resolve) {
966
+ setTimeout(function () {
967
+ resolve(true);
968
+ }, second);
969
+ }));
970
+ case 1:
971
+ case "end":
972
+ return _context2.stop();
973
+ }
974
+ }, _callee2);
975
+ }))();
976
+ },
977
+ offset: function offset(curEle) {
978
+ var parentDom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
979
+ var totalLeft = 0;
980
+ var totalTop = 0;
981
+ var par = curEle.offsetParent;
982
+ var parDom = curEle;
983
+
984
+ //首先把自己本身的相加
985
+ totalLeft += curEle.offsetLeft;
986
+ totalTop += curEle.offsetTop;
987
+ //现在开始一级一级往上查找,只要没有遇到body,我们就把父级参照物的边框和偏移相加
988
+ while (par) {
989
+ var _par, _par2;
990
+ if (parDom === parentDom) {
991
+ break;
992
+ }
993
+ if (navigator.userAgent.indexOf('MSIE 8.0') === -1) {
994
+ //不是IE8我们才进行累加父级参照物的边框
995
+ totalTop += par.clientTop;
996
+ totalLeft += par.clientLeft;
997
+ }
998
+ //把父级参照物的偏移相加
999
+ totalTop += ((_par = par) === null || _par === void 0 ? void 0 : _par.offsetTop) || 0;
1000
+ totalLeft += ((_par2 = par) === null || _par2 === void 0 ? void 0 : _par2.offsetLeft) || 0;
1001
+ par = par.offsetParent;
1002
+ parDom = parDom.parentNode;
1003
+ }
1004
+ return {
1005
+ left: totalLeft,
1006
+ top: totalTop
1007
+ };
1008
+ },
1009
+ makeQrUrl: function makeQrUrl(url) {
1010
+ var foreground = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#1677ff';
1011
+ var size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 600;
1012
+ if (!url) {
1013
+ return '';
1014
+ }
1015
+ return JrQrcode.getQrBase64(url, {
1016
+ padding: 12,
1017
+ // 二维码四边空白(默认为10px)
1018
+ width: size,
1019
+ // 二维码图片宽度(默认为256px)
1020
+ height: size,
1021
+ // 二维码图片高度(默认为256px)
1022
+ correctLevel: 0,
1023
+ // 二维码容错level(默认为高) L : 1, M : 0, Q : 3, H : 2
1024
+ reverse: false,
1025
+ // 反色二维码,二维码颜色为上层容器的背景颜色
1026
+ background: '#ffffff',
1027
+ // 二维码背景颜色(默认白色)
1028
+ foreground: foreground // 二维码颜色(默认黑色)
1029
+ });
1030
+ },
1031
+ onLogin: function onLogin() {
1032
+ return PostMessage('login');
1033
+ },
1034
+ getObjectURL: function getObjectURL(file) {
1035
+ var url = window.URL || window.webkitURL;
1036
+ return url.createObjectURL(file);
1037
+ },
1038
+ // file
1039
+ onDownFile: function onDownFile(url) {
1040
+ document.location.href = url;
1041
+ },
1042
+ // inviteKey ; 36进制
1043
+ onInviteIn: function onInviteIn() {
1044
+ var inviteKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1045
+ if (!inviteKey) {
1046
+ return;
1047
+ }
1048
+ // 邀请 id
1049
+ inviteKey = inviteKey || Tool.getQuery('i');
1050
+ var i = parseInt(inviteKey, 36) || 0;
1051
+ if (i > 0) {
1052
+ Tool.store.set('inviteUserId', i);
1053
+ }
1054
+ },
1055
+ isLogin: function isLogin() {
1056
+ var userInfo = this.getLocalUserInfo();
1057
+ return userInfo.isLogin && userInfo.sid;
1058
+ },
1059
+ getTimeOffset: function getTimeOffset() {
1060
+ return Tool.store.get('time-offset') || 0;
1061
+ },
1062
+ setTimeOffset: function setTimeOffset(serverTime) {
1063
+ if (serverTime <= 0) {
1064
+ return;
1065
+ }
1066
+ var offset = serverTime * 1000 - Date.now();
1067
+ return Tool.store.set('time-offset', offset);
1068
+ },
1069
+ getTime: function getTime() {
1070
+ // 毫秒
1071
+ return Date.now() - Tool.getTimeOffset();
1072
+ },
1073
+ h5Pay: function h5Pay(query) {
1074
+ var data = JSON.stringify(_objectSpread({
1075
+ payBackUrl: document.location.href
1076
+ }, query));
1077
+ (top || window).document.location.href = 'https://pay.shanren.wang/pay/we-h5?data=' + encodeURIComponent(data);
1078
+ }
1079
+ });
1080
+ if (!window._GData) {
1081
+ window._GData = {};
1082
+ }
1083
+ Tool.GData = window._GData;
1084
+ window._Tool = Tool;
1085
+ Tool.onWindowError();
1086
+ export default Tool;