Skip to content

Commit

Permalink
chore: user模块去掉less和样式调整 (#11002)
Browse files Browse the repository at this point in the history
  • Loading branch information
hms181231 authored Oct 13, 2023
1 parent b652775 commit da0f9a7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 134 deletions.
2 changes: 1 addition & 1 deletion src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function getInitialState(): Promise<{
};
// 如果不是登录页面,执行
const { location } = history;
if (location.pathname !== loginPath) {
if (![loginPath, '/user/register', '/user/register-result'].includes(location.pathname)) {
const currentUser = await fetchUserInfo();
return {
fetchUserInfo,
Expand Down
23 changes: 0 additions & 23 deletions src/pages/user/register-result/style.less

This file was deleted.

91 changes: 45 additions & 46 deletions src/pages/user/register/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { history, Link, useRequest } from '@umijs/max';
import { Button, Col, Form, Input, message, Popover, Progress, Row, Select } from 'antd';
import { Button, Col, Form, Input, message, Popover, Progress, Row, Select, Space } from 'antd';
import type { Store } from 'antd/es/form/interface';
import type { FC } from 'react';
import { useEffect, useState } from 'react';
Expand All @@ -9,7 +9,6 @@ import useStyles from './style.style';

const FormItem = Form.Item;
const { Option } = Select;
const InputGroup = Input.Group;

const passwordProgressMap: {
ok: 'success';
Expand Down Expand Up @@ -83,7 +82,7 @@ const Register: FC = () => {
if (data.status === 'ok') {
message.success('注册成功!');
history.push({
pathname: '/user/register-result?account=' + params.email,
pathname: `/user/register-result?account=${params[0].email}`,
});
}
},
Expand Down Expand Up @@ -140,7 +139,7 @@ const Register: FC = () => {
<h3>注册</h3>
<Form form={form} name="UserRegister" onFinish={onFinish}>
<FormItem
name="mail"
name="email"
rules={[
{
required: true,
Expand Down Expand Up @@ -216,37 +215,35 @@ const Register: FC = () => {
>
<Input size="large" type="password" placeholder="确认密码" />
</FormItem>
<InputGroup compact>
<Select
size="large"
value={prefix}
onChange={changePrefix}
style={{
width: '20%',
}}
>
<Option value="86">+86</Option>
<Option value="87">+87</Option>
</Select>
<FormItem
style={{
width: '80%',
}}
name="mobile"
rules={[
{
required: true,
message: '请输入手机号!',
},
{
pattern: /^\d{11}$/,
message: '手机号格式错误!',
},
]}
>
<FormItem
name="mobile"
rules={[
{
required: true,
message: '请输入手机号!',
},
{
pattern: /^\d{11}$/,
message: '手机号格式错误!',
},
]}
>
<Space.Compact style={{ width: '100%' }}>
<Select
size="large"
value={prefix}
onChange={changePrefix}
style={{
width: '30%',
}}
>
<Option value="86">+86</Option>
<Option value="87">+87</Option>
</Select>

<Input size="large" placeholder="手机号" />
</FormItem>
</InputGroup>
</Space.Compact>
</FormItem>
<Row gutter={8}>
<Col span={16}>
<FormItem
Expand All @@ -273,18 +270,20 @@ const Register: FC = () => {
</Col>
</Row>
<FormItem>
<Button
size="large"
loading={submitting}
className={styles.submit}
type="primary"
htmlType="submit"
>
<span>注册</span>
</Button>
<Link className={styles.login} to="/user/login">
<span>使用已有账户登录</span>
</Link>
<div className={styles.footer}>
<Button
size="large"
loading={submitting}
className={styles.submit}
type="primary"
htmlType="submit"
>
<span>注册</span>
</Button>
<Link to="/user/login">
<span>使用已有账户登录</span>
</Link>
</div>
</FormItem>
</Form>
</div>
Expand Down
60 changes: 0 additions & 60 deletions src/pages/user/register/style.less

This file was deleted.

11 changes: 7 additions & 4 deletions src/pages/user/register/style.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ const useStyles = createStyles(({ token }) => {
display: 'block',
width: '100%',
},

footer: {
width: '100%',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
},
submit: {
width: '50%',
},
login: {
float: 'right',
lineHeight: token.controlHeight,
},
success: {
transition: 'color 0.3s',
color: token.colorSuccess,
Expand Down

0 comments on commit da0f9a7

Please sign in to comment.