Files
featherVoice/QXLive/Mine(音域)/Controller/设置/QXSetPwdViewController.m

104 lines
4.3 KiB
Mathematica
Raw Normal View History

2025-08-08 10:49:36 +08:00
//
// QXSetPwdViewController.m
// QXLive
//
// Created by on 2025/5/12.
//
#import "QXSetPwdViewController.h"
#import "QXLoginTextField.h"
#import "QXLoginNetwork.h"
#import "QXMineNetwork.h"
@interface QXSetPwdViewController ()<QXLoginTextFieldDelegate>
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *mobileLabel;
@property (nonatomic,strong)QXLoginTextField *codeTextField;
@property (nonatomic,strong)QXLoginTextField *pwdTextField;
@property (nonatomic,strong)QXLoginTextField *repwdTextField;
@property (nonatomic,strong)UIButton *commitBtn;
@end
@implementation QXSetPwdViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = QXText(@"设置密码");
}
-(void)initSubViews{
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.text = QXText(@"当前手机号");
self.titleLabel.textColor = RGB16(0x999999);
self.titleLabel.font = [UIFont systemFontOfSize:12];
[self.view addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(NavContentHeight+17);
make.height.mas_equalTo(18);
}];
self.mobileLabel = [[UILabel alloc] init];
self.mobileLabel.text = [QXGlobal shareGlobal].loginModel.mobile;
self.mobileLabel.textColor = QXConfig.textColor;
self.mobileLabel.font = [UIFont boldSystemFontOfSize:17];
[self.view addSubview:self.mobileLabel];
[self.mobileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel.mas_right).offset(4);
make.centerY.equalTo(self.titleLabel);
make.height.mas_equalTo(28);
}];
self.codeTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, NavContentHeight+56, SCREEN_WIDTH-32, 44) type:(LoginTextTypeCode)];
self.codeTextField.backgroundColor = RGB16(0xEFF2F8);
[self.codeTextField addRoundedCornersWithRadius:11];
self.codeTextField.delegate = self;
[self.view addSubview:self.codeTextField];
self.pwdTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, self.codeTextField.bottom+16, SCREEN_WIDTH-32, 44) type:(LoginTextTypePassword)];
self.pwdTextField.backgroundColor = RGB16(0xEFF2F8);
[self.view addSubview:self.pwdTextField];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.pwdTextField.bottom+16, SCREEN_WIDTH-38*2, 42)];
[self.commitBtn setTitle:QXText(@"提交") forState:(UIControlStateNormal)];
self.commitBtn.needEventInterval = 0.6;
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.view addSubview:self.commitBtn];
}
-(void)didClickSendCode:(UIButton *)sender{
MJWeakSelf
[QXLoginNetwork getSmscodeWithMobile:[QXGlobal shareGlobal].loginModel.mobile
type:GetSmscodeTypeSetPassword
successBlock:^(id _Nonnull responseObject) {
[weakSelf.codeTextField startTimeDown];
}
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)commitAction{
QXLOG(@"提交密码");
MJWeakSelf
[QXLoginNetwork changPasswordWithMobile:self.mobileLabel.text
new_password:self.pwdTextField.textField.text
sms_code:self.codeTextField.textField.text
user_id:[QXGlobal shareGlobal].loginModel.user_id
successBlock:^(id _Nonnull responseObject) {
[[NSNotificationCenter defaultCenter] postNotificationName:noticeChangePassword object:nil];
[weakSelf.navigationController popToRootViewControllerAnimated:YES];
}
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
@end