This commit is contained in:
lianxiang 2018-09-10 19:59:09 +08:00
parent 7685ce516e
commit 86f8824e14
21 changed files with 177 additions and 35 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 189 KiB

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_back@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_login@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_meaasag@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_moment_back@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_right@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_desplay@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_notselect@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_turndown@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "nav_red_moment@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "nav_redback@2x.png",

View File

@ -1,5 +1,9 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_send@2x.png",

View File

@ -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;

View File

@ -99,11 +99,13 @@
break;
default:
break;
}
}] ;
//
[manager startMonitoring];
}
//

View File

@ -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;//退出登录
/**

View File

@ -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

View File

@ -15,6 +15,7 @@
#import "MBProgressHUD.h"
#import "GiGaAttributedLabel.h"
#import "UINavigationBar+Custom.h"
#import "GiGaUserDefault.h"
@interface GiGaRegistViewController ()<TTTAttributedLabelDelegate>
@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) {
@ -221,6 +229,8 @@
GILog(@"注册->%@",result.message);
if (result.code == 0) {
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{

View File

@ -17,6 +17,7 @@
#import "GiGaBaseAPiRequest.h"
#import "GiGaUser.h"
#import "GiGaServerConfig.h"
#import "GIGAMBHUDHelper.h"
@interface GiGaUserLoginVC ()
@property (weak, nonatomic) IBOutlet UIImageView *userImagView;
@ -178,35 +179,39 @@
-(void)loginWithAction:(UIButton *)btn{
NSDictionary *params = @{
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{

View File

@ -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{

View File

@ -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;
}

View File

@ -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