fix: 修改依赖包
This commit is contained in:
parent
1e1ac401e5
commit
688dfda457
36
docs/index.md
Normal file
36
docs/index.md
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
hero:
|
||||
title: lambo
|
||||
description: 致力于提升前端开发效率与规范
|
||||
actions:
|
||||
- text: 快速上手
|
||||
link: /bizs
|
||||
features:
|
||||
- title: biz
|
||||
emoji: 🍑
|
||||
description: 业务库
|
||||
- title: hooks
|
||||
emoji: 💎
|
||||
description: hooks
|
||||
- title: func
|
||||
emoji: 🌈
|
||||
description: 常用函数库
|
||||
- title: meta
|
||||
emoji: ☀️
|
||||
description: 原子组件库
|
||||
- title: constants
|
||||
emoji: 🈶️
|
||||
description: 静态定义库
|
||||
- title: request
|
||||
emoji: 🥣
|
||||
description: 网络请求库
|
||||
- title: types
|
||||
emoji: 🈸
|
||||
description: typescript 声明库
|
||||
- title: material
|
||||
emoji: 🥱
|
||||
description: 物料库
|
||||
- title: cli
|
||||
emoji: 🐔
|
||||
description: 脚手架
|
||||
---
|
@ -1,5 +1,19 @@
|
||||
# @zhst/biz
|
||||
|
||||
## 0.20.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.12.0
|
||||
- @zhst/func@0.14.0
|
||||
- @zhst/icon@0.4.0
|
||||
- @zhst/meta@0.18.0
|
||||
|
||||
## 0.19.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/biz",
|
||||
"version": "0.19.0",
|
||||
"version": "0.20.0",
|
||||
"description": "业务库",
|
||||
"keywords": [
|
||||
"business",
|
||||
|
@ -12,8 +12,4 @@
|
||||
&-btns-divider {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
&-create-modal {
|
||||
// width: 600px;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,16 @@
|
||||
# @zhst/utils
|
||||
|
||||
## 0.14.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/request@0.14.0
|
||||
|
||||
## 0.13.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/func",
|
||||
"version": "0.13.0",
|
||||
"version": "0.14.0",
|
||||
"description": "函数合集",
|
||||
"keywords": [
|
||||
"hooks"
|
||||
|
@ -1,5 +1,16 @@
|
||||
# @zhst/hooks
|
||||
|
||||
## 0.12.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.0
|
||||
|
||||
## 0.11.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/hooks",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"description": "hooks合集",
|
||||
"keywords": [
|
||||
"hooks"
|
||||
|
@ -1,5 +1,11 @@
|
||||
# @zhst/icon
|
||||
|
||||
## 0.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/icon",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"description": "图标库",
|
||||
"keywords": [
|
||||
"icon",
|
||||
|
@ -1,5 +1,19 @@
|
||||
# @zhst/material
|
||||
|
||||
## 0.15.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.12.0
|
||||
- @zhst/func@0.14.0
|
||||
- @zhst/meta@0.18.0
|
||||
- @zhst/biz@0.20.0
|
||||
|
||||
## 0.14.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/material",
|
||||
"version": "0.14.0",
|
||||
"version": "0.15.0",
|
||||
"description": "物料库",
|
||||
"keywords": [
|
||||
"business",
|
||||
|
@ -1,5 +1,19 @@
|
||||
# @zhst/utils
|
||||
|
||||
## 0.18.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.12.0
|
||||
- @zhst/func@0.14.0
|
||||
- @zhst/icon@0.4.0
|
||||
- @zhst/meta@0.18.0
|
||||
|
||||
## 0.17.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/meta",
|
||||
"version": "0.17.0",
|
||||
"version": "0.18.0",
|
||||
"description": "原子组件",
|
||||
"keywords": [
|
||||
"meta",
|
||||
|
@ -1,5 +1,16 @@
|
||||
# @zhst/request
|
||||
|
||||
## 0.14.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.0
|
||||
|
||||
## 0.13.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -10,7 +10,10 @@ export var reqConfig = function reqConfig(config) {
|
||||
authorization = _ref.authorization,
|
||||
_ref$showMsg = _ref.showMsg,
|
||||
showMsg = _ref$showMsg === void 0 ? true : _ref$showMsg,
|
||||
onError = _ref.onError;
|
||||
onError = _ref.onError,
|
||||
onExpired = _ref.onExpired,
|
||||
_ref$expiredCodes = _ref.expiredCodes,
|
||||
expiredCodes = _ref$expiredCodes === void 0 ? [403, 401, 203] : _ref$expiredCodes;
|
||||
return _objectSpread({
|
||||
timeout: 1000,
|
||||
baseURL: location.origin,
|
||||
@ -46,14 +49,11 @@ export var reqConfig = function reqConfig(config) {
|
||||
responseInterceptors: [
|
||||
// 一个二元组,第一个元素是 request 拦截器,第二个元素是错误处理
|
||||
[function (response) {
|
||||
// if (response.status !== 200) {
|
||||
// throw Error(JSON.stringify(response.data));
|
||||
// }
|
||||
var _ref2 = (response === null || response === void 0 ? void 0 : response.data) || {},
|
||||
code = _ref2.code;
|
||||
if ([403, 401, 203].includes(code)) {
|
||||
if (expiredCodes.includes(code)) {
|
||||
message.error('登录过期,请重新登录');
|
||||
onError === null || onError === void 0 || onError(response === null || response === void 0 ? void 0 : response.data);
|
||||
onExpired === null || onExpired === void 0 || onExpired(response === null || response === void 0 ? void 0 : response.data);
|
||||
return {};
|
||||
}
|
||||
if (showMsg && code !== 200) {
|
||||
|
@ -27,7 +27,9 @@ var reqConfig = (config) => {
|
||||
const {
|
||||
authorization,
|
||||
showMsg = true,
|
||||
onError
|
||||
onError,
|
||||
onExpired,
|
||||
expiredCodes = [403, 401, 203]
|
||||
} = config || {};
|
||||
return {
|
||||
timeout: 1e3,
|
||||
@ -71,9 +73,9 @@ var reqConfig = (config) => {
|
||||
(response) => {
|
||||
var _a;
|
||||
const { code } = (response == null ? void 0 : response.data) || {};
|
||||
if ([403, 401, 203].includes(code)) {
|
||||
if (expiredCodes.includes(code)) {
|
||||
import_antd.message.error("登录过期,请重新登录");
|
||||
onError == null ? void 0 : onError(response == null ? void 0 : response.data);
|
||||
onExpired == null ? void 0 : onExpired(response == null ? void 0 : response.data);
|
||||
return {};
|
||||
}
|
||||
if (showMsg && code !== 200) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/request",
|
||||
"version": "0.13.0",
|
||||
"version": "0.14.0",
|
||||
"description": "请求库",
|
||||
"keywords": [
|
||||
"request",
|
||||
|
@ -15,6 +15,8 @@ export interface ReqConfigProps {
|
||||
*/
|
||||
authorization?: string
|
||||
showMsg?: boolean
|
||||
onExpired?: (error?: any) => void;
|
||||
expiredCodes?: number[];
|
||||
/**
|
||||
* 报错捕捉
|
||||
* @param error 报错信息
|
||||
@ -28,6 +30,8 @@ export const reqConfig = (config: ReqConfigProps) => {
|
||||
authorization,
|
||||
showMsg = true,
|
||||
onError,
|
||||
onExpired,
|
||||
expiredCodes = [403, 401, 203]
|
||||
} = config || {}
|
||||
|
||||
return {
|
||||
@ -72,14 +76,11 @@ export const reqConfig = (config: ReqConfigProps) => {
|
||||
// 一个二元组,第一个元素是 request 拦截器,第二个元素是错误处理
|
||||
[
|
||||
(response: { status: number; data: any; }) => {
|
||||
// if (response.status !== 200) {
|
||||
// throw Error(JSON.stringify(response.data));
|
||||
// }
|
||||
const { code } = response?.data || {}
|
||||
|
||||
if ([403,401, 203].includes(code)) {
|
||||
if (expiredCodes.includes(code)) {
|
||||
message.error('登录过期,请重新登录')
|
||||
onError?.(response?.data)
|
||||
onExpired?.(response?.data)
|
||||
return {}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,22 @@
|
||||
# @zhst/slave
|
||||
|
||||
## 0.10.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修改 logOut 事件
|
||||
|
||||
## 0.9.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.0
|
||||
|
||||
## 0.8.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -27,6 +27,7 @@ var Slave = /*#__PURE__*/function () {
|
||||
while (1) switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_opt$jumpToLogin = opt.jumpToLogin, jumpToLogin = _opt$jumpToLogin === void 0 ? true : _opt$jumpToLogin, jumpUrl = opt.jumpUrl, tokenKey = opt.tokenKey, _opt$showMsg = opt.showMsg, showMsg = _opt$showMsg === void 0 ? true : _opt$showMsg, msgText = opt.msgText, from = opt.from, to = opt.to;
|
||||
this.config = opt;
|
||||
this.checkUrl(jumpUrl, 'jumpUrl');
|
||||
// 当前链接
|
||||
currentUrl = new URL(location.href); // 当前待跳转链接
|
||||
@ -58,7 +59,7 @@ var Slave = /*#__PURE__*/function () {
|
||||
location.href = currentJumpUrl.href;
|
||||
}
|
||||
}
|
||||
case 10:
|
||||
case 11:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
@ -113,14 +114,29 @@ var Slave = /*#__PURE__*/function () {
|
||||
// 退出登录
|
||||
}, {
|
||||
key: "logOut",
|
||||
value: function logOut() {
|
||||
value: function logOut(jumpUrl, config) {
|
||||
this.removeToken();
|
||||
location.replace(location.origin + location.pathname);
|
||||
var _ref = config || this.config || {},
|
||||
from = _ref.from,
|
||||
to = _ref.to;
|
||||
var targetUrl = new URL(jumpUrl);
|
||||
this._setUrlKey({
|
||||
targetKey: 'from',
|
||||
targetUrl: from,
|
||||
jumpUrl: targetUrl
|
||||
});
|
||||
this._setUrlKey({
|
||||
targetKey: 'to',
|
||||
targetUrl: to,
|
||||
jumpUrl: targetUrl
|
||||
});
|
||||
location.href = targetUrl.href;
|
||||
}
|
||||
}, {
|
||||
key: "setToken",
|
||||
value: function setToken(val) {
|
||||
var tokenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.authTokenDefine;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
val && localStorage.setItem(tokenKey, val);
|
||||
}
|
||||
}, {
|
||||
|
@ -40,6 +40,7 @@ var Slave = class {
|
||||
to
|
||||
// force
|
||||
} = opt;
|
||||
this.config = opt;
|
||||
this.checkUrl(jumpUrl, "jumpUrl");
|
||||
let currentUrl = new URL(location.href);
|
||||
let currentJumpUrl = new URL(jumpUrl);
|
||||
@ -100,9 +101,21 @@ var Slave = class {
|
||||
}
|
||||
}
|
||||
// 退出登录
|
||||
logOut() {
|
||||
logOut(jumpUrl, config) {
|
||||
this.removeToken();
|
||||
location.replace(location.origin + location.pathname);
|
||||
const { from, to } = config || this.config || {};
|
||||
const targetUrl = new URL(jumpUrl);
|
||||
this._setUrlKey({
|
||||
targetKey: "from",
|
||||
targetUrl: from,
|
||||
jumpUrl: targetUrl
|
||||
});
|
||||
this._setUrlKey({
|
||||
targetKey: "to",
|
||||
targetUrl: to,
|
||||
jumpUrl: targetUrl
|
||||
});
|
||||
location.href = targetUrl.href;
|
||||
}
|
||||
setToken(val, tokenKey = this.authTokenDefine) {
|
||||
val && localStorage.setItem(tokenKey, val);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/slave",
|
||||
"version": "0.8.0",
|
||||
"version": "0.10.0",
|
||||
"description": "微前端子应用方法库",
|
||||
"keywords": [
|
||||
"slave",
|
||||
|
@ -42,6 +42,7 @@ class Slave {
|
||||
to,
|
||||
// force
|
||||
} = opt
|
||||
this.config = opt
|
||||
this.checkUrl(jumpUrl, 'jumpUrl')
|
||||
// 当前链接
|
||||
let currentUrl = new URL(location.href)
|
||||
@ -117,12 +118,26 @@ class Slave {
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
public logOut() {
|
||||
public logOut(jumpUrl: string, config?: ISlaveConfig) {
|
||||
this.removeToken()
|
||||
location.replace(location.origin + location.pathname)
|
||||
const { from, to } = config || this.config || {}
|
||||
const targetUrl = new URL(jumpUrl)
|
||||
|
||||
this._setUrlKey({
|
||||
targetKey: 'from',
|
||||
targetUrl: from,
|
||||
jumpUrl: targetUrl
|
||||
})
|
||||
this._setUrlKey({
|
||||
targetKey: 'to',
|
||||
targetUrl: to,
|
||||
jumpUrl: targetUrl
|
||||
})
|
||||
location.href = targetUrl.href
|
||||
}
|
||||
|
||||
public setToken(val: string | null, tokenKey: string = this.authTokenDefine) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
val && localStorage.setItem(tokenKey, val)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user