feat: 删除图形验证码

This commit is contained in:
landaiqing
2024-05-05 02:53:25 +08:00
parent 85eb0c4382
commit 73033b22ab
3 changed files with 44 additions and 100 deletions

View File

@@ -137,6 +137,7 @@
//float: left; //float: left;
margin: 0; margin: 0;
padding: 0 32px; padding: 0 32px;
width: 400px;
} }
.mp_tips { .mp_tips {

View File

@@ -1,5 +1,4 @@
import { import {
BarcodeOutlined,
GithubOutlined, GithubOutlined,
GitlabOutlined, GitlabOutlined,
LockOutlined, LockOutlined,
@@ -30,24 +29,8 @@ const iconStyles: CSSProperties = {
} }
export default observer(() => { export default observer(() => {
// @ts-ignore
const [generateMpRegCodeData, setGenerateMpRegCodeData] = useState<API.GenerateMpRegCode>({})
const [form] = Form.useForm() const [form] = Form.useForm()
// @ts-ignore
const [base64Code, setBase64Code] = useState<API.GenerateBase64Code>({ data: '' })
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const clickGetBase64CodeMethod = async () => {
await getBase64CodeMethod()
}
const CodeImg = (
<img
src={'data:image/jpg;base64,' + base64Code.data}
onClick={clickGetBase64CodeMethod}
title='点击刷新'
style={{ cursor: 'pointer', height: 40, width: 90 }}
/>
)
const getBase64CodeMethod = async () => {}
const items = [ const items = [
{ {
@@ -171,26 +154,26 @@ export default observer(() => {
}, },
]} ]}
/> />
<ProFormText {/*<ProFormText*/}
addonAfter={CodeImg} {/* addonAfter={CodeImg}*/}
name='code' {/* name='code'*/}
fieldProps={{ {/* fieldProps={{*/}
size: 'large', {/* size: 'large',*/}
prefix: <BarcodeOutlined className={'prefixIcon'} />, {/* prefix: <BarcodeOutlined className={'prefixIcon'} />,*/}
autoComplete: 'off', {/* autoComplete: 'off',*/}
}} {/* }}*/}
placeholder='请输入图形验证码' {/* placeholder='请输入图形验证码'*/}
rules={[ {/* rules={[*/}
{ {/* {*/}
required: true, {/* required: true,*/}
message: '请输入图形验证码!', {/* message: '请输入图形验证码!',*/}
}, {/* },*/}
{ {/* {*/}
pattern: /^[a-zA-Z0-9]{5}$/, {/* pattern: /^[a-zA-Z0-9]{5}$/,*/}
message: '图形验证码格式不正确', {/* message: '图形验证码格式不正确',*/}
}, {/* },*/}
]} {/* ]}*/}
/> {/*/>*/}
</> </>
)} )}
{loginType === 'phone' && ( {loginType === 'phone' && (
@@ -214,26 +197,26 @@ export default observer(() => {
}, },
]} ]}
/> />
<ProFormText {/*<ProFormText*/}
addonAfter={CodeImg} {/* addonAfter={CodeImg}*/}
name='code' {/* name='code'*/}
fieldProps={{ {/* fieldProps={{*/}
size: 'large', {/* size: 'large',*/}
prefix: <BarcodeOutlined className={'prefixIcon'} />, {/* prefix: <BarcodeOutlined className={'prefixIcon'} />,*/}
autoComplete: 'off', {/* autoComplete: 'off',*/}
}} {/* }}*/}
placeholder='请输入图形验证码' {/* placeholder='请输入图形验证码'*/}
rules={[ {/* rules={[*/}
{ {/* {*/}
required: true, {/* required: true,*/}
message: '请输入图形验证码!', {/* message: '请输入图形验证码!',*/}
}, {/* },*/}
{ {/* {*/}
pattern: /^[a-zA-Z0-9]{5}$/, {/* pattern: /^[a-zA-Z0-9]{5}$/,*/}
message: '图形验证码格式不正确', {/* message: '图形验证码格式不正确',*/}
}, {/* },*/}
]} {/* ]}*/}
/> {/*/>*/}
<ProFormCaptcha <ProFormCaptcha
fieldProps={{ fieldProps={{
size: 'large', size: 'large',

View File

@@ -1,4 +1,4 @@
import { BarcodeOutlined, LockOutlined, MobileOutlined, WechatOutlined } from '@ant-design/icons' import { LockOutlined, MobileOutlined, WechatOutlined } from '@ant-design/icons'
import { ProFormCaptcha, ProFormText } from '@ant-design/pro-components' import { ProFormCaptcha, ProFormText } from '@ant-design/pro-components'
import { Space, Tabs, message, Image, Alert, Form, Button } from 'antd' import { Space, Tabs, message, Image, Alert, Form, Button } from 'antd'
import { useState } from 'react' import { useState } from 'react'
@@ -12,25 +12,7 @@ import FooterComponent from '@/components/Footer'
type LoginType = 'phone' type LoginType = 'phone'
export default observer(() => { export default observer(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const [generateMpRegCodeData, setGenerateMpRegCodeData] = useState<API.GenerateMpRegCode>({})
const [form] = Form.useForm() const [form] = Form.useForm()
// @ts-ignore
const [base64Code, setBase64Code] = useState<API.GenerateBase64Code>({ data: '' })
const clickGetBase64CodeMethod = async () => {
await getBase64CodeMethod()
}
const CodeImg = (
<img
src={'data:image/jpg;base64,' + base64Code.data}
onClick={clickGetBase64CodeMethod}
title='点击刷新'
style={{ cursor: 'pointer', height: 40, width: 90 }}
/>
)
const getBase64CodeMethod = async () => {}
const items = [ const items = [
{ {
key: 'phone', key: 'phone',
@@ -175,28 +157,6 @@ export default observer(() => {
}), }),
]} ]}
/> />
<ProFormText
addonAfter={CodeImg}
name='code'
fieldProps={{
size: 'large',
prefix: <BarcodeOutlined className={'prefixIcon'} />,
autoComplete: 'off',
}}
placeholder='请输入图形验证码'
rules={[
{
required: true,
message: '请输入图形验证码!',
},
{
pattern: /^[a-zA-Z0-9]{5}$/,
message: '图形验证码格式不正确!',
},
]}
/>
<ProFormCaptcha <ProFormCaptcha
fieldProps={{ fieldProps={{
size: 'large', size: 'large',