Browse Source

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

pull/11011/head
hms181231 2 years ago
committed by GitHub
parent
commit
da0f9a7e63
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app.tsx
  2. 23
      src/pages/user/register-result/style.less
  3. 41
      src/pages/user/register/index.tsx
  4. 60
      src/pages/user/register/style.less
  5. 11
      src/pages/user/register/style.style.ts

2
src/app.tsx

@ -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,

23
src/pages/user/register-result/style.less

@ -1,23 +0,0 @@
.registerResult {
width: 800px;
min-height: 400px;
margin: auto;
padding: 80px;
background: none;
:global {
.anticon {
font-size: 64px;
}
}
.title {
margin-top: 32px;
font-size: 20px;
line-height: 28px;
}
.actions {
margin-top: 40px;
a + a {
margin-left: 8px;
}
}
}

41
src/pages/user/register/index.tsx

@ -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';
@ -9,7 +9,6 @@ import useStyles from './style.style';
const FormItem = Form.Item;
const { Option } = Select;
const InputGroup = Input.Group;
const passwordProgressMap: {
ok: 'success';
@ -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}`,
});
}
},
@ -140,7 +139,7 @@ const Register: FC = () => {
<h3></h3>
<Form form={form} name="UserRegister" onFinish={onFinish}>
<FormItem
name="mail"
name="email"
rules={[
{
required: true,
@ -216,22 +215,7 @@ 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={[
{
@ -244,9 +228,22 @@ const Register: FC = () => {
},
]}
>
<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="手机号" />
</Space.Compact>
</FormItem>
</InputGroup>
<Row gutter={8}>
<Col span={16}>
<FormItem
@ -273,6 +270,7 @@ const Register: FC = () => {
</Col>
</Row>
<FormItem>
<div className={styles.footer}>
<Button
size="large"
loading={submitting}
@ -282,9 +280,10 @@ const Register: FC = () => {
>
<span></span>
</Button>
<Link className={styles.login} to="/user/login">
<Link to="/user/login">
<span>使</span>
</Link>
</div>
</FormItem>
</Form>
</div>

60
src/pages/user/register/style.less

@ -1,60 +0,0 @@
@import '~antd/es/style/themes/default.less';
.main {
width: 368px;
margin: 0 auto;
h3 {
margin-bottom: 20px;
font-size: 16px;
}
.password {
margin-bottom: 24px;
:global {
.ant-form-item-explain {
display: none;
}
}
}
.getCaptcha {
display: block;
width: 100%;
}
.submit {
width: 50%;
}
.login {
float: right;
line-height: @btn-height-lg;
}
}
.success,
.warning,
.error {
transition: color 0.3s;
}
.success {
color: @success-color;
}
.warning {
color: @warning-color;
}
.error {
color: @error-color;
}
.progress-pass > .progress {
:global {
.ant-progress-bg {
background-color: @warning-color;
}
}
}

11
src/pages/user/register/style.style.ts

@ -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,

Loading…
Cancel
Save