123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- //
- // AS_LoginC.m
- // Asteria
- //
- // Created by 王猛 on 2023/5/15.
- //
- #import "AS_LoginC.h"
- #import "EamilTFmatchV.h"
- #import "PassWordSecureBtnV.h"
- #import "LoginThirdAuthV.h"
- #import <AFNetworking/AFNetworking.h>
- @interface AS_LoginC ()
- @property (nonatomic, strong) UIScrollView *scrollview;
- @property (nonatomic, strong) EamilTFmatchV *xxx_emailTFV;
- @property (nonatomic, strong) PassWordSecureBtnV *xxx_passwordV;
- @property (nonatomic, strong) UIButton *xxx_logInBtn;
- @property (nonatomic, strong) LoginThirdAuthV *xxx_authV;
- @end
- @implementation AS_LoginC
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.customNavBar.hidden = YES;
- self.navigationController.navigationBar.hidden = YES;
- }
- - (void)initSubviews{
- [super initSubviews];
- [self.view addSubview:self.scrollview];
- UIView *logNav = [self logNavView];
- [self.scrollview addSubview:logNav];
- UIImageView *Hi_imgV = [[UIImageView alloc]init];
- UIImage *hiImg = [UIImage imageNamed:@"login_HI"];
- Hi_imgV.image = hiImg;
- Hi_imgV.frame = CGRectMake(20, CGRectGetMaxY(logNav.frame)+60, KScreenWidth-40, hiImg.size.height/hiImg.size.width*(KScreenWidth-40));
- [self.scrollview addSubview:Hi_imgV];
-
- [self.scrollview addSubview:self.xxx_emailTFV];
- [self.scrollview addSubview:self.xxx_passwordV];
- [self.scrollview bringSubviewToFront:self.xxx_emailTFV];
- [self.scrollview addSubview:self.xxx_logInBtn];
- [self.scrollview addSubview:self.xxx_authV];
-
- self.xxx_emailTFV.mj_y = CGRectGetMaxY(Hi_imgV.frame)+35;
- self.xxx_passwordV.frame = CGRectFlatMake(20, CGRectGetMaxY(self.xxx_emailTFV.frame)+30, KScreenWidth-40, 50+20);
- self.xxx_logInBtn.frame = CGRectMake(20, CGRectGetMaxY(self.xxx_passwordV.frame)+10, KScreenWidth-40, 45);
- self.xxx_authV.mj_y = CGRectGetMaxY(self.xxx_logInBtn.frame)+30;
- }
- -(void)handle_closeEvent:(UIButton *)btn{
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- -(void)handle_xxx_logInBtnEvent:(UIButton *)btn{//进行登录操作
- ///登录的跳转
- if (self.xxx_emailTFV.xxx_emailTF.text.length == 0 || ![Current_normalTool xxx_isValidateEmail:self.xxx_emailTFV.xxx_emailTF.text]) {
- [self.view makeToast:@"* Please prvide an email address." duration:2 position:CSToastPositionCenter];
- return;
- }else if(self.xxx_passwordV.xxx_passwordTF.text.length == 0){
- [self.view makeToast:@"Please input a password" duration:2 position:CSToastPositionCenter];
- return;
- }
- NSString *urlStr = [NSString stringWithFormat:@"%@V1/integration/customer/token",AS_Server];
- NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
- params[@"username"] = self.xxx_emailTFV.xxx_emailTF.text;
- params[@"password"] = self.xxx_passwordV.xxx_passwordTF.text;
- // NSString *josnStr = [Current_normalTool jsonStringFromDictionary:params];
- // [PPNetworkHelper POST:urlStr parameters:params success:^(id responseObject) {
- // NSDictionary *tmpDic= responseObject;
- //
- // } failure:^(NSError *error) {
- // [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter];
- // }];
-
- AFHTTPSessionManager *manager =[AFHTTPSessionManager manager];
-
- manager.requestSerializer = [AFJSONRequestSerializer serializer];
-
- manager.responseSerializer = [AFHTTPResponseSerializer serializer];
-
- manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json", @"text/plain", @"text/html", nil];
- [manager POST:urlStr parameters:params headers:nil progress:^(NSProgress * _Nonnull uploadProgress) {
-
- } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
- NSString * jsonStr = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
- NSDictionary *temDic = [Current_normalTool dicFromjsonStr:jsonStr];
- NSLog(@"%@",temDic);
- } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
-
- }];
-
-
-
- }
- #pragma mark - **************** 懒加载 ****************
- -(UIView *)logNavView{
- IPhoneXHeigh
- UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, securitytop_Y)];
- UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [closeBtn setImage:[UIImage imageNamed:@"common_close"] forState:UIControlStateNormal];
- [closeBtn addTarget:self action:@selector(handle_closeEvent:) forControlEvents:UIControlEventTouchUpInside];
- closeBtn.frame = CGRectMake(20, securitytop_Y-44, 44, 44);
- [topView addSubview:closeBtn];
- UIImageView *headImg = [[UIImageView alloc]init];
- UIImage *bannerImg = [UIImage imageNamed:@"common_headLogo"];
- headImg.image = bannerImg ;
- headImg.frame = CGRectMake((KScreenWidth- bannerImg.size.width)/2, (IPHONEX ? 44 : 20)+20 , bannerImg.size.width, bannerImg.size.height);
- [topView addSubview:headImg];
- return topView;
- }
- - (UIScrollView *)scrollview {
- if (!_scrollview) {
- _scrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
- }
- return _scrollview;
- }
- -(EamilTFmatchV *)xxx_emailTFV{
- if (!_xxx_emailTFV) {
- _xxx_emailTFV = [[EamilTFmatchV alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 50)];
- }
- return _xxx_emailTFV;
- }
- - (PassWordSecureBtnV *)xxx_passwordV {
- if (!_xxx_passwordV) {
- _xxx_passwordV = [[PassWordSecureBtnV alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.xxx_emailTFV.frame)+30, KScreenWidth-40, 50+20)];
- }
- return _xxx_passwordV;
- }
- - (UIButton *)xxx_logInBtn {
- if (!_xxx_logInBtn) {
- _xxx_logInBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_xxx_logInBtn setTitleColor:[UIColor colorWithHexString:@"#000000"] forState:UIControlStateNormal];
- _xxx_logInBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:16];
- [_xxx_logInBtn setTitle:@"LOG IN" forState:UIControlStateNormal];
- [_xxx_logInBtn addTarget:self action:@selector(handle_xxx_logInBtnEvent:) forControlEvents:UIControlEventTouchUpInside];
- _xxx_logInBtn.backgroundColor = ThemeColor;
- _xxx_logInBtn.layer.cornerRadius = 4;
- _xxx_logInBtn.clipsToBounds = YES;
- }
- return _xxx_logInBtn;
- }
- - (LoginThirdAuthV *)xxx_authV {
- if (!_xxx_authV) {
- _xxx_authV = [[LoginThirdAuthV alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 15+20+(36+10)*3)];
- }
- return _xxx_authV;
- }
- @end
|