diff --git a/GIGA/Assets.xcassets/AppIcon.appiconset/icon_appstore.png b/GIGA/Assets.xcassets/AppIcon.appiconset/icon_appstore.png index 8555c9e..379b889 100644 Binary files a/GIGA/Assets.xcassets/AppIcon.appiconset/icon_appstore.png and b/GIGA/Assets.xcassets/AppIcon.appiconset/icon_appstore.png differ diff --git a/GIGA/Assets.xcassets/login/btn_back.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_back.imageset/Contents.json index 37bd2b8..130483e 100644 --- a/GIGA/Assets.xcassets/login/btn_back.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_back.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_back@2x.png", diff --git a/GIGA/Assets.xcassets/login/btn_login.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_login.imageset/Contents.json index 221145d..9bb3ee0 100644 --- a/GIGA/Assets.xcassets/login/btn_login.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_login.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_login@2x.png", diff --git a/GIGA/Assets.xcassets/login/btn_meaasag.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_meaasag.imageset/Contents.json index f530c0a..c454cc3 100644 --- a/GIGA/Assets.xcassets/login/btn_meaasag.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_meaasag.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_meaasag@2x.png", diff --git a/GIGA/Assets.xcassets/login/btn_moment_back.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/Contents.json index 4a9e8f2..e67fafe 100644 --- a/GIGA/Assets.xcassets/login/btn_moment_back.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_moment_back@2x.png", diff --git a/GIGA/Assets.xcassets/login/btn_right.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_right.imageset/Contents.json index 280fbc2..7a5ca54 100644 --- a/GIGA/Assets.xcassets/login/btn_right.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_right.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_right@2x.png", diff --git a/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/Contents.json index 48dffc8..5db27e6 100644 --- a/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_tab_desplay@2x.png", diff --git a/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/Contents.json index 3058113..f9fd4bf 100644 --- a/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_tab_notselect@2x.png", diff --git a/GIGA/Assets.xcassets/login/btn_turndown.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_turndown.imageset/Contents.json index 57ea7eb..f34ae32 100644 --- a/GIGA/Assets.xcassets/login/btn_turndown.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/btn_turndown.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "btn_turndown@2x.png", diff --git a/GIGA/Assets.xcassets/login/nav_red_moment.imageset/Contents.json b/GIGA/Assets.xcassets/login/nav_red_moment.imageset/Contents.json index fb1e4c7..3df176b 100644 --- a/GIGA/Assets.xcassets/login/nav_red_moment.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/nav_red_moment.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "nav_red_moment@2x.png", diff --git a/GIGA/Assets.xcassets/login/nav_redback.imageset/Contents.json b/GIGA/Assets.xcassets/login/nav_redback.imageset/Contents.json index 147d463..1f90e1b 100644 --- a/GIGA/Assets.xcassets/login/nav_redback.imageset/Contents.json +++ b/GIGA/Assets.xcassets/login/nav_redback.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "nav_redback@2x.png", diff --git a/GIGA/Assets.xcassets/maskTime/ic_send.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/ic_send.imageset/Contents.json index 58aae92..dde3656 100644 --- a/GIGA/Assets.xcassets/maskTime/ic_send.imageset/Contents.json +++ b/GIGA/Assets.xcassets/maskTime/ic_send.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "ic_send@2x.png", diff --git a/GIGA/Common/BaseVC/GiGaBaseViewController.h b/GIGA/Common/BaseVC/GiGaBaseViewController.h index 0e92391..290718a 100644 --- a/GIGA/Common/BaseVC/GiGaBaseViewController.h +++ b/GIGA/Common/BaseVC/GiGaBaseViewController.h @@ -25,6 +25,7 @@ @property (nonatomic, copy) void(^ network)(AFNetworkReachabilityStatus status); //当前网络状态,-1未知、0无网络、1蜂窝数据网络、2WiFi @property (nonatomic, assign) AFNetworkReachabilityStatus currentNetworkStatus; +-(void)testNetworkStatus; - (void)showNoNetWorkView; - (void)removeNoNetWorkView; diff --git a/GIGA/Common/BaseVC/GiGaBaseViewController.m b/GIGA/Common/BaseVC/GiGaBaseViewController.m index c7837a1..93d4c9a 100644 --- a/GIGA/Common/BaseVC/GiGaBaseViewController.m +++ b/GIGA/Common/BaseVC/GiGaBaseViewController.m @@ -99,11 +99,13 @@ break; default: + break; } }] ; //开始检测 [manager startMonitoring]; + } //显示信息,并在设定延时后返回上级界面 diff --git a/GIGA/Common/GiGaUserDB/GiGaUserDefault.h b/GIGA/Common/GiGaUserDB/GiGaUserDefault.h index 4ac2cb9..b125092 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserDefault.h +++ b/GIGA/Common/GiGaUserDB/GiGaUserDefault.h @@ -12,13 +12,14 @@ @interface GiGaUserDefault : NSObject -// +//登录 +(void)saveUserId:(NSString *)userId; +(void)saveToken:(NSString *)token; +(NSString *)getCurentToken; +(NSString *)getCurentUserId; +(void)removeUserId;//退出登录 +(BOOL)isUserLogin; ++(void)userLogOut;//退出登录 /** 保存用户表版本号 diff --git a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m index 09bad0d..4d6b7de 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m +++ b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m @@ -13,6 +13,7 @@ NSString *const GIGADEFAULTKEY_USERID = @"GiGaUserId"; NSString *const kShowUserGuard = @"ShowUserGuard"; NSString *const kShowAppGuard = @"ShowAppGuard"; NSString *const kWeiXinSaveToken = @"WeiXinSaveToken"; +NSString *const kWeiXinUserInfo = @"WeiXinUserinfo"; NSString *const kGiGaToken = @"GiGatoken"; @implementation GiGaUserDefault @@ -52,6 +53,11 @@ NSString *const kGiGaToken = @"GiGatoken"; } ++(void)userLogOut{ + UD_REMOVE_KEY(kGiGaToken); + UD_REMOVE_KEY(GIGADEFAULTKEY_USERID); +} + +(void)saveDBVersion:(NSInteger)versionNum{ NSNumber *verNum = [NSNumber numberWithInteger:versionNum]; @@ -100,4 +106,15 @@ NSString *const kGiGaToken = @"GiGatoken"; return [UD_STADARDUD objectForKey:kWeiXinSaveToken]; } ++(void)saveWeiXinUserInfoDic:(NSDictionary *)dic +{ + [UD_STADARDUD setObject:dic forKey:kWeiXinUserInfo]; +} + ++(NSDictionary *)getWeiXinUserInfoDic{ + + return [UD_STADARDUD objectForKey:kWeiXinUserInfo]; +} + + @end diff --git a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m index 472f68c..1be4232 100644 --- a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m +++ b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m @@ -15,6 +15,7 @@ #import "MBProgressHUD.h" #import "GiGaAttributedLabel.h" #import "UINavigationBar+Custom.h" +#import "GiGaUserDefault.h" @interface GiGaRegistViewController () @property (weak, nonatomic) IBOutlet UITextField *phoneNumberTextField; @@ -212,7 +213,14 @@ -(void)regeist:(UIButton *)btn{ btn.userInteractionEnabled = NO; - NSDictionary *param = @{@"username":self.phoneNumberTextField.text,@"verifiedCode":self.codeTextField.text,@"password":self.passTexFied.text}; + NSDictionary *weixinInfoDic = [GiGaUserDefault getWeiXinAccessToenDic]; + NSDictionary *param = nil; + if (weixinInfoDic) { + param = @{@"username":self.phoneNumberTextField.text,@"verifiedCode":self.codeTextField.text,@"password":self.passTexFied.text,@"openid":weixinInfoDic[@"openid"]}; + }else{ + param = @{@"username":self.phoneNumberTextField.text,@"verifiedCode":self.codeTextField.text,@"password":self.passTexFied.text}; + } + GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:@"sys/v1/phoneregister" method:RequestPostMethod parms:param]; [api requstDataWithResult:^(GiGaAPIResult *result) { @@ -220,7 +228,9 @@ btn.userInteractionEnabled = YES; GILog(@"注册->%@",result.message); if (result.code == 0) { - NC_POST_NAME_OBJECT(kUserRegistSucccess,self.phoneNumberTextField.text); + NC_POST_NAME_OBJECT(kUserRegistSucccess,self.phoneNumberTextField.text); + GIGA_ShowToast(result.message); + [self.navigationController popToRootViewControllerAnimated:YES]; }else if (result.code == GiGAErrorCode_USER_EXIST){ GIGA_ShowToast(@"用户已存在"); @@ -230,7 +240,6 @@ GIGA_ShowToast(result.message); } }]; - } -(void)checkBtnAction:(UIButton *)btn{ diff --git a/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m b/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m index 4c7d041..7668151 100644 --- a/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m +++ b/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m @@ -17,6 +17,7 @@ #import "GiGaBaseAPiRequest.h" #import "GiGaUser.h" #import "GiGaServerConfig.h" +#import "GIGAMBHUDHelper.h" @interface GiGaUserLoginVC () @property (weak, nonatomic) IBOutlet UIImageView *userImagView; @@ -148,7 +149,7 @@ GiGaRegistViewController *registVC = [[GiGaRegistViewController alloc] init]; [self.navigationController pushViewController:registVC animated:YES]; - + } #pragma mark 手机号登录 @@ -178,35 +179,39 @@ -(void)loginWithAction:(UIButton *)btn{ - NSDictionary *params = @{ - @"username":self.acountTextField.text, - @"password":self.passwordTextField.text - }; - + NSDictionary *weixinInfoDic = [GiGaUserDefault getWeiXinAccessToenDic]; + NSDictionary *params = nil; + if (weixinInfoDic) { + + params = @{ + @"username":self.acountTextField.text, + @"password":self.passwordTextField.text, + @"openid":weixinInfoDic[@"openid"], + }; + }else{ + + params = @{ + @"username":self.acountTextField.text, + @"password":self.passwordTextField.text + }; + } + + //[GIGAMBHUDHelper messageAddto:self.view title:@"登录中..."]; [self.view makeToastActivity:CSToastPositionCenter]; + NSString *url = [NSString stringWithFormat:@"%@sys/v1/login",[GiGaServerConfig getMainUrl]]; [GiGaNetManager userLoginrequest:url params:params completionHandler:^(NSURLResponse *response, NSDictionary *resDic, NSError * _Nullable error) { GILog(@"%@",resDic); [self.view hideToastActivity]; GiGaAPIResult *result = [[GiGaAPIResult alloc] initWithDictionary:resDic]; - GILog(@"**登陆***\n code:%ld\n message:%@\n *******\n",result.code,result.message); if (result.success) { - //token - [GiGaUserDefault saveToken:resDic[@"token"]]; - //埋点 - [MobClick endEvent:MobClick_UserLogin]; - //暂定123 登陆标志 - [GiGaUserDefault saveUserId:@"123"]; - GIGA_WIndowTost(@"登录成功!"); - [self dismissViewControllerAnimated:YES completion:nil]; + [self userloginSussecess:resDic]; }else{ GIGA_ShowToast(result.message); } - }]; - } -(void)saveUserData{ @@ -229,7 +234,9 @@ //授权成功获取access_token -(void)WeiXinLongIn:(NSNotification *)notification{ - + //检查网络 + //[self testNetworkStatus]; + [self.view makeToastActivity:CSToastPositionCenter]; NSDictionary *param = @{ @"appid":WXin_APPID, @"secret":WXin_APPSecret, @@ -243,14 +250,15 @@ [self requstWeiXinUserinfo]; } failure:^(NSError *err) { + [self.view makeToast:err.localizedDescription]; GILog(@"access_token err-->%@",err.localizedDescription); - - }]; + }]; } //获取微信用户信息 -(void)requstWeiXinUserinfo{ + NSDictionary *tokenDic = [GiGaUserDefault getWeiXinAccessToenDic]; NSDictionary *param = @{ @"openid":tokenDic[@"openid"], @@ -260,14 +268,66 @@ [WeiIXinApiManager getWeiXinUserInfoUrl:@"https://api.weixin.qq.com/sns/userinfo" parameters:param success:^(id response) { NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingAllowFragments error:nil]; GILog(@"weixinUser info back -->%@",dict); - + [self gigaUploadweixinInfo:dict]; } failure:^(NSError *err) { + [self.view makeToast:err.localizedDescription]; GILog(@"weixin_userinfoApi err-->%@",err.localizedDescription); }]; +} + +//上传微信用户信息 +-(void)gigaUploadweixinInfo:(NSDictionary *)weiXinUserinfo{ + + [self.view makeToastActivity:CSToastPositionCenter]; + NSString *url = [NSString stringWithFormat:@"%@sys/v1/wechatlogin",[GiGaServerConfig getMainUrl]]; + [GiGaNetManager requestMethod:RequestPostMethod Url:url params:weiXinUserinfo responseBlock:^(NSDictionary *responseDict, NSDictionary *responseHeaderFields, NSError *error) { + [self.view hideToastActivity]; + + if (!error) { + + if ([responseDict[@"code"] integerValue] == 0) { + //[self userloginSussecess:responseDict]; + [self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; + [self jxt_showAlertWithTitle:@"温馨提示" message:@"请先绑定或注册手机号" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { + alertMaker.addActionCancelTitle(@"知道了"); + } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { + + }]; + }else if([responseDict[@"code"] integerValue] == 500){ + //登录流程待定 +// [self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; +// [self jxt_showAlertWithTitle:@"温馨提示" message:@"请绑定手机号" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { +// +// } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { +// +// }]; + + }else{ + + [self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; + } + + }else{ + [self.view makeToast:@"用户信息提交异常"]; + GILog(@"上传微信用户信息error:\n%@",error.localizedDescription); + } + }]; } +-(void)userloginSussecess:(NSDictionary *)resDic{ + + //token + [GiGaUserDefault saveToken:resDic[@"token"]]; + //埋点 + [MobClick endEvent:MobClick_UserLogin]; + //暂定123 登陆标志 + [GiGaUserDefault saveUserId:@"123"]; + GIGA_WIndowTost(@"登录成功!"); + [self dismissViewControllerAnimated:YES completion:nil]; + +} //接收注册成功通知 -(void)userRegistSuccsessNoti:(NSNotification *)noti{ diff --git a/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m b/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m index 3d3569b..619672e 100644 --- a/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m +++ b/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m @@ -17,6 +17,7 @@ #import "NSString+Unicode.h" #import "GIGAMBHUDHelper.h" #import "LXCustomSwith.h" +#import "GiGaUserDefault.h" //弹幕控制器 @interface GiGaFlingCommitVC () @@ -89,13 +90,12 @@ [super viewDidLoad]; // Do any additional setup after loading the view. - [self.view addSubview: self.commitInputView]; [self.view addSubview:self.danmuSwitch]; [self.view bringSubviewToFront:self.danmuSwitch]; - - + weakify(self); + self.commitInputView.SendCommentHandler = ^(NSString *content) { GILog(@"发送->:%@",content); NSArray *arr = @[@{ @@ -103,9 +103,7 @@ @"room":@"", @"sendUserName":@"lianxiang" }]; - [weakSelf.client emit:@"talk" with:arr]; - }; //开启弹幕 @@ -113,13 +111,18 @@ [[LXDanMuManager shareInstance] start]; //socket [self connetction]; - + //显示隐藏输入框 + BOOL isUserLogin = [GiGaUserDefault isUserLogin]; + if (!isUserLogin) { + self.commitInputView.hidden = YES; + } } -(void)connetction{ NSURL* url = [[NSURL alloc] initWithString:@"http://wsyts.s1.natapp.cc"]; - SocketManager *manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @NO, @"forcePolling": @YES,@"connectParams":@{@"token":@""}}]; + //@"connectParams":@{@"token":@""} + SocketManager *manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @NO, @"forcePolling": @YES,@"extraHeaders":@{@"device":@"ios"},@"token":@""}]; _manager = manager; _client = manager.defaultSocket; @@ -175,7 +178,6 @@ }]; } - //弹幕插入 -(void)showDanMuWith:(GiGaCommentModel *)model{ diff --git a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m index 232db20..c21f520 100644 --- a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m +++ b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m @@ -106,7 +106,6 @@ NSAttributedString *title = [GiGaHelper stringWithText:@"开始敷面膜" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTMEDIUM(13) leterSpace:0]; [_startMaskButton setAttributedTitle:title forState:UIControlStateNormal]; [_startMaskButton addTarget:self action:@selector(startMaskButtonAction) forControlEvents:UIControlEventTouchUpInside]; - } return _startMaskButton; } diff --git a/GIGA/Modules/Me/Controller/GiSysSettingsVC.m b/GIGA/Modules/Me/Controller/GiSysSettingsVC.m index 8194342..84a681c 100644 --- a/GIGA/Modules/Me/Controller/GiSysSettingsVC.m +++ b/GIGA/Modules/Me/Controller/GiSysSettingsVC.m @@ -9,6 +9,7 @@ #import "GiSysSettingsVC.h" #import "GiGaSettingsViewCell.h" #import "JXTAlertController.h" +#import "GiGaUserDefault.h" @interface GiSysSettingsVC () @@ -108,6 +109,7 @@ case 1: { GILog(@"退出登录"); + [self userlogOut]; } break; @@ -115,8 +117,13 @@ GILog(@"取消"); break; } - }]; } +-(void)userlogOut{ + [GiGaUserDefault userLogOut]; + [self.navigationController popToRootViewControllerAnimated:YES]; +} + + @end