byt-ui 0.1.14 → 0.1.15
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/lib/byt-ui.common.js +16 -10
- package/lib/byt-ui.umd.js +16 -10
- package/lib/byt-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/common/modules/request.js +17 -12
package/lib/byt-ui.common.js
CHANGED
|
@@ -180208,6 +180208,7 @@ class request_Request {
|
|
|
180208
180208
|
'428': 'token过期,请重新登录',
|
|
180209
180209
|
'429': '请求过频繁',
|
|
180210
180210
|
'479': '演示环境,没有权限操作',
|
|
180211
|
+
'503': '服务未启动,请联系管理员处理',
|
|
180211
180212
|
'default': '系统未知错误,请反馈给管理员'
|
|
180212
180213
|
};
|
|
180213
180214
|
this._methods = ['get', 'post', 'delete', 'put'];
|
|
@@ -180216,15 +180217,20 @@ class request_Request {
|
|
|
180216
180217
|
baseURL: '/bytserver',
|
|
180217
180218
|
responseType: 'json',
|
|
180218
180219
|
timeout: 60000,
|
|
180219
|
-
|
|
180220
|
+
showError: true,
|
|
180221
|
+
withCredentials: false,
|
|
180222
|
+
validateStatus(status) {
|
|
180223
|
+
// >=200或者<=500的统一由成功拦截处理
|
|
180224
|
+
return status >= 200 && status <= 500; // 默认的
|
|
180225
|
+
}
|
|
180220
180226
|
}, options);
|
|
180221
|
-
this.
|
|
180227
|
+
this._request = lib_axios.create(this.options);
|
|
180222
180228
|
// 注册fetch;
|
|
180223
180229
|
this.register();
|
|
180224
180230
|
}
|
|
180225
180231
|
interceptors() {
|
|
180226
180232
|
// HTTPrequest拦截
|
|
180227
|
-
this.
|
|
180233
|
+
this._request.interceptors.request.use(config => {
|
|
180228
180234
|
const TENANT_ID = (0,cookie.getCookie)('tenantId');
|
|
180229
180235
|
const isToken = (config.headers || {}).isToken === false;
|
|
180230
180236
|
const token = (0,cookie.getCookie)('access_token');
|
|
@@ -180239,7 +180245,7 @@ class request_Request {
|
|
|
180239
180245
|
});
|
|
180240
180246
|
|
|
180241
180247
|
// HTTPresponse拦截
|
|
180242
|
-
this.
|
|
180248
|
+
this._request.interceptors.response.use(res => {
|
|
180243
180249
|
const status = Number(res.status) || 200;
|
|
180244
180250
|
const message = res.data.msg || this._errorCode[status] || this._errorCode['default'];
|
|
180245
180251
|
if (status == 424 || status == 428) {
|
|
@@ -180251,7 +180257,7 @@ class request_Request {
|
|
|
180251
180257
|
} = this._Vue.prototype.$appCommon;
|
|
180252
180258
|
outLogin && outLogin();
|
|
180253
180259
|
}
|
|
180254
|
-
return res.data;
|
|
180260
|
+
return Promise.reject(res.data);
|
|
180255
180261
|
}
|
|
180256
180262
|
if (status !== 200 || res.data.code === 1) {
|
|
180257
180263
|
if (res.config.showError) element_ui_common.Message.error(message);
|
|
@@ -180279,7 +180285,7 @@ class request_Request {
|
|
|
180279
180285
|
}
|
|
180280
180286
|
setMethods() {
|
|
180281
180287
|
this._methods.forEach(v => {
|
|
180282
|
-
this.
|
|
180288
|
+
this._request[v] = ({
|
|
180283
180289
|
url,
|
|
180284
180290
|
data = {},
|
|
180285
180291
|
params = {},
|
|
@@ -180289,7 +180295,7 @@ class request_Request {
|
|
|
180289
180295
|
showError
|
|
180290
180296
|
}) => {
|
|
180291
180297
|
return new Promise((resolve, reject) => {
|
|
180292
|
-
this.
|
|
180298
|
+
this._request({
|
|
180293
180299
|
url,
|
|
180294
180300
|
method: v.toUpperCase(),
|
|
180295
180301
|
data,
|
|
@@ -180307,7 +180313,7 @@ class request_Request {
|
|
|
180307
180313
|
// 重试请求
|
|
180308
180314
|
reject(err);
|
|
180309
180315
|
if (retry > 0) {
|
|
180310
|
-
this.
|
|
180316
|
+
this._request[v]({
|
|
180311
180317
|
url,
|
|
180312
180318
|
data,
|
|
180313
180319
|
params,
|
|
@@ -180332,9 +180338,9 @@ class request_Request {
|
|
|
180332
180338
|
}
|
|
180333
180339
|
const request_fetch = (config = {}, Vue) => {
|
|
180334
180340
|
const {
|
|
180335
|
-
|
|
180341
|
+
_request
|
|
180336
180342
|
} = new request_Request(Object.assign({}, config), Vue);
|
|
180337
|
-
return
|
|
180343
|
+
return _request;
|
|
180338
180344
|
};
|
|
180339
180345
|
/* harmony default export */ var request = ({
|
|
180340
180346
|
install(Vue, config = {}) {
|
package/lib/byt-ui.umd.js
CHANGED
|
@@ -180218,6 +180218,7 @@ class request_Request {
|
|
|
180218
180218
|
'428': 'token过期,请重新登录',
|
|
180219
180219
|
'429': '请求过频繁',
|
|
180220
180220
|
'479': '演示环境,没有权限操作',
|
|
180221
|
+
'503': '服务未启动,请联系管理员处理',
|
|
180221
180222
|
'default': '系统未知错误,请反馈给管理员'
|
|
180222
180223
|
};
|
|
180223
180224
|
this._methods = ['get', 'post', 'delete', 'put'];
|
|
@@ -180226,15 +180227,20 @@ class request_Request {
|
|
|
180226
180227
|
baseURL: '/bytserver',
|
|
180227
180228
|
responseType: 'json',
|
|
180228
180229
|
timeout: 60000,
|
|
180229
|
-
|
|
180230
|
+
showError: true,
|
|
180231
|
+
withCredentials: false,
|
|
180232
|
+
validateStatus(status) {
|
|
180233
|
+
// >=200或者<=500的统一由成功拦截处理
|
|
180234
|
+
return status >= 200 && status <= 500; // 默认的
|
|
180235
|
+
}
|
|
180230
180236
|
}, options);
|
|
180231
|
-
this.
|
|
180237
|
+
this._request = lib_axios.create(this.options);
|
|
180232
180238
|
// 注册fetch;
|
|
180233
180239
|
this.register();
|
|
180234
180240
|
}
|
|
180235
180241
|
interceptors() {
|
|
180236
180242
|
// HTTPrequest拦截
|
|
180237
|
-
this.
|
|
180243
|
+
this._request.interceptors.request.use(config => {
|
|
180238
180244
|
const TENANT_ID = (0,cookie.getCookie)('tenantId');
|
|
180239
180245
|
const isToken = (config.headers || {}).isToken === false;
|
|
180240
180246
|
const token = (0,cookie.getCookie)('access_token');
|
|
@@ -180249,7 +180255,7 @@ class request_Request {
|
|
|
180249
180255
|
});
|
|
180250
180256
|
|
|
180251
180257
|
// HTTPresponse拦截
|
|
180252
|
-
this.
|
|
180258
|
+
this._request.interceptors.response.use(res => {
|
|
180253
180259
|
const status = Number(res.status) || 200;
|
|
180254
180260
|
const message = res.data.msg || this._errorCode[status] || this._errorCode['default'];
|
|
180255
180261
|
if (status == 424 || status == 428) {
|
|
@@ -180261,7 +180267,7 @@ class request_Request {
|
|
|
180261
180267
|
} = this._Vue.prototype.$appCommon;
|
|
180262
180268
|
outLogin && outLogin();
|
|
180263
180269
|
}
|
|
180264
|
-
return res.data;
|
|
180270
|
+
return Promise.reject(res.data);
|
|
180265
180271
|
}
|
|
180266
180272
|
if (status !== 200 || res.data.code === 1) {
|
|
180267
180273
|
if (res.config.showError) element_ui_common.Message.error(message);
|
|
@@ -180289,7 +180295,7 @@ class request_Request {
|
|
|
180289
180295
|
}
|
|
180290
180296
|
setMethods() {
|
|
180291
180297
|
this._methods.forEach(v => {
|
|
180292
|
-
this.
|
|
180298
|
+
this._request[v] = ({
|
|
180293
180299
|
url,
|
|
180294
180300
|
data = {},
|
|
180295
180301
|
params = {},
|
|
@@ -180299,7 +180305,7 @@ class request_Request {
|
|
|
180299
180305
|
showError
|
|
180300
180306
|
}) => {
|
|
180301
180307
|
return new Promise((resolve, reject) => {
|
|
180302
|
-
this.
|
|
180308
|
+
this._request({
|
|
180303
180309
|
url,
|
|
180304
180310
|
method: v.toUpperCase(),
|
|
180305
180311
|
data,
|
|
@@ -180317,7 +180323,7 @@ class request_Request {
|
|
|
180317
180323
|
// 重试请求
|
|
180318
180324
|
reject(err);
|
|
180319
180325
|
if (retry > 0) {
|
|
180320
|
-
this.
|
|
180326
|
+
this._request[v]({
|
|
180321
180327
|
url,
|
|
180322
180328
|
data,
|
|
180323
180329
|
params,
|
|
@@ -180342,9 +180348,9 @@ class request_Request {
|
|
|
180342
180348
|
}
|
|
180343
180349
|
const request_fetch = (config = {}, Vue) => {
|
|
180344
180350
|
const {
|
|
180345
|
-
|
|
180351
|
+
_request
|
|
180346
180352
|
} = new request_Request(Object.assign({}, config), Vue);
|
|
180347
|
-
return
|
|
180353
|
+
return _request;
|
|
180348
180354
|
};
|
|
180349
180355
|
/* harmony default export */ var request = ({
|
|
180350
180356
|
install(Vue, config = {}) {
|