byt-ui 0.1.9 → 0.1.11
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 +34 -22
- package/lib/byt-ui.umd.js +34 -22
- package/lib/byt-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/common/modules/request.js +29 -16
package/lib/byt-ui.common.js
CHANGED
|
@@ -176225,8 +176225,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
176225
176225
|
|
|
176226
176226
|
// EXPORTS
|
|
176227
176227
|
__webpack_require__.d(__webpack_exports__, {
|
|
176228
|
-
"default": function() { return /* binding */
|
|
176229
|
-
|
|
176228
|
+
"default": function() { return /* binding */ request; },
|
|
176229
|
+
fetch: function() { return /* binding */ request_fetch; }
|
|
176230
176230
|
});
|
|
176231
176231
|
|
|
176232
176232
|
// NAMESPACE OBJECT: ./node_modules/axios/lib/platform/common/utils.js
|
|
@@ -180165,12 +180165,12 @@ var cookie = __webpack_require__(71099);
|
|
|
180165
180165
|
|
|
180166
180166
|
|
|
180167
180167
|
class request_Request {
|
|
180168
|
-
constructor(config = {}) {
|
|
180168
|
+
constructor(config = {}, Vue = null) {
|
|
180169
180169
|
const {
|
|
180170
180170
|
options = {},
|
|
180171
180171
|
handler = {}
|
|
180172
180172
|
} = config;
|
|
180173
|
-
this.
|
|
180173
|
+
this._Vue = Vue || null;
|
|
180174
180174
|
this._errorCode = {
|
|
180175
180175
|
'000': '操作太频繁,请勿重复请求',
|
|
180176
180176
|
'401': '当前操作没有权限',
|
|
@@ -180178,8 +180178,9 @@ class request_Request {
|
|
|
180178
180178
|
'404': '接口不存在',
|
|
180179
180179
|
'417': '未绑定登录账号,请使用密码登录后绑定',
|
|
180180
180180
|
'423': '演示环境不能操作,如需了解联系我们',
|
|
180181
|
+
'424': 'token过期,请重新登录',
|
|
180181
180182
|
'426': '用户名不存在或密码错误',
|
|
180182
|
-
'428': '
|
|
180183
|
+
'428': 'token过期,请重新登录',
|
|
180183
180184
|
'429': '请求过频繁',
|
|
180184
180185
|
'479': '演示环境,没有权限操作',
|
|
180185
180186
|
'default': '系统未知错误,请反馈给管理员'
|
|
@@ -180192,6 +180193,7 @@ class request_Request {
|
|
|
180192
180193
|
timeout: 60000,
|
|
180193
180194
|
withCredentials: false
|
|
180194
180195
|
}, options);
|
|
180196
|
+
this.request = lib_axios.create(this.options);
|
|
180195
180197
|
// 注册fetch;
|
|
180196
180198
|
this.register();
|
|
180197
180199
|
}
|
|
@@ -180204,9 +180206,8 @@ class request_Request {
|
|
|
180204
180206
|
if (token && !isToken) {
|
|
180205
180207
|
config.headers['Authorization'] = `Bearer ${token}`; // token
|
|
180206
180208
|
}
|
|
180207
|
-
|
|
180208
|
-
|
|
180209
|
-
}
|
|
180209
|
+
config.headers['TENANT-ID'] = TENANT_ID || this.getQueryString('TENANT-ID') || ''; // 租户ID
|
|
180210
|
+
|
|
180210
180211
|
return config;
|
|
180211
180212
|
}, error => {
|
|
180212
180213
|
return Promise.reject(error);
|
|
@@ -180220,7 +180221,6 @@ class request_Request {
|
|
|
180220
180221
|
case 200:
|
|
180221
180222
|
if (res.data.code === 1) {
|
|
180222
180223
|
element_ui_common.Message.error(message);
|
|
180223
|
-
this.handler.error && this.handler.error(res.data);
|
|
180224
180224
|
return Promise.reject(res.data);
|
|
180225
180225
|
}
|
|
180226
180226
|
this.handler.success && this.handler.success(res.data);
|
|
@@ -180229,10 +180229,16 @@ class request_Request {
|
|
|
180229
180229
|
case 428:
|
|
180230
180230
|
// 后台定义 424||428 针对令牌过期的特殊响应码
|
|
180231
180231
|
this.handler.expire && this.handler.expire(res.data);
|
|
180232
|
+
element_ui_common.Message.error(message);
|
|
180233
|
+
if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
|
|
180234
|
+
const {
|
|
180235
|
+
outLogin
|
|
180236
|
+
} = this._Vue.prototype.$appCommon;
|
|
180237
|
+
outLogin && outLogin();
|
|
180238
|
+
}
|
|
180232
180239
|
break;
|
|
180233
180240
|
default:
|
|
180234
180241
|
element_ui_common.Message.error(message);
|
|
180235
|
-
this.handler.error && this.handler.error(res.data);
|
|
180236
180242
|
return Promise.reject(message);
|
|
180237
180243
|
}
|
|
180238
180244
|
}, error => {
|
|
@@ -180246,11 +180252,19 @@ class request_Request {
|
|
|
180246
180252
|
element_ui_common.Message.error(error.response.data.msg);
|
|
180247
180253
|
break;
|
|
180248
180254
|
}
|
|
180249
|
-
this.error && this.error(error.response);
|
|
180255
|
+
this.handler.error && this.handler.error(error.response);
|
|
180250
180256
|
}
|
|
180251
180257
|
return Promise.reject(new Error(error));
|
|
180252
180258
|
});
|
|
180253
180259
|
}
|
|
180260
|
+
getQueryString(name) {
|
|
180261
|
+
const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i');
|
|
180262
|
+
const r = window.location.search.substr(1).match(reg);
|
|
180263
|
+
if (r != null) {
|
|
180264
|
+
return decodeURIComponent(r[2]);
|
|
180265
|
+
}
|
|
180266
|
+
return null;
|
|
180267
|
+
}
|
|
180254
180268
|
setMethods() {
|
|
180255
180269
|
this._methods.forEach(v => {
|
|
180256
180270
|
this.request[v] = ({
|
|
@@ -180295,8 +180309,6 @@ class request_Request {
|
|
|
180295
180309
|
});
|
|
180296
180310
|
}
|
|
180297
180311
|
register() {
|
|
180298
|
-
this.request = lib_axios.create(this.options);
|
|
180299
|
-
|
|
180300
180312
|
// 添加拦截器
|
|
180301
180313
|
this.interceptors();
|
|
180302
180314
|
|
|
@@ -180304,15 +180316,15 @@ class request_Request {
|
|
|
180304
180316
|
this.setMethods();
|
|
180305
180317
|
}
|
|
180306
180318
|
}
|
|
180307
|
-
const {
|
|
180308
|
-
|
|
180309
|
-
|
|
180310
|
-
|
|
180311
|
-
|
|
180312
|
-
|
|
180313
|
-
|
|
180314
|
-
|
|
180315
|
-
Vue.prototype.$http =
|
|
180319
|
+
const request_fetch = (config = {}, Vue) => {
|
|
180320
|
+
const {
|
|
180321
|
+
request
|
|
180322
|
+
} = new request_Request(Object.assign({}, config), Vue);
|
|
180323
|
+
return request;
|
|
180324
|
+
};
|
|
180325
|
+
/* harmony default export */ var request = ({
|
|
180326
|
+
install(Vue, config = {}) {
|
|
180327
|
+
Vue.prototype.$http = request_fetch(config, Vue);
|
|
180316
180328
|
}
|
|
180317
180329
|
});
|
|
180318
180330
|
|
package/lib/byt-ui.umd.js
CHANGED
|
@@ -176235,8 +176235,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
176235
176235
|
|
|
176236
176236
|
// EXPORTS
|
|
176237
176237
|
__webpack_require__.d(__webpack_exports__, {
|
|
176238
|
-
"default": function() { return /* binding */
|
|
176239
|
-
|
|
176238
|
+
"default": function() { return /* binding */ request; },
|
|
176239
|
+
fetch: function() { return /* binding */ request_fetch; }
|
|
176240
176240
|
});
|
|
176241
176241
|
|
|
176242
176242
|
// NAMESPACE OBJECT: ./node_modules/axios/lib/platform/common/utils.js
|
|
@@ -180175,12 +180175,12 @@ var cookie = __webpack_require__(41591);
|
|
|
180175
180175
|
|
|
180176
180176
|
|
|
180177
180177
|
class request_Request {
|
|
180178
|
-
constructor(config = {}) {
|
|
180178
|
+
constructor(config = {}, Vue = null) {
|
|
180179
180179
|
const {
|
|
180180
180180
|
options = {},
|
|
180181
180181
|
handler = {}
|
|
180182
180182
|
} = config;
|
|
180183
|
-
this.
|
|
180183
|
+
this._Vue = Vue || null;
|
|
180184
180184
|
this._errorCode = {
|
|
180185
180185
|
'000': '操作太频繁,请勿重复请求',
|
|
180186
180186
|
'401': '当前操作没有权限',
|
|
@@ -180188,8 +180188,9 @@ class request_Request {
|
|
|
180188
180188
|
'404': '接口不存在',
|
|
180189
180189
|
'417': '未绑定登录账号,请使用密码登录后绑定',
|
|
180190
180190
|
'423': '演示环境不能操作,如需了解联系我们',
|
|
180191
|
+
'424': 'token过期,请重新登录',
|
|
180191
180192
|
'426': '用户名不存在或密码错误',
|
|
180192
|
-
'428': '
|
|
180193
|
+
'428': 'token过期,请重新登录',
|
|
180193
180194
|
'429': '请求过频繁',
|
|
180194
180195
|
'479': '演示环境,没有权限操作',
|
|
180195
180196
|
'default': '系统未知错误,请反馈给管理员'
|
|
@@ -180202,6 +180203,7 @@ class request_Request {
|
|
|
180202
180203
|
timeout: 60000,
|
|
180203
180204
|
withCredentials: false
|
|
180204
180205
|
}, options);
|
|
180206
|
+
this.request = lib_axios.create(this.options);
|
|
180205
180207
|
// 注册fetch;
|
|
180206
180208
|
this.register();
|
|
180207
180209
|
}
|
|
@@ -180214,9 +180216,8 @@ class request_Request {
|
|
|
180214
180216
|
if (token && !isToken) {
|
|
180215
180217
|
config.headers['Authorization'] = `Bearer ${token}`; // token
|
|
180216
180218
|
}
|
|
180217
|
-
|
|
180218
|
-
|
|
180219
|
-
}
|
|
180219
|
+
config.headers['TENANT-ID'] = TENANT_ID || this.getQueryString('TENANT-ID') || ''; // 租户ID
|
|
180220
|
+
|
|
180220
180221
|
return config;
|
|
180221
180222
|
}, error => {
|
|
180222
180223
|
return Promise.reject(error);
|
|
@@ -180230,7 +180231,6 @@ class request_Request {
|
|
|
180230
180231
|
case 200:
|
|
180231
180232
|
if (res.data.code === 1) {
|
|
180232
180233
|
element_ui_common.Message.error(message);
|
|
180233
|
-
this.handler.error && this.handler.error(res.data);
|
|
180234
180234
|
return Promise.reject(res.data);
|
|
180235
180235
|
}
|
|
180236
180236
|
this.handler.success && this.handler.success(res.data);
|
|
@@ -180239,10 +180239,16 @@ class request_Request {
|
|
|
180239
180239
|
case 428:
|
|
180240
180240
|
// 后台定义 424||428 针对令牌过期的特殊响应码
|
|
180241
180241
|
this.handler.expire && this.handler.expire(res.data);
|
|
180242
|
+
element_ui_common.Message.error(message);
|
|
180243
|
+
if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
|
|
180244
|
+
const {
|
|
180245
|
+
outLogin
|
|
180246
|
+
} = this._Vue.prototype.$appCommon;
|
|
180247
|
+
outLogin && outLogin();
|
|
180248
|
+
}
|
|
180242
180249
|
break;
|
|
180243
180250
|
default:
|
|
180244
180251
|
element_ui_common.Message.error(message);
|
|
180245
|
-
this.handler.error && this.handler.error(res.data);
|
|
180246
180252
|
return Promise.reject(message);
|
|
180247
180253
|
}
|
|
180248
180254
|
}, error => {
|
|
@@ -180256,11 +180262,19 @@ class request_Request {
|
|
|
180256
180262
|
element_ui_common.Message.error(error.response.data.msg);
|
|
180257
180263
|
break;
|
|
180258
180264
|
}
|
|
180259
|
-
this.error && this.error(error.response);
|
|
180265
|
+
this.handler.error && this.handler.error(error.response);
|
|
180260
180266
|
}
|
|
180261
180267
|
return Promise.reject(new Error(error));
|
|
180262
180268
|
});
|
|
180263
180269
|
}
|
|
180270
|
+
getQueryString(name) {
|
|
180271
|
+
const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i');
|
|
180272
|
+
const r = window.location.search.substr(1).match(reg);
|
|
180273
|
+
if (r != null) {
|
|
180274
|
+
return decodeURIComponent(r[2]);
|
|
180275
|
+
}
|
|
180276
|
+
return null;
|
|
180277
|
+
}
|
|
180264
180278
|
setMethods() {
|
|
180265
180279
|
this._methods.forEach(v => {
|
|
180266
180280
|
this.request[v] = ({
|
|
@@ -180305,8 +180319,6 @@ class request_Request {
|
|
|
180305
180319
|
});
|
|
180306
180320
|
}
|
|
180307
180321
|
register() {
|
|
180308
|
-
this.request = lib_axios.create(this.options);
|
|
180309
|
-
|
|
180310
180322
|
// 添加拦截器
|
|
180311
180323
|
this.interceptors();
|
|
180312
180324
|
|
|
@@ -180314,15 +180326,15 @@ class request_Request {
|
|
|
180314
180326
|
this.setMethods();
|
|
180315
180327
|
}
|
|
180316
180328
|
}
|
|
180317
|
-
const {
|
|
180318
|
-
|
|
180319
|
-
|
|
180320
|
-
|
|
180321
|
-
|
|
180322
|
-
|
|
180323
|
-
|
|
180324
|
-
|
|
180325
|
-
Vue.prototype.$http =
|
|
180329
|
+
const request_fetch = (config = {}, Vue) => {
|
|
180330
|
+
const {
|
|
180331
|
+
request
|
|
180332
|
+
} = new request_Request(Object.assign({}, config), Vue);
|
|
180333
|
+
return request;
|
|
180334
|
+
};
|
|
180335
|
+
/* harmony default export */ var request = ({
|
|
180336
|
+
install(Vue, config = {}) {
|
|
180337
|
+
Vue.prototype.$http = request_fetch(config, Vue);
|
|
180326
180338
|
}
|
|
180327
180339
|
});
|
|
180328
180340
|
|