//
//  logViewController.m
//  Open
//
//  Created by gao on 2017/1/20.
//  Copyright © 2017年 黄江涛 . All rights reserved.
//

#import "logViewController.h"
#import "smallTableVController.h"
#import "enterTableViewController.h"
#import "UIImageView+WebCache.h"
#import "UIButton+WebCache.h"
#import "quickLoginViewController.h"
#import "LoginVC.h"
@interface logViewController ()<smalltableVControllerDelegate>

@property(nonatomic,strong)LoginViewController *loginVC;

@property(nonatomic,strong)UIImageView *imageV2222iew;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightForIphone5s;

@property(nonatomic)BOOL changeButtonBOOL;

//天气
@property (weak, nonatomic) IBOutlet UIImageView *imageWeather;
@property (weak, nonatomic) IBOutlet UILabel *strWeather;

@property (weak, nonatomic) IBOutlet UIButton *buttonWeather;

@property (weak, nonatomic) IBOutlet UIView *pushHidel;

@end

@implementation logViewController
//-(instancetype)initWithCoder:(NSCoder *)aDecoder
//{
//    if (self =[super initWithCoder:aDecoder]) {
////        [self faceToAN:self.greybackgroundView andtranslter:YES];
////        [self faceToAN:self.shareFourView andtranslter:YES];
//    
//        
//        
//        
//    }
//    return self;
//}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:YES];
    self.pushHidel.hidden = YES;
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.pushHidel.hidden = NO;
    
    //    [self getUserInfoForPlatform:UMSocialPlatformType_QQ];
    
    
    AppDelegate *delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
    if (delegate.onLine == NO ) {
        [SVProgressHUD doneShow];
        [SVProgressHUD showErrorWithStatus:@"网络状态不佳"];
        return;
    }
    
    self.strWeather.text=  [[NSUserDefaults standardUserDefaults] objectForKey:@"weatherti1"];
    self.imageWeather.image = [UIImage imageNamed: [[NSUserDefaults standardUserDefaults] objectForKey:@"weatherti2"]];
    delegate.telephoneLoginStr =DIANHUAHUAOMA;
    delegate.telephoneLoginPassport =MIMAPASSPORT;
      [logNetModel getLogMessage3:nil andTelephone:delegate.telephoneLoginStr andLoginpassword:delegate.telephoneLoginPassport  andUid:nil andl:0 andweixinId:nil andPicId:nil completionHandle:^(lodModel *model, NSError *error) {
        ///////
        //          if(model.userinfo.account_type == 0)  [getPeopleID getpeopleLimitedAuthority:YES];else
        // [getPeopleID getpeopleLimitedAuthority:NO];
        if ([getPeopleID getpeopleLimited]  ==YES) {
            
            if([[UIScreen mainScreen]bounds].size.height == 480)
            {
                self.heightForIphone5s.constant = 231 +38.5;
            }else{
                self.heightForIphone5s.constant = 308 + 44;
            }
            
        }else{
            //264 ->220
            
            
            if([[UIScreen mainScreen]bounds].size.height == 480)
            {
                self.heightForIphone5s.constant = 198 +33;
            }else{
                self.heightForIphone5s.constant = 264 +37;
            }
            
            
            
        }
        
        
        
        
        if([[UIScreen mainScreen]bounds].size.height == 568)
        {
            //        self.heightForIphone5s.constant =210;
        }
          
          
          
          
                    self.shareFourView.layer.cornerRadius =15;
                    self.navigationItem.hidesBackButton = YES;
                    self.navigationController.toolbarHidden=YES;
                    self.buttomTitle.layer.masksToBounds=YES;
                    self.buttomTitle.layer.cornerRadius =self.buttomTitle.bounds.size.width*0.5;
                    self.buttomTitle.titleLabel.textColor=[UIColor blackColor];
          
                    [self.buttomTitle.imageView  setContentMode:UIViewContentModeScaleAspectFill];
                    if([[NSUserDefaults standardUserDefaults] boolForKey:@"firstlog"]){
          
                        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"secondImage"]) {
                            //            [self.buttomTitle setBackgroundImage:[ UIImage imageWithData:[getPeopleID getFileImage]] forState:UIControlStateNormal];
                            [self.buttomTitle setImage:[UIImage imageWithData:[getPeopleID getFileImage]]forState:UIControlStateNormal];
                            //                self.buttomTitle.layer.borderWidth=2.0;
          
                        }else
                        {
                            //            [self.buttomTitle sd_setBackgroundImageWithURL:[getPeopleID PeoplePhoto] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"titleimage_1"]];
          
                            [self.buttomTitle sd_setImageWithURL:[getPeopleID PeoplePhoto] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"titleimage_1"]];
          
                            //                self.buttomTitle.layer.borderWidth=2.0;
                        }
                        //        [self.buttomTitle setTitle:[getPeopleID Peopletitle] forState:UIControlStateNormal];
                        self.imageLabel.text = [getPeopleID Peopletitle];
                    }else
                    {
                        //            [self.buttomTitle setBackgroundImage:[UIImage imageNamed:@"Nodenglu"] forState:UIControlStateNormal];
                        [self.buttomTitle setImage:[UIImage imageNamed:@"Nodenglu"] forState:UIControlStateNormal];
                        self.imageLabel.text = @"";
                    }
          
                    //    self.navigationController.toolbarHidden=YES;
          
          
          
          
            /////
                        }];
    
        
        

    
}

