diff --git a/config/config.ts b/config/config.ts index 696bc582c17d8e9ec566cb5bbf1722585d0e3c5f..3bf9c73d2f696307d861ba76c86eb05c3b5dca22 100644 --- a/config/config.ts +++ b/config/config.ts @@ -102,16 +102,6 @@ export default { path: '/user/login', component: './user/login', }, - { - name: 'register-result', - path: '/user/register-result', - component: './user/register-result', - }, - { - name: 'register', - path: '/user/register', - component: './user/register', - }, ], }, { diff --git a/src/app.js b/src/app.js index a12847b63779036231cc4974221b55b3cdffb745..ff52b98efd73c52e0845960b081e8b52932ced06 100644 --- a/src/app.js +++ b/src/app.js @@ -1,7 +1,6 @@ export const dva = { config: { onError(e) { - console.log(e); e.preventDefault(); }, }, diff --git a/src/config.js b/src/config.js index e6fbbd09b5de8629a0a1722d45afc66c6327ea86..cad0e5fc66b866263ea1bba78f8b1678028b4b36 100644 --- a/src/config.js +++ b/src/config.js @@ -11,4 +11,5 @@ export default { resMessageKey: 'message', // 后台正常返回错误编码 successCode: 'sys.success', // 后台正常返回错误编码 isThrowError: true, + copyright: `${new Date().getFullYear()} KIM3.0技术中台部出品`, }; diff --git a/src/layouts/UserLayout.less b/src/layouts/UserLayout.less index cdc207ef66a07f9b5895182cff8c8b6d48c9c3da..06dd9ba12e77d44f50be0e7460b362479868b95d 100755 --- a/src/layouts/UserLayout.less +++ b/src/layouts/UserLayout.less @@ -6,6 +6,20 @@ height: 100vh; overflow: auto; background: @layout-body-background; + .content { + padding: 0; + } + :global { + .anticon-copyright { + margin-right: 16px; + } + .ant-layout-footer { + background: linear-gradient(#43cec4, #43cec4); + .ant-pro-global-footer-copyright { + color: rgba(255, 255, 255, 0.6); + } + } + } } .lang { diff --git a/src/layouts/UserLayout.tsx b/src/layouts/UserLayout.tsx index 34565a739488c2310cf1a8fe1ae41e811554c831..5fa515239c05ca4431bae5198a6435952f06bf44 100644 --- a/src/layouts/UserLayout.tsx +++ b/src/layouts/UserLayout.tsx @@ -9,6 +9,7 @@ import { connect } from 'dva'; import { formatMessage } from 'umi-plugin-react/locale'; import DefaultSettings from 'config/defaultSettings'; import logo from '../assets/logo.svg'; +import config from '@/config'; import styles from './UserLayout.less'; export interface UserLayoutProps extends ConnectProps { @@ -43,19 +44,8 @@ const UserLayout: React.SFC = props => {
-
-
-
- - logo - Ant Design - -
-
Ant Design 是西湖区最具影响力的 Web 设计规范
-
- {children} -
- +
{children}
+ ); diff --git a/src/pages/user/login/_mock.ts b/src/pages/user/login/_mock.ts deleted file mode 100644 index 8c7698f6dd5792ce00f833a586e106cc973d09ce..0000000000000000000000000000000000000000 --- a/src/pages/user/login/_mock.ts +++ /dev/null @@ -1,36 +0,0 @@ -function getFakeCaptcha(req: any, res: { json: (arg0: string) => void }) { - return res.json('captcha-xxx'); -} - -export default { - 'POST /api/login/account': ( - req: { body: { password: any; userName: any; type: any } }, - res: { - send: (data: any) => void; - }, - ) => { - const { password, userName, type } = req.body; - if (password === 'ant.design' && userName === 'admin') { - res.send({ - status: 'ok', - type, - currentAuthority: 'admin', - }); - return; - } - if (password === 'ant.design' && userName === 'user') { - res.send({ - status: 'ok', - type, - currentAuthority: 'user', - }); - return; - } - res.send({ - status: 'error', - type, - currentAuthority: 'guest', - }); - }, - 'GET /api/login/captcha': getFakeCaptcha, -}; diff --git a/src/pages/user/login/components/Login/LoginContext.tsx b/src/pages/user/login/components/Login/LoginContext.tsx deleted file mode 100644 index ae571e0db3dd5fbbd1e5b1248947b9c9ab4ad4df..0000000000000000000000000000000000000000 --- a/src/pages/user/login/components/Login/LoginContext.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createContext } from 'react'; - -export interface LoginContextProps { - tabUtil?: { - addTab: (id: string) => void; - removeTab: (id: string) => void; - }; - updateActive?: (activeItem: { [key: string]: string } | string) => void; -} - -const LoginContext: React.Context = createContext({}); - -export default LoginContext; diff --git a/src/pages/user/login/components/Login/LoginItem.tsx b/src/pages/user/login/components/Login/LoginItem.tsx deleted file mode 100644 index 6daea72b5242d22e05f25b8b7638abd07e98dc13..0000000000000000000000000000000000000000 --- a/src/pages/user/login/components/Login/LoginItem.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import { Button, Col, Form, Input, Row } from 'antd'; -import React, { Component } from 'react'; - -import { FormComponentProps } from 'antd/es/form'; -import omit from 'omit.js'; -import ItemMap from './map'; -import LoginContext, { LoginContextProps } from './LoginContext'; -import styles from './index.less'; - -type Omit = Pick>; - -export type WrappedLoginItemProps = Omit; -export type LoginItemKeyType = keyof typeof ItemMap; -export interface LoginItemType { - UserName: React.FC; - Password: React.FC; - Mobile: React.FC; - Captcha: React.FC; -} - -export interface LoginItemProps { - name?: string; - rules?: any[]; - style?: React.CSSProperties; - onGetCaptcha?: (event?: MouseEvent) => void | Promise | false; - placeholder?: string; - buttonText?: React.ReactNode; - onPressEnter?: (e: any) => void; - countDown?: number; - getCaptchaButtonText?: string; - getCaptchaSecondText?: string; - updateActive?: LoginContextProps['updateActive']; - type?: string; - defaultValue?: string; - form?: FormComponentProps['form']; - customProps?: { [key: string]: any }; - onChange?: (e: any) => void; - tabUtil?: any; -} - -interface LoginItemState { - count: number; -} - -const FormItem = Form.Item; - -class WrapFormItem extends Component { - static defaultProps = { - getCaptchaButtonText: 'captcha', - getCaptchaSecondText: 'second', - }; - - interval: number | undefined = undefined; - - constructor(props: LoginItemProps) { - super(props); - this.state = { - count: 0, - }; - } - - componentDidMount() { - const { updateActive, name = '' } = this.props; - if (updateActive) { - updateActive(name); - } - } - - componentWillUnmount() { - clearInterval(this.interval); - } - - onGetCaptcha = () => { - const { onGetCaptcha } = this.props; - const result = onGetCaptcha ? onGetCaptcha() : null; - if (result === false) { - return; - } - if (result instanceof Promise) { - result.then(this.runGetCaptchaCountDown); - } else { - this.runGetCaptchaCountDown(); - } - }; - - getFormItemOptions = ({ onChange, defaultValue, customProps = {}, rules }: LoginItemProps) => { - const options: { - rules?: any[]; - onChange?: LoginItemProps['onChange']; - initialValue?: LoginItemProps['defaultValue']; - } = { - rules: rules || customProps.rules, - }; - if (onChange) { - options.onChange = onChange; - } - if (defaultValue) { - options.initialValue = defaultValue; - } - return options; - }; - - runGetCaptchaCountDown = () => { - const { countDown } = this.props; - let count = countDown || 59; - this.setState({ count }); - this.interval = window.setInterval(() => { - count -= 1; - this.setState({ count }); - if (count === 0) { - clearInterval(this.interval); - } - }, 1000); - }; - - render() { - const { count } = this.state; - - // 这么写是为了防止restProps中 带入 onChange, defaultValue, rules props tabUtil - const { - onChange, - customProps, - defaultValue, - rules, - name, - getCaptchaButtonText, - getCaptchaSecondText, - updateActive, - type, - form, - tabUtil, - ...restProps - } = this.props; - if (!name) { - return null; - } - if (!form) { - return null; - } - const { getFieldDecorator } = form; - // get getFieldDecorator props - const options = this.getFormItemOptions(this.props); - const otherProps = restProps || {}; - - if (type === 'Captcha') { - const inputProps = omit(otherProps, ['onGetCaptcha', 'countDown']); - - return ( - - - - {getFieldDecorator(name, options)()} - - - - - - - ); - } - return ( - - {getFieldDecorator(name, options)()} - - ); - } -} - -const LoginItem: Partial = {}; - -Object.keys(ItemMap).forEach(key => { - const item = ItemMap[key]; - LoginItem[key] = (props: LoginItemProps) => ( - - {context => ( - - )} - - ); -}); - -export default LoginItem as LoginItemType; diff --git a/src/pages/user/login/components/Login/LoginSubmit.tsx b/src/pages/user/login/components/Login/LoginSubmit.tsx deleted file mode 100644 index e4d75cb6e1a672562a1ace801af177eee2061c9c..0000000000000000000000000000000000000000 --- a/src/pages/user/login/components/Login/LoginSubmit.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Button, Form } from 'antd'; - -import { ButtonProps } from 'antd/es/button'; -import React from 'react'; -import classNames from 'classnames'; -import styles from './index.less'; - -const FormItem = Form.Item; - -interface LoginSubmitProps extends ButtonProps { - className?: string; -} - -const LoginSubmit: React.SFC = ({ className, ...rest }) => { - const clsString = classNames(styles.submit, className); - return ( - - + + {/*
+
+
+ copyright + 2019 KIM3.0技术中台部出品 +
+
*/} +
+ +
+
+ ); + } +} + +export default Login; diff --git a/src/pages/user/login/index.less b/src/pages/user/login/index.less new file mode 100644 index 0000000000000000000000000000000000000000..46900113b2cfd3a4b62043a5f4542e7ac866d0f0 --- /dev/null +++ b/src/pages/user/login/index.less @@ -0,0 +1,100 @@ +@import '~@/themes/vars.less'; + +.root { + // background-image: url(../assets/background-image.png); + // background-repeat: no-repeat; + // // background-color: #b8e5f8; + // background-size: cover; + background: linear-gradient(@color-primary, @color-primary); + width: 100%; + // height: 100vh; + display: flex; + justify-content: center; + align-items: center; + position: relative; + .container { + // height: 500px; + width: 500px; + background-color: rgba(255, 255, 255, 0); + //border-radius: 4px; + //box-shadow: 0px 2px 4px; + margin-bottom: 50px; + display: flex; + justify-content: center; + align-items: center; + z-index: 1; + position: relative; + .box { + width: 260px; + .title { + font-size: @font-size-xmd; + color: white; + text-align: center; + margin-bottom: @space-md * 2; + font-weight: 500; + } + .username, + .password { + margin-bottom: @space-lg; + :global { + .ant-input { + font-size: @font-size-sm; + height: 36px; + padding-bottom: 8px; + padding-left: 40px; + } + i { + font-size: @font-size-sm; + color: @color-primary; + } + } + } + .submit { + font-size: @font-size-sm; + //line-height: 36px; + height: 36px; + width: 100%; + background-color: rgba(43, 187, 176, 0.8); + //border-color: rgba(43, 187, 176, 0.9); + box-shadow: 0 0px 0 rgba(0, 0, 0, 0); + } + } + .more { + // height: 100px; + top: 100%; + // bottom: 0px; + width: 100%; + position: absolute; + display: flex; + align-items: center; + flex-direction: column; + .info { + width: 60%; + display: flex; + justify-content: space-between; + a { + color: rgba(255, 255, 255, 0.8); + font-size: @font-size-md; + margin: @space-lg * 2 0; + } + } + .rights { + font-size: 10px; + color: rgba(255, 255, 255, 0.6); + :first-child { + margin-right: @space-lg; + } + } + } + } + .line { + position: absolute; + bottom: 0; + width: 100%; + background-color: @color-primary; + //height: 80%; + //background-image: url("../assets/line.png"); + //background-repeat: no-repeat; + //background-size: cover; + } +} diff --git a/src/pages/user/login/index.tsx b/src/pages/user/login/index.tsx deleted file mode 100644 index 942b46f7134c6878cfe853376aa2e2fbc61ab889..0000000000000000000000000000000000000000 --- a/src/pages/user/login/index.tsx +++ /dev/null @@ -1,211 +0,0 @@ -import { Alert, Checkbox, Icon } from 'antd'; -import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale'; -import React, { Component } from 'react'; - -import { CheckboxChangeEvent } from 'antd/es/checkbox'; -import { Dispatch } from 'redux'; -import { FormComponentProps } from 'antd/es/form'; -import Link from 'umi/link'; -import { connect } from 'dva'; -import { StateType } from './model'; -import LoginComponents from './components/Login'; -import styles from './style.less'; - -const { Tab, UserName, Password, Mobile, Captcha, Submit } = LoginComponents; - -interface LoginProps { - dispatch: Dispatch; - userLogin: StateType; - submitting: boolean; -} -interface LoginState { - type: string; - autoLogin: boolean; -} -export interface FromDataType { - userName: string; - password: string; - mobile: string; - captcha: string; -} - -@connect( - ({ - userLogin, - loading, - }: { - userLogin: StateType; - loading: { - effects: { - [key: string]: string; - }; - }; - }) => ({ - userLogin, - submitting: loading.effects['userLogin/login'], - }), -) -class Login extends Component { - loginForm: FormComponentProps['form'] | undefined | null = undefined; - - state: LoginState = { - type: 'account', - autoLogin: true, - }; - - changeAutoLogin = (e: CheckboxChangeEvent) => { - this.setState({ - autoLogin: e.target.checked, - }); - }; - - handleSubmit = (err: any, values: FromDataType) => { - const { type } = this.state; - if (!err) { - const { dispatch } = this.props; - dispatch({ - type: 'userLogin/login', - payload: { - ...values, - type, - }, - }); - } - }; - - onTabChange = (type: string) => { - this.setState({ type }); - }; - - onGetCaptcha = () => - new Promise((resolve, reject) => { - if (!this.loginForm) { - return; - } - this.loginForm.validateFields(['mobile'], {}, (err: any, values: FromDataType) => { - if (err) { - reject(err); - } else { - const { dispatch } = this.props; - ((dispatch({ - type: 'userLogin/getCaptcha', - payload: values.mobile, - }) as unknown) as Promise) - .then(resolve) - .catch(reject); - } - }); - }); - - renderMessage = (content: string) => ( - - ); - - render() { - const { userLogin, submitting } = this.props; - const { status, type: loginType } = userLogin; - const { type, autoLogin } = this.state; - return ( -
- { - this.loginForm = form; - }} - > - - {status === 'error' && - loginType === 'account' && - !submitting && - this.renderMessage( - formatMessage({ id: 'user-login.login.message-invalid-credentials' }), - )} - - - this.loginForm && this.loginForm.validateFields(this.handleSubmit) - } - /> - - - {status === 'error' && - loginType === 'mobile' && - !submitting && - this.renderMessage( - formatMessage({ id: 'user-login.login.message-invalid-verification-code' }), - )} - - - -
- - - - - - -
- - - -
- - - - - - - -
-
-
- ); - } -} - -export default Login; diff --git a/src/pages/user/login/locales/en-US.ts b/src/pages/user/login/locales/en-US.ts deleted file mode 100644 index c3e7080d05c6addaedee6ab7fbaa5889e5fe38a3..0000000000000000000000000000000000000000 --- a/src/pages/user/login/locales/en-US.ts +++ /dev/null @@ -1,78 +0,0 @@ -export default { - 'user-login.login.userName': 'userName', - 'user-login.login.password': 'password', - 'user-login.login.message-invalid-credentials': - 'Invalid username or password(admin/ant.design)', - 'user-login.login.message-invalid-verification-code': 'Invalid verification code', - 'user-login.login.tab-login-credentials': 'Credentials', - 'user-login.login.tab-login-mobile': 'Mobile number', - 'user-login.login.remember-me': 'Remember me', - 'user-login.login.forgot-password': 'Forgot your password?', - 'user-login.login.sign-in-with': 'Sign in with', - 'user-login.login.signup': 'Sign up', - 'user-login.login.login': 'Login', - 'user-login.register.register': 'Register', - 'user-login.register.get-verification-code': 'Get code', - 'user-login.register.sign-in': 'Already have an account?', - 'user-login.register-result.msg': 'Account:registered at {email}', - 'user-login.register-result.activation-email': - 'The activation email has been sent to your email address and is valid for 24 hours. Please log in to the email in time and click on the link in the email to activate the account.', - 'user-login.register-result.back-home': 'Back to home', - 'user-login.register-result.view-mailbox': 'View mailbox', - 'user-login.email.required': 'Please enter your email!', - 'user-login.email.wrong-format': 'The email address is in the wrong format!', - 'user-login.userName.required': 'Please enter your userName!', - 'user-login.password.required': 'Please enter your password!', - 'user-login.password.twice': 'The passwords entered twice do not match!', - 'user-login.strength.msg': - "Please enter at least 6 characters and don't use passwords that are easy to guess.", - 'user-login.strength.strong': 'Strength: strong', - 'user-login.strength.medium': 'Strength: medium', - 'user-login.strength.short': 'Strength: too short', - 'user-login.confirm-password.required': 'Please confirm your password!', - 'user-login.phone-number.required': 'Please enter your phone number!', - 'user-login.phone-number.wrong-format': 'Malformed phone number!', - 'user-login.verification-code.required': 'Please enter the verification code!', - 'user-login.title.required': 'Please enter a title', - 'user-login.date.required': 'Please select the start and end date', - 'user-login.goal.required': 'Please enter a description of the goal', - 'user-login.standard.required': 'Please enter a metric', - 'user-login.form.get-captcha': 'Get Captcha', - 'user-login.captcha.second': 'sec', - 'user-login.form.optional': ' (optional) ', - 'user-login.form.submit': 'Submit', - 'user-login.form.save': 'Save', - 'user-login.email.placeholder': 'Email', - 'user-login.password.placeholder': 'Password', - 'user-login.confirm-password.placeholder': 'Confirm password', - 'user-login.phone-number.placeholder': 'Phone number', - 'user-login.verification-code.placeholder': 'Verification code', - 'user-login.title.label': 'Title', - 'user-login.title.placeholder': 'Give the target a name', - 'user-login.date.label': 'Start and end date', - 'user-login.placeholder.start': 'Start date', - 'user-login.placeholder.end': 'End date', - 'user-login.goal.label': 'Goal description', - 'user-login.goal.placeholder': 'Please enter your work goals', - 'user-login.standard.label': 'Metrics', - 'user-login.standard.placeholder': 'Please enter a metric', - 'user-login.client.label': 'Client', - 'user-login.label.tooltip': 'Target service object', - 'user-login.client.placeholder': - 'Please describe your customer service, internal customers directly @ Name / job number', - 'user-login.invites.label': 'Inviting critics', - 'user-login.invites.placeholder': - 'Please direct @ Name / job number, you can invite up to 5 people', - 'user-login.weight.label': 'Weight', - 'user-login.weight.placeholder': 'Please enter weight', - 'user-login.public.label': 'Target disclosure', - 'user-login.label.help': 'Customers and invitees are shared by default', - 'user-login.radio.public': 'Public', - 'user-login.radio.partially-public': 'Partially public', - 'user-login.radio.private': 'Private', - 'user-login.publicUsers.placeholder': 'Open to', - 'user-login.option.A': 'Colleague A', - 'user-login.option.B': 'Colleague B', - 'user-login.option.C': 'Colleague C', - 'user-login.navBar.lang': 'Languages', -}; diff --git a/src/pages/user/login/locales/zh-CN.ts b/src/pages/user/login/locales/zh-CN.ts deleted file mode 100644 index fe0e7f596706ad8ede54ef6c2c54c90539a021e2..0000000000000000000000000000000000000000 --- a/src/pages/user/login/locales/zh-CN.ts +++ /dev/null @@ -1,74 +0,0 @@ -export default { - 'user-login.login.userName': '用户名', - 'user-login.login.password': '密码', - 'user-login.login.message-invalid-credentials': '账户或密码错误(admin/ant.design)', - 'user-login.login.message-invalid-verification-code': '验证码错误', - 'user-login.login.tab-login-credentials': '账户密码登录', - 'user-login.login.tab-login-mobile': '手机号登录', - 'user-login.login.remember-me': '自动登录', - 'user-login.login.forgot-password': '忘记密码', - 'user-login.login.sign-in-with': '其他登录方式', - 'user-login.login.signup': '注册账户', - 'user-login.login.login': '登录', - 'user-login.register.register': '注册', - 'user-login.register.get-verification-code': '获取验证码', - 'user-login.register.sign-in': '使用已有账户登录', - 'user-login.register-result.msg': '你的账户:{email} 注册成功', - 'user-login.register-result.activation-email': - '激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。', - 'user-login.register-result.back-home': '返回首页', - 'user-login.register-result.view-mailbox': '查看邮箱', - 'user-login.email.required': '请输入邮箱地址!', - 'user-login.email.wrong-format': '邮箱地址格式错误!', - 'user-login.userName.required': '请输入用户名!', - 'user-login.password.required': '请输入密码!', - 'user-login.password.twice': '两次输入的密码不匹配!', - 'user-login.strength.msg': '请至少输入 6 个字符。请不要使用容易被猜到的密码。', - 'user-login.strength.strong': '强度:强', - 'user-login.strength.medium': '强度:中', - 'user-login.strength.short': '强度:太短', - 'user-login.confirm-password.required': '请确认密码!', - 'user-login.phone-number.required': '请输入手机号!', - 'user-login.phone-number.wrong-format': '手机号格式错误!', - 'user-login.verification-code.required': '请输入验证码!', - 'user-login.title.required': '请输入标题', - 'user-login.date.required': '请选择起止日期', - 'user-login.goal.required': '请输入目标描述', - 'user-login.standard.required': '请输入衡量标准', - 'user-login.form.get-captcha': '获取验证码', - 'user-login.captcha.second': '秒', - 'user-login.form.optional': '(选填)', - 'user-login.form.submit': '提交', - 'user-login.form.save': '保存', - 'user-login.email.placeholder': '邮箱', - 'user-login.password.placeholder': '至少6位密码,区分大小写', - 'user-login.confirm-password.placeholder': '确认密码', - 'user-login.phone-number.placeholder': '手机号', - 'user-login.verification-code.placeholder': '验证码', - 'user-login.title.label': '标题', - 'user-login.title.placeholder': '给目标起个名字', - 'user-login.date.label': '起止日期', - 'user-login.placeholder.start': '开始日期', - 'user-login.placeholder.end': '结束日期', - 'user-login.goal.label': '目标描述', - 'user-login.goal.placeholder': '请输入你的阶段性工作目标', - 'user-login.standard.label': '衡量标准', - 'user-login.standard.placeholder': '请输入衡量标准', - 'user-login.client.label': '客户', - 'user-login.label.tooltip': '目标的服务对象', - 'user-login.client.placeholder': '请描述你服务的客户,内部客户直接 @姓名/工号', - 'user-login.invites.label': '邀评人', - 'user-login.invites.placeholder': '请直接 @姓名/工号,最多可邀请 5 人', - 'user-login.weight.label': '权重', - 'user-login.weight.placeholder': '请输入', - 'user-login.public.label': '目标公开', - 'user-login.label.help': '客户、邀评人默认被分享', - 'user-login.radio.public': '公开', - 'user-login.radio.partially-public': '部分公开', - 'user-login.radio.private': '不公开', - 'user-login.publicUsers.placeholder': '公开给', - 'user-login.option.A': '同事甲', - 'user-login.option.B': '同事乙', - 'user-login.option.C': '同事丙', - 'user-login.navBar.lang': '语言', -}; diff --git a/src/pages/user/login/locales/zh-TW.ts b/src/pages/user/login/locales/zh-TW.ts deleted file mode 100644 index cf0b460d2d34a578a0a294c244da0716b771c7e6..0000000000000000000000000000000000000000 --- a/src/pages/user/login/locales/zh-TW.ts +++ /dev/null @@ -1,74 +0,0 @@ -export default { - 'user-login.login.userName': '賬戶', - 'user-login.login.password': '密碼', - 'user-login.login.message-invalid-credentials': '賬戶或密碼錯誤(admin/ant.design)', - 'user-login.login.message-invalid-verification-code': '驗證碼錯誤', - 'user-login.login.tab-login-credentials': '賬戶密碼登錄', - 'user-login.login.tab-login-mobile': '手機號登錄', - 'user-login.login.remember-me': '自動登錄', - 'user-login.login.forgot-password': '忘記密碼', - 'user-login.login.sign-in-with': '其他登錄方式', - 'user-login.login.signup': '註冊賬戶', - 'user-login.login.login': '登錄', - 'user-login.register.register': '註冊', - 'user-login.register.get-verification-code': '獲取驗證碼', - 'user-login.register.sign-in': '使用已有賬戶登錄', - 'user-login.register-result.msg': '妳的賬戶:{email} 註冊成功', - 'user-login.register-result.activation-email': - '激活郵件已發送到妳的郵箱中,郵件有效期為24小時。請及時登錄郵箱,點擊郵件中的鏈接激活帳戶。', - 'user-login.register-result.back-home': '返回首頁', - 'user-login.register-result.view-mailbox': '查看郵箱', - 'user-login.email.required': '請輸入郵箱地址!', - 'user-login.email.wrong-format': '郵箱地址格式錯誤!', - 'user-login.userName.required': '請輸入賬戶!', - 'user-login.password.required': '請輸入密碼!', - 'user-login.password.twice': '兩次輸入的密碼不匹配!', - 'user-login.strength.msg': '請至少輸入 6 個字符。請不要使用容易被猜到的密碼。', - 'user-login.strength.strong': '強度:強', - 'user-login.strength.medium': '強度:中', - 'user-login.strength.short': '強度:太短', - 'user-login.confirm-password.required': '請確認密碼!', - 'user-login.phone-number.required': '請輸入手機號!', - 'user-login.phone-number.wrong-format': '手機號格式錯誤!', - 'user-login.verification-code.required': '請輸入驗證碼!', - 'user-login.title.required': '請輸入標題', - 'user-login.date.required': '請選擇起止日期', - 'user-login.goal.required': '請輸入目標描述', - 'user-login.standard.required': '請輸入衡量標淮', - 'user-login.form.get-captcha': '獲取驗證碼', - 'user-login.captcha.second': '秒', - 'user-login.form.optional': '(選填)', - 'user-login.form.submit': '提交', - 'user-login.form.save': '保存', - 'user-login.email.placeholder': '郵箱', - 'user-login.password.placeholder': '至少6位密碼,區分大小寫', - 'user-login.confirm-password.placeholder': '確認密碼', - 'user-login.phone-number.placeholder': '手機號', - 'user-login.verification-code.placeholder': '驗證碼', - 'user-login.title.label': '標題', - 'user-login.title.placeholder': '給目標起個名字', - 'user-login.date.label': '起止日期', - 'user-login.placeholder.start': '開始日期', - 'user-login.placeholder.end': '結束日期', - 'user-login.goal.label': '目標描述', - 'user-login.goal.placeholder': '請輸入妳的階段性工作目標', - 'user-login.standard.label': '衡量標淮', - 'user-login.standard.placeholder': '請輸入衡量標淮', - 'user-login.client.label': '客戶', - 'user-login.label.tooltip': '目標的服務對象', - 'user-login.client.placeholder': '請描述妳服務的客戶,內部客戶直接 @姓名/工號', - 'user-login.invites.label': '邀評人', - 'user-login.invites.placeholder': '請直接 @姓名/工號,最多可邀請 5 人', - 'user-login.weight.label': '權重', - 'user-login.weight.placeholder': '請輸入', - 'user-login.public.label': '目標公開', - 'user-login.label.help': '客戶、邀評人默認被分享', - 'user-login.radio.public': '公開', - 'user-login.radio.partially-public': '部分公開', - 'user-login.radio.private': '不公開', - 'user-login.publicUsers.placeholder': '公開給', - 'user-login.option.A': '同事甲', - 'user-login.option.B': '同事乙', - 'user-login.option.C': '同事丙', - 'user-login.navBar.lang': '語言', -}; diff --git a/src/pages/user/login/model.ts b/src/pages/user/login/model.ts deleted file mode 100644 index cbad9b8179ad10efaefbe792161cee8a30b84b46..0000000000000000000000000000000000000000 --- a/src/pages/user/login/model.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { AnyAction, Reducer } from 'redux'; -import { EffectsCommandMap } from 'dva'; -import { routerRedux } from 'dva/router'; -import { fakeAccountLogin, getFakeCaptcha } from './service'; -import { getPageQuery, setAuthority } from './utils/utils'; - -export interface StateType { - status?: 'ok' | 'error'; - type?: string; - currentAuthority?: 'user' | 'guest' | 'admin'; -} - -export type Effect = ( - action: AnyAction, - effects: EffectsCommandMap & { select: (func: (state: StateType) => T) => T }, -) => void; - -export interface ModelType { - namespace: string; - state: StateType; - effects: { - login: Effect; - getCaptcha: Effect; - }; - reducers: { - changeLoginStatus: Reducer; - }; -} - -const Model: ModelType = { - namespace: 'userLogin', - - state: { - status: undefined, - }, - - effects: { - *login({ payload }, { call, put }) { - const response = yield call(fakeAccountLogin, payload); - yield put({ - type: 'changeLoginStatus', - payload: response, - }); - // Login successfully - if (response.status === 'ok') { - const urlParams = new URL(window.location.href); - const params = getPageQuery(); - let { redirect } = params as { redirect: string }; - if (redirect) { - const redirectUrlParams = new URL(redirect); - if (redirectUrlParams.origin === urlParams.origin) { - redirect = redirect.substr(urlParams.origin.length); - if (redirect.match(/^\/.*#/)) { - redirect = redirect.substr(redirect.indexOf('#') + 1); - } - } else { - window.location.href = redirect; - return; - } - } - yield put(routerRedux.replace(redirect || '/')); - } - }, - - *getCaptcha({ payload }, { call }) { - yield call(getFakeCaptcha, payload); - }, - }, - - reducers: { - changeLoginStatus(state, { payload }) { - setAuthority(payload.currentAuthority); - return { - ...state, - status: payload.status, - type: payload.type, - }; - }, - }, -}; - -export default Model; diff --git a/src/pages/user/login/models/index.js b/src/pages/user/login/models/index.js new file mode 100644 index 0000000000000000000000000000000000000000..404d59470f922bec0ad05067af9b782785177abe --- /dev/null +++ b/src/pages/user/login/models/index.js @@ -0,0 +1,18 @@ +import { login } from '../services'; + +const initData = {}; +export default { + namespace: 'UserLogin', + state: { + ...initData, + }, + effects: { + *login({ payload }, { call }) { + const res = yield call(login, payload); + return res; + }, + }, + reducers: { + clearData: () => ({ ...initData }), + }, +}; diff --git a/src/pages/user/login/service.ts b/src/pages/user/login/service.ts deleted file mode 100644 index 1f89d6620b42b2a1d41ee82f1d95362727e97f20..0000000000000000000000000000000000000000 --- a/src/pages/user/login/service.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { get } from '@/utils/request'; -import { FromDataType } from './index'; - -export async function fakeAccountLogin(params: FromDataType) { - return get('/api/login/account', { - method: 'POST', - data: params, - }); -} - -export async function getFakeCaptcha(mobile: string) { - return get(`/api/login/captcha?mobile=${mobile}`); -} diff --git a/src/pages/user/login/services/index.js b/src/pages/user/login/services/index.js new file mode 100644 index 0000000000000000000000000000000000000000..16a6c6c4aee557bebde86ffd66d5649324398077 --- /dev/null +++ b/src/pages/user/login/services/index.js @@ -0,0 +1,3 @@ +import { post } from '@/utils/request'; + +export const login = data => post('/api/v1/login', data); diff --git a/src/pages/user/login/style.less b/src/pages/user/login/style.less deleted file mode 100644 index d9bbbf33e71c72b8f10ff30b4502cf70dad09cf2..0000000000000000000000000000000000000000 --- a/src/pages/user/login/style.less +++ /dev/null @@ -1,39 +0,0 @@ -@import '~antd/es/style/themes/default.less'; - -.main { - width: 368px; - margin: 0 auto; - @media screen and (max-width: @screen-sm) { - width: 95%; - } - - .icon { - margin-left: 16px; - color: rgba(0, 0, 0, 0.2); - font-size: 24px; - vertical-align: middle; - cursor: pointer; - transition: color 0.3s; - - &:hover { - color: @primary-color; - } - } - - .other { - margin-top: 24px; - line-height: 22px; - text-align: left; - - .register { - float: right; - } - } - - :global { - .antd-pro-login-submit { - width: 100%; - margin-top: 24px; - } - } -} diff --git a/src/pages/user/login/utils/utils.ts b/src/pages/user/login/utils/utils.ts deleted file mode 100644 index bca43c8c2b99385b22b8bb6f12b981e880a6a3f5..0000000000000000000000000000000000000000 --- a/src/pages/user/login/utils/utils.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { parse } from 'qs'; - -export function getPageQuery() { - return parse(window.location.href.split('?')[1]); -} - -export function setAuthority(authority: string | string[]) { - const proAuthority = typeof authority === 'string' ? [authority] : authority; - return localStorage.setItem('antd-pro-authority', JSON.stringify(proAuthority)); -} diff --git a/src/pages/user/register-result/Result/index.less b/src/pages/user/register-result/Result/index.less deleted file mode 100644 index 60fa5a05324c56e25fda971fef62f267b8c22cbb..0000000000000000000000000000000000000000 --- a/src/pages/user/register-result/Result/index.less +++ /dev/null @@ -1,58 +0,0 @@ -@import '~antd/es/style/themes/default.less'; - -.result { - width: 72%; - margin: 0 auto; - text-align: center; - @media screen and (max-width: @screen-xs) { - width: 100%; - } - - .icon { - margin-bottom: 24px; - font-size: 72px; - line-height: 72px; - - & > .success { - color: @success-color; - } - - & > .error { - color: @error-color; - } - } - - .title { - margin-bottom: 16px; - color: @heading-color; - font-weight: 500; - font-size: 24px; - line-height: 32px; - } - - .description { - margin-bottom: 24px; - color: @text-color-secondary; - font-size: 14px; - line-height: 22px; - } - - .extra { - padding: 24px 40px; - text-align: left; - background: @background-color-light; - border-radius: @border-radius-sm; - - @media screen and (max-width: @screen-xs) { - padding: 18px 20px; - } - } - - .actions { - margin-top: 32px; - - button:not(:last-child) { - margin-right: 8px; - } - } -} diff --git a/src/pages/user/register-result/Result/index.tsx b/src/pages/user/register-result/Result/index.tsx deleted file mode 100644 index 8c8ea1e4bc38983144625451a2508c329a0e2098..0000000000000000000000000000000000000000 --- a/src/pages/user/register-result/Result/index.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Icon } from 'antd'; -import React from 'react'; -import classNames from 'classnames'; -import styles from './index.less'; - -export interface ResultProps { - actions?: React.ReactNode; - className?: string; - description?: React.ReactNode; - extra?: React.ReactNode; - style?: React.CSSProperties; - title?: React.ReactNode; - type: 'success' | 'error'; -} - -const Result: React.SFC = ({ - className, - type, - title, - description, - extra, - actions, - ...restProps -}) => { - const iconMap = { - error: , - success: , - }; - const clsString = classNames(styles.result, className); - return ( -
-
{iconMap[type]}
-
{title}
- {description &&
{description}
} - {extra &&
{extra}
} - {actions &&
{actions}
} -
- ); -}; - -export default Result; diff --git a/src/pages/user/register-result/index.tsx b/src/pages/user/register-result/index.tsx deleted file mode 100644 index fc0d17418c5fdf6d7de79afd75edfb2d9178b070..0000000000000000000000000000000000000000 --- a/src/pages/user/register-result/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale'; - -import { Button } from 'antd'; -import Link from 'umi/link'; -import React from 'react'; -import { RouteChildrenProps } from 'react-router'; -import Result from './Result'; -import styles from './style.less'; - -const actions = ( -
- - - - - - -
-); - -const RegisterResult: React.SFC = ({ location }) => ( - - - - } - description={formatMessage({ id: 'user-register-result.register-result.activation-email' })} - actions={actions} - style={{ marginTop: 56 }} - /> -); - -export default RegisterResult; diff --git a/src/pages/user/register-result/locales/en-US.ts b/src/pages/user/register-result/locales/en-US.ts deleted file mode 100644 index 2da822ea6fc24baebc8c0ec589d9f3316c94b8d3..0000000000000000000000000000000000000000 --- a/src/pages/user/register-result/locales/en-US.ts +++ /dev/null @@ -1,23 +0,0 @@ -export default { - 'user-register-result.login.userName': 'userName', - 'user-register-result.login.password': 'password', - 'user-register-result.login.message-invalid-credentials': - 'Invalid username or password(admin/ant.design)', - 'user-register-result.login.message-invalid-verification-code': 'Invalid verification code', - 'user-register-result.login.tab-login-credentials': 'Credentials', - 'user-register-result.login.tab-login-mobile': 'Mobile number', - 'user-register-result.login.remember-me': 'Remember me', - 'user-register-result.login.forgot-password': 'Forgot your password?', - 'user-register-result.login.sign-in-with': 'Sign in with', - 'user-register-result.login.signup': 'Sign up', - 'user-register-result.login.login': 'Login', - 'user-register-result.register.register': 'Register', - 'user-register-result.register.get-verification-code': 'Get code', - 'user-register-result.register.sign-in': 'Already have an account?', - 'user-register-result.register-result.msg': 'Account:registered at {email}', - 'user-register-result.register-result.activation-email': - 'The activation email has been sent to your email address and is valid for 24 hours. Please log in to the email in time and click on the link in the email to activate the account.', - 'user-register-result.register-result.back-home': 'Back to home', - 'user-register-result.register-result.view-mailbox': 'View mailbox', - 'user-register-result.navBar.lang': 'Languages', -}; diff --git a/src/pages/user/register-result/locales/zh-CN.ts b/src/pages/user/register-result/locales/zh-CN.ts deleted file mode 100644 index 17a75e513d1d9ee5748601ff1b135c96893ee0fe..0000000000000000000000000000000000000000 --- a/src/pages/user/register-result/locales/zh-CN.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default { - 'user-register-result.login.userName': '用户名', - 'user-register-result.login.password': '密码', - 'user-register-result.login.message-invalid-credentials': '账户或密码错误(admin/ant.design)', - 'user-register-result.login.message-invalid-verification-code': '验证码错误', - 'user-register-result.login.tab-login-credentials': '账户密码登录', - 'user-register-result.login.tab-login-mobile': '手机号登录', - 'user-register-result.login.remember-me': '自动登录', - 'user-register-result.login.forgot-password': '忘记密码', - 'user-register-result.login.sign-in-with': '其他登录方式', - 'user-register-result.login.signup': '注册账户', - 'user-register-result.login.login': '登录', - 'user-register-result.register.register': '注册', - 'user-register-result.register.get-verification-code': '获取验证码', - 'user-register-result.register.sign-in': '使用已有账户登录', - 'user-register-result.register-result.msg': '你的账户:{email} 注册成功', - 'user-register-result.register-result.activation-email': - '激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。', - 'user-register-result.register-result.back-home': '返回首页', - 'user-register-result.register-result.view-mailbox': '查看邮箱', - 'user-register-result.navBar.lang': '语言', -}; diff --git a/src/pages/user/register-result/locales/zh-TW.ts b/src/pages/user/register-result/locales/zh-TW.ts deleted file mode 100644 index f64d1611b94cd214d5599a61a886ecd20afc4f85..0000000000000000000000000000000000000000 --- a/src/pages/user/register-result/locales/zh-TW.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default { - 'user-register-result.login.userName': '賬戶', - 'user-register-result.login.password': '密碼', - 'user-register-result.login.message-invalid-credentials': '賬戶或密碼錯誤(admin/ant.design)', - 'user-register-result.login.message-invalid-verification-code': '驗證碼錯誤', - 'user-register-result.login.tab-login-credentials': '賬戶密碼登錄', - 'user-register-result.login.tab-login-mobile': '手機號登錄', - 'user-register-result.login.remember-me': '自動登錄', - 'user-register-result.login.forgot-password': '忘記密碼', - 'user-register-result.login.sign-in-with': '其他登錄方式', - 'user-register-result.login.signup': '註冊賬戶', - 'user-register-result.login.login': '登錄', - 'user-register-result.register.register': '註冊', - 'user-register-result.register.get-verification-code': '獲取驗證碼', - 'user-register-result.register.sign-in': '使用已有賬戶登錄', - 'user-register-result.register-result.msg': '妳的賬戶:{email} 註冊成功', - 'user-register-result.register-result.activation-email': - '激活郵件已發送到妳的郵箱中,郵件有效期為24小時。請及時登錄郵箱,點擊郵件中的鏈接激活帳戶。', - 'user-register-result.register-result.back-home': '返回首頁', - 'user-register-result.register-result.view-mailbox': '查看郵箱', - 'user-register-result.navBar.lang': '語言', -}; diff --git a/src/pages/user/register-result/style.less b/src/pages/user/register-result/style.less deleted file mode 100644 index a969a5eee1c69f1345c7fbc190c54cf94919e592..0000000000000000000000000000000000000000 --- a/src/pages/user/register-result/style.less +++ /dev/null @@ -1,18 +0,0 @@ -.registerResult { - :global { - .anticon { - font-size: 64px; - } - } - .title { - margin-top: 32px; - font-size: 20px; - line-height: 28px; - } - .actions { - margin-top: 40px; - a + a { - margin-left: 8px; - } - } -} diff --git a/src/pages/user/register/_mock.ts b/src/pages/user/register/_mock.ts deleted file mode 100644 index dd86f440092eb9da6a7622cff99bf51a269bec84..0000000000000000000000000000000000000000 --- a/src/pages/user/register/_mock.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default { - 'POST /api/register': ( - req: any, - res: { send: (arg0: { status: string; currentAuthority: string }) => void }, - ) => { - res.send({ status: 'ok', currentAuthority: 'user' }); - }, -}; diff --git a/src/pages/user/register/index.tsx b/src/pages/user/register/index.tsx deleted file mode 100644 index b4de7c5203a125e255bafad8bbe8fa11c936db1f..0000000000000000000000000000000000000000 --- a/src/pages/user/register/index.tsx +++ /dev/null @@ -1,382 +0,0 @@ -import { Button, Col, Form, Input, Popover, Progress, Row, Select, message } from 'antd'; -import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale'; -import React, { Component } from 'react'; - -import { Dispatch } from 'redux'; -import { FormComponentProps } from 'antd/es/form'; -import Link from 'umi/link'; -import { connect } from 'dva'; -import router from 'umi/router'; -import { StateType } from './model'; -import styles from './style.less'; - -const FormItem = Form.Item; -const { Option } = Select; -const InputGroup = Input.Group; - -const passwordStatusMap = { - ok: ( -
- -
- ), - pass: ( -
- -
- ), - poor: ( -
- -
- ), -}; - -const passwordProgressMap: { - ok: 'success'; - pass: 'normal'; - poor: 'exception'; -} = { - ok: 'success', - pass: 'normal', - poor: 'exception', -}; - -interface UserRegisterProps extends FormComponentProps { - dispatch: Dispatch; - userRegister: StateType; - submitting: boolean; -} -interface UserRegisterState { - count: number; - confirmDirty: boolean; - visible: boolean; - help: string; - prefix: string; -} - -export interface UserRegisterParams { - mail: string; - password: string; - confirm: string; - mobile: string; - captcha: string; - prefix: string; -} - -@connect( - ({ - userRegister, - loading, - }: { - userRegister: StateType; - loading: { - effects: { - [key: string]: string; - }; - }; - }) => ({ - userRegister, - submitting: loading.effects['userRegister/submit'], - }), -) -class Register extends Component { - state: UserRegisterState = { - count: 0, - confirmDirty: false, - visible: false, - help: '', - prefix: '86', - }; - - interval: number | undefined = undefined; - - componentDidUpdate() { - const { userRegister, form } = this.props; - const account = form.getFieldValue('mail'); - if (userRegister.status === 'ok') { - message.success('注册成功!'); - router.push({ - pathname: '/user/register-result', - state: { - account, - }, - }); - } - } - - componentWillUnmount() { - clearInterval(this.interval); - } - - onGetCaptcha = () => { - let count = 59; - this.setState({ count }); - this.interval = window.setInterval(() => { - count -= 1; - this.setState({ count }); - if (count === 0) { - clearInterval(this.interval); - } - }, 1000); - }; - - getPasswordStatus = () => { - const { form } = this.props; - const value = form.getFieldValue('password'); - if (value && value.length > 9) { - return 'ok'; - } - if (value && value.length > 5) { - return 'pass'; - } - return 'poor'; - }; - - handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - const { form, dispatch } = this.props; - form.validateFields({ force: true }, (err, values) => { - if (!err) { - const { prefix } = this.state; - dispatch({ - type: 'userRegister/submit', - payload: { - ...values, - prefix, - }, - }); - } - }); - }; - - checkConfirm = (rule: any, value: string, callback: (messgae?: string) => void) => { - const { form } = this.props; - if (value && value !== form.getFieldValue('password')) { - callback(formatMessage({ id: 'user-register.password.twice' })); - } else { - callback(); - } - }; - - checkPassword = (rule: any, value: string, callback: (messgae?: string) => void) => { - const { visible, confirmDirty } = this.state; - if (!value) { - this.setState({ - help: formatMessage({ id: 'user-register.password.required' }), - visible: !!value, - }); - callback('error'); - } else { - this.setState({ - help: '', - }); - if (!visible) { - this.setState({ - visible: !!value, - }); - } - if (value.length < 6) { - callback('error'); - } else { - const { form } = this.props; - if (value && confirmDirty) { - form.validateFields(['confirm'], { force: true }); - } - callback(); - } - } - }; - - changePrefix = (value: string) => { - this.setState({ - prefix: value, - }); - }; - - renderPasswordProgress = () => { - const { form } = this.props; - const value = form.getFieldValue('password'); - const passwordStatus = this.getPasswordStatus(); - return value && value.length ? ( -
- 100 ? 100 : value.length * 10} - showInfo={false} - /> -
- ) : null; - }; - - render() { - const { form, submitting } = this.props; - const { getFieldDecorator } = form; - const { count, prefix, help, visible } = this.state; - return ( -
-

- -

-
- - {getFieldDecorator('mail', { - rules: [ - { - required: true, - message: formatMessage({ id: 'user-register.email.required' }), - }, - { - type: 'email', - message: formatMessage({ id: 'user-register.email.wrong-format' }), - }, - ], - })( - , - )} - - - { - if (node && node.parentNode) { - return node.parentNode as HTMLElement; - } - return node; - }} - content={ -
- {passwordStatusMap[this.getPasswordStatus()]} - {this.renderPasswordProgress()} -
- -
-
- } - overlayStyle={{ width: 240 }} - placement="right" - visible={visible} - > - {getFieldDecorator('password', { - rules: [ - { - validator: this.checkPassword, - }, - ], - })( - , - )} -
-
- - {getFieldDecorator('confirm', { - rules: [ - { - required: true, - message: formatMessage({ id: 'user-register.confirm-password.required' }), - }, - { - validator: this.checkConfirm, - }, - ], - })( - , - )} - - - - - {getFieldDecorator('mobile', { - rules: [ - { - required: true, - message: formatMessage({ id: 'user-register.phone-number.required' }), - }, - { - pattern: /^\d{11}$/, - message: formatMessage({ id: 'user-register.phone-number.wrong-format' }), - }, - ], - })( - , - )} - - - - - - {getFieldDecorator('captcha', { - rules: [ - { - required: true, - message: formatMessage({ id: 'user-register.verification-code.required' }), - }, - ], - })( - , - )} - - - - - - - - - - - - -
-
- ); - } -} - -export default Form.create()(Register); diff --git a/src/pages/user/register/locales/en-US.ts b/src/pages/user/register/locales/en-US.ts deleted file mode 100644 index 7609fc22fc6777b80a748c879aadbb7f68900e76..0000000000000000000000000000000000000000 --- a/src/pages/user/register/locales/en-US.ts +++ /dev/null @@ -1,78 +0,0 @@ -export default { - 'user-register.login.userName': 'userName', - 'user-register.login.password': 'password', - 'user-register.login.message-invalid-credentials': - 'Invalid username or password(admin/ant.design)', - 'user-register.login.message-invalid-verification-code': 'Invalid verification code', - 'user-register.login.tab-login-credentials': 'Credentials', - 'user-register.login.tab-login-mobile': 'Mobile number', - 'user-register.login.remember-me': 'Remember me', - 'user-register.login.forgot-password': 'Forgot your password?', - 'user-register.login.sign-in-with': 'Sign in with', - 'user-register.login.signup': 'Sign up', - 'user-register.login.login': 'Login', - 'user-register.register.register': 'Register', - 'user-register.register.get-verification-code': 'Get code', - 'user-register.register.sign-in': 'Already have an account?', - 'user-register.register-result.msg': 'Account:registered at {email}', - 'user-register.register-result.activation-email': - 'The activation email has been sent to your email address and is valid for 24 hours. Please log in to the email in time and click on the link in the email to activate the account.', - 'user-register.register-result.back-home': 'Back to home', - 'user-register.register-result.view-mailbox': 'View mailbox', - 'user-register.email.required': 'Please enter your email!', - 'user-register.email.wrong-format': 'The email address is in the wrong format!', - 'user-register.userName.required': 'Please enter your userName!', - 'user-register.password.required': 'Please enter your password!', - 'user-register.password.twice': 'The passwords entered twice do not match!', - 'user-register.strength.msg': - "Please enter at least 6 characters and don't use passwords that are easy to guess.", - 'user-register.strength.strong': 'Strength: strong', - 'user-register.strength.medium': 'Strength: medium', - 'user-register.strength.short': 'Strength: too short', - 'user-register.confirm-password.required': 'Please confirm your password!', - 'user-register.phone-number.required': 'Please enter your phone number!', - 'user-register.phone-number.wrong-format': 'Malformed phone number!', - 'user-register.verification-code.required': 'Please enter the verification code!', - 'user-register.title.required': 'Please enter a title', - 'user-register.date.required': 'Please select the start and end date', - 'user-register.goal.required': 'Please enter a description of the goal', - 'user-register.standard.required': 'Please enter a metric', - 'user-register.form.get-captcha': 'Get Captcha', - 'user-register.captcha.second': 'sec', - 'user-register.form.optional': ' (optional) ', - 'user-register.form.submit': 'Submit', - 'user-register.form.save': 'Save', - 'user-register.email.placeholder': 'Email', - 'user-register.password.placeholder': 'Password', - 'user-register.confirm-password.placeholder': 'Confirm password', - 'user-register.phone-number.placeholder': 'Phone number', - 'user-register.verification-code.placeholder': 'Verification code', - 'user-register.title.label': 'Title', - 'user-register.title.placeholder': 'Give the target a name', - 'user-register.date.label': 'Start and end date', - 'user-register.placeholder.start': 'Start date', - 'user-register.placeholder.end': 'End date', - 'user-register.goal.label': 'Goal description', - 'user-register.goal.placeholder': 'Please enter your work goals', - 'user-register.standard.label': 'Metrics', - 'user-register.standard.placeholder': 'Please enter a metric', - 'user-register.client.label': 'Client', - 'user-register.label.tooltip': 'Target service object', - 'user-register.client.placeholder': - 'Please describe your customer service, internal customers directly @ Name / job number', - 'user-register.invites.label': 'Inviting critics', - 'user-register.invites.placeholder': - 'Please direct @ Name / job number, you can invite up to 5 people', - 'user-register.weight.label': 'Weight', - 'user-register.weight.placeholder': 'Please enter weight', - 'user-register.public.label': 'Target disclosure', - 'user-register.label.help': 'Customers and invitees are shared by default', - 'user-register.radio.public': 'Public', - 'user-register.radio.partially-public': 'Partially public', - 'user-register.radio.private': 'Private', - 'user-register.publicUsers.placeholder': 'Open to', - 'user-register.option.A': 'Colleague A', - 'user-register.option.B': 'Colleague B', - 'user-register.option.C': 'Colleague C', - 'user-register.navBar.lang': 'Languages', -}; diff --git a/src/pages/user/register/locales/zh-CN.ts b/src/pages/user/register/locales/zh-CN.ts deleted file mode 100644 index 4ca4078ea3521c3b5f3a860732f29c6bf0bfc2cc..0000000000000000000000000000000000000000 --- a/src/pages/user/register/locales/zh-CN.ts +++ /dev/null @@ -1,74 +0,0 @@ -export default { - 'user-register.login.userName': '用户名', - 'user-register.login.password': '密码', - 'user-register.login.message-invalid-credentials': '账户或密码错误(admin/ant.design)', - 'user-register.login.message-invalid-verification-code': '验证码错误', - 'user-register.login.tab-login-credentials': '账户密码登录', - 'user-register.login.tab-login-mobile': '手机号登录', - 'user-register.login.remember-me': '自动登录', - 'user-register.login.forgot-password': '忘记密码', - 'user-register.login.sign-in-with': '其他登录方式', - 'user-register.login.signup': '注册账户', - 'user-register.login.login': '登录', - 'user-register.register.register': '注册', - 'user-register.register.get-verification-code': '获取验证码', - 'user-register.register.sign-in': '使用已有账户登录', - 'user-register.register-result.msg': '你的账户:{email} 注册成功', - 'user-register.register-result.activation-email': - '激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。', - 'user-register.register-result.back-home': '返回首页', - 'user-register.register-result.view-mailbox': '查看邮箱', - 'user-register.email.required': '请输入邮箱地址!', - 'user-register.email.wrong-format': '邮箱地址格式错误!', - 'user-register.userName.required': '请输入用户名!', - 'user-register.password.required': '请输入密码!', - 'user-register.password.twice': '两次输入的密码不匹配!', - 'user-register.strength.msg': '请至少输入 6 个字符。请不要使用容易被猜到的密码。', - 'user-register.strength.strong': '强度:强', - 'user-register.strength.medium': '强度:中', - 'user-register.strength.short': '强度:太短', - 'user-register.confirm-password.required': '请确认密码!', - 'user-register.phone-number.required': '请输入手机号!', - 'user-register.phone-number.wrong-format': '手机号格式错误!', - 'user-register.verification-code.required': '请输入验证码!', - 'user-register.title.required': '请输入标题', - 'user-register.date.required': '请选择起止日期', - 'user-register.goal.required': '请输入目标描述', - 'user-register.standard.required': '请输入衡量标准', - 'user-register.form.get-captcha': '获取验证码', - 'user-register.captcha.second': '秒', - 'user-register.form.optional': '(选填)', - 'user-register.form.submit': '提交', - 'user-register.form.save': '保存', - 'user-register.email.placeholder': '邮箱', - 'user-register.password.placeholder': '至少6位密码,区分大小写', - 'user-register.confirm-password.placeholder': '确认密码', - 'user-register.phone-number.placeholder': '手机号', - 'user-register.verification-code.placeholder': '验证码', - 'user-register.title.label': '标题', - 'user-register.title.placeholder': '给目标起个名字', - 'user-register.date.label': '起止日期', - 'user-register.placeholder.start': '开始日期', - 'user-register.placeholder.end': '结束日期', - 'user-register.goal.label': '目标描述', - 'user-register.goal.placeholder': '请输入你的阶段性工作目标', - 'user-register.standard.label': '衡量标准', - 'user-register.standard.placeholder': '请输入衡量标准', - 'user-register.client.label': '客户', - 'user-register.label.tooltip': '目标的服务对象', - 'user-register.client.placeholder': '请描述你服务的客户,内部客户直接 @姓名/工号', - 'user-register.invites.label': '邀评人', - 'user-register.invites.placeholder': '请直接 @姓名/工号,最多可邀请 5 人', - 'user-register.weight.label': '权重', - 'user-register.weight.placeholder': '请输入', - 'user-register.public.label': '目标公开', - 'user-register.label.help': '客户、邀评人默认被分享', - 'user-register.radio.public': '公开', - 'user-register.radio.partially-public': '部分公开', - 'user-register.radio.private': '不公开', - 'user-register.publicUsers.placeholder': '公开给', - 'user-register.option.A': '同事甲', - 'user-register.option.B': '同事乙', - 'user-register.option.C': '同事丙', - 'user-register.navBar.lang': '语言', -}; diff --git a/src/pages/user/register/locales/zh-TW.ts b/src/pages/user/register/locales/zh-TW.ts deleted file mode 100644 index 6c17f83b2fa319f1bab5f8b9e5415c5c71df4d9d..0000000000000000000000000000000000000000 --- a/src/pages/user/register/locales/zh-TW.ts +++ /dev/null @@ -1,74 +0,0 @@ -export default { - 'user-register.login.userName': '賬戶', - 'user-register.login.password': '密碼', - 'user-register.login.message-invalid-credentials': '賬戶或密碼錯誤(admin/ant.design)', - 'user-register.login.message-invalid-verification-code': '驗證碼錯誤', - 'user-register.login.tab-login-credentials': '賬戶密碼登錄', - 'user-register.login.tab-login-mobile': '手機號登錄', - 'user-register.login.remember-me': '自動登錄', - 'user-register.login.forgot-password': '忘記密碼', - 'user-register.login.sign-in-with': '其他登錄方式', - 'user-register.login.signup': '註冊賬戶', - 'user-register.login.login': '登錄', - 'user-register.register.register': '註冊', - 'user-register.register.get-verification-code': '獲取驗證碼', - 'user-register.register.sign-in': '使用已有賬戶登錄', - 'user-register.register-result.msg': '妳的賬戶:{email} 註冊成功', - 'user-register.register-result.activation-email': - '激活郵件已發送到妳的郵箱中,郵件有效期為24小時。請及時登錄郵箱,點擊郵件中的鏈接激活帳戶。', - 'user-register.register-result.back-home': '返回首頁', - 'user-register.register-result.view-mailbox': '查看郵箱', - 'user-register.email.required': '請輸入郵箱地址!', - 'user-register.email.wrong-format': '郵箱地址格式錯誤!', - 'user-register.userName.required': '請輸入賬戶!', - 'user-register.password.required': '請輸入密碼!', - 'user-register.password.twice': '兩次輸入的密碼不匹配!', - 'user-register.strength.msg': '請至少輸入 6 個字符。請不要使用容易被猜到的密碼。', - 'user-register.strength.strong': '強度:強', - 'user-register.strength.medium': '強度:中', - 'user-register.strength.short': '強度:太短', - 'user-register.confirm-password.required': '請確認密碼!', - 'user-register.phone-number.required': '請輸入手機號!', - 'user-register.phone-number.wrong-format': '手機號格式錯誤!', - 'user-register.verification-code.required': '請輸入驗證碼!', - 'user-register.title.required': '請輸入標題', - 'user-register.date.required': '請選擇起止日期', - 'user-register.goal.required': '請輸入目標描述', - 'user-register.standard.required': '請輸入衡量標淮', - 'user-register.form.get-captcha': '獲取驗證碼', - 'user-register.captcha.second': '秒', - 'user-register.form.optional': '(選填)', - 'user-register.form.submit': '提交', - 'user-register.form.save': '保存', - 'user-register.email.placeholder': '郵箱', - 'user-register.password.placeholder': '至少6位密碼,區分大小寫', - 'user-register.confirm-password.placeholder': '確認密碼', - 'user-register.phone-number.placeholder': '手機號', - 'user-register.verification-code.placeholder': '驗證碼', - 'user-register.title.label': '標題', - 'user-register.title.placeholder': '給目標起個名字', - 'user-register.date.label': '起止日期', - 'user-register.placeholder.start': '開始日期', - 'user-register.placeholder.end': '結束日期', - 'user-register.goal.label': '目標描述', - 'user-register.goal.placeholder': '請輸入妳的階段性工作目標', - 'user-register.standard.label': '衡量標淮', - 'user-register.standard.placeholder': '請輸入衡量標淮', - 'user-register.client.label': '客戶', - 'user-register.label.tooltip': '目標的服務對象', - 'user-register.client.placeholder': '請描述妳服務的客戶,內部客戶直接 @姓名/工號', - 'user-register.invites.label': '邀評人', - 'user-register.invites.placeholder': '請直接 @姓名/工號,最多可邀請 5 人', - 'user-register.weight.label': '權重', - 'user-register.weight.placeholder': '請輸入', - 'user-register.public.label': '目標公開', - 'user-register.label.help': '客戶、邀評人默認被分享', - 'user-register.radio.public': '公開', - 'user-register.radio.partially-public': '部分公開', - 'user-register.radio.private': '不公開', - 'user-register.publicUsers.placeholder': '公開給', - 'user-register.option.A': '同事甲', - 'user-register.option.B': '同事乙', - 'user-register.option.C': '同事丙', - 'user-register.navBar.lang': '語言', -}; diff --git a/src/pages/user/register/model.ts b/src/pages/user/register/model.ts deleted file mode 100644 index bedce185b28eaf6a623fbb7356b99a8ad90793ff..0000000000000000000000000000000000000000 --- a/src/pages/user/register/model.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { AnyAction, Reducer } from 'redux'; - -import { EffectsCommandMap } from 'dva'; -import { fakeRegister } from './service'; - -export interface StateType { - status?: 'ok' | 'error'; - currentAuthority?: 'user' | 'guest' | 'admin'; -} - -export type Effect = ( - action: AnyAction, - effects: EffectsCommandMap & { select: (func: (state: StateType) => T) => T }, -) => void; - -export interface ModelType { - namespace: string; - state: StateType; - effects: { - submit: Effect; - }; - reducers: { - registerHandle: Reducer; - }; -} - -const Model: ModelType = { - namespace: 'userRegister', - - state: { - status: undefined, - }, - - effects: { - *submit({ payload }, { call, put }) { - const response = yield call(fakeRegister, payload); - yield put({ - type: 'registerHandle', - payload: response, - }); - }, - }, - - reducers: { - registerHandle(state, { payload }) { - return { - ...state, - status: payload.status, - }; - }, - }, -}; - -export default Model; diff --git a/src/pages/user/register/service.ts b/src/pages/user/register/service.ts deleted file mode 100644 index 99d42f78e47d640e892b3ccd3c606cd0ddc13ffc..0000000000000000000000000000000000000000 --- a/src/pages/user/register/service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { get } from '@/utils/request'; -import { UserRegisterParams } from './index'; - -export async function fakeRegister(params: UserRegisterParams) { - return get('/api/register', { - method: 'POST', - data: params, - }); -} diff --git a/src/pages/user/register/style.less b/src/pages/user/register/style.less deleted file mode 100644 index e3ee3b445d5cd666c8bbe032f95a235a99678790..0000000000000000000000000000000000000000 --- a/src/pages/user/register/style.less +++ /dev/null @@ -1,57 +0,0 @@ -@import '~antd/es/style/themes/default.less'; - -.main { - width: 368px; - margin: 0 auto; - - :global { - .ant-form-item { - margin-bottom: 24px; - } - } - - h3 { - margin-bottom: 20px; - font-size: 16px; - } - - .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; - } - } -} diff --git a/src/typings.d.ts b/src/typings.d.ts index 1207eb6c626291047562366b2d53d0fc75531122..c06709b6769b85ea747581ad7aa11cb49623f2c7 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -22,11 +22,11 @@ declare module 'webpack-theme-color-replacer'; declare module 'webpack-theme-color-replacer/client'; // src/typings.d.ts -// declare module 'umi-plugin-react/locale' { -// export default interface MessageDescriptor { -// id: string; -// } /* eslint-disable-line */ -// } +declare module 'umi-plugin-react/locale' { + export default interface MessageDescriptor { + id: string; + } /* eslint-disable-line */ +} declare let ga: Function; diff --git a/src/utils/store.js b/src/utils/store.js index b6cef3df0f28321c30a78ad0d3549168e34c57ec..e570cfe9bc26ab5732fdfe4e6a7bad54ee93a43c 100644 --- a/src/utils/store.js +++ b/src/utils/store.js @@ -5,8 +5,6 @@ import localStorage from 'store/storages/localStorage'; import defaults from 'store/plugins/defaults'; import expire from 'store/plugins/expire'; -console.log(config); - const { storeNameSpace } = config; const storages = [localStorage];