chore: update default theme style

This commit is contained in:
JustSong
2025-01-31 23:25:32 +08:00
parent 45d10aa3df
commit be089a072b
2 changed files with 159 additions and 83 deletions

View File

@@ -1,6 +1,21 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, Form, Grid, Header, Image, Segment } from 'semantic-ui-react'; import {
import { API, copy, showError, showInfo, showNotice, showSuccess } from '../helpers'; Button,
Form,
Grid,
Header,
Image,
Card,
Message,
} from 'semantic-ui-react';
import {
API,
copy,
showError,
showInfo,
showNotice,
showSuccess,
} from '../helpers';
import { useSearchParams } from 'react-router-dom'; import { useSearchParams } from 'react-router-dom';
const PasswordResetConfirm = () => { const PasswordResetConfirm = () => {
@@ -63,11 +78,23 @@ const PasswordResetConfirm = () => {
return ( return (
<Grid textAlign='center' style={{ marginTop: '48px' }}> <Grid textAlign='center' style={{ marginTop: '48px' }}>
<Grid.Column style={{ maxWidth: 450 }}> <Grid.Column style={{ maxWidth: 450 }}>
<Header as='h2' color='' textAlign='center'> <Card
<Image src='/logo.png' /> 密码重置确认 fluid
className='chart-card'
style={{ boxShadow: '0 1px 3px rgba(0,0,0,0.12)' }}
>
<Card.Content>
<Card.Header>
<Header
as='h2'
textAlign='center'
style={{ marginBottom: '1.5em' }}
>
<Image src='/logo.png' style={{ marginBottom: '10px' }} />
<Header.Content>密码重置确认</Header.Content>
</Header> </Header>
</Card.Header>
<Form size='large'> <Form size='large'>
<Segment>
<Form.Input <Form.Input
fluid fluid
icon='mail' icon='mail'
@@ -76,6 +103,7 @@ const PasswordResetConfirm = () => {
name='email' name='email'
value={email} value={email}
readOnly readOnly
style={{ marginBottom: '1em' }}
/> />
{newPassword && ( {newPassword && (
<Form.Input <Form.Input
@@ -86,6 +114,11 @@ const PasswordResetConfirm = () => {
name='newPassword' name='newPassword'
value={newPassword} value={newPassword}
readOnly readOnly
style={{
marginBottom: '1em',
cursor: 'pointer',
backgroundColor: '#f8f9fa',
}}
onClick={(e) => { onClick={(e) => {
e.target.select(); e.target.select();
navigator.clipboard.writeText(newPassword); navigator.clipboard.writeText(newPassword);
@@ -94,17 +127,26 @@ const PasswordResetConfirm = () => {
/> />
)} )}
<Button <Button
color='green' color='blue'
fluid fluid
size='large' size='large'
onClick={handleSubmit} onClick={handleSubmit}
loading={loading} loading={loading}
disabled={disableButton} disabled={disableButton}
style={{ marginBottom: '1em' }}
> >
{disableButton ? `密码重置完成` : '提交'} {disableButton ? '密码重置完成' : '提交'}
</Button> </Button>
</Segment>
</Form> </Form>
{newPassword && (
<Message style={{ background: 'transparent', boxShadow: 'none' }}>
<p style={{ fontSize: '0.9em', color: '#666' }}>
新密码已生成请点击密码框或上方按钮复制请及时登录并修改密码
</p>
</Message>
)}
</Card.Content>
</Card>
</Grid.Column> </Grid.Column>
</Grid> </Grid>
); );

View File

@@ -1,11 +1,19 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, Form, Grid, Header, Image, Segment } from 'semantic-ui-react'; import {
Button,
Form,
Grid,
Header,
Image,
Card,
Message,
} from 'semantic-ui-react';
import { API, showError, showInfo, showSuccess } from '../helpers'; import { API, showError, showInfo, showSuccess } from '../helpers';
import Turnstile from 'react-turnstile'; import Turnstile from 'react-turnstile';
const PasswordResetForm = () => { const PasswordResetForm = () => {
const [inputs, setInputs] = useState({ const [inputs, setInputs] = useState({
email: '' email: '',
}); });
const { email } = inputs; const { email } = inputs;
@@ -42,7 +50,7 @@ const PasswordResetForm = () => {
function handleChange(e) { function handleChange(e) {
const { name, value } = e.target; const { name, value } = e.target;
setInputs(inputs => ({ ...inputs, [name]: value })); setInputs((inputs) => ({ ...inputs, [name]: value }));
} }
async function handleSubmit(e) { async function handleSubmit(e) {
@@ -69,11 +77,23 @@ const PasswordResetForm = () => {
return ( return (
<Grid textAlign='center' style={{ marginTop: '48px' }}> <Grid textAlign='center' style={{ marginTop: '48px' }}>
<Grid.Column style={{ maxWidth: 450 }}> <Grid.Column style={{ maxWidth: 450 }}>
<Header as='h2' color='' textAlign='center'> <Card
<Image src='/logo.png' /> 密码重置 fluid
className='chart-card'
style={{ boxShadow: '0 1px 3px rgba(0,0,0,0.12)' }}
>
<Card.Content>
<Card.Header>
<Header
as='h2'
textAlign='center'
style={{ marginBottom: '1.5em' }}
>
<Image src='/logo.png' style={{ marginBottom: '10px' }} />
<Header.Content>密码重置</Header.Content>
</Header> </Header>
</Card.Header>
<Form size='large'> <Form size='large'>
<Segment>
<Form.Input <Form.Input
fluid fluid
icon='mail' icon='mail'
@@ -82,29 +102,43 @@ const PasswordResetForm = () => {
name='email' name='email'
value={email} value={email}
onChange={handleChange} onChange={handleChange}
style={{ marginBottom: '1em' }}
/> />
{turnstileEnabled ? ( {turnstileEnabled && (
<div
style={{
marginBottom: '1em',
display: 'flex',
justifyContent: 'center',
}}
>
<Turnstile <Turnstile
sitekey={turnstileSiteKey} sitekey={turnstileSiteKey}
onVerify={(token) => { onVerify={(token) => {
setTurnstileToken(token); setTurnstileToken(token);
}} }}
/> />
) : ( </div>
<></>
)} )}
<Button <Button
color='green' color='blue'
fluid fluid
size='large' size='large'
onClick={handleSubmit} onClick={handleSubmit}
loading={loading} loading={loading}
disabled={disableButton} disabled={disableButton}
style={{ marginBottom: '1em' }}
> >
{disableButton ? `重试 (${countdown})` : '提交'} {disableButton ? `重试 (${countdown})` : '提交'}
</Button> </Button>
</Segment>
</Form> </Form>
<Message style={{ background: 'transparent', boxShadow: 'none' }}>
<p style={{ fontSize: '0.9em', color: '#666' }}>
系统将向您的邮箱发送一封包含重置链接的邮件请注意查收
</p>
</Message>
</Card.Content>
</Card>
</Grid.Column> </Grid.Column>
</Grid> </Grid>
); );