fast-vue-multi-pages 1.0.6 → 1.0.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.
@@ -1,4 +1,6 @@
1
1
  import { AxiosPromise } from "axios";
2
+ import { FastVueMultiSimpleJsonResponse } from "./FastVueMultiSimpleJsonResponse";
3
+ import { FastVueMultiSimpleRequestConfig } from "./FastVueMultiSimpleRequestConfig";
2
4
  /**
3
5
  * FastVueMultiHttp 网咯请求接口工具类
4
6
  * @author Janesen
@@ -117,7 +119,7 @@ export declare namespace FastVueMultiHttp {
117
119
  * @param config 请求配置
118
120
  * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
119
121
  */
120
- static request(method: string, url: string, params: any, config?: SimpleRequestConfig, callBack?: (result: SimpleJsonResponse) => void): Promise<SimpleJsonResponse>;
122
+ static request(method: string, url: string, params: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
121
123
  /**
122
124
  * post请求接口
123
125
  * @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
@@ -125,7 +127,7 @@ export declare namespace FastVueMultiHttp {
125
127
  * @param config 请求配置
126
128
  * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
127
129
  */
128
- static post(url: string, params: any, config?: SimpleRequestConfig, callBack?: (result: SimpleJsonResponse) => void): Promise<SimpleJsonResponse>;
130
+ static post(url: string, params: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
129
131
  /**
130
132
  * get请求接口
131
133
  * @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
@@ -133,93 +135,6 @@ export declare namespace FastVueMultiHttp {
133
135
  * @param config 请求配置
134
136
  * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
135
137
  */
136
- static get(url: string, params: any, config?: SimpleRequestConfig, callBack?: (result: SimpleJsonResponse) => void): Promise<SimpleJsonResponse>;
137
- }
138
- /**
139
- * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
140
- */
141
- class SimpleJsonResponse {
142
- responseData: any;
143
- cacheData: boolean;
144
- requestConfig: SimpleRequestConfig;
145
- constructor(responseData: any, cacheData?: boolean);
146
- /**
147
- * 获取接口返回的原始数据
148
- */
149
- getResponseData(): any;
150
- /**
151
- * 判断当前回调的数据是否是缓存的数据
152
- */
153
- isCacheData(): boolean;
154
- /**
155
- * 判断接口是否请求成功-success
156
- */
157
- isSuccess(): boolean;
158
- /**
159
- * 获取接口请求返回的状态值-code
160
- */
161
- getCode(): number;
162
- /**
163
- * 获取接口请求返回的消息提示-message
164
- */
165
- getMessage(): string;
166
- /**
167
- * 获取接口请求返回的数据-data
168
- */
169
- getData(): any;
170
- /**
171
- * 获取接口请求返回的其他数据,例如:data_1、data_2
172
- * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
173
- */
174
- getOtherData(suffixIndex: number): any;
175
- /**
176
- * 判断接口返回的数据data是否是分页的数据
177
- */
178
- isPageData(): boolean;
179
- /**
180
- * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
181
- */
182
- getList(): any[];
183
- /**
184
- * 获取接口列表分页数据的页数
185
- */
186
- getPage(): number;
187
- /**
188
- * 获取接口列表分页数据的总页数
189
- */
190
- getTotalPage(): number;
191
- /**
192
- * 获取接口列表分页数据的总行数
193
- */
194
- getTotalRow(): number;
195
- /**
196
- * 获取接口列表分页数据的每页大小
197
- */
198
- getPageSize(): number;
199
- /**
200
- * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
201
- */
202
- isFinished(): boolean;
203
- }
204
- /**
205
- * 接口请求配置类
206
- */
207
- class SimpleRequestConfig {
208
- /**
209
- * 是否追加全局参数,默认true
210
- */
211
- finalParams: boolean;
212
- /**
213
- * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
214
- */
215
- cache: boolean;
216
- /**
217
- * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
218
- */
219
- alwaysCache: boolean;
220
- /**
221
- * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
222
- */
223
- alwaysBackRequest: boolean;
138
+ static get(url: string, params: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
224
139
  }
225
140
  }
@@ -6,6 +6,8 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
6
6
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
7
  const FastVueMultiConfig_1 = require("../vue/FastVueMultiConfig");
8
8
  const FastVueMultiStore_1 = require("../other/FastVueMultiStore");
9
+ const FastVueMultiSimpleJsonResponse_1 = require("./FastVueMultiSimpleJsonResponse");
10
+ const FastVueMultiSimpleRequestConfig_1 = require("./FastVueMultiSimpleRequestConfig");
9
11
  /**
10
12
  * FastVueMultiHttp 网咯请求接口工具类
11
13
  * @author Janesen
@@ -354,7 +356,7 @@ var FastVueMultiHttp;
354
356
  let result = FastVueMultiStore_1.FastVueMultiStore.getValue(cacheKey);
355
357
  if (result.success) {
356
358
  cachedData = true;
357
- let fastResponseData = new SimpleJsonResponse(JSON.parse(result.data), true);
359
+ let fastResponseData = new FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse(JSON.parse(result.data), true);
358
360
  fastResponseData.requestConfig = config;
359
361
  resolved(fastResponseData);
360
362
  if (callBack) {
@@ -366,7 +368,7 @@ var FastVueMultiHttp;
366
368
  }
367
369
  }
368
370
  if (!url) {
369
- let fastResponseData = new SimpleJsonResponse({
371
+ let fastResponseData = new FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse({
370
372
  success: false,
371
373
  message: "JS错误:请求地址不可为空!"
372
374
  });
@@ -378,9 +380,9 @@ var FastVueMultiHttp;
378
380
  }
379
381
  FastVueMultiHttp.Base.doRequest(method, url, params).then(function (response) {
380
382
  if (!config) {
381
- config = new FastVueMultiHttp.SimpleRequestConfig();
383
+ config = new FastVueMultiSimpleRequestConfig_1.FastVueMultiSimpleRequestConfig();
382
384
  }
383
- let fastResponseData = new SimpleJsonResponse(response.data);
385
+ let fastResponseData = new FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse(response.data);
384
386
  fastResponseData.requestConfig = config;
385
387
  if (config.cache) {
386
388
  if (config.alwaysBackRequest || !cachedData) {
@@ -425,148 +427,4 @@ var FastVueMultiHttp;
425
427
  }
426
428
  }
427
429
  FastVueMultiHttp.Simple = Simple;
428
- /**
429
- * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
430
- */
431
- class SimpleJsonResponse {
432
- responseData;
433
- cacheData = false;
434
- requestConfig = new FastVueMultiHttp.SimpleRequestConfig();
435
- constructor(responseData, cacheData) {
436
- this.responseData = responseData;
437
- if (cacheData == undefined) {
438
- cacheData = false;
439
- }
440
- this.cacheData = cacheData;
441
- }
442
- /**
443
- * 获取接口返回的原始数据
444
- */
445
- getResponseData() {
446
- return this.responseData;
447
- }
448
- /**
449
- * 判断当前回调的数据是否是缓存的数据
450
- */
451
- isCacheData() {
452
- return this.cacheData;
453
- }
454
- /**
455
- * 判断接口是否请求成功-success
456
- */
457
- isSuccess() {
458
- return this.responseData.success;
459
- }
460
- /**
461
- * 获取接口请求返回的状态值-code
462
- */
463
- getCode() {
464
- return this.responseData.code;
465
- }
466
- /**
467
- * 获取接口请求返回的消息提示-message
468
- */
469
- getMessage() {
470
- return this.responseData.message;
471
- }
472
- /**
473
- * 获取接口请求返回的数据-data
474
- */
475
- getData() {
476
- return this.responseData.data;
477
- }
478
- /**
479
- * 获取接口请求返回的其他数据,例如:data_1、data_2
480
- * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
481
- */
482
- getOtherData(suffixIndex) {
483
- return this.responseData["data_" + suffixIndex];
484
- }
485
- /**
486
- * 判断接口返回的数据data是否是分页的数据
487
- */
488
- isPageData() {
489
- if (!this.responseData.data) {
490
- return false;
491
- }
492
- return this.responseData.data.hasOwnProperty("page");
493
- }
494
- /**
495
- * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
496
- */
497
- getList() {
498
- if (this.isPageData()) {
499
- return this.responseData.data.list;
500
- }
501
- if (this.responseData.data) {
502
- return this.responseData.data;
503
- }
504
- return [];
505
- }
506
- /**
507
- * 获取接口列表分页数据的页数
508
- */
509
- getPage() {
510
- if (this.isPageData()) {
511
- return this.responseData.data.page;
512
- }
513
- return -1;
514
- }
515
- /**
516
- * 获取接口列表分页数据的总页数
517
- */
518
- getTotalPage() {
519
- if (this.isPageData()) {
520
- return this.responseData.data.totalPage;
521
- }
522
- return -1;
523
- }
524
- /**
525
- * 获取接口列表分页数据的总行数
526
- */
527
- getTotalRow() {
528
- if (this.isPageData()) {
529
- return this.responseData.data.totalRow;
530
- }
531
- return -1;
532
- }
533
- /**
534
- * 获取接口列表分页数据的每页大小
535
- */
536
- getPageSize() {
537
- if (this.isPageData()) {
538
- return this.responseData.data.pageSize;
539
- }
540
- return -1;
541
- }
542
- /**
543
- * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
544
- */
545
- isFinished() {
546
- return this.getPage() >= this.getTotalPage() || this.getList().length === 0;
547
- }
548
- }
549
- FastVueMultiHttp.SimpleJsonResponse = SimpleJsonResponse;
550
- /**
551
- * 接口请求配置类
552
- */
553
- class SimpleRequestConfig {
554
- /**
555
- * 是否追加全局参数,默认true
556
- */
557
- finalParams = true;
558
- /**
559
- * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
560
- */
561
- cache = false;
562
- /**
563
- * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
564
- */
565
- alwaysCache = false;
566
- /**
567
- * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
568
- */
569
- alwaysBackRequest = false;
570
- }
571
- FastVueMultiHttp.SimpleRequestConfig = SimpleRequestConfig;
572
430
  })(FastVueMultiHttp || (exports.FastVueMultiHttp = FastVueMultiHttp = {}));