//V1.3.2注释了
//-(void)viewWillAppear:(BOOL)animated
//{
//     self.pushHidel.hidden = NO;
//
////    [self getUserInfoForPlatform:UMSocialPlatformType_QQ];
//
//
//    AppDelegate *delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
//    if (delegate.onLine == NO ) {
//          [SVProgressHUD doneShow];
//        [SVProgressHUD showErrorWithStatus:@"网络状态不佳"];
//        return;
//    }
//
//            self.strWeather.text=  [[NSUserDefaults standardUserDefaults] objectForKey:@"weatherti1"];
//            self.imageWeather.image = [UIImage imageNamed: [[NSUserDefaults standardUserDefaults] objectForKey:@"weatherti2"]];
//    delegate.telephoneLoginStr =DIANHUAHUAOMA;
//    delegate.telephoneLoginPassport =MIMAPASSPORT;
//      [logNetModel getLogMessage3:nil andTelephone:delegate.telephoneLoginStr andLoginpassword:delegate.telephoneLoginPassport  andUid:nil andl:0 andweixinId:nil andPicId:nil completionHandle:^(lodModel *model, NSError *error) {
//    ///////
////          if(model.userinfo.account_type == 0)  [getPeopleID getpeopleLimitedAuthority:YES];else
//// [getPeopleID getpeopleLimitedAuthority:NO];
//          if ([getPeopleID getpeopleLimited]  ==YES) {
//
//              if([[UIScreen mainScreen]bounds].size.height == 480)
//              {
//                  self.heightForIphone5s.constant = 231 ;
//              }else{
//                   self.heightForIphone5s.constant = 308 ;
//              }
//
//          }else{
//              //264 ->220
//
//
//              if([[UIScreen mainScreen]bounds].size.height == 480)
//              {
//                    self.heightForIphone5s.constant = 198 ;
//              }else{
//                  self.heightForIphone5s.constant = 264 ;
//              }
//
//
//
//          }
//
//
//
//
//          if([[UIScreen mainScreen]bounds].size.height == 568)
//          {
//              //        self.heightForIphone5s.constant =210;
//          }
//
//
//
//
//          self.shareFourView.layer.cornerRadius =15;
//          self.navigationItem.hidesBackButton = YES;
//          self.navigationController.toolbarHidden=YES;
//          self.buttomTitle.layer.masksToBounds=YES;
//          self.buttomTitle.layer.cornerRadius =self.buttomTitle.bounds.size.width*0.5;
//          self.buttomTitle.titleLabel.textColor=[UIColor blackColor];
//
//          [self.buttomTitle.imageView  setContentMode:UIViewContentModeScaleAspectFill];
//          if([[NSUserDefaults standardUserDefaults] boolForKey:@"firstlog"]){
//
//              if ([[NSUserDefaults standardUserDefaults] boolForKey:@"secondImage"]) {
//                  //            [self.buttomTitle setBackgroundImage:[ UIImage imageWithData:[getPeopleID getFileImage]] forState:UIControlStateNormal];
//                  [self.buttomTitle setImage:[UIImage imageWithData:[getPeopleID getFileImage]]forState:UIControlStateNormal];
//                  //                self.buttomTitle.layer.borderWidth=2.0;
//
//              }else
//              {
//                  //            [self.buttomTitle sd_setBackgroundImageWithURL:[getPeopleID PeoplePhoto] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"titleimage_1"]];
//
//                  [self.buttomTitle sd_setImageWithURL:[getPeopleID PeoplePhoto] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"titleimage_1"]];
//
//                  //                self.buttomTitle.layer.borderWidth=2.0;
//              }
//              //        [self.buttomTitle setTitle:[getPeopleID Peopletitle] forState:UIControlStateNormal];
//              self.imageLabel.text = [getPeopleID Peopletitle];
//          }else
//          {
//              //            [self.buttomTitle setBackgroundImage:[UIImage imageNamed:@"Nodenglu"] forState:UIControlStateNormal];
//              [self.buttomTitle setImage:[UIImage imageNamed:@"Nodenglu"] forState:UIControlStateNormal];
//              self.imageLabel.text = @"";
//          }
//
//          //    self.navigationController.toolbarHidden=YES;
//
//
//
//
//  /////
//              }];
//
//
//}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
    //内存不足时调用的方法，开发者可在需要时释放一些暂不会使用的对象，进而释放内存（基本上我都没用过这个方法）
}



- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view reloadInputViews];
    

    //预取号
   // [CLShanYanSDKManager preGetPhonenumber:nil];
    
    
    
    
    
    if (self.changeView == YES) {
        [self faceToAN:self.greybackgroundView andtranslter:NO];
        [self faceToAN:self.shareFourView andtranslter:NO];
    }else
    {
        [self faceToAN:self.greybackgroundView andtranslter:YES];
        [self faceToAN:self.shareFourView andtranslter:YES];
    }

            UIStoryboard *sb  =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
            logViewController *tc=[sb instantiateViewControllerWithIdentifier:@"smallTableVController"];
    self.view.backgroundColor=[UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
[self addChildViewController:tc];
        self.tableViewContainer.layer.cornerRadius=10.0;
    //加载姓名和身份证
      [self.closeViewButton addTarget:self action:@selector(closeView) forControlEvents:UIControlEventTouchUpInside];

}
-(void)closeView{
    [self faceToAN:self.greybackgroundView andtranslter:YES];
    [self faceToAN:self.shareFourView andtranslter:YES];

}

- (IBAction)jumpToLog:(id)sender {
    

    
    
    if([[NSUserDefaults standardUserDefaults] boolForKey:@"firstlog"]){
        [self.buttomTitle setTitle:[[NSUserDefaults standardUserDefaults]valueForKey:@"NameID"] forState:UIControlStateNormal];
        UIStoryboard *sb  =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
        enterTableViewController *tc=[sb instantiateViewControllerWithIdentifier:@"enterTableViewController"];
        tc.hidesBottomBarWhenPushed=YES;
        [self.navigationController pushViewController:tc animated:YES];
    }else{
        
        
        //耗时开始计时
       // CFAbsoluteTime startButtonClick   = CFAbsoluteTimeGetCurrent();
        
//        [sender setEnabled:NO];
//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//            [sender setEnabled:YES];
//        });
        
//        CGFloat screenScale = [UIScreen mainScreen].bounds.size.width/375.0;
//
//        CLUIConfigure * baseUIConfigure = [CLUIConfigure new];
//        baseUIConfigure.viewController = self;
//        //NAV
//        baseUIConfigure.cl_navigation_backgroundClear = @(YES);
//        baseUIConfigure.cl_navigation_backBtnImage = [UIImage imageNamed:@"928返回"];
//
//        //LOGO
//        baseUIConfigure.clLogoImage = [UIImage imageNamed:@"logo"];
//        baseUIConfigure.clLogoWidth = @(100);
//        baseUIConfigure.clLogoHeight = @(100);
//        baseUIConfigure.clLogoOffsetY = @(100 * screenScale);
//
//        //手机号显示控件
//        baseUIConfigure.clPhoneNumberColor = UIColor.blackColor;
//        baseUIConfigure.clPhoneNumberOffsetY = @(250*screenScale);
//        baseUIConfigure.clPhoneNumberWidth = @(200);
//        baseUIConfigure.clPhoneNumberHeight = @(20);
//        baseUIConfigure.clPhoneNumberFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:20.0];
//
//        baseUIConfigure.clLoginBtnText = @"本机号一键登录";
//        baseUIConfigure.clLoginBtnBgColor = [UIColor colorWithRed:27/255.0 green:132/255.0 blue:208/255.0 alpha:1.0];
//        baseUIConfigure.clLoginBtnTextColor = [UIColor whiteColor];
//        baseUIConfigure.clLoginBtnOffsetY = @(290*screenScale);
//        baseUIConfigure.clLoginBtnWidth = @(self.view.bounds.size.width * 0.8);
//        baseUIConfigure.clLoginBtnHeight =  @(40);
//        baseUIConfigure.clLoginBtnCornerRadius = @(20);
//
//        // baseUIConfigure.clAppPrivacyName = @"《我测条款名》";
//        // baseUIConfigure.clAppPrivacyUrlString = @"https://www.baidu.com";
//        // baseUIConfigure.clAppPrivacyColor = UIColor.greenColor;
//
//        //CustomAreaView
//        __weak typeof(self) weakSelf = self;
//        baseUIConfigure.customAreaView = ^(UIView * _Nonnull customAreaView) {
//            //customAreaView为导航条以下的全屏 375*667比例系数适配 默认375*667下一键登录button底部y约为 270
//
//            UIButton * button = [[UIButton alloc]init];
//            [button setTitle:@"其他方式登录" forState:(UIControlStateNormal)];
//            button.titleLabel.font = [UIFont systemFontOfSize:14];
//            [button setTitleColor:[UIColor grayColor] forState:(UIControlStateNormal)];
//            [button addTarget:weakSelf action:@selector(otherLoginWayBtnCliced:) forControlEvents:(UIControlEventTouchUpInside)];
//            [customAreaView addSubview:button];
//
//            [button mas_makeConstraints:^(MASConstraintMaker *make) {
//                make.left.right.mas_equalTo(0);
//                make.top.mas_equalTo(340*screenScale);
//                make.height.mas_equalTo(40);
//            }];
//        };
//
//        [SVProgressHUD setContainerView:self.view];
//        [SVProgressHUD show];
//
//        [CLShanYanSDKManager quickAuthLoginWithConfigure:baseUIConfigure timeOut:4 complete:^(CLCompleteResult * _Nonnull completeResult) {
//
//            [SVProgressHUD dismiss];
//
//            if (completeResult.error) {
//
//                //提示：错误无需提示给用户，可以在用户无感知的状态下直接切换登录方式
//                if (completeResult.code == 1011){
//                    //用户取消登录（点返回）
//                    //处理建议：如无特殊需求可不做处理，仅作为交互状态回调，此时已经回到当前用户自己的页面
//                    [SVProgressHUD showInfoWithStatus: @"用户取消免密登录"];
//                }else{
//                    //处理建议：其他错误代码表示闪验通道无法继续，可以统一走开发者自己的其他登录方式，也可以对不同的错误单独处理
//                    //1003    一键登录获取token失败
//                    //1008    未开启移动网络
//                    //1009    未检测到sim卡
//                    //其他     其他错误//
//
//                    dispatch_async(dispatch_get_main_queue(), ^{
//
//
//
//                        //雷俊博代码
//
//                        LoginViewController *log=  [LoginViewController sharedInstance];
//                        log.hidesBottomBarWhenPushed =YES;
//                        log.editText=NO;
//                        if(![self.navigationController.topViewController isKindOfClass:[log class]]) {
//                            [self.navigationController pushViewController:log animated:YES];
//                        }
//
//
//                        //雷俊博代码
//
//
//
////                         LoginResultController *vc = [LoginResultController new];
////                         vc.error = completeResult.error;
////                         [weakSelf.navigationController pushViewController:vc animated:YES];
////                          NSLog(@"%@",completeResult.error);
//                    });
//                }
//            }else{
//                dispatch_async(dispatch_get_main_queue(), ^{
//
////                                        //手动管理页面销毁
////                                        if (manualDismiss == YES) {
////                                            [self dismissViewControllerAnimated:YES completion:nil];
////                                            //释放内存和引用
////                                            [CLShanYanSDKManager clRelease];
////                                        }
//
//                    NSLog(@"quickAuthLogin Success:%@",completeResult.data);
//
//
//                    [logNetModel QuickLogin:[completeResult.data objectForKey:@"appId"] andAccessToken:[completeResult.data objectForKey:@"accessToken"] andTelecom:[completeResult.data objectForKey:@"telecom"] andTimeStamp:[completeResult.data objectForKey:@"timestamp"] andRandoms:[completeResult.data objectForKey:@"randoms"] andVersion:[completeResult.data objectForKey:@"version"] andDevice:[completeResult.data objectForKey:@"device"] andSign:[completeResult.data objectForKey:@"sign"] completionHandle:^(logModel_2 *model, NSError *error)
//                        {
//
//                            [SVProgressHUD dismiss];
//                            NSLog(@"12345678");
//                            NSLog(@"logResultModel%@",model.result);
//
//                            if ([model.code isEqualToString:@"0"]) {
//                                //ViewController *vc = [ViewController new];
//                                //vc.completeResultData = completeResult.data;
//                                //vc.timesStart = startButtonClick;
//                                //[self getPhonenumber];
//                                //[self.navigationController pushViewController:vc animated:YES];
//
//                                NSLog(@"123%@",model.code);
//                                self.peopleMessage =[[NSString alloc]init];
//                                NSLog(@"234%@",self.peopleMessage);
//                                //判断账号是否登入时候使用
//                                [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstlog"];
//                                [getPeopleID getPeopletitle:model.result.cus_name];
//                                [getPeopleID getPeoplePhoto:model.result.photo];
//                                [getPeopleID getPeopleID:model.result.ID];
//                                [getPeopleID getPeopleIphoneNmber:model.result.telphone];
//                                [self viewWillAppear:YES];
//
//                                AppDelegate *delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
//
//                                if ( delegate.isLogin == NO) {
//                                    [getPeopleID getProvince:model.result.provinceName];
//
//                                }
//                                if (model.result.account_type == 0) {
//                                    self.editText =NO;
//                                    _passView.hidden =YES;
//                                    _registerView.hidden =YES;
//                                    if ([self.thirdStr isEqualToString:@"登入"]) {
//
//
//                                    }else{
//                                        [getPeopleID getpeopleLimitedAuthority:YES];
//                                        [self.navigationController popViewControllerAnimated:YES];
//                                    }
//
//                                }else if(model.result.account_type == 12){
//                                    //打开注册的页面
//
//                                    //
//                                    //                                    //s注册
//                                    //                                    FandRViewController *logVC =    [FandRViewController sharedInstance];
//                                    //                                    logVC.strTitle =@"注册";
//                                    //                                    logVC.changeBut =YES;
//                                    //                                    logVC.emailSender =NO;
//                                    //                                    logVC.registLabelTwo.text =@"注册";
//                                    //                                    logVC.hidesBottomBarWhenPushed =YES;
//                                    //                                    [self.navigationController pushViewController:logVC animated:YES];
//
//
//
//                                }else
//                                {
//                                    [getPeopleID getpeopleLimitedAuthority:NO];
//                                    [self.navigationController popViewControllerAnimated:YES];
//                                }
//
//                            }else{
//
//                                //雷俊博代码
//
//
//                                [SVProgressHUD showErrorWithStatus:@"一键登录失败"];
//
//                                //雷俊博代码
//
//
//                                codeSelected *code = [codeSelected MustTakeReturn:[model.code intValue]];
//                                [code returnCodeMethod];
//
//
//
//
//                            }
//
//
//
//
//                        }
//
//
//
//
//
//
//                    ];
//
//
//
//
//
//
//
//                    if(weakSelf.navigationController){
//
//
//                         //[weakSelf.navigationController pushViewController:vc animated:YES];
//                    } else {
//                         //[weakSelf presentViewController:vc animated:YES completion:^{
//
//                       //  }];
//                    }
//                });
//            }
//        }];
        
        
        
      
        
        
        
        
        

        
//
//        quickLoginViewController *log = [quickLoginViewController sharedInstance];
//        log.hidesBottomBarWhenPushed =YES;
//        if(![self.navigationController.topViewController isKindOfClass:[log class]]) {
//            [self.navigationController pushViewController:log animated:YES];
//                    }
//
        
        //雷注释别人的登录界面,试试自己的
//        LoginViewController *log=  [LoginViewController sharedInstance];
//        log.hidesBottomBarWhenPushed =YES;
//        log.editText=NO;
//        if(![self.navigationController.topViewController isKindOfClass:[log class]]) {
//            [self.navigationController pushViewController:log animated:YES];
//        }
        LoginVC *loginVC = [[LoginVC alloc]init];
        UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:loginVC];
        [self presentViewController:nav animated:YES completion:nil];
        
        
    }
}
-(void)otherLoginWayBtnCliced:(UIButton*)btn {
    
    
        [SVProgressHUD dismiss];
        if (self.navigationController.viewControllers.lastObject.navigationController) {
            [self.navigationController.viewControllers.lastObject dismissViewControllerAnimated:YES completion:^{
                
                LoginViewController *log=  [LoginViewController sharedInstance];
                log.hidesBottomBarWhenPushed =YES;
                log.editText=NO;
                if(![self.navigationController.topViewController isKindOfClass:[log class]]) {
                    [self.navigationController pushViewController:log animated:YES];
                }
            }];
        }
   
    
}
//显示动画
-(void)faceToAN:(UIView *)view1 andtranslter:(BOOL)bools;
{
    CATransition *applicationLoadViewIn =[CATransition animation];
    [applicationLoadViewIn setDuration:0.5];
    [applicationLoadViewIn setType:kCATransitionMoveIn];
    [applicationLoadViewIn setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
    //you view need to replace
    [[view1 layer]addAnimation:applicationLoadViewIn forKey:kCATransitionMoveIn];
    
    [view1 reloadInputViews];
    //    [self.view reloadInputViews];
    view1.hidden=bools;
    
}
-(void)senderVC:(smallTableVController *)vc andPutOtherSan:(BOOL)BOOLs
{
    self.greybackgroundView.hidden=BOOLs;
    self.shareFourView.hidden=BOOLs;
}
- (IBAction)weixin:(id)sender {
       [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession];

    
    
}
- (IBAction)qq:(id)sender {
     [self shareWebPageToPlatformType: UMSocialPlatformType_QQ ];
}
- (IBAction)weibo:(id)sender {
    [UMSocialGlobal shareInstance].isUsingHttpsWhenShareContent = NO;
      [self shareWebPageToPlatformType:UMSocialPlatformType_Sina];
}
- (IBAction)zhifubao:(id)sender {
      [self shareWebPageToPlatformType: UMSocialPlatformType_APSession];
}
- (void)getUserInfoForPlatform:(UMSocialPlatformType)platformType
{
    [[UMSocialManager defaultManager] getUserInfoWithPlatform:platformType currentViewController:self completion:^(id result, NSError *error) {
        UMSocialUserInfoResponse *resp = result;
        // 第三方登录数据(为空表示平台未提供)
        // 授权数据
        NSLog(@" uid: %@", resp.uid);
        NSLog(@" openid: %@", resp.openid);
        NSLog(@" accessToken: %@", resp.accessToken);
        NSLog(@" refreshToken: %@", resp.refreshToken);
        NSLog(@" expiration: %@", resp.expiration);
        
        // 用户数据
        NSLog(@" name: %@", resp.name);
        NSLog(@" iconurl: %@", resp.iconurl);
        NSLog(@" gender: %@", resp.gender);
        
        // 第三方平台SDK原始数据
        NSLog(@" originalResponse: %@", resp.originalResponse);
    }];
}
//网页分享
- (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType
{
    //创建分享消息对象
    UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
    
    //创建网页内容对象
    NSString* thumbURL =  UMS_THUMB_IMAGE;
    UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:UMS_Title descr:UMS_Text thumImage:thumbURL];
    //设置网页地址
    shareObject.webpageUrl = UMS_WebLink;
    
    //分享消息对象设置分享内容对象
    messageObject.shareObject = shareObject;
    
    //调用分享接口
    [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
        if (error) {
            UMSocialLogInfo(@"************Share fail with error %@*********",error);
        }else{
            if ([data isKindOfClass:[UMSocialShareResponse class]]) {
                UMSocialShareResponse *resp = data;
                //分享结果消息
                UMSocialLogInfo(@"response message is %@",resp.message);
                //第三方原始返回的数据
                UMSocialLogInfo(@"response originalResponse data is %@",resp.originalResponse);
                
            }else{
                UMSocialLogInfo(@"response data is %@",data);
            }
        }
        [self alertWithError:error];
    }];
}


- (void)alertWithError:(NSError *)error
{
    NSString *result = nil;
    if (!error) {
        result = [NSString stringWithFormat:@"分享成功"];
    }
    else{
        NSMutableString *str = [NSMutableString string];
        if (error.userInfo) {
            for (NSString *key in error.userInfo) {
                [str appendFormat:@"%@ = %@\n", key, error.userInfo[key]];
            }
        }
        if (error) {
            result = [NSString stringWithFormat:@"Share fail with error code: %d\n%@",(int)error.code, str];
            result = [NSString stringWithFormat:@"分享失败"];
        }
        else{
            result = [NSString stringWithFormat:@"Share fail"];
        }
    }
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
                                                    message:result
                                                   delegate:nil
                                          cancelButtonTitle:NSLocalizedString(@"确定", @"确定")
                                          otherButtonTitles:nil];
    [alert show];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [SVProgressHUD dismiss];

}
@end
