From 51b793019dff824e617c3d265dab32a952642432 Mon Sep 17 00:00:00 2001 From: jiangzhixiong <710328466@qq.com> Date: Fri, 22 Mar 2024 17:12:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=89=A9=E6=96=99?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- global.d.ts | 1 + packages/material/CHANGELOG.md | 6 ++++++ packages/material/package.json | 2 +- packages/material/src/login/Login.tsx | 15 +++++++++++++-- packages/material/src/login/demo/basic.tsx | 3 ++- packages/material/src/login/index.less | 5 +++++ packages/slave/README.md | 2 ++ packages/slave/src/index.tsx | 17 +++++++++++------ 8 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 packages/material/src/login/index.less diff --git a/global.d.ts b/global.d.ts index e69de29..1ea3960 100644 --- a/global.d.ts +++ b/global.d.ts @@ -0,0 +1 @@ +declare module '*.less'; diff --git a/packages/material/CHANGELOG.md b/packages/material/CHANGELOG.md index 0303728..bd3d572 100644 --- a/packages/material/CHANGELOG.md +++ b/packages/material/CHANGELOG.md @@ -1,5 +1,11 @@ # @zhst/material +## 0.7.1 + +### Patch Changes + +- 添加登录 css 属性 + ## 0.7.0 ### Minor Changes diff --git a/packages/material/package.json b/packages/material/package.json index 5f8b27c..1f5e304 100644 --- a/packages/material/package.json +++ b/packages/material/package.json @@ -1,6 +1,6 @@ { "name": "@zhst/material", - "version": "0.7.0", + "version": "0.7.1", "description": "物料库", "keywords": [ "business", diff --git a/packages/material/src/login/Login.tsx b/packages/material/src/login/Login.tsx index f83f29b..ec32d5e 100644 --- a/packages/material/src/login/Login.tsx +++ b/packages/material/src/login/Login.tsx @@ -5,6 +5,10 @@ import React, { FC } from 'react' import { Button, Checkbox, Flex, Form, FormProps, Image, Input, theme } from 'antd'; import { HomeOutlined } from '@ant-design/icons'; +import { isNumber } from '@zhst/func'; +import './index.less' + +const materialName = 'zhst-material-login' const { useToken } = theme @@ -14,6 +18,8 @@ interface LoginProps { rememberPassword?: boolean imageUrl: string; onFinish: FormProps['onFinish'] + width?: string | number + height?: string | number } const Login: FC = (props) => { @@ -22,13 +28,17 @@ const Login: FC = (props) => { onIconClick, rememberPassword = true, imageUrl, + width, + height, onFinish } = props const [form] = Form.useForm(); const { token } = useToken() + console.log('width', width) + return ( - + = (props) => { -
+
diff --git a/packages/material/src/login/demo/basic.tsx b/packages/material/src/login/demo/basic.tsx index dd1a86a..21684dc 100644 --- a/packages/material/src/login/demo/basic.tsx +++ b/packages/material/src/login/demo/basic.tsx @@ -6,10 +6,11 @@ import bg1 from '../images/ai-suanfa.png' const demo = () => { return ( -
+
console.log('val', val)} />
diff --git a/packages/material/src/login/index.less b/packages/material/src/login/index.less new file mode 100644 index 0000000..ccd5c73 --- /dev/null +++ b/packages/material/src/login/index.less @@ -0,0 +1,5 @@ +.zhst-material-login { + &::-webkit-scrollbar { + display: none; + } +} diff --git a/packages/slave/README.md b/packages/slave/README.md index 8c92118..e180964 100644 --- a/packages/slave/README.md +++ b/packages/slave/README.md @@ -32,6 +32,8 @@ slave.init({ | tokenKey | 从链接获取的登录校验字段 | string | token | - | | showMsg | 是否显示“请先登录”提示框 | boolean | true | - | | msgText | 提示框自定义文案 | string | 请先登录 | - | +| from | 来自哪个链接(可选) | string | - | - | +| to | 准备去的链接(可选) | string | - | - | ## slave 实例方法 diff --git a/packages/slave/src/index.tsx b/packages/slave/src/index.tsx index 6e6db95..77e2ffd 100644 --- a/packages/slave/src/index.tsx +++ b/packages/slave/src/index.tsx @@ -15,6 +15,9 @@ export interface ISlaveConfig { */ tokenKey?: string; showMsg?: boolean; + msgText?: string; + from?: string; + to?: string } class Slave { @@ -32,7 +35,10 @@ class Slave { jumpToLogin = true, jumpUrl, tokenKey, - showMsg = true + showMsg = true, + msgText, + from, + to, } = opt // eslint-disable-next-line @typescript-eslint/no-unused-expressions @@ -40,13 +46,12 @@ class Slave { this.token = _token localStorage.setItem('ZHST_AUTH_TOKEN', _token as string) - this.checkEnv({ showMsg }) + this.checkEnv({ showMsg, msgText }) if (jumpToLogin && jumpUrl && !_token) { let jumpUrlObj = new URL(jumpUrl) - console.log('jumpUrlObj', jumpUrlObj, jumpUrl) - + // 判断是否为同一个域,采用不同的跳转方式 if (jumpUrlObj.origin === location.origin) { history.pushState('', '', jumpUrl) } else { @@ -56,9 +61,9 @@ class Slave { } // 判端是否登录 - checkEnv(_opt: { showMsg: boolean }) { + checkEnv(_opt: { showMsg: boolean, msgText?: string }) { if (!this.token && _opt.showMsg) { - message.error('请先登录!') + message.error(_opt.msgText || '请先登录!') return } }