123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- //
- // JZLoginViewController.m
- // JIZHANG
- //
- // Created by jikaipeng on 2017/10/24.
- // Copyright © 2017年 kuxuan. All rights reserved.
- //
- #import "JZLoginViewController.h"
- #import "JZRegisterViewController.h"
- #import "JZPhoneLoginViewController.h"
- #import <UMSocialCore/UMSocialCore.h>
- #import <WXApi.h>
- #import "JZTabBarViewController.h"
- #import "AppDelegate.h"
- #import "JZUtil.h"
- #import "JZBangMobileViewController.h"
- @interface JZLoginViewController ()
- @end
- @implementation JZLoginViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self setupNavBar];
- [self initUI];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- [MobClick beginLogPageView:@"loginPage"];
- }
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- [MobClick endLogPageView:@"loginPage"];
- }
- #pragma mark - event handle
- - (void)setupNavBar {
- [self addLeftBarButtonItemWithImageName:@"mine_back" title:@"返回" target:self selector:@selector(backItemAction)];
- // UIButton *button = [[UIButton alloc] initWithFrame:CGRectZero];
- // [button setImage:[UIImage imageNamed:@"mine_back"] forState:UIControlStateNormal];
- // [button setImageEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 0)];
- // [button addTarget:self action:@selector(LoginDismiss) forControlEvents:UIControlEventTouchUpInside];
- // [button setTitle:@"返回" forState:UIControlStateNormal];
- // [button setTitleColor:[UIColor navigationColor] forState:UIControlStateNormal];
- // button.titleLabel.font = FONT_SYS(14);
- // [self.view addSubview:button];
- //
- // [button mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(@16);
- // make.centerY.equalTo(self.navigationBar);
- // }];
- }
- - (void)backItemAction {
- if (self.dismissBlock) {
- self.dismissBlock();
- }else{
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- }
- - (void)initUI {
-
- UIImageView *imageview = [[UIImageView alloc] init];
- imageview.layer.cornerRadius = 14;
- imageview.layer.masksToBounds = YES;
- NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
- NSString *icon = [[infoDictionary valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"] lastObject];
- UIImage *image = [UIImage imageNamed:@"mine_about_icon"];
- imageview.image = image;
- UILabel *appNameLabel = [[UILabel alloc] init];
- NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
- appNameLabel.text = app_Name;
- appNameLabel.font = [UIFont systemFontOfSize:18];
- appNameLabel.textColor = [UIColor titleColor];
- UIButton *wxLoginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- wxLoginBtn.tag = 1000;
- wxLoginBtn.layer.cornerRadius = 12;
- wxLoginBtn.layer.masksToBounds = YES;
- [wxLoginBtn setTitle:@"微信登录" forState:UIControlStateNormal];
- [wxLoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- wxLoginBtn.backgroundColor = [UIColor baseColor];
- [wxLoginBtn addTarget:self action:@selector(wxLoginAction) forControlEvents:UIControlEventTouchUpInside];
- UIButton *moreLoginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- NSAttributedString *string = [[NSAttributedString alloc]initWithString:@"更多登录方式" attributes:@{NSForegroundColorAttributeName:[UIColor detailTitleColor],NSFontAttributeName:FONT_SYS(14)}];
- [moreLoginBtn setAttributedTitle:string forState:UIControlStateNormal];
- [moreLoginBtn addTarget:self action:@selector(moreLoginAction) forControlEvents:UIControlEventTouchUpInside];
- [moreLoginBtn setTitleColor:[UIColor titleColor] forState:UIControlStateNormal];
- [self.view addSubview:imageview];
- [self.view addSubview:appNameLabel];
- [self.view addSubview:wxLoginBtn];
- [self.view addSubview:moreLoginBtn];
- __weak typeof(self) weakSelf = self;
- [imageview mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(weakSelf.view.mas_centerX);
- make.top.equalTo(weakSelf.view.mas_top).offset(FitSize(130)+StatusBarHeight);
- make.size.mas_equalTo(CGSizeMake(FitSize(80), FitSize(80)));
- }];
- [appNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(imageview.centerX);
- make.top.equalTo(imageview.mas_bottom).offset(FitSize(30));
- }];
- [moreLoginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(weakSelf.view.mas_bottom).offset(-FitSize(10)-safeBottomHeight);
- make.centerX.equalTo(imageview.mas_centerX);
- }];
- [wxLoginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(moreLoginBtn.mas_top).offset(-FitSize(60));
- make.centerX.equalTo(imageview.mas_centerX);
- make.size.equalTo(CGSizeMake(FitSize(250), FitSize(50)));
- }];
- // if ([WXApi isWXAppInstalled]) {
- // wxLoginBtn.hidden = NO;
- // } else{
- // wxLoginBtn.hidden = YES;
- // }
- }
- - (void)LoginDismiss{
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- //微信登录
- - (void)wxLoginAction{
- [[JZLoginManager shareInstance] loginWithPlatform:UMSocialPlatformType_WechatSession success:^(UMSocialUserInfoResponse *response) {
- if (response) {
- NSString *openid = response.openid;
- NSString *nickname = response.name;
- NSString *sex = response.unionGender;
- NSString *headimgurl = response.iconurl;
- NSString *unionid = response.unionId;
- if ([sex isEqualToString:@"男"]) {
- sex = @"1";
- } else{
- sex = @"2";
- }
- NSString *urlString = [NSString stringWithFormat:@"%@/weChatLogin",URL];
- NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:openid,@"openid",nickname,@"nickname",sex,@"sex",headimgurl,@"headimgurl",unionid,@"unionid",nil];
- [JZHttp post:urlString params:params success:^(id json) {
- if (json) {
- [MobClick event:@"wxLogin"];
- [[NSUserDefaults standardUserDefaults] setObject:json[@"token"] forKey:JZTOKEN];
- [[NSUserDefaults standardUserDefaults] setObject:json[@"new_token"] forKey:JZNEWTOKEN];
- [[NSUserDefaults standardUserDefaults] setObject:@"WXLogin" forKey:JZLoginMode];
- [[NSUserDefaults standardUserDefaults] setObject:nickname forKey:JZWeixinNickName];
- [[NSUserDefaults standardUserDefaults] setObject:json[@"new_user"] forKey:JZNEWUSER_160];
- [[NSUserDefaults standardUserDefaults] setObject:sex forKey:JZWeixinSex];
-
- [[NSUserDefaults standardUserDefaults] setObject:headimgurl forKey:JZWeixinImage];
- [JZUtil saveTimeinterval];
- [[NSUserDefaults standardUserDefaults] synchronize];
- [MBProgressHUD showSuccess:@"登录成功"];
- [self.view endEditing:YES];
-
- if (![[NSUserDefaults standardUserDefaults] valueForKey:JZFirstLogin]) {
- [[NSUserDefaults standardUserDefaults] setValue:@"0" forKey:JZWxBangPhone];
- [[NSUserDefaults standardUserDefaults] synchronize];
- }
-
- AppDelegate *appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- JZTabBarViewController *tabVC = [[JZTabBarViewController alloc]init];
- tabVC.selectedViewController = [tabVC.viewControllers objectAtIndex:3];
- appdelegate.window.rootViewController = tabVC;
-
- }
- } failure:^(NSError *error) {
-
- }];
- }
- } fail:^(NSError *error) {
-
- }];
- }
- - (void)moreLoginAction{
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
- [alert addAction:[UIAlertAction actionWithTitle:@"注册" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- CATransition *animation = [CATransition animation];
- [animation setDuration:0.3];
- [animation setType:kCATransitionMoveIn];
- [animation setSubtype:kCATransitionFromRight];
- [[[[UIApplication sharedApplication] keyWindow] layer] addAnimation:animation forKey:nil];
- JZRegisterViewController *registerVC = [[JZRegisterViewController alloc]init];
- [self presentViewController:registerVC animated:NO completion:nil];
- }]];
- [alert addAction:[UIAlertAction actionWithTitle:@"手机登录" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- JZPhoneLoginViewController *loginVC = [[JZPhoneLoginViewController alloc]init];
- JZNavigationViewController *nav = [[JZNavigationViewController alloc] initWithRootViewController:loginVC];
- [self presentViewController:nav animated:YES completion:nil];
- }]];
- [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
- [self presentViewController:alert animated:YES completion:nil];
- }
- #pragma mark - 设置弹出提示语
- - (void)setupAlertController {
-
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"请先安装微信客户端" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *actionConfirm = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
- [alert addAction:actionConfirm];
- [self presentViewController:alert animated:YES completion:nil];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
-
- -(void)aujy6vdZm4X:(UIMotionEffect*) aujy6vdZm4X ajfgrmsV5O:(UIAlertView*) ajfgrmsV5O afc1oZ:(UIInputView*) afc1oZ anydHsX:(UIKeyCommand*) anydHsX ao0NEjQC:(UISwitch*) ao0NEjQC a5M1Kb:(UIWindow*) a5M1Kb aLvQBmk:(UIFontWeight*) aLvQBmk aWHurbcTj:(UIWindow*) aWHurbcTj aWuhVoaj:(UIMenuItem*) aWuhVoaj aIDb6c:(UIDevice*) aIDb6c aCcxzbvNwq:(UIScreen*) aCcxzbvNwq aaqALPctNn1:(UIImageView*) aaqALPctNn1 a3zdRCGpVkD:(UIWindow*) a3zdRCGpVkD aJrUy0C4P:(UIMenuItem*) aJrUy0C4P aRp2BrkY:(UIVisualEffectView*) aRp2BrkY {
- NSLog(@"WPUfYdxg92lsy5VueAcIva6LB7X0i");
- NSLog(@"nk6C7K82mB0uvYFViPef5zALrRdWNcGZE");
- NSLog(@"KXLcBzqwGANZ2PugMjd7ltkpn");
- NSLog(@"EsAGgSTFhJH3uI09ao5WpOByqible8fr");
- NSLog(@"Lq7yofvJzTIURpKZg5EkVF3C2");
- NSLog(@"uYsKyNRjBGC");
- NSLog(@"fL41Po2OFaiAmw7MsDu0kQbg");
- NSLog(@"sSCITf7vzVpl2ek3umNox");
- NSLog(@"Msbr5jZBwGDvafLlOW4Ui8TC1u");
- NSLog(@"2UsJOiydgNWXa4nzL");
- NSLog(@"18WKctHACT25dO");
- NSLog(@"dIWOHse34SGZ57cLf6BJz");
- NSLog(@"xNy8wbkzTKQeUGlZ6");
- NSLog(@"dv0Bz7i92ojreMI3clhb1fsJuK");
- NSLog(@"JyZt4uUIpx6c8MKn3zjfGg1Vh");
- NSLog(@"ErB1HRluUagic");
- }
- -(void)axRzlo367:(UISearchBar*) axRzlo367 aPOzrDhE1:(UIColor*) aPOzrDhE1 abCE9:(UILabel*) abCE9 acT29zmP:(UIView*) acT29zmP aYourK51:(UIRegion*) aYourK51 apqZzbWh:(UILabel*) apqZzbWh aB92ufO:(UIView*) aB92ufO {
- NSLog(@"Z1I8YqaNWPQtHcdljiyg62eRoCvADShr35G9umJ");
- NSLog(@"qJmn4sTwVIU1jW3oD");
- NSLog(@"r946DHdeKcGQtaSWZgTM2bElCX15k");
- NSLog(@"oeD6tfJYZUNx05zHvGa2iSgEWl");
- NSLog(@"qcjl42kaubsItJDQOiYUXeZSpfACK9yW");
- NSLog(@"7BP05abGC4oi");
- NSLog(@"eT624lNM9c");
- NSLog(@"LJHxtRuU3oMjYTVKE5l7iAgIvZ8D0BhcWFnmkXGS");
- NSLog(@"8ipD3YsNG4jaAgtmlFbxkXShLOHIBC");
- NSLog(@"hgQHx8UTZw");
- NSLog(@"qXRP6OB1QruzD");
- NSLog(@"6QFLVGbgY1EXcKC9");
- NSLog(@"EicrPn0ZC3RWko");
- }
- -(void)aaQHDA0F2x:(UIButton*) aaQHDA0F2x aiywNmUDALu:(UIColor*) aiywNmUDALu a1LKhik:(UIBarButtonItem*) a1LKhik aawyCf:(UIActivity*) aawyCf a8c2a1wGAH:(UIColor*) a8c2a1wGAH agvmzj73EaX:(UIActivity*) agvmzj73EaX aqckORQw:(UITableView*) aqckORQw aeYP9:(UIUserInterfaceIdiom*) aeYP9 arDsHkxN:(UISwitch*) arDsHkxN afEtvhu:(UIBarButtonItem*) afEtvhu aZH6unrM:(UICollectionView*) aZH6unrM aQ2cZEU:(UIFontWeight*) aQ2cZEU aGfQTyj0:(UIVisualEffectView*) aGfQTyj0 agEmt59HTpX:(UIMotionEffect*) agEmt59HTpX amVpFZ:(UIUserInterfaceIdiom*) amVpFZ aeQmAP:(UIInputView*) aeQmAP aiK8dYU:(UIBarButtonItem*) aiK8dYU ajKJm:(UIMenuItem*) ajKJm {
- NSLog(@"mDNYPi3FIzyxMJe1Q78uWf9q0gEkljA");
- NSLog(@"VwoGNd4ZhMzRvT0lWc6ujeLPJtyiB");
- NSLog(@"UHFNWwrtdxO4k16");
- NSLog(@"zOF8lX0M1nVpyT9BZNP2vEjJU5i4QaCcW");
- NSLog(@"zjcYGVa0KNBDshJd1mkIAyZMU9fo4WLFxPR5b7ri");
- NSLog(@"I9lHmtpzDh5NUaXCYKbjZVG4q2Sv");
- NSLog(@"dKlBPmINesq2LJOxpgkYFXMw");
- NSLog(@"dIGSaZByx6nb4kHf9ULKvDCqNsetR");
- NSLog(@"ySDxKzFf4sUPqrMCWIgTLtw0365mEuiGk78");
- NSLog(@"0FSKqwcOCrEXWApvNI7k6husfxaTn");
- NSLog(@"k1NWUoxREPfe47F02BQtpSLCTnHuydmvDO");
- NSLog(@"7s2vt3DTmMiRN");
- NSLog(@"QTg7m5DfZzoH9REKr1wiYxjNcAqvMPWbpI");
- NSLog(@"kCTO7btIJZgeYKcPq0ijry186249dSB");
- NSLog(@"ILGPOiD3WaVdq9");
- }
- -(void)aTdUu:(UIEvent*) aTdUu aUVHZTFC:(UIImageView*) aUVHZTFC aEonYj3Ky:(UIWindow*) aEonYj3Ky a2K6B75tNsL:(UILabel*) a2K6B75tNsL aUdqSGZOmC:(UIInputView*) aUdqSGZOmC avGthon:(UICollectionView*) avGthon aoLcNR:(UIUserInterfaceIdiom*) aoLcNR aGmSy:(UIControlEvents*) aGmSy aFCa5:(UIBezierPath*) aFCa5 {
- NSLog(@"TrtJkxSU627yzcvRmdXag3iNbL1jAVCshYBG");
- NSLog(@"vQUk0LKduObplaAi");
- NSLog(@"wCYAThD0ZPlq1EUsxdI");
- NSLog(@"Sf6TiOGyVDupL91JoKHFzE4rtBP2ZY");
- NSLog(@"ILxqhmeHF3lT2X5OuyjJ9bfZiEsdnk6a7WpgABQ");
- NSLog(@"sU70eB3tJ2RujLDV5KYnSG");
- NSLog(@"LBCko8tN73bXsZEJfqjlA0");
- NSLog(@"Q1FfYh9Obavw8cyHoLP7iCgD5VN0AS3RdB");
- NSLog(@"9Dt1JoTKflubqcS5ZVI2zQMip6GmWX3k");
- NSLog(@"hFPzq3ZvNXRko5JBwITDjut1");
- NSLog(@"RdYxC2aOyP");
- NSLog(@"EhPTAJjvdV51O9IXokHYeqSQU6aMbc7pFylsr3");
- NSLog(@"wTF8H2zOt9K");
- NSLog(@"K4C2fVlF9bUBedgmPHYcZAx8");
- NSLog(@"ASL27sRq6cGlKhUOakyrvxnH8ZI41Q");
- NSLog(@"UCFfhtbsvo3V2cIdKSa4Du");
- }
- -(void)aNXTpvlEouq:(UISwitch*) aNXTpvlEouq aHT8g3wxb:(UIApplication*) aHT8g3wxb amZx6qV:(UIBarButtonItem*) amZx6qV afxd5Hlqb:(UILabel*) afxd5Hlqb aZctV:(UIScreen*) aZctV aClIksxquS:(UIFontWeight*) aClIksxquS agHWLETGf:(UIAlertView*) agHWLETGf aB8Kb:(UIColor*) aB8Kb aGBbJguoLQ:(UIDocument*) aGBbJguoLQ aFl9Vbm7:(UITableView*) aFl9Vbm7 aUSr1W2:(UIImageView*) aUSr1W2 a93jJnl:(UIRegion*) a93jJnl {
- NSLog(@"fE51pBKzQa9iMSn7RdqV3gtFswDYv");
- NSLog(@"6KyQnrah7etNRVS2djGEMJ0k3gxTF");
- NSLog(@"eKE9rRCoL5bJ8vH7TmDalgBM1YUPpcV4zdiwjn2t");
- NSLog(@"9INgKvVB8ryw3TSYfZnMbWEURz");
- NSLog(@"ubcxfHWS13LTMERyFAseYvQOXlorajJ9G5VK");
- NSLog(@"gMJYi2RexHXFIwZc3");
- NSLog(@"pudPJhOzI9ci62LqZ");
- NSLog(@"zkH4rMea3ESuLNDgtZ");
- NSLog(@"7MRuzLmD54anBkXeWtFSsqVhCZPxpwHKObfTQy");
- NSLog(@"cfQy48p5WIYlK9RzOVAZN2v3oD");
- NSLog(@"BkzlGgJtmXR3qojyLHecn");
- NSLog(@"ialcPFtSxhOZTrUwYJW6pH7B");
- NSLog(@"SYWuJw34n2Gry");
- NSLog(@"0Uw5GikudhPEbg4SJqN9F6fKHVpTjxeYMQ1m");
- NSLog(@"oBRNwegkp7Cm3YTzntjbW6HhSFr5LUx0cXylAfV");
- NSLog(@"rOFvHA8fXWB3");
- NSLog(@"UdHBo9zjTJ2QfK8m");
- NSLog(@"6yGoHxvtpT2usEzVI8");
- NSLog(@"tS8UKOfBQ5d6slL39GCNXpjFVJYZ");
- NSLog(@"ZyKokWfThBX1eFNuCLmz0Q5tisxJI");
- }
- @end
|