fast-vue-multi-pages 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/README.md +63 -0
  2. package/dist/cjs/FastVueMultiTool.d.ts +60 -0
  3. package/dist/cjs/FastVueMultiTool.js +65 -0
  4. package/dist/cjs/http/FastVueMultiCookie.d.ts +18 -0
  5. package/dist/cjs/http/FastVueMultiCookie.js +30 -0
  6. package/dist/cjs/http/FastVueMultiHttp.d.ts +225 -0
  7. package/dist/cjs/http/FastVueMultiHttp.js +572 -0
  8. package/dist/cjs/index.d.ts +2 -0
  9. package/dist/cjs/index.js +5 -0
  10. package/dist/cjs/loader/FastTagBuilderLoader.d.ts +2 -0
  11. package/dist/cjs/loader/FastTagBuilderLoader.js +89 -0
  12. package/dist/cjs/other/FastVueMultiBoolean.d.ts +13 -0
  13. package/dist/cjs/other/FastVueMultiBoolean.js +56 -0
  14. package/dist/cjs/other/FastVueMultiClipboard.d.ts +21 -0
  15. package/dist/cjs/other/FastVueMultiClipboard.js +38 -0
  16. package/dist/cjs/other/FastVueMultiDate.d.ts +30 -0
  17. package/dist/cjs/other/FastVueMultiDate.js +166 -0
  18. package/dist/cjs/other/FastVueMultiElement.d.ts +46 -0
  19. package/dist/cjs/other/FastVueMultiElement.js +154 -0
  20. package/dist/cjs/other/FastVueMultiFunction.d.ts +19 -0
  21. package/dist/cjs/other/FastVueMultiFunction.js +68 -0
  22. package/dist/cjs/other/FastVueMultiStore.d.ts +13 -0
  23. package/dist/cjs/other/FastVueMultiStore.js +23 -0
  24. package/dist/cjs/other/FastVueMultiWindow.d.ts +21 -0
  25. package/dist/cjs/other/FastVueMultiWindow.js +53 -0
  26. package/dist/cjs/store/FastVueMultiStore.d.ts +13 -0
  27. package/dist/cjs/store/FastVueMultiStore.js +23 -0
  28. package/dist/cjs/vue/FastVueMultiConfig.d.ts +18 -0
  29. package/dist/cjs/vue/FastVueMultiConfig.js +43 -0
  30. package/dist/esm/FastVueMultiTool.d.ts +60 -0
  31. package/dist/esm/FastVueMultiTool.js +59 -0
  32. package/dist/esm/http/FastVueMultiCookie.d.ts +18 -0
  33. package/dist/esm/http/FastVueMultiCookie.js +34 -0
  34. package/dist/esm/http/FastVueMultiHttp.d.ts +225 -0
  35. package/dist/esm/http/FastVueMultiHttp.js +608 -0
  36. package/dist/esm/index.d.ts +2 -0
  37. package/dist/esm/index.js +6 -0
  38. package/dist/esm/loader/FastTagBuilderLoader.d.ts +2 -0
  39. package/dist/esm/loader/FastTagBuilderLoader.js +89 -0
  40. package/dist/esm/other/FastVueMultiBoolean.d.ts +13 -0
  41. package/dist/esm/other/FastVueMultiBoolean.js +60 -0
  42. package/dist/esm/other/FastVueMultiClipboard.d.ts +21 -0
  43. package/dist/esm/other/FastVueMultiClipboard.js +56 -0
  44. package/dist/esm/other/FastVueMultiDate.d.ts +30 -0
  45. package/dist/esm/other/FastVueMultiDate.js +170 -0
  46. package/dist/esm/other/FastVueMultiElement.d.ts +46 -0
  47. package/dist/esm/other/FastVueMultiElement.js +158 -0
  48. package/dist/esm/other/FastVueMultiFunction.d.ts +19 -0
  49. package/dist/esm/other/FastVueMultiFunction.js +97 -0
  50. package/dist/esm/other/FastVueMultiStore.d.ts +13 -0
  51. package/dist/esm/other/FastVueMultiStore.js +27 -0
  52. package/dist/esm/other/FastVueMultiWindow.d.ts +21 -0
  53. package/dist/esm/other/FastVueMultiWindow.js +57 -0
  54. package/dist/esm/store/FastVueMultiStore.d.ts +13 -0
  55. package/dist/esm/store/FastVueMultiStore.js +27 -0
  56. package/dist/esm/vue/FastVueMultiConfig.d.ts +18 -0
  57. package/dist/esm/vue/FastVueMultiConfig.js +48 -0
  58. package/package.json +64 -0
  59. package/vue/FastBuildOption.d.ts +241 -0
  60. package/vue/FastBuildOption.js +249 -0
  61. package/vue/FastInjectJsPlugin.d.ts +11 -0
  62. package/vue/FastInjectJsPlugin.js +101 -0
  63. package/vue/FastPages.d.ts +25 -0
  64. package/vue/FastPages.js +173 -0
  65. package/vue/FastVueMultiConfig.d.ts +18 -0
  66. package/vue/FastVueMultiConfig.js +43 -0
  67. package/vue/FastVueMultiPages.d.ts +62 -0
  68. package/vue/FastVueMultiPages.js +294 -0
  69. package/vue/index.d.ts +2 -0
  70. package/vue/index.js +5 -0