@@ -0,0 +1,67 @@
1
+ import { FastVueMultiSimpleRequestConfig } from "./FastVueMultiSimpleRequestConfig";
2
+ /**
3
+ * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
4
+ */
5
+ export declare class FastVueMultiSimpleJsonResponse {
6
+ responseData: any;
7
+ cacheData: boolean;
8
+ requestConfig: FastVueMultiSimpleRequestConfig;
9
+ constructor(responseData: any, cacheData?: boolean);
10
+ /**
11
+ * 获取接口返回的原始数据
12
+ */
13
+ getResponseData(): any;
14
+ /**
15
+ * 判断当前回调的数据是否是缓存的数据
16
+ */
17
+ isCacheData(): boolean;
18
+ /**
19
+ * 判断接口是否请求成功-success
20
+ */
21
+ isSuccess(): boolean;
22
+ /**
23
+ * 获取接口请求返回的状态值-code
24
+ */
25
+ getCode(): number;
26
+ /**
27
+ * 获取接口请求返回的消息提示-message
28
+ */
29
+ getMessage(): string;
30
+ /**
31
+ * 获取接口请求返回的数据-data
32
+ */
33
+ getData(): any;
34
+ /**
35
+ * 获取接口请求返回的其他数据,例如:data_1、data_2
36
+ * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
37
+ */
38
+ getOtherData(suffixIndex: number): any;
39
+ /**
40
+ * 判断接口返回的数据data是否是分页的数据
41
+ */
42
+ isPageData(): boolean;
43
+ /**
44
+ * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
45
+ */
46
+ getList(): any[];
47
+ /**
48
+ * 获取接口列表分页数据的页数
49
+ */
50
+ getPage(): number;
51
+ /**
52
+ * 获取接口列表分页数据的总页数
53
+ */
54
+ getTotalPage(): number;
55
+ /**
56
+ * 获取接口列表分页数据的总行数
57
+ */
58
+ getTotalRow(): number;
59
+ /**
60
+ * 获取接口列表分页数据的每页大小
61
+ */
62
+ getPageSize(): number;
63
+ /**
64
+ * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
65
+ */
66
+ isFinished(): boolean;
67
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FastVueMultiSimpleJsonResponse = void 0;
4
+ const FastVueMultiSimpleRequestConfig_1 = require("./FastVueMultiSimpleRequestConfig");
5
+ /**
6
+ * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
7
+ */
8
+ class FastVueMultiSimpleJsonResponse {
9
+ responseData;
10
+ cacheData = false;
11
+ requestConfig = new FastVueMultiSimpleRequestConfig_1.FastVueMultiSimpleRequestConfig();
12
+ constructor(responseData, cacheData) {
13
+ this.responseData = responseData;
14
+ if (cacheData == undefined) {
15
+ cacheData = false;
16
+ }
17
+ this.cacheData = cacheData;
18
+ }
19
+ /**
20
+ * 获取接口返回的原始数据
21
+ */
22
+ getResponseData() {
23
+ return this.responseData;
24
+ }
25
+ /**
26
+ * 判断当前回调的数据是否是缓存的数据
27
+ */
28
+ isCacheData() {
29
+ return this.cacheData;
30
+ }
31
+ /**
32
+ * 判断接口是否请求成功-success
33
+ */
34
+ isSuccess() {
35
+ return this.responseData.success;
36
+ }
37
+ /**
38
+ * 获取接口请求返回的状态值-code
39
+ */
40
+ getCode() {
41
+ return this.responseData.code;
42
+ }
43
+ /**
44
+ * 获取接口请求返回的消息提示-message
45
+ */
46
+ getMessage() {
47
+ return this.responseData.message;
48
+ }
49
+ /**
50
+ * 获取接口请求返回的数据-data
51
+ */
52
+ getData() {
53
+ return this.responseData.data;
54
+ }
55
+ /**
56
+ * 获取接口请求返回的其他数据,例如:data_1、data_2
57
+ * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
58
+ */
59
+ getOtherData(suffixIndex) {
60
+ return this.responseData["data_" + suffixIndex];
61
+ }
62
+ /**
63
+ * 判断接口返回的数据data是否是分页的数据
64
+ */
65
+ isPageData() {
66
+ if (!this.responseData.data) {
67
+ return false;
68
+ }
69
+ return this.responseData.data.hasOwnProperty("page");
70
+ }
71
+ /**
72
+ * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
73
+ */
74
+ getList() {
75
+ if (this.isPageData()) {
76
+ return this.responseData.data.list;
77
+ }
78
+ if (this.responseData.data) {
79
+ return this.responseData.data;
80
+ }
81
+ return [];
82
+ }
83
+ /**
84
+ * 获取接口列表分页数据的页数
85
+ */
86
+ getPage() {
87
+ if (this.isPageData()) {
88
+ return this.responseData.data.page;
89
+ }
90
+ return -1;
91
+ }
92
+ /**
93
+ * 获取接口列表分页数据的总页数
94
+ */
95
+ getTotalPage() {
96
+ if (this.isPageData()) {
97
+ return this.responseData.data.totalPage;
98
+ }
99
+ return -1;
100
+ }
101
+ /**
102
+ * 获取接口列表分页数据的总行数
103
+ */
104
+ getTotalRow() {
105
+ if (this.isPageData()) {
106
+ return this.responseData.data.totalRow;
107
+ }
108
+ return -1;
109
+ }
110
+ /**
111
+ * 获取接口列表分页数据的每页大小
112
+ */
113
+ getPageSize() {
114
+ if (this.isPageData()) {
115
+ return this.responseData.data.pageSize;
116
+ }
117
+ return -1;
118
+ }
119
+ /**
120
+ * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
121
+ */
122
+ isFinished() {
123
+ return this.getPage() >= this.getTotalPage() || this.getList().length === 0;
124
+ }
125
+ }
126
+ exports.FastVueMultiSimpleJsonResponse = FastVueMultiSimpleJsonResponse;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 接口请求配置类
3
+ */
4
+ export declare class FastVueMultiSimpleRequestConfig {
5
+ /**
6
+ * 是否追加全局参数,默认true
7
+ */
8
+ finalParams: boolean;
9
+ /**
10
+ * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
11
+ */
12
+ cache: boolean;
13
+ /**
14
+ * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
15
+ */
16
+ alwaysCache: boolean;
17
+ /**
18
+ * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
19
+ */
20
+ alwaysBackRequest: boolean;
21
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FastVueMultiSimpleRequestConfig = void 0;
4
+ /**
5
+ * 接口请求配置类
6
+ */
7
+ class FastVueMultiSimpleRequestConfig {
8
+ /**
9
+ * 是否追加全局参数,默认true
10
+ */
11
+ finalParams = true;
12
+ /**
13
+ * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
14
+ */
15
+ cache = false;
16
+ /**
17
+ * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
18
+ */
19
+ alwaysCache = false;
20
+ /**
21
+ * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
22
+ */
23
+ alwaysBackRequest = false;
24
+ }
25
+ exports.FastVueMultiSimpleRequestConfig = FastVueMultiSimpleRequestConfig;
@@ -1,2 +1,4 @@
1
1
  import { FastVueMultiTool } from "./FastVueMultiTool";
2
- export { FastVueMultiTool };
2
+ import { FastVueMultiSimpleJsonResponse } from "./http/FastVueMultiSimpleJsonResponse";
3
+ import { FastVueMultiSimpleRequestConfig } from "./http/FastVueMultiSimpleRequestConfig";
4
+ export { FastVueMultiTool, FastVueMultiSimpleJsonResponse, FastVueMultiSimpleRequestConfig };
package/dist/cjs/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FastVueMultiTool = void 0;
3
+ exports.FastVueMultiSimpleRequestConfig = exports.FastVueMultiSimpleJsonResponse = exports.FastVueMultiTool = void 0;
4
4
  const FastVueMultiTool_1 = require("./FastVueMultiTool");
5
5
  Object.defineProperty(exports, "FastVueMultiTool", { enumerable: true, get: function () { return FastVueMultiTool_1.FastVueMultiTool; } });
6
+ const FastVueMultiSimpleJsonResponse_1 = require("./http/FastVueMultiSimpleJsonResponse");
7
+ Object.defineProperty(exports, "FastVueMultiSimpleJsonResponse", { enumerable: true, get: function () { return FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse; } });
8
+ const FastVueMultiSimpleRequestConfig_1 = require("./http/FastVueMultiSimpleRequestConfig");
9
+ Object.defineProperty(exports, "FastVueMultiSimpleRequestConfig", { enumerable: true, get: function () { return FastVueMultiSimpleRequestConfig_1.FastVueMultiSimpleRequestConfig; } });
@@ -25,7 +25,7 @@ class FastVueMultiDate {
25
25
  */
26
26
  static format(source, pattern) {
27
27
  if (lodash_1.default.isEmpty(pattern)) {
28
- return null;
28
+ return source.toLocaleString();
29
29
  }
30
30
  if (lodash_1.default.isEmpty(source)) {
31
31
  return null;
@@ -49,7 +49,7 @@ class FastVueMultiDate {
49
49
  */
50
50
  static formatNice(source, level) {
51
51
  if (lodash_1.default.isEmpty(source)) {
52
- return null;
52
+ return source;
53
53
  }
54
54
  if (level === undefined) {
55
55
  level = 2;
@@ -63,7 +63,7 @@ class FastVueMultiDate {
63
63
  const time1 = new Date().getTime(); //当前的时间戳
64
64
  const sourceDate = this.parse(source);
65
65
  if (!sourceDate) {
66
- return null;
66
+ return source;
67
67
  }
68
68
  const time2 = sourceDate.getTime();
69
69
  const time = time1 - time2;
@@ -36,6 +36,8 @@ class FastVueMultiFile {
36
36
  }
37
37
  }
38
38
  };
39
+ inputElement.onerror = reject;
40
+ inputElement.onabort = reject;
39
41
  inputElement.dispatchEvent(event);
40
42
  });
41
43
  }
@@ -1,4 +1,6 @@
1
1
  import { AxiosPromise } from "axios";
2
+ import { FastVueMultiSimpleJsonResponse } from "./FastVueMultiSimpleJsonResponse";
3
+ import { FastVueMultiSimpleRequestConfig } from "./FastVueMultiSimpleRequestConfig";
2
4
  /**
3
5
  * FastVueMultiHttp 网咯请求接口工具类
4
6
  * @author Janesen
@@ -117,7 +119,7 @@ export declare namespace FastVueMultiHttp {
117
119
  * @param config 请求配置
118
120
  * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
119
121
  */
120
- static request(method: string, url: string, params: any, config?: SimpleRequestConfig, callBack?: (result: SimpleJsonResponse) => void): Promise<SimpleJsonResponse>;
122
+ static request(method: string, url: string, params: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
121
123
  /**
122
124
  * post请求接口
123
125
  * @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
@@ -125,7 +127,7 @@ export declare namespace FastVueMultiHttp {
125
127
  * @param config 请求配置
126
128
  * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
127
129
  */
128
- static post(url: string, params: any, config?: SimpleRequestConfig, callBack?: (result: SimpleJsonResponse) => void): Promise<SimpleJsonResponse>;
130
+ static post(url: string, params: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
129
131
  /**
130
132
  * get请求接口
131
133
  * @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
@@ -133,93 +135,6 @@ export declare namespace FastVueMultiHttp {
133
135
  * @param config 请求配置
134
136
  * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
135
137
  */
136
- static get(url: string, params: any, config?: SimpleRequestConfig, callBack?: (result: SimpleJsonResponse) => void): Promise<SimpleJsonResponse>;
137
- }
138
- /**
139
- * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
140
- */
141
- class SimpleJsonResponse {
142
- responseData: any;
143
- cacheData: boolean;
144
- requestConfig: SimpleRequestConfig;
145
- constructor(responseData: any, cacheData?: boolean);
146
- /**
147
- * 获取接口返回的原始数据
148
- */
149
- getResponseData(): any;
150
- /**
151
- * 判断当前回调的数据是否是缓存的数据
152
- */
153
- isCacheData(): boolean;
154
- /**
155
- * 判断接口是否请求成功-success
156
- */
157
- isSuccess(): boolean;
158
- /**
159
- * 获取接口请求返回的状态值-code
160
- */
161
- getCode(): number;
162
- /**
163
- * 获取接口请求返回的消息提示-message
164
- */
165
- getMessage(): string;
166
- /**
167
- * 获取接口请求返回的数据-data
168
- */
169
- getData(): any;
170
- /**
171
- * 获取接口请求返回的其他数据,例如:data_1、data_2
172
- * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
173
- */
174
- getOtherData(suffixIndex: number): any;
175
- /**
176
- * 判断接口返回的数据data是否是分页的数据
177
- */
178
- isPageData(): boolean;
179
- /**
180
- * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
181
- */
182
- getList(): any[];
183
- /**
184
- * 获取接口列表分页数据的页数
185
- */
186
- getPage(): number;
187
- /**
188
- * 获取接口列表分页数据的总页数
189
- */
190
- getTotalPage(): number;
191
- /**
192
- * 获取接口列表分页数据的总行数
193
- */
194
- getTotalRow(): number;
195
- /**
196
- * 获取接口列表分页数据的每页大小
197
- */
198
- getPageSize(): number;
199
- /**
200
- * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
201
- */
202
- isFinished(): boolean;
203
- }
204
- /**
205
- * 接口请求配置类
206
- */
207
- class SimpleRequestConfig {
208
- /**
209
- * 是否追加全局参数,默认true
210
- */
211
- finalParams: boolean;
212
- /**
213
- * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
214
- */
215
- cache: boolean;
216
- /**
217
- * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
218
- */
219
- alwaysCache: boolean;
220
- /**
221
- * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
222
- */
223
- alwaysBackRequest: boolean;
138
+ static get(url: string, params: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
224
139
  }
225
140
  }
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "axios", "lodash", "../vue/FastVueMultiConfig", "../other/FastVueMultiStore"], function (require, exports, tslib_1, axios_1, lodash_1, FastVueMultiConfig_1, FastVueMultiStore_1) {
1
+ define(["require", "exports", "tslib", "axios", "lodash", "../vue/FastVueMultiConfig", "../other/FastVueMultiStore", "./FastVueMultiSimpleJsonResponse", "./FastVueMultiSimpleRequestConfig"], function (require, exports, tslib_1, axios_1, lodash_1, FastVueMultiConfig_1, FastVueMultiStore_1, FastVueMultiSimpleJsonResponse_1, FastVueMultiSimpleRequestConfig_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.FastVueMultiHttp = void 0;
@@ -372,7 +372,7 @@ define(["require", "exports", "tslib", "axios", "lodash", "../vue/FastVueMultiCo
372
372
  result = FastVueMultiStore_1.FastVueMultiStore.getValue(cacheKey);
373
373
  if (result.success) {
374
374
  cachedData = true;
375
- fastResponseData = new SimpleJsonResponse(JSON.parse(result.data), true);
375
+ fastResponseData = new FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse(JSON.parse(result.data), true);
376
376
  fastResponseData.requestConfig = config;
377
377
  resolved(fastResponseData);
378
378
  if (callBack) {
@@ -384,7 +384,7 @@ define(["require", "exports", "tslib", "axios", "lodash", "../vue/FastVueMultiCo
384
384
  }
385
385
  }
386
386
  if (!url) {
387
- fastResponseData = new SimpleJsonResponse({
387
+ fastResponseData = new FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse({
388
388
  success: false,
389
389
  message: "JS错误:请求地址不可为空!"
390
390
  });
@@ -396,9 +396,9 @@ define(["require", "exports", "tslib", "axios", "lodash", "../vue/FastVueMultiCo
396
396
  }
397
397
  FastVueMultiHttp.Base.doRequest(method, url, params).then(function (response) {
398
398
  if (!config) {
399
- config = new FastVueMultiHttp.SimpleRequestConfig();
399
+ config = new FastVueMultiSimpleRequestConfig_1.FastVueMultiSimpleRequestConfig();
400
400
  }
401
- var fastResponseData = new SimpleJsonResponse(response.data);
401
+ var fastResponseData = new FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse(response.data);
402
402
  fastResponseData.requestConfig = config;
403
403
  if (config.cache) {
404
404
  if (config.alwaysBackRequest || !cachedData) {
@@ -457,152 +457,5 @@ define(["require", "exports", "tslib", "axios", "lodash", "../vue/FastVueMultiCo
457
457
  return Simple;
458
458
  }(Base));
459
459
  FastVueMultiHttp.Simple = Simple;
460
- /**
461
- * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
462
- */
463
- var SimpleJsonResponse = /** @class */ (function () {
464
- function SimpleJsonResponse(responseData, cacheData) {
465
- this.cacheData = false;
466
- this.requestConfig = new FastVueMultiHttp.SimpleRequestConfig();
467
- this.responseData = responseData;
468
- if (cacheData == undefined) {
469
- cacheData = false;
470
- }
471
- this.cacheData = cacheData;
472
- }
473
- /**
474
- * 获取接口返回的原始数据
475
- */
476
- SimpleJsonResponse.prototype.getResponseData = function () {
477
- return this.responseData;
478
- };
479
- /**
480
- * 判断当前回调的数据是否是缓存的数据
481
- */
482
- SimpleJsonResponse.prototype.isCacheData = function () {
483
- return this.cacheData;
484
- };
485
- /**
486
- * 判断接口是否请求成功-success
487
- */
488
- SimpleJsonResponse.prototype.isSuccess = function () {
489
- return this.responseData.success;
490
- };
491
- /**
492
- * 获取接口请求返回的状态值-code
493
- */
494
- SimpleJsonResponse.prototype.getCode = function () {
495
- return this.responseData.code;
496
- };
497
- /**
498
- * 获取接口请求返回的消息提示-message
499
- */
500
- SimpleJsonResponse.prototype.getMessage = function () {
501
- return this.responseData.message;
502
- };
503
- /**
504
- * 获取接口请求返回的数据-data
505
- */
506
- SimpleJsonResponse.prototype.getData = function () {
507
- return this.responseData.data;
508
- };
509
- /**
510
- * 获取接口请求返回的其他数据,例如:data_1、data_2
511
- * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
512
- */
513
- SimpleJsonResponse.prototype.getOtherData = function (suffixIndex) {
514
- return this.responseData["data_" + suffixIndex];
515
- };
516
- /**
517
- * 判断接口返回的数据data是否是分页的数据
518
- */
519
- SimpleJsonResponse.prototype.isPageData = function () {
520
- if (!this.responseData.data) {
521
- return false;
522
- }
523
- return this.responseData.data.hasOwnProperty("page");
524
- };
525
- /**
526
- * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
527
- */
528
- SimpleJsonResponse.prototype.getList = function () {
529
- if (this.isPageData()) {
530
- return this.responseData.data.list;
531
- }
532
- if (this.responseData.data) {
533
- return this.responseData.data;
534
- }
535
- return [];
536
- };
537
- /**
538
- * 获取接口列表分页数据的页数
539
- */
540
- SimpleJsonResponse.prototype.getPage = function () {
541
- if (this.isPageData()) {
542
- return this.responseData.data.page;
543
- }
544
- return -1;
545
- };
546
- /**
547
- * 获取接口列表分页数据的总页数
548
- */
549
- SimpleJsonResponse.prototype.getTotalPage = function () {
550
- if (this.isPageData()) {
551
- return this.responseData.data.totalPage;
552
- }
553
- return -1;
554
- };
555
- /**
556
- * 获取接口列表分页数据的总行数
557
- */
558
- SimpleJsonResponse.prototype.getTotalRow = function () {
559
- if (this.isPageData()) {
560
- return this.responseData.data.totalRow;
561
- }
562
- return -1;
563
- };
564
- /**
565
- * 获取接口列表分页数据的每页大小
566
- */
567
- SimpleJsonResponse.prototype.getPageSize = function () {
568
- if (this.isPageData()) {
569
- return this.responseData.data.pageSize;
570
- }
571
- return -1;
572
- };
573
- /**
574
- * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
575
- */
576
- SimpleJsonResponse.prototype.isFinished = function () {
577
- return this.getPage() >= this.getTotalPage() || this.getList().length === 0;
578
- };
579
- return SimpleJsonResponse;
580
- }());
581
- FastVueMultiHttp.SimpleJsonResponse = SimpleJsonResponse;
582
- /**
583
- * 接口请求配置类
584
- */
585
- var SimpleRequestConfig = /** @class */ (function () {
586
- function SimpleRequestConfig() {
587
- /**
588
- * 是否追加全局参数,默认true
589
- */
590
- this.finalParams = true;
591
- /**
592
- * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
593
- */
594
- this.cache = false;
595
- /**
596
- * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
597
- */
598
- this.alwaysCache = false;
599
- /**
600
- * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
601
- */
602
- this.alwaysBackRequest = false;
603
- }
604
- return SimpleRequestConfig;
605
- }());
606
- FastVueMultiHttp.SimpleRequestConfig = SimpleRequestConfig;
607
460
  })(FastVueMultiHttp || (exports.FastVueMultiHttp = FastVueMultiHttp = {}));
608
461
  });
@@ -0,0 +1,67 @@
1
+ import { FastVueMultiSimpleRequestConfig } from "./FastVueMultiSimpleRequestConfig";
2
+ /**
3
+ * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
4
+ */
5
+ export declare class FastVueMultiSimpleJsonResponse {
6
+ responseData: any;
7
+ cacheData: boolean;
8
+ requestConfig: FastVueMultiSimpleRequestConfig;
9
+ constructor(responseData: any, cacheData?: boolean);
10
+ /**
11
+ * 获取接口返回的原始数据
12
+ */
13
+ getResponseData(): any;
14
+ /**
15
+ * 判断当前回调的数据是否是缓存的数据
16
+ */
17
+ isCacheData(): boolean;
18
+ /**
19
+ * 判断接口是否请求成功-success
20
+ */
21
+ isSuccess(): boolean;
22
+ /**
23
+ * 获取接口请求返回的状态值-code
24
+ */
25
+ getCode(): number;
26
+ /**
27
+ * 获取接口请求返回的消息提示-message
28
+ */
29
+ getMessage(): string;
30
+ /**
31
+ * 获取接口请求返回的数据-data
32
+ */
33
+ getData(): any;
34
+ /**
35
+ * 获取接口请求返回的其他数据,例如:data_1、data_2
36
+ * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
37
+ */
38
+ getOtherData(suffixIndex: number): any;
39
+ /**
40
+ * 判断接口返回的数据data是否是分页的数据
41
+ */
42
+ isPageData(): boolean;
43
+ /**
44
+ * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
45
+ */
46
+ getList(): any[];
47
+ /**
48
+ * 获取接口列表分页数据的页数
49
+ */
50
+ getPage(): number;
51
+ /**
52
+ * 获取接口列表分页数据的总页数
53
+ */
54
+ getTotalPage(): number;
55
+ /**
56
+ * 获取接口列表分页数据的总行数
57
+ */
58
+ getTotalRow(): number;
59
+ /**
60
+ * 获取接口列表分页数据的每页大小
61
+ */
62
+ getPageSize(): number;
63
+ /**
64
+ * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
65
+ */
66
+ isFinished(): boolean;
67
+ }
@@ -0,0 +1,127 @@
1
+ define(["require", "exports", "./FastVueMultiSimpleRequestConfig"], function (require, exports, FastVueMultiSimpleRequestConfig_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FastVueMultiSimpleJsonResponse = void 0;
5
+ /**
6
+ * 常规返回数据的格式解析类 JSON:{success:true,message:"消息",data:{}}
7
+ */
8
+ var FastVueMultiSimpleJsonResponse = /** @class */ (function () {
9
+ function FastVueMultiSimpleJsonResponse(responseData, cacheData) {
10
+ this.cacheData = false;
11
+ this.requestConfig = new FastVueMultiSimpleRequestConfig_1.FastVueMultiSimpleRequestConfig();
12
+ this.responseData = responseData;
13
+ if (cacheData == undefined) {
14
+ cacheData = false;
15
+ }
16
+ this.cacheData = cacheData;
17
+ }
18
+ /**
19
+ * 获取接口返回的原始数据
20
+ */
21
+ FastVueMultiSimpleJsonResponse.prototype.getResponseData = function () {
22
+ return this.responseData;
23
+ };
24
+ /**
25
+ * 判断当前回调的数据是否是缓存的数据
26
+ */
27
+ FastVueMultiSimpleJsonResponse.prototype.isCacheData = function () {
28
+ return this.cacheData;
29
+ };
30
+ /**
31
+ * 判断接口是否请求成功-success
32
+ */
33
+ FastVueMultiSimpleJsonResponse.prototype.isSuccess = function () {
34
+ return this.responseData.success;
35
+ };
36
+ /**
37
+ * 获取接口请求返回的状态值-code
38
+ */
39
+ FastVueMultiSimpleJsonResponse.prototype.getCode = function () {
40
+ return this.responseData.code;
41
+ };
42
+ /**
43
+ * 获取接口请求返回的消息提示-message
44
+ */
45
+ FastVueMultiSimpleJsonResponse.prototype.getMessage = function () {
46
+ return this.responseData.message;
47
+ };
48
+ /**
49
+ * 获取接口请求返回的数据-data
50
+ */
51
+ FastVueMultiSimpleJsonResponse.prototype.getData = function () {
52
+ return this.responseData.data;
53
+ };
54
+ /**
55
+ * 获取接口请求返回的其他数据,例如:data_1、data_2
56
+ * @param suffixIndex 数据后缀,例如:data_1 后缀传 1
57
+ */
58
+ FastVueMultiSimpleJsonResponse.prototype.getOtherData = function (suffixIndex) {
59
+ return this.responseData["data_" + suffixIndex];
60
+ };
61
+ /**
62
+ * 判断接口返回的数据data是否是分页的数据
63
+ */
64
+ FastVueMultiSimpleJsonResponse.prototype.isPageData = function () {
65
+ if (!this.responseData.data) {
66
+ return false;
67
+ }
68
+ return this.responseData.data.hasOwnProperty("page");
69
+ };
70
+ /**
71
+ * 获取接口返回的数据列表,如果data是分页数据则返回分页的列表,否则返回data
72
+ */
73
+ FastVueMultiSimpleJsonResponse.prototype.getList = function () {
74
+ if (this.isPageData()) {
75
+ return this.responseData.data.list;
76
+ }
77
+ if (this.responseData.data) {
78
+ return this.responseData.data;
79
+ }
80
+ return [];
81
+ };
82
+ /**
83
+ * 获取接口列表分页数据的页数
84
+ */
85
+ FastVueMultiSimpleJsonResponse.prototype.getPage = function () {
86
+ if (this.isPageData()) {
87
+ return this.responseData.data.page;
88
+ }
89
+ return -1;
90
+ };
91
+ /**
92
+ * 获取接口列表分页数据的总页数
93
+ */
94
+ FastVueMultiSimpleJsonResponse.prototype.getTotalPage = function () {
95
+ if (this.isPageData()) {
96
+ return this.responseData.data.totalPage;
97
+ }
98
+ return -1;
99
+ };
100
+ /**
101
+ * 获取接口列表分页数据的总行数
102
+ */
103
+ FastVueMultiSimpleJsonResponse.prototype.getTotalRow = function () {
104
+ if (this.isPageData()) {
105
+ return this.responseData.data.totalRow;
106
+ }
107
+ return -1;
108
+ };
109
+ /**
110
+ * 获取接口列表分页数据的每页大小
111
+ */
112
+ FastVueMultiSimpleJsonResponse.prototype.getPageSize = function () {
113
+ if (this.isPageData()) {
114
+ return this.responseData.data.pageSize;
115
+ }
116
+ return -1;
117
+ };
118
+ /**
119
+ * 是否已加载结束,当page>=totalPage 或 list 为空时,认为加载已结束
120
+ */
121
+ FastVueMultiSimpleJsonResponse.prototype.isFinished = function () {
122
+ return this.getPage() >= this.getTotalPage() || this.getList().length === 0;
123
+ };
124
+ return FastVueMultiSimpleJsonResponse;
125
+ }());
126
+ exports.FastVueMultiSimpleJsonResponse = FastVueMultiSimpleJsonResponse;
127
+ });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 接口请求配置类
3
+ */
4
+ export declare class FastVueMultiSimpleRequestConfig {
5
+ /**
6
+ * 是否追加全局参数,默认true
7
+ */
8
+ finalParams: boolean;
9
+ /**
10
+ * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
11
+ */
12
+ cache: boolean;
13
+ /**
14
+ * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
15
+ */
16
+ alwaysCache: boolean;
17
+ /**
18
+ * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
19
+ */
20
+ alwaysBackRequest: boolean;
21
+ }
@@ -0,0 +1,30 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FastVueMultiSimpleRequestConfig = void 0;
5
+ /**
6
+ * 接口请求配置类
7
+ */
8
+ var FastVueMultiSimpleRequestConfig = /** @class */ (function () {
9
+ function FastVueMultiSimpleRequestConfig() {
10
+ /**
11
+ * 是否追加全局参数,默认true
12
+ */
13
+ this.finalParams = true;
14
+ /**
15
+ * 是否缓存数据,true:检测到有当前接口的缓存数据时,将回调缓存的数据
16
+ */
17
+ this.cache = false;
18
+ /**
19
+ * 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
20
+ */
21
+ this.alwaysCache = false;
22
+ /**
23
+ * 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调缓存数据,第二次回调接口返回的数据,否则值回调一次接口返回的数据,不支持then方法接收
24
+ */
25
+ this.alwaysBackRequest = false;
26
+ }
27
+ return FastVueMultiSimpleRequestConfig;
28
+ }());
29
+ exports.FastVueMultiSimpleRequestConfig = FastVueMultiSimpleRequestConfig;
30
+ });
@@ -1,2 +1,4 @@
1
1
  import { FastVueMultiTool } from "./FastVueMultiTool";
2
- export { FastVueMultiTool };
2
+ import { FastVueMultiSimpleJsonResponse } from "./http/FastVueMultiSimpleJsonResponse";
3
+ import { FastVueMultiSimpleRequestConfig } from "./http/FastVueMultiSimpleRequestConfig";
4
+ export { FastVueMultiTool, FastVueMultiSimpleJsonResponse, FastVueMultiSimpleRequestConfig };
package/dist/esm/index.js CHANGED
@@ -1,6 +1,8 @@
1
- define(["require", "exports", "./FastVueMultiTool"], function (require, exports, FastVueMultiTool_1) {
1
+ define(["require", "exports", "./FastVueMultiTool", "./http/FastVueMultiSimpleJsonResponse", "./http/FastVueMultiSimpleRequestConfig"], function (require, exports, FastVueMultiTool_1, FastVueMultiSimpleJsonResponse_1, FastVueMultiSimpleRequestConfig_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.FastVueMultiTool = void 0;
4
+ exports.FastVueMultiSimpleRequestConfig = exports.FastVueMultiSimpleJsonResponse = exports.FastVueMultiTool = void 0;
5
5
  Object.defineProperty(exports, "FastVueMultiTool", { enumerable: true, get: function () { return FastVueMultiTool_1.FastVueMultiTool; } });
6
+ Object.defineProperty(exports, "FastVueMultiSimpleJsonResponse", { enumerable: true, get: function () { return FastVueMultiSimpleJsonResponse_1.FastVueMultiSimpleJsonResponse; } });
7
+ Object.defineProperty(exports, "FastVueMultiSimpleRequestConfig", { enumerable: true, get: function () { return FastVueMultiSimpleRequestConfig_1.FastVueMultiSimpleRequestConfig; } });
6
8
  });
@@ -27,7 +27,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
27
27
  */
28
28
  FastVueMultiDate.format = function (source, pattern) {
29
29
  if (lodash_1.default.isEmpty(pattern)) {
30
- return null;
30
+ return source.toLocaleString();
31
31
  }
32
32
  if (lodash_1.default.isEmpty(source)) {
33
33
  return null;
@@ -51,7 +51,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
51
51
  */
52
52
  FastVueMultiDate.formatNice = function (source, level) {
53
53
  if (lodash_1.default.isEmpty(source)) {
54
- return null;
54
+ return source;
55
55
  }
56
56
  if (level === undefined) {
57
57
  level = 2;
@@ -65,7 +65,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
65
65
  var time1 = new Date().getTime(); //当前的时间戳
66
66
  var sourceDate = this.parse(source);
67
67
  if (!sourceDate) {
68
- return null;
68
+ return source;
69
69
  }
70
70
  var time2 = sourceDate.getTime();
71
71
  var time = time1 - time2;
@@ -44,6 +44,8 @@ define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
44
44
  }
45
45
  }
46
46
  };
47
+ inputElement.onerror = reject;
48
+ inputElement.onabort = reject;
47
49
  inputElement.dispatchEvent(event);
48
50
  })];
49
51
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-vue-multi-pages",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "author": "janesen",
5
5
  "description": "快速搭建VUE项目工具类的基本库,主要用于每个功能页面独立生成html",
6
6
  "main": "./dist/cjs/index.js",
@@ -30,7 +30,8 @@
30
30
  "moment": "^2.30.1",
31
31
  "@types/js-cookie": "^3.0.6",
32
32
  "@types/lodash": "^4.17.6",
33
- "copy-to-clipboard": "^3.3.3"
33
+ "copy-to-clipboard": "^3.3.3",
34
+ "ip": "^2.0.1"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@typescript-eslint/eslint-plugin": "^7.16.0",
@@ -51,4 +51,8 @@ export declare class FastVueMultiPages {
51
51
  * @param path
52
52
  */
53
53
  private static removeFile;
54
+ /**
55
+ * 获取本机IP地址
56
+ */
57
+ static getLocalIP(): string;
54
58
  }
@@ -275,5 +275,12 @@ class FastVueMultiPages {
275
275
  fs.rmdirSync(path); // 删除文件夹自身
276
276
  }
277
277
  }
278
+ /**
279
+ * 获取本机IP地址
280
+ */
281
+ static getLocalIP() {
282
+ let ip = require('ip');
283
+ return ip.address();
284
+ }
278
285
  }
279
286
  exports.FastVueMultiPages = FastVueMultiPages;