Authored by shixiang

修改密码提交 接口未调试

review -于良
... ... @@ -139,7 +139,7 @@ export default function native(platform) {
component={ModifyPasswordContainer}
hideNavBar={false}
navBar={NavBar}
title={'修改密码2'}
title={'修改密码'}
titleStyle={styles.navTitle}
type="push"
/>
... ...
... ... @@ -95,7 +95,6 @@ const styles = StyleSheet.create({
cellContainer: {
backgroundColor:'white',
borderColor:'red',
flexDirection: 'row',
height: 45,
borderBottomWidth:0.5,
... ...
... ... @@ -47,7 +47,7 @@ export default class Login extends Component {
onPress={this.props.onDeleteUserPress}>
<Image
style={styles.buttonDelete}
source={require('../images/delete@2x.png')
source={require('../images/delete.png')
}
/>
</TouchableWithoutFeedback>
... ...
... ... @@ -11,7 +11,8 @@ let {
Text,
Dimensions,
TextInput,
TouchableWithoutFeedback
TouchableWithoutFeedback,
Platform
} = React;
export default class Login extends Component {
... ... @@ -22,6 +23,7 @@ export default class Login extends Component {
static propTypes = {
account: React.PropTypes.string,
username: React.PropTypes.string,
pwd: React.PropTypes.string,
onLogoutPress:React.PropTypes.func,
onModifyPress:React.PropTypes.func,
... ... @@ -33,17 +35,21 @@ export default class Login extends Component {
<View style={styles.container}>
<View style={styles.accountContainer }>
<Text style={styles.text}>
账号:
账号:{this.props.username}
</Text>
</View>
<View style={styles.line}/>
<TouchableWithoutFeedback
onPress={this.props.onModifyPress}>
<View style={styles.pwdContainer }>
<View style={styles.pwdContainer }>
<Text style={styles.text}>
修改密码
</Text>
</View>
<Image
style={styles.icon}
source={require('../images/grey.png')}
/>
</View>
</TouchableWithoutFeedback>
<Button style={styles.button}
textStyle={styles.buttonText}
... ... @@ -66,24 +72,28 @@ var styles = StyleSheet.create({
alignItems: 'center',
width: width,
height: height,
top:64,
backgroundColor: 'gray'
top:(Platform.OS === 'android') ? 50 : 64,
backgroundColor: '#F5FCFF'
},
accountContainer:{
width: width,
height: 40,
marginTop:15,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white'
},
pwdContainer:{
width: width,
height: 40,
flexDirection: 'column',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white'
},
text:{
flex:1,
marginLeft: buttonMargin,
marginRight: buttonMargin,
color:'black',
... ... @@ -103,6 +113,10 @@ var styles = StyleSheet.create({
line:{
width: width,
height: 1,
backgroundColor: 'gray',
}
},
icon: {
marginRight:10,
},
});
... ...
... ... @@ -21,10 +21,13 @@ export default class ModifyPassword extends Component {
}
static propTypes = {
account: React.PropTypes.string,
pwd: React.PropTypes.string,
onPress:React.PropTypes.func,
onModifyPress:React.PropTypes.func,
oldPwd: React.PropTypes.string,
newPwd: React.PropTypes.string,
repeatPwd: React.PropTypes.string,
onModifyOldPwd:React.PropTypes.func,
onModifyNewPwd:React.PropTypes.func,
onModifyRepeatPwd:React.PropTypes.func,
onModifySubmitPress:React.PropTypes.func,
};
render() {
... ... @@ -39,6 +42,8 @@ export default class ModifyPassword extends Component {
style={styles.pwd}
secureTextEntry={true}
underlineColorAndroid='transparent'
onChangeText={this.props.onModifyOldPwd}
value={this.props.oldPwd}
/>
</View>
<View style={styles.line}/>
... ... @@ -50,6 +55,8 @@ export default class ModifyPassword extends Component {
style={styles.pwd}
secureTextEntry={true}
underlineColorAndroid='transparent'
onChangeText={this.props.onModifyNewPwd}
value={this.props.newPwd}
/>
</View>
<View style={styles.line}/>
... ... @@ -61,11 +68,13 @@ export default class ModifyPassword extends Component {
style={styles.pwd}
secureTextEntry={true}
underlineColorAndroid='transparent'
onChangeText={this.props.onModifyRepeatPwd}
value={this.props.repeatPwd}
/>
</View>
<Button style={styles.button}
textStyle={styles.buttonText}
onPress={this.props.onLogoutPress}
onPress={this.props.onModifySubmitPress}
>
确定
</Button>
... ... @@ -85,34 +94,26 @@ var styles = StyleSheet.create({
width: width,
height: height,
top:64,
backgroundColor: 'gray'
backgroundColor: '#F5FCFF'
},
accountContainer:{
flexDirection: 'row',
width: width,
height: 40,
justifyContent: 'center',
backgroundColor: 'white'
},
pwdContainer:{
width: width,
height: 40,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white'
},
text:{
width: 80,
height: 40,
flex:1,
marginLeft: buttonMargin,
marginRight: buttonMargin,
color:'black',
},
pwd: {
flex: 1,
paddingLeft:10,
flex: 4,
borderColor: 'gray',
borderWidth: 1
textAlignVertical:'center',
},
button: {
marginLeft: buttonMargin,
... ... @@ -128,6 +129,6 @@ var styles = StyleSheet.create({
line:{
width: width,
height: 1,
backgroundColor: 'gray',
}
});
... ...
... ... @@ -177,7 +177,7 @@ export default class NavBar extends React.Component {
if (CONFIG.sceneKey.user === sceneKey) {
return (
<View style={styles.userInfoContainer}>
<View style={styles.userInfoContainer} >
<Text style={styles.userInfoTitle} onPress={() => {console.log('title pressed');}}>vans旗舰店</Text>
<Image source={require('../images/white.png')} style={styles.whiteArrow}/>
</View>
... ...
... ... @@ -16,7 +16,11 @@ export default keyMirror({
PWD_CHANGE:null,
PWD_DISPLAY:null,
PWD_MODIFY:null,
PWD_MODIFY_OLD:null,
PWD_MODIFY_NEW:null,
PWD_MODIFY_REPEAT:null,
PWD_MODIFY_SUBMIT:null,
LOGIN_REQUEST: null,
LOGIN_SUCCESS: null,
LOGIN_FAILURE: null,
... ...
... ... @@ -19,7 +19,7 @@ let {
Image,
TextInput,
Dimensions,
Alert
Alert,
} = React;
/**
... ... @@ -85,6 +85,7 @@ export default class LogoutContainer extends Component {
return (
<Logout
account={this.props.user.profile.account}
username={this.props.user.profile.username}
pwd={this.props.user.profile.pid}
onLogoutPress={this.onLogoutPress}
onModifyPress={this.onModifyPress}
... ...
... ... @@ -61,8 +61,10 @@ export default class ModifyPasswordContainer extends Component {
constructor(props) {
super(props);
this.onLogoutPress = this.onLogoutPress.bind(this);
this.onModifyPress = this.onModifyPress.bind(this);
this.onModifyOldPwd = this.onModifyOldPwd.bind(this);
this.onModifyNewPwd = this.onModifyNewPwd.bind(this);
this.onModifyRepeatPwd = this.onModifyRepeatPwd.bind(this);
this.onModifySubmitPress = this.onModifySubmitPress.bind(this);
}
componentDidMount() {
... ... @@ -73,20 +75,38 @@ export default class ModifyPasswordContainer extends Component {
}
onLogoutPress(){
this.props.actions.logout();
onModifyOldPwd(text:string){
this.props.actions.pwdModifyOld(text);
}
onModifyPress(){
this.props.actions.pwdModify();
onModifyNewPwd(text:string){
this.props.actions.pwdModifyNew(text);
}
onModifyRepeatPwd(text:string){
this.props.actions.pwdModifyRepeat(text);
}
onModifySubmitPress(){
Alert.alert(
'修改密码',
this.props.user.password.old+'+'+this.props.user.password.new+'+'+this.props.user.password.repeat,
[
{text: 'OK', onPress: () => this.props.actions.pwdModifySubmit()},
]
);
}
render() {
return (
<ModifyPassword
account={this.props.user.profile.account}
pwd={this.props.user.profile.pid}
onLogoutPress={this.onLogoutPress}
oldPwd={this.props.user.password.old}
newPwd={this.props.user.password.new}
repeatPwd={this.props.user.password.repeat}
onModifyOldPwd={this.onModifyOldPwd}
onModifyNewPwd={this.onModifyNewPwd}
onModifyRepeatPwd={this.onModifyRepeatPwd}
onModifySubmitPress={this.onModifySubmitPress}
/>
);
... ...
... ... @@ -20,6 +20,10 @@ const {
PWD_CHANGE,
PWD_DISPLAY,
PWD_MODIFY,
PWD_MODIFY_OLD,
PWD_MODIFY_NEW,
PWD_MODIFY_REPEAT,
PWD_MODIFY_SUBMIT,
LOGIN_REQUEST,
LOGIN_SUCCESS,
... ... @@ -54,7 +58,8 @@ export function userItemsPressed(item) {
};
case 1:
Actions.AboutUs();
// Actions.AboutUs();
Actions.Logout();
return {
type: ABOUT_US,
};
... ... @@ -117,13 +122,13 @@ export function accountClean() {
export function pwdChange(pwd) {
return {
type: PWD_CHANGE,
payload: pwd
payload: pwd
};
}
export function pwdDisplay(ishow) {
return {
type: PWD_DISPLAY,
payload: ishow
payload: ishow
};
}
... ... @@ -141,6 +146,39 @@ export function pwdModify() {
};
}
export function pwdModifyOld(pwd) {
return {
type: PWD_MODIFY_OLD,
payload: pwd
};
}
export function pwdModifyNew(pwd) {
return {
type: PWD_MODIFY_NEW,
payload: pwd
};
}
export function pwdModifyRepeat(pwd) {
return {
type: PWD_MODIFY_REPEAT,
payload: pwd
};
}
export function pwdModifySubmit() {
return {
type: PWD_MODIFY_SUBMIT
};
}
export function login(account, password) {
return dispatch => {
dispatch(loginRequest());
... ...
... ... @@ -23,13 +23,18 @@ let InitialState = Record({
error: null,
isValid: false,
isFetching: false,
isShowPwd:false,
isShowPwd:false,
profile: new (Record({
account: '',
pid: '',
username: '',
sessionKey: '',
})),
password: new (Record({
new: '',
old: '',
repeat: '',
})),
shops: List(),
listItems: List([
{
... ...
... ... @@ -23,6 +23,10 @@ const {
PWD_CHANGE,
PWD_DISPLAY,
PWD_MODIFY,
PWD_MODIFY_OLD,
PWD_MODIFY_NEW,
PWD_MODIFY_REPEAT,
PWD_MODIFY_SUBMIT,
LOGIN_REQUEST,
LOGIN_SUCCESS,
... ... @@ -69,7 +73,24 @@ export default function userReducer(state = initialState, action) {
let nextState = state.setIn(['profile', 'pid'], action.payload);
return nextState;
}
case PWD_MODIFY_OLD:{
let nextState = state.setIn(['password', 'old'], action.payload);
return nextState;
}
case PWD_MODIFY_NEW:{
let nextState = state.setIn(['password', 'new'], action.payload);
return nextState;
}
case PWD_MODIFY_REPEAT:{
let nextState = state.setIn(['password', 'repeat'], action.payload);
return nextState;
}
case PWD_MODIFY_SUBMIT:{
let nextState = state.setIn(['password', 'old'], '')
.setIn(['password', 'new'], '')
.setIn(['password', 'repeat'], '');
return nextState;
}
case LOGOUT_REQUEST:{
let nextState = state.setIn(['profile', 'pid'], '').setIn(['profile', 'account'], '')
.setIn(['profile', 'pid'], '')
... ...