@@ -0,0 +1,608 @@
1
+ define(["require", "exports", "tslib", "axios", "lodash", "../vue/FastVueMultiConfig", "../other/FastVueMultiStore"], function (require, exports, tslib_1, axios_1, lodash_1, FastVueMultiConfig_1, FastVueMultiStore_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FastVueMultiHttp = void 0;
5
+ axios_1 = tslib_1.__importDefault(axios_1);
6
+ lodash_1 = tslib_1.__importDefault(lodash_1);
7
+ /**
8
+ * FastVueMultiHttp 网咯请求接口工具类
9
+ * @author Janesen
10
+ */
11
+ var FastVueMultiHttp;
12
+ (function (FastVueMultiHttp) {
13
+ /**
14
+ * 基本的网络请求接口
15
+ */
16
+ var Base = /** @class */ (function () {
17
+ function Base() {
18
+ }
19
+ /**
20
+ * 获取地址栏携带的参数
21
+ * @param paramName 参数名
22
+ */
23
+ Base.getWindowUrlParam = function (paramName) {
24
+ return this.getUrlParam(window.location.href, paramName);
25
+ };
26
+ /**
27
+ * 获取地址栏携带的参数对象信息
28
+ */
29
+ Base.getWindowUrlInfo = function () {
30
+ return this.getUrlParamInfo(window.location.href);
31
+ };
32
+ /**
33
+ * 获取url的参数
34
+ * @param url 地址
35
+ * @param paramName 参数名
36
+ */
37
+ Base.getUrlParam = function (url, paramName) {
38
+ var windowUrlInfo = FastVueMultiHttp.Base.getUrlParamInfo(url);
39
+ for (var windowUrlInfoKey in windowUrlInfo) {
40
+ if (windowUrlInfoKey == paramName) {
41
+ return windowUrlInfo[windowUrlInfoKey];
42
+ }
43
+ }
44
+ return null;
45
+ };
46
+ /**
47
+ * 获取url的参数实体对象
48
+ * @param url 地址
49
+ */
50
+ Base.getUrlParamInfo = function (url) {
51
+ var urlInfo = {};
52
+ var splitArray = url.split("#")[0].split("?");
53
+ var search = splitArray[splitArray.length - 1];
54
+ var vars = search.split("&");
55
+ for (var i = 0; i < vars.length; i++) {
56
+ var pair = vars[i].split("=");
57
+ urlInfo[pair[0]] = pair[1];
58
+ }
59
+ return urlInfo;
60
+ };
61
+ /**
62
+ * 追加url参数
63
+ * @param url
64
+ * @param params
65
+ */
66
+ Base.appendUrlParams = function (url, params) {
67
+ var newUrl = url;
68
+ if (url.indexOf("?") > 0) {
69
+ newUrl = url + "&1=1";
70
+ }
71
+ else {
72
+ newUrl = url + "?1=1";
73
+ }
74
+ if (params) {
75
+ this.convertToFormData(params).forEach(function (value, key, parent) {
76
+ if (value instanceof File) {
77
+ return;
78
+ }
79
+ newUrl = newUrl + "&" + key + "=" + value;
80
+ });
81
+ }
82
+ return newUrl;
83
+ };
84
+ /**
85
+ * 合并多个FormData参数
86
+ * @param formData
87
+ */
88
+ Base.mergeFormData = function () {
89
+ var formData = [];
90
+ for (var _i = 0; _i < arguments.length; _i++) {
91
+ formData[_i] = arguments[_i];
92
+ }
93
+ var newParams = new FormData();
94
+ formData.forEach(function (item) {
95
+ if (lodash_1.default.isNull(item)) {
96
+ return true;
97
+ }
98
+ item.forEach(function (value, key, parent) {
99
+ newParams.append(key, value);
100
+ });
101
+ });
102
+ return newParams;
103
+ };
104
+ /**
105
+ * 如果是formData对象则转转换参数为object对象
106
+ * @param param
107
+ */
108
+ Base.convertToObject = function (param) {
109
+ if (param instanceof FormData) {
110
+ var newParams_1 = {};
111
+ param.forEach(function (value, key, parent) {
112
+ newParams_1[key] = value;
113
+ });
114
+ return newParams_1;
115
+ }
116
+ return param;
117
+ };
118
+ /**
119
+ * 转换参数为FormData格式
120
+ * @param param 任意格式的参数,FormData、Object、Function
121
+ */
122
+ Base.convertToFormData = function (param) {
123
+ var newParams = new FormData();
124
+ if (param instanceof FormData) {
125
+ return param;
126
+ }
127
+ else if (lodash_1.default.isFunction(param)) {
128
+ return this.convertToFormData(param());
129
+ }
130
+ else {
131
+ for (var paramKey in param) {
132
+ if (param.hasOwnProperty(paramKey)) {
133
+ newParams.append(paramKey, param[paramKey]);
134
+ }
135
+ }
136
+ }
137
+ return newParams;
138
+ };
139
+ /**
140
+ * 合并参数并转换为FormData格式
141
+ * @param params 任意多个参数,FormData、Object、Function
142
+ */
143
+ Base.mergeParams = function () {
144
+ var params = [];
145
+ for (var _i = 0; _i < arguments.length; _i++) {
146
+ params[_i] = arguments[_i];
147
+ }
148
+ var newParams = new FormData();
149
+ params.forEach(function (param) {
150
+ if (lodash_1.default.isNull(param)) {
151
+ return true;
152
+ }
153
+ if (lodash_1.default.isArray(param)) {
154
+ newParams = FastVueMultiHttp.Base.mergeFormData(newParams, FastVueMultiHttp.Base.mergeParamsByArray(param));
155
+ }
156
+ else {
157
+ newParams = FastVueMultiHttp.Base.mergeFormData(newParams, FastVueMultiHttp.Base.convertToFormData(param));
158
+ }
159
+ });
160
+ return newParams;
161
+ };
162
+ /**
163
+ * 将数组格式的参数合并
164
+ * @param params 数组
165
+ */
166
+ Base.mergeParamsByArray = function (params) {
167
+ var newParams = new FormData();
168
+ for (var i = 0; i < params.length; i++) {
169
+ var item = params[i];
170
+ if (lodash_1.default.isNull(item)) {
171
+ continue;
172
+ }
173
+ if (lodash_1.default.isArray(item)) {
174
+ newParams = this.mergeFormData(newParams, this.mergeParamsByArray(item));
175
+ }
176
+ else {
177
+ newParams = this.mergeFormData(newParams, this.convertToFormData(item));
178
+ }
179
+ }
180
+ return newParams;
181
+ };
182
+ /**
183
+ * 发起接口请求
184
+ * @param method 请求方法,例如,post、get
185
+ * @param url 请求地址
186
+ * @param params 请求参数
187
+ */
188
+ Base.doRequest = function (method, url, params) {
189
+ var axiosConfig = {
190
+ headers: this.getFinalHeaders(),
191
+ method: method,
192
+ url: url,
193
+ timeout: 3 * 60 * 1000
194
+ };
195
+ if (method === "post") {
196
+ if (lodash_1.default.isString(params)) {
197
+ axiosConfig.paramsSerializer = params;
198
+ }
199
+ else {
200
+ axiosConfig.data = this.convertToFormData(params);
201
+ }
202
+ }
203
+ else {
204
+ if (lodash_1.default.isString(params)) {
205
+ axiosConfig.paramsSerializer = params;
206
+ }
207
+ else {
208
+ axiosConfig.params = this.convertToObject(params);
209
+ }
210
+ }
211
+ var _request = axios_1.default.create();
212
+ _request.interceptors.request.use(function (config) {
213
+ var httpBeforeRequest = FastVueMultiConfig_1.FastVueMultiConfig.getGlobalConfig("httpBeforeRequest");
214
+ if (httpBeforeRequest) {
215
+ httpBeforeRequest(config);
216
+ }
217
+ return config;
218
+ }, function (error) {
219
+ return Promise.reject(error);
220
+ });
221
+ _request.interceptors.response.use(function (response) {
222
+ var httpAfterRequest = FastVueMultiConfig_1.FastVueMultiConfig.getGlobalConfig("httpAfterRequest");
223
+ if (httpAfterRequest) {
224
+ httpAfterRequest(response);
225
+ }
226
+ return response;
227
+ }, function (error) {
228
+ return Promise.reject(error);
229
+ });
230
+ return _request(axiosConfig);
231
+ };
232
+ /**
233
+ * 执行post请求
234
+ * @param url 请求地址
235
+ * @param params 请求参数,可为object或form data
236
+ */
237
+ Base.doPost = function (url, params) {
238
+ return this.doRequest("post", url, params);
239
+ };
240
+ /**
241
+ * 执行get请求
242
+ * @param url 请求接口地址
243
+ * @param params 请求接口参数
244
+ */
245
+ Base.doGet = function (url, params) {
246
+ return this.doRequest("get", url, params);
247
+ };
248
+ /**
249
+ * 获取请求接口的默认头信息配置
250
+ */
251
+ Base.getFinalHeaders = function () {
252
+ var justFinalHeaders = {};
253
+ if (window["FastSecurity"]) {
254
+ // @ts-ignore
255
+ justFinalHeaders["token"] = window["FastSecurity"].token();
256
+ }
257
+ var httpFinalHeaders = FastVueMultiConfig_1.FastVueMultiConfig.getGlobalConfig("httpFinalHeaders");
258
+ if (httpFinalHeaders) {
259
+ for (var dataKey in httpFinalHeaders) {
260
+ if (httpFinalHeaders[dataKey] === undefined) {
261
+ continue;
262
+ }
263
+ justFinalHeaders[dataKey] = httpFinalHeaders[dataKey];
264
+ }
265
+ }
266
+ return justFinalHeaders;
267
+ };
268
+ /**
269
+ * 设置请求头
270
+ * @param key
271
+ * @param value
272
+ */
273
+ Base.setFinalHeader = function (key, value) {
274
+ var httpFinalHeaders = FastVueMultiConfig_1.FastVueMultiConfig.getGlobalConfig("httpFinalHeaders");
275
+ if (httpFinalHeaders) {
276
+ httpFinalHeaders[key] = value;
277
+ }
278
+ };
279
+ /**
280
+ * 获取接口的全局参数,同步获取了原生APP的全局参数
281
+ */
282
+ Base.getFinalParams = function () {
283
+ var justFinalParams = {};
284
+ var finalParams = FastVueMultiConfig_1.FastVueMultiConfig.getGlobalConfig("httpFinalParams");
285
+ if (finalParams) {
286
+ for (var dataKey in finalParams) {
287
+ if (finalParams[dataKey] === undefined) {
288
+ continue;
289
+ }
290
+ justFinalParams[dataKey] = finalParams[dataKey];
291
+ }
292
+ }
293
+ return justFinalParams;
294
+ };
295
+ /**
296
+ * 设置全局请求参数
297
+ * @param key
298
+ * @param value
299
+ */
300
+ Base.setFinalParam = function (key, value) {
301
+ var finalParams = FastVueMultiConfig_1.FastVueMultiConfig.getGlobalConfig("httpFinalParams");
302
+ if (finalParams) {
303
+ finalParams[key] = value;
304
+ }
305
+ };
306
+ /**
307
+ * 构建接口请求的缓存key
308
+ * @param url 请求地址
309
+ * @param params 请求参数
310
+ */
311
+ Base.buildCacheKey = function (url, params) {
312
+ var md5 = require('md5');
313
+ if (params instanceof FormData) {
314
+ var paramObj_1 = {};
315
+ params.forEach(function (value, key, parent) {
316
+ if (value instanceof File) {
317
+ paramObj_1[key] = value.name + "//" + value.size + "//" + value.type;
318
+ }
319
+ else {
320
+ paramObj_1[key] = value;
321
+ }
322
+ });
323
+ return md5(url + JSON.stringify(paramObj_1));
324
+ }
325
+ return md5(url + JSON.stringify(params));
326
+ };
327
+ return Base;
328
+ }());
329
+ FastVueMultiHttp.Base = Base;
330
+ // noinspection DuplicatedCode
331
+ /**
332
+ * 常规的接口请求类,返回格式要求为JSON:{success:true,message:"消息",data:{}}
333
+ */
334
+ var Simple = /** @class */ (function (_super) {
335
+ tslib_1.__extends(Simple, _super);
336
+ function Simple() {
337
+ return _super !== null && _super.apply(this, arguments) || this;
338
+ }
339
+ /**
340
+ * 发起请求接口
341
+ * @param method 请求方法,例如:post、get
342
+ * @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
343
+ * @param params 参数
344
+ * @param config 请求配置
345
+ * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
346
+ */
347
+ Simple.request = function (method, url, params, config, callBack) {
348
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
349
+ return tslib_1.__generator(this, function (_a) {
350
+ return [2 /*return*/, new Promise(function (resolved, rejected) {
351
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
352
+ var justFinalParams, dataKey, cacheKey, cachedData, result, fastResponseData, fastResponseData;
353
+ return tslib_1.__generator(this, function (_a) {
354
+ if (!config) {
355
+ config = {
356
+ finalParams: true
357
+ };
358
+ }
359
+ params = FastVueMultiHttp.Base.convertToFormData(params);
360
+ if (config.finalParams) {
361
+ justFinalParams = FastVueMultiHttp.Base.getFinalParams();
362
+ for (dataKey in justFinalParams) {
363
+ if (params.has(dataKey)) {
364
+ delete justFinalParams[dataKey];
365
+ }
366
+ }
367
+ params = FastVueMultiHttp.Base.mergeParams(justFinalParams, params);
368
+ }
369
+ cacheKey = FastVueMultiHttp.Base.buildCacheKey(url, params);
370
+ cachedData = false;
371
+ if (config.cache) {
372
+ result = FastVueMultiStore_1.FastVueMultiStore.getValue(cacheKey);
373
+ if (result.success) {
374
+ cachedData = true;
375
+ fastResponseData = new SimpleJsonResponse(JSON.parse(result.data), true);
376
+ fastResponseData.requestConfig = config;
377
+ resolved(fastResponseData);
378
+ if (callBack) {
379
+ callBack(fastResponseData);
380
+ }
381
+ if (!config.alwaysCache) {
382
+ return [2 /*return*/];
383
+ }
384
+ }
385
+ }
386
+ if (!url) {
387
+ fastResponseData = new SimpleJsonResponse({
388
+ success: false,
389
+ message: "JS错误:请求地址不可为空!"
390
+ });
391
+ resolved(fastResponseData);
392
+ if (callBack) {
393
+ callBack(fastResponseData);
394
+ }
395
+ return [2 /*return*/];
396
+ }
397
+ FastVueMultiHttp.Base.doRequest(method, url, params).then(function (response) {
398
+ if (!config) {
399
+ config = new FastVueMultiHttp.SimpleRequestConfig();
400
+ }
401
+ var fastResponseData = new SimpleJsonResponse(response.data);
402
+ fastResponseData.requestConfig = config;
403
+ if (config.cache) {
404
+ if (config.alwaysBackRequest || !cachedData) {
405
+ resolved(fastResponseData);
406
+ if (callBack) {
407
+ callBack(fastResponseData);
408
+ }
409
+ }
410
+ FastVueMultiStore_1.FastVueMultiStore.setValue(cacheKey, JSON.stringify(response.data));
411
+ }
412
+ else {
413
+ resolved(fastResponseData);
414
+ if (callBack) {
415
+ callBack(fastResponseData);
416
+ }
417
+ }
418
+ }).catch(function (error) {
419
+ console.error(error);
420
+ rejected(error);
421
+ });
422
+ return [2 /*return*/];
423
+ });
424
+ });
425
+ })];
426
+ });
427
+ });
428
+ };
429
+ /**
430
+ * post请求接口
431
+ * @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
432
+ * @param params 参数
433
+ * @param config 请求配置
434
+ * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
435
+ */
436
+ Simple.post = function (url, params, config, callBack) {
437
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
438
+ return tslib_1.__generator(this, function (_a) {
439
+ return [2 /*return*/, this.request("post", url, params, config, callBack)];
440
+ });
441
+ });
442
+ };
443
+ /**
444
+ * get请求接口
445
+ * @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
446
+ * @param params 参数
447
+ * @param config 请求配置
448
+ * @param callBack 请求接口回调函数,在使用alwaysCache和alwaysBackRequest参数为true时,必须使用回调函数接收
449
+ */
450
+ Simple.get = function (url, params, config, callBack) {
451
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
452
+ return tslib_1.__generator(this, function (_a) {
453
+ return [2 /*return*/, this.request("get", url, params, config, callBack)];
454
+ });
455
+ });
456
+ };
457
+ return Simple;
458
+ }(Base));
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
+ })(FastVueMultiHttp || (exports.FastVueMultiHttp = FastVueMultiHttp = {}));
608
+ });
@@ -0,0 +1,2 @@
1
+ import { FastVueMultiTool } from "./FastVueMultiTool";
2
+ export { FastVueMultiTool };
@@ -0,0 +1,6 @@
1
+ define(["require", "exports", "./FastVueMultiTool"], function (require, exports, FastVueMultiTool_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FastVueMultiTool = void 0;
5
+ Object.defineProperty(exports, "FastVueMultiTool", { enumerable: true, get: function () { return FastVueMultiTool_1.FastVueMultiTool; } });
6
+ });
@@ -0,0 +1,2 @@
1
+ declare const htmlparser2: any;
2
+ declare const singleTag: string[];