add
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// GIGaChangePassVC.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/19.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GIGaChangePassVC.h"
|
||||
#import "GiGaBaseAPiRequest.h"
|
||||
|
||||
@interface GIGaChangePassVC ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation GIGaChangePassVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self addNavTitile:@"修改密码"];
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
UIButton *saveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[saveBtn addTarget:self action:@selector(doBtnAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
saveBtn.frame = CGRectMake(0, 0,40, 36);
|
||||
NSAttributedString *attrititle = [GiGaHelper stringWithText:@"完成" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTMEDIUM(16) leterSpace:0];
|
||||
[saveBtn setAttributedTitle:attrititle forState:UIControlStateNormal];
|
||||
UIBarButtonItem *saveItem = [[UIBarButtonItem alloc] initWithCustomView:saveBtn];
|
||||
self.navigationItem.rightBarButtonItem = saveItem;
|
||||
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
-(void)doBtnAction:(UIButton *)btn{
|
||||
|
||||
if (self.oldPassField.text.length == 0) {
|
||||
|
||||
//[self.view makeToast:@"请输入原密码" duration:2 position:CSToastPositionTop];
|
||||
GIGA_ShowToast(@"请输入新密码");
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.xinPassFiled.text.length == 0) {
|
||||
//[self.view makeToast:@"请输入新密码" duration:2 position:CSToastPositionTop];
|
||||
GIGA_ShowToast(@"请输入新密码");
|
||||
return;
|
||||
}
|
||||
|
||||
int leng = [GiGaHelper convertToInt: self.xinPassFiled.text];
|
||||
if (!(leng >= 6 && leng <= 20)) {
|
||||
GIGA_ShowToast(@"请输入6-20位数字和字母组成的新密码");
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.reNewPassFiled.text.length == 0) {
|
||||
GIGA_ShowToast(@"请输入新密码");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (self.reNewPassFiled.text != self.xinPassFiled.text) {
|
||||
GIGA_ShowToast(@"两次输入密码不一致!");
|
||||
return;
|
||||
}
|
||||
|
||||
[self newPassBtnAction:btn];
|
||||
|
||||
}
|
||||
|
||||
-(void)newPassBtnAction:(UIButton *)btn{
|
||||
|
||||
btn.userInteractionEnabled = NO;
|
||||
[self.view makeToastActivity:CSToastPositionCenter];
|
||||
NSDictionary *params = @{
|
||||
@"password":self.oldPassField.text,
|
||||
@"newPassword":self.xinPassFiled.text,
|
||||
@"newPasswordConfirm":self.reNewPassFiled.text
|
||||
};
|
||||
GiGaBaseAPiRequest *requst = [GiGaBaseAPiRequest initWithRequestPath:kPAiUSerEditpwd method:RequestPostMethod parms:params];
|
||||
[requst requstDataWithResult:^(GiGaAPIResult *result) {
|
||||
[self.view hideToastActivity];
|
||||
btn.userInteractionEnabled = YES;
|
||||
if (result.success) {
|
||||
GIGA_WIndowTost(result.message);
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
}else{
|
||||
if (result.code == 401) {
|
||||
//token失效
|
||||
[GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self];
|
||||
}
|
||||
GIGA_WIndowTost(result.message);
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user