| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- //
- // MOGuildSMSVC.m
- // MiMoLive
- //
- // Created by SuperC on 2023/10/26.
- //
- #import "MOGuildSMSVC.h"
- #import "MOSelectPartitionVC.h"
- #import "MOGuildApplyVC.h"
- @interface MOGuildSMSVC ()
- /** 返回按钮距离顶部的距离 */
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *backBtnTop;
- @property (weak, nonatomic) IBOutlet UILabel *titleLab;
- @property (weak, nonatomic) IBOutlet UIView *phoneBgView;
- @property (weak, nonatomic) IBOutlet UIView *codeBgView;
- @property (weak, nonatomic) IBOutlet UIView *countryNumBgView;
- @property (weak, nonatomic) IBOutlet UIImageView *countryImg;
- @property (weak, nonatomic) IBOutlet BigBtn *countryBtn;
- @property (weak, nonatomic) IBOutlet UITextField *mobileTxf;
- @property (weak, nonatomic) IBOutlet UITextField *codeTxf;
- @property (weak, nonatomic) IBOutlet UIButton *nextBtn;
- /** 最终校验的结果 */
- @property (nonatomic, copy) NSString *resultString;
- @end
- @implementation MOGuildSMSVC
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:YES animated:animated];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view from its nib.
-
- [self setupUI];
- }
- - (IBAction)backBtnClick:(id)sender {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (IBAction)countryChangeBtnClick:(id)sender {
- WEAKSELF
- MOSelectPartitionVC *vc = [[MOSelectPartitionVC alloc] init];
- vc.selectCellBlock = ^(MOCountryList * _Nonnull model) {
- __strong typeof(weakSelf) self = weakSelf;
- [self.countryBtn setTitle:model.num forState:UIControlStateNormal];
- };
- [self.navigationController pushViewController:vc animated:YES];
- }
- //获取验证码
- - (IBAction)sendSmsBtnClick:(id)sender {
- if(self.mobileTxf.text.length == 0)
- {
- [MBProgressHUD showTipMessageInView:NSLocalString(@"mimo_login_hint_phone")];
- return;
- }
-
- [MBProgressHUD showActivityMessageInView:@""];
- WEAKSELF
- NSDictionary *dic = @{@"code":self.countryBtn.titleLabel.text,
- @"num":self.mobileTxf.text};
-
- [kHttpManager toGetGuildMobileCodeWithParams:dic andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
-
- [MBProgressHUD hideHUD];
-
- if(kCode_Success){
- [MBProgressHUD showTipMessageInView:NSLocalString(@"mimo_login_hint_verify_code")];
- [weakSelf.codeTxf becomeFirstResponder];
- }
- else{
- kShowNetError(data)
- }
- }];
- }
- //校验手机验证码
- - (IBAction)nextBtnClick:(id)sender {
- //验证码登录
- if(self.mobileTxf.text.length == 0)
- {
- [MBProgressHUD showTipMessageInView:NSLocalString(@"mimo_login_hint_phone")];
- return;
- }
-
- if(self.codeTxf.text.length == 0){
- [MBProgressHUD showTipMessageInView:NSLocalString(@"mimo_login_hint_verify_code")];
- return;
- }
-
- [MBProgressHUD showActivityMessageInView:@""];
- WEAKSELF
- NSDictionary *mobileDict = @{@"code":self.countryBtn.titleLabel.text,
- @"num":self.mobileTxf.text};
-
- NSDictionary *dict = @{@"mobile":mobileDict,
- @"code":self.codeTxf.text};
- [kHttpManager toGetGuildApplyVerifyMobileWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
-
- [MBProgressHUD hideHUD];
-
- if(kCode_Success){
-
- weakSelf.resultString = [MODataManager objectOrNilForKey:@"result" fromDictionary:data[@"data"]];
-
- MOGuildApplyVC *vc = [[MOGuildApplyVC alloc] init];
- vc.resultString = weakSelf.resultString;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }
- else{
- kShowNetError(data)
- }
- }];
- }
- - (void)setupUI{
-
- self.titleLab.text = NSLocalString(@"mimo_guild_apply_to_settle_in_title");
- self.mobileTxf.placeholder = NSLocalString(@"mimo_login_hint_phone");
- self.codeTxf.placeholder = NSLocalString(@"mimo_login_hint_verify_code");
- [self.nextBtn setTitle:NSLocalString(@"mimo_anchor_next") forState:UIControlStateNormal];
-
- CGFloat statusBarHeight = STATUS_BAR_HEIGHT;
- self.backBtnTop.constant = statusBarHeight + 12.0;
-
- self.phoneBgView.layer.cornerRadius = 12.0;
- self.phoneBgView.layer.masksToBounds = YES;
-
- self.countryNumBgView.layer.cornerRadius = 6.0;
- self.countryNumBgView.layer.masksToBounds = YES;
-
- //右图左文
- self.countryBtn.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
- self.countryBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
-
- self.codeBgView.layer.cornerRadius = 12.0;
- self.codeBgView.layer.masksToBounds = YES;
-
- NSArray *colorArr = @[[MOTools colorWithHexString:@"#FF62EE" alpha:1.0],[MOTools colorWithHexString:@"#9923FF" alpha:1.0]];
- UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, (SCREENWIDTH - 36.0 * 2), 50.0) Colors:colorArr GradientType:0];
- [self.nextBtn setBackgroundImage:image forState:UIControlStateNormal];
- self.nextBtn.layer.cornerRadius = 50.0 / 2.0;
- self.nextBtn.layer.masksToBounds = YES;
- }
- @end
|