Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: user模块去掉less和样式调整 #11002

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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