微信登陆,bug修改

This commit is contained in:
kai60
2020-01-09 09:25:43 +08:00
parent 82590f8fba
commit bfb68dd81c
62 changed files with 5105 additions and 275 deletions
@@ -12,6 +12,7 @@
#import "IfishMianTabViewController.h"
#import "IfishAlibcWebViewController.h"
#import <AlibcTradeSDK/AlibcTradeSDK.h>
#import "RegistViewController.h"
@interface IfishADTimerViewController ()
@property(nonatomic)UIActivityIndicatorView*indicatorView;
@property(nonatomic,strong) NSString *adUrl;
@@ -166,8 +167,23 @@
//设置根视图
-(void)setAppTabRoot{
IfishMianTabViewController *mianVC=[[IfishMianTabViewController alloc] init];
[UIApplication sharedApplication].delegate.window.rootViewController=mianVC;
UserModel*model=[dataContorl getUserInfo];
NSUserDefaults*userdefult=[NSUserDefaults standardUserDefaults];
BOOL skiped =[userdefult boolForKey:[CommonUtils getNotNilStr:model.unionId]];
if (!skiped&&[CommonUtils getNotNilStr:model.phoneNumber].length==0&&[CommonUtils getNotNilStr:model.unionId].length)
{
RegistViewController*revv=[[RegistViewController alloc]init];
revv.isBind=YES;
revv.isFromLogin=YES;
[self.navigationController pushViewController:revv animated:YES];
}
else
{
IfishMianTabViewController *mianVC=[[IfishMianTabViewController alloc] init];
[UIApplication sharedApplication].delegate.window.rootViewController=mianVC;
}
}
@@ -238,7 +238,9 @@
-(void)initImageView{
UserModel*userModel=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"];
NSString*wechatImgUrl=[[NSUserDefaults standardUserDefaults] stringForKey:@"wechatImgUrl"];
NSString*fullpath=[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]stringByAppendingPathComponent:@"avatar.png"];
UIImage*saveImage=[[UIImage alloc]initWithContentsOfFile:fullpath];
if (saveImage==nil) {
@@ -260,14 +262,28 @@
// [_iconImageButton setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"userIcon%d.png",i]] forState:UIControlStateNormal];
NSString*str=[NSString stringWithFormat:@"%@%@",kGetIconUrl,userModel.userImg];
if (wechatImgUrl.length)
{
str=wechatImgUrl;
}
[self.userImg sd_setImageWithURL:[NSURL URLWithString:str] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
NSLog(@"error=%@,%@",error,image);
}];
[self.userImg sd_setImageWithURL:[NSURL URLWithString:str]];
}
}
}else{
NSString*str=[NSString stringWithFormat:@"%@%@",kGetIconUrl,userModel.userImg];
if (wechatImgUrl.length)
{
str=wechatImgUrl;
}
if ([str isEqualToString:kGetIconUrl]) {
//int i = (arc4random()%7) + 1;// 设置随机头像
int i = 1;
@@ -14,7 +14,7 @@
#define TUICHUAlertTAg 4100
#import "IfishUserDefaultHelper.h"
#import "SettingResetViewController.h"
#import "RegistViewController.h"
@interface IfishSetViewController ()<UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate>
@property(nonatomic,strong)UITableView *tableView;
@@ -34,9 +34,23 @@ extern BOOL firstLogIn;
}
-(void)loadData{
self.titles=@[@[@"更换手机",@"修改密码",@"恢复出厂模式"],@[@"切换账号"]];
self.imgs = @[@[@"personal_iocn_replace",@"replace_iocn_code",@"setting-reset"],@[@"personal_iocn_switch"]];
self.titles=@[@[@"更换手机",@"修改密码",@"恢复出厂模式"],@[@"切换账号",@"绑定手机"]];
self.imgs = @[@[@"personal_iocn_replace",@"replace_iocn_code",@"setting-reset"],@[@"personal_iocn_switch",@"renyuan"]];
UserModel*model=[dataContorl getUserInfo];
if ([CommonUtils getNotNilStr:model.phoneNumber].length)
{
self.titles=@[@[@"更换手机",@"修改密码",@"恢复出厂模式"],@[@"切换账号"]];
self.imgs = @[@[@"personal_iocn_replace",@"replace_iocn_code",@"setting-reset"],@[@"personal_iocn_switch"]];
}
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self loadData];
[self.tableView reloadData];
}
-(void)creatTab{
@@ -130,6 +144,15 @@ extern BOOL firstLogIn;
[alert show];
}
else if (indexPath.section==1&&indexPath.row==1){
RegistViewController*revc=[[RegistViewController alloc]init];
revc.hidesBottomBarWhenPushed=YES;
revc.isBind=YES;
[self.navigationController pushViewController:revc animated:YES];
}
}
@@ -25,6 +25,7 @@
// CFShow((__bridge CFTypeRef)(infoDic));
NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"];
NSLog(@"app_Version%@",app_Version);
app_Version=@"4.7.4";
NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version];
NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"];
if (buildVersion.length > 0) {
@@ -37,8 +37,12 @@
attch.image = [UIImage imageNamed:@"explore_iocn_authentication"];
attch.bounds = CGRectMake(0,0, 12, 10);
}
NSAttributedString *str=[NSAttributedString attributedStringWithAttachment:attch];
[attri appendAttributedString:str];
if (attch.image)
{
NSAttributedString *str=[NSAttributedString attributedStringWithAttachment:attch];
[attri appendAttributedString:str];
}
self.tanSuoTitle.attributedText = attri;
}
@@ -108,6 +108,7 @@ Assign BOOL isPush;
[self creatReatRefreshView];//
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteCurDevice) name:@"DeleteCurDevice" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDevice) name:@"updateDevice" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateUserInfobyValidation) name:@"updateUserInfobyValidation" object:nil];
}
-(void)updateDevice{
@@ -117,8 +118,45 @@ Assign BOOL isPush;
-(void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"DeleteCurDevice" object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateDevice" object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateUserInfobyValidation" object:nil];
}
-(void)updateUserInfobyValidation
{
[self addDataRequestQueue];
UserModel*model=[dataContorl getUserInfo];
if (model.unionId)
{
[AFHttpTool requestWihtMethod:RequestMethodTypePost
url:kUserWechatValidation
params:@{@"unionId":[CommonUtils getNotNilStr:model.unionId]}
success:^(id response) {
if (!response) {
return ;
}
NSDictionary*dict=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSString *result=dict[@"result"];
if ([result isEqualToString:@"100"]) {
//
NSDictionary*dataDic=dict[@"data"];
NSDictionary *userDic=dataDic[@"userInfo"];
UserModel *model=[[UserModel alloc] initWithDict:userDic];
[[DataCenter defaultDtacenter]setValue:model forKey:@"UserLogIn"];
NSDictionary *userAssetDic=dataDic[@"userAsset"];
IfishUserAsset *userAsset =[[IfishUserAsset alloc] initWithDict:userAssetDic];
[[DataCenter defaultDtacenter]setValue:userAsset forKey:@"IfishUserAsset"];
[self getUsernameAddImg];
}
} failure:^(NSError *err) {
}];
}
}
-(void)addDataRequestQueue
{
// UI更新受影响
@@ -518,11 +556,12 @@ Assign BOOL isPush;
}
-(void)getUsernameAddImg{
IfishUserAsset *userAsset = [dataContorl getAllIfishUserAsset];
UserModel*umodel=[dataContorl getUserInfo];
NSString*wechatImgUrl=[[NSUserDefaults standardUserDefaults] stringForKey:@"wechatImgUrl"];
_userNameLabel.text = umodel.nickName;
[_userNameLabel sizeToFit];
CGFloat btnH = 40*KWidth_Scale;
CGFloat btnW =100*KWidth_Scale;
_levelBtn.frame = CGRectMake(CGRectGetMaxX(_userNameLabel.frame) + 2, CGRectGetMaxY(_userNameLabel.frame) - btnH,btnW, btnH);
@@ -545,7 +584,13 @@ Assign BOOL isPush;
[_userImgView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"userIcon%d.png",i]]];
}else{
}else if (wechatImgUrl.length){
[_userImgView sd_setImageWithURL:[NSURL URLWithString:wechatImgUrl]];
}
else{
NSLog(@"%@",[NSString stringWithFormat:@"%@%@",kGetIconUrl,umodel.userImg]);
[_userImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetIconUrl,umodel.userImg]]];