This commit is contained in:
qitmac000249 2017-07-25 16:18:07 +08:00
commit bd70fe6c7a
5 changed files with 34 additions and 18 deletions

View File

@ -13,7 +13,7 @@ const { Header } = Layout;
const MenuUser = (props) => (
<Menu>
<Menu.Item key="0">
<Link to={`/profile/${props.uid}`} onClick={props.relieveLink}><Icon type="user" />{ props.user }</Link>
<Link to={`/user/profile/${props.uid}`} onClick={props.relieveLink}><Icon type="user" />{ props.user }</Link>
</Menu.Item>
<Menu.Item key="1">
<Link to="/news" onClick={props.relieveLink}><Icon type="mail" />{ props.msg }</Link>
@ -178,4 +178,4 @@ export default connect(
checkLoginState,
changeMenuItem
}
)(HeaderCom)
)(HeaderCom)

View File

@ -66,7 +66,11 @@ class Login extends Component {
{/* 用户名 (Email) */}
<FormItem style={formItemStyle}>
{getFieldDecorator('email', {
rules: [{ required: true, message: '请输入email!' }]
rules: [{
required: true,
message: '请输入正确的email!',
pattern: /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
}]
})(
<Input style={changeHeight} prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Email" />
)}

View File

@ -94,7 +94,11 @@ class Reg extends Component {
{/* Emaiil */}
<FormItem style={formItemStyle}>
{getFieldDecorator('email', {
rules: [{ required: true, message: '请输入email!' }]
rules: [{
required: true,
message: '请输入email!',
pattern: /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
}]
})(
<Input style={changeHeight} prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder="Email" />
)}

View File

@ -29,13 +29,17 @@ export default (state = initialState, action) => {
};
}
case LOGIN: {
return {
...state,
isLogin: true,
loginState: MEMBER_STATUS,
uid: action.payload.data.data.uid,
userName: action.payload.data.data.username
};
if (action.payload.data.errcode === 0) {
return {
...state,
isLogin: true,
loginState: MEMBER_STATUS,
uid: action.payload.data.data.uid,
userName: action.payload.data.data.username
};
} else {
return state;
}
}
case LOGIN_OUT: {
return{

View File

@ -29,13 +29,17 @@ export default (state = initialState, action) => {
};
}
case LOGIN: {
return {
...state,
isLogin: true,
loginState: MEMBER_STATUS,
uid: action.payload.data.data.uid,
userName: action.payload.data.data.username
};
if (action.payload.data.errcode === 0) {
return {
...state,
isLogin: true,
loginState: MEMBER_STATUS,
uid: action.payload.data.data.uid,
userName: action.payload.data.data.username
};
} else {
return state;
}
}
case LOGIN_OUT: {
return{