cloud-web-corejs 1.1.0-dev.48 → 1.1.0-dev.49
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.
package/package.json
CHANGED
|
@@ -290,7 +290,7 @@ tmixins = {
|
|
|
290
290
|
method: `post`,
|
|
291
291
|
data: {operateTime: time},
|
|
292
292
|
modal: false,
|
|
293
|
-
...(silent ? { ignoreNetworkError: true } : {}),
|
|
293
|
+
...(silent ? { ignoreNetworkError: true, ignore502: true } : {}),
|
|
294
294
|
success: res => {
|
|
295
295
|
let records = res.objx || [];
|
|
296
296
|
records.forEach(record => {
|
|
@@ -394,7 +394,7 @@ tmixins = {
|
|
|
394
394
|
direction: direction
|
|
395
395
|
},
|
|
396
396
|
modal: false,
|
|
397
|
-
...(silent ? { ignoreNetworkError: true } : {}),
|
|
397
|
+
...(silent ? { ignoreNetworkError: true, ignore502: true } : {}),
|
|
398
398
|
success: res => {
|
|
399
399
|
let rows = res.objx || [];
|
|
400
400
|
if (rows.length) {
|
|
@@ -497,6 +497,7 @@ tmixins = {
|
|
|
497
497
|
data: {},
|
|
498
498
|
modal: false,
|
|
499
499
|
ignoreNetworkError: true,
|
|
500
|
+
ignore502: true,
|
|
500
501
|
success: res => {
|
|
501
502
|
this.isExitsRead = res.objx === 1;
|
|
502
503
|
}
|
package/src/utils/request.js
CHANGED
|
@@ -145,6 +145,10 @@ function isAxiosNetworkError(error) {
|
|
|
145
145
|
return error.code === "ERR_NETWORK" || /network error/i.test(message);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
function isGateway502(error) {
|
|
149
|
+
return !!(error && error.response && error.response.status === 502);
|
|
150
|
+
}
|
|
151
|
+
|
|
148
152
|
function shouldSwallowNetworkError(config, error) {
|
|
149
153
|
return !!(
|
|
150
154
|
config &&
|
|
@@ -153,6 +157,10 @@ function shouldSwallowNetworkError(config, error) {
|
|
|
153
157
|
);
|
|
154
158
|
}
|
|
155
159
|
|
|
160
|
+
function shouldSwallow502(config, error) {
|
|
161
|
+
return !!(config && config.ignore502 === true && isGateway502(error));
|
|
162
|
+
}
|
|
163
|
+
|
|
156
164
|
function getRequestErrorMessage(error) {
|
|
157
165
|
const config = (error && error.config) || {};
|
|
158
166
|
const response = error && error.response;
|
|
@@ -491,12 +499,12 @@ service.interceptors.response.use(
|
|
|
491
499
|
return Promise.reject(error);
|
|
492
500
|
}
|
|
493
501
|
let config = error.config;
|
|
494
|
-
//
|
|
495
|
-
|
|
496
|
-
|
|
502
|
+
// ignoreNetworkError 只吞 Network Error;ignore502 只吞 502。两者互不影响。
|
|
503
|
+
const swallowError =
|
|
504
|
+
shouldSwallowNetworkError(config, error) || shouldSwallow502(config, error);
|
|
497
505
|
if (handleRequestNetworkError()) {
|
|
498
506
|
if (config && config.modalStrictly !== true) removeModel(config);
|
|
499
|
-
return
|
|
507
|
+
return swallowError ? Promise.resolve() : Promise.reject(error);
|
|
500
508
|
}
|
|
501
509
|
if (
|
|
502
510
|
error.response &&
|
|
@@ -511,7 +519,7 @@ service.interceptors.response.use(
|
|
|
511
519
|
if (config.modalStrictly !== true) {
|
|
512
520
|
removeModel(config);
|
|
513
521
|
}
|
|
514
|
-
if (config.errorMsg !== false && !
|
|
522
|
+
if (config.errorMsg !== false && !swallowError) {
|
|
515
523
|
const requestError = getRequestErrorMessage(error);
|
|
516
524
|
ErroreBox.msg({
|
|
517
525
|
content: requestError.summary,
|
|
@@ -530,7 +538,7 @@ service.interceptors.response.use(
|
|
|
530
538
|
});
|
|
531
539
|
}
|
|
532
540
|
}
|
|
533
|
-
return
|
|
541
|
+
return swallowError ? Promise.resolve() : Promise.reject(error);
|
|
534
542
|
}
|
|
535
543
|
);
|
|
536
544
|
|
|
@@ -638,6 +638,7 @@ export default {
|
|
|
638
638
|
},
|
|
639
639
|
failMsg: false,
|
|
640
640
|
ignoreNetworkError: true,
|
|
641
|
+
ignore502: !isLoading,
|
|
641
642
|
fail: (res, response) => {
|
|
642
643
|
if (response && response.status == 200) {
|
|
643
644
|
this.$errorMsg(res);
|
|
@@ -661,6 +662,7 @@ export default {
|
|
|
661
662
|
},
|
|
662
663
|
failMsg: false,
|
|
663
664
|
ignoreNetworkError: true,
|
|
665
|
+
ignore502: !isLoading,
|
|
664
666
|
fail: (res, response) => {
|
|
665
667
|
if (response && response.status == 200) {
|
|
666
668
|
this.$errorMsg(res);
|
|
@@ -879,6 +879,7 @@ export default {
|
|
|
879
879
|
},
|
|
880
880
|
failMsg: false,
|
|
881
881
|
ignoreNetworkError: true,
|
|
882
|
+
ignore502: !isLoading,
|
|
882
883
|
fail: (res, response) => {
|
|
883
884
|
if (response && response.status === 200) {
|
|
884
885
|
this.$errorMsg(res);
|
|
@@ -902,6 +903,7 @@ export default {
|
|
|
902
903
|
},
|
|
903
904
|
failMsg: false,
|
|
904
905
|
ignoreNetworkError: true,
|
|
906
|
+
ignore502: !isLoading,
|
|
905
907
|
fail: (res, response) => {
|
|
906
908
|
if (response && response.status === 200) {
|
|
907
909
|
this.$errorMsg(res);
|
|
@@ -798,6 +798,7 @@ export default {
|
|
|
798
798
|
isLoading,
|
|
799
799
|
modal: isLoading || false,
|
|
800
800
|
ignoreNetworkError: opts.ignoreNetworkError,
|
|
801
|
+
ignore502: opts.ignore502,
|
|
801
802
|
success: opts.success,
|
|
802
803
|
failMsg: false,
|
|
803
804
|
errorMsg: false,
|
|
@@ -818,6 +819,7 @@ export default {
|
|
|
818
819
|
url: YX_PREFIX + "/bd_api/intf/getOrderCount",
|
|
819
820
|
isLoading,
|
|
820
821
|
ignoreNetworkError: !isLoading,
|
|
822
|
+
ignore502: !isLoading,
|
|
821
823
|
success: (res) => {
|
|
822
824
|
let objx = res.objx || {};
|
|
823
825
|
this.shortcutItems.forEach((item) => {
|
|
@@ -834,6 +836,7 @@ export default {
|
|
|
834
836
|
url: YX_PREFIX + "/bd_api/intf/getOrderMessage",
|
|
835
837
|
isLoading,
|
|
836
838
|
ignoreNetworkError: !isLoading,
|
|
839
|
+
ignore502: !isLoading,
|
|
837
840
|
success: (res) => {
|
|
838
841
|
let objx = res.objx;
|
|
839
842
|
this.pendingMessageRows = Array.isArray(objx)
|
|
@@ -1046,6 +1049,7 @@ export default {
|
|
|
1046
1049
|
isLoading: isLoading,
|
|
1047
1050
|
modal: isLoading || false,
|
|
1048
1051
|
ignoreNetworkError: !isLoading,
|
|
1052
|
+
ignore502: !isLoading,
|
|
1049
1053
|
// loadingTarget: document.body,
|
|
1050
1054
|
success: (res) => {
|
|
1051
1055
|
this.unDoWfRows =
|
|
@@ -1071,6 +1075,7 @@ export default {
|
|
|
1071
1075
|
isLoading: isLoading,
|
|
1072
1076
|
modal: isLoading || false,
|
|
1073
1077
|
ignoreNetworkError: !isLoading,
|
|
1078
|
+
ignore502: !isLoading,
|
|
1074
1079
|
// loadingTarget: document.body,
|
|
1075
1080
|
success: (res) => {
|
|
1076
1081
|
this.unreadMessageNum = res.objx || 0;
|