// // JXSelfUserInfoVC.m // shiku_im // // Created by 123 on 2020/6/1. // Copyright © 2020 Reese. All rights reserved. // #import "JXSelfUserInfoVC.h" #import "selectValueVC.h" #import "selectProvinceVC.h" #import "ImageResize.h" #import "JXChatViewController.h" #import "JXLocationVC.h" #import "JXMapData.h" #import "JXInputValueVC.h" #import "FMDatabase.h" #import "userWeiboVC.h" #import "JXReportUserVC.h" #import "JXQRCodeViewController.h" #import "JXImageScrollVC.h" #import "DMScaleTransition.h" #import "JXSetLabelVC.h" #import "JXLabelObject.h" #import "JXSetNoteAndLabelVC.h" #import "JXCirclePermissionsVC.h" #import "CYSpecialCareViewController.h" #import "JLBubbleModel.h" #import "JXChatViewC.h" #define HEIGHT 56 #define LINE_INSET 8 //#define IMGSIZE 150 #define TopHeight 7 #define CellHeight 45 @interface JXSelfUserInfoVC () @property (nonatomic,strong) NSMutableArray *titleArr; @end @implementation JXSelfUserInfoVC - (id)init { self = [super init]; if (self) { [g_navigation dismissViewController:self animated:YES]; [g_navigation dismissViewController:self animated:YES]; self.isGotoBack = YES; self.title = Localized(@"JX_BaseInfo"); self.heightFooter = 0; self.heightHeader = JX_SCREEN_TOP; //self.view.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT); [self createHeadAndFoot]; self.tableBody.backgroundColor = HEXCOLOR(0xF2F2F2); self.tableBody.scrollEnabled = YES; // UIButton *rightBtn=[[UIButton alloc]init]; // [rightBtn setImage:[UIImage imageNamed:@"title_more_black"] forState:UIControlStateNormal]; // [self.view addSubview:rightBtn]; // [self.tableHeader addSubview:rightBtn]; // rightBtn.frame = CGRectMake(JX_SCREEN_WIDTH-24-8, JX_SCREEN_TOP - 34, 24, 24); // [rightBtn addTarget:self action:@selector(onMore) forControlEvents:UIControlEventTouchUpInside]; // [g_navigation dismissViewController:self animated:NO]; // [g_navigation dismissViewController:self animated:NO]; } return self; } - (void)viewDidLoad { [super viewDidLoad]; _titleArr = [[NSMutableArray alloc]init]; self.view.backgroundColor=kRGBColor246; UIView *toView=[[UIView alloc]init]; toView.backgroundColor=[UIColor whiteColor]; [self.view addSubview:toView]; [toView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.height.mas_equalTo(200); make.right.mas_equalTo(0); make.top.mas_equalTo(JX_SCREEN_TOP); }]; // 头像 UIImageView *imageHead=[[UIImageView alloc]init]; imageHead.backgroundColor=[UIColor lightGrayColor]; imageHead.layer.cornerRadius=50; imageHead.layer.masksToBounds=YES; [toView addSubview:imageHead]; [imageHead mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(30); make.left.mas_equalTo(15); make.height.mas_equalTo(100); make.width.mas_equalTo(100); }]; [g_server delHeadImage:g_server.myself.userId]; [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:imageHead]; // // UILabel *nameL=[[UILabel alloc]init]; // nameL.textColor=kRGBColor51; // nameL.font=[UIFont systemFontOfSize:20 weight:UIFontWeightMedium]; // nameL.text=memberAcc; // [toView addSubview:nameL]; // [nameL mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.mas_equalTo(imageHead.mas_right).mas_offset(15); // make.top.mas_equalTo(35); // // }]; UILabel *nickNam=[[UILabel alloc]init]; nickNam.text= [NSString stringWithFormat:@"昵称:%@",g_server.myself.userNickname]; nickNam.textColor=kRGBColor51; [toView addSubview:nickNam]; [nickNam mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(imageHead.mas_right).mas_offset(15); // make.top.mas_equalTo(nameL.mas_bottom).mas_offset(10); make.top.mas_equalTo(35); }]; UIImageView *sex = [[UIImageView alloc] init]; if ([g_server.myself.sex intValue]==0) { sex.image = [UIImage imageNamed:@"basic_famale"]; }else {// 男 sex.image = [UIImage imageNamed:@"basic_male"]; } [toView addSubview:sex]; [sex mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(nickNam.mas_right).mas_offset(5); make.centerY.mas_equalTo(nickNam.mas_centerY).mas_offset(0); }]; NSString *gradeIndexcc= [[NSUserDefaults standardUserDefaults] objectForKey:@"gradeIndexcc"]; UILabel *vipL=[[UILabel alloc]init]; vipL.text= [NSString stringWithFormat:@"会员等级:VIP%@",gradeIndexcc]; vipL.textColor=kRGBColor51; [toView addSubview:vipL]; [vipL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(nickNam.mas_bottom).mas_offset(10); make.left.mas_equalTo(imageHead.mas_right).mas_offset(15); }]; NSString* city = [g_constant getAddressForNumber:g_server.myself.provinceId cityId:g_server.myself.cityId areaId:g_server.myself.areaId]; UILabel *cityL=[[UILabel alloc]init]; cityL.text= [NSString stringWithFormat:@"%@",city]; cityL.textColor=kRGBColor51; [toView addSubview:cityL]; [cityL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(vipL.mas_bottom).mas_offset(10); make.left.mas_equalTo(imageHead.mas_right).mas_offset(15); }]; } - (void)onMore{ int n = _friendStatus; [_titleArr removeAllObjects]; [_titleArr addObject:Localized(@"JXUserInfoVC_Report")]; if ([self.user.userType intValue] != 2) { [_titleArr addObject:@"设置备注和名称"];//Localized(@"JX_SetNotesAndDescriptions")]; if(n == friend_status_friend){ if(n == friend_status_black) [_titleArr addObject:Localized(@"JXUserInfoVC_CancelBlackList")]; else if(![_user.isBeenBlack boolValue]) { [_titleArr addObject:Localized(@"JXUserInfoVC_AddBlackList")]; } if(![_user.isBeenBlack boolValue]){ if(n == friend_status_friend) [_titleArr addObject:Localized(@"JXUserInfoVC_DeleteFirend")]; else [_titleArr addObject:Localized(@"JX_AddFriend")]; } } } _selectView = [[JX_SelectMenuView alloc] initWithTitle:_titleArr image:@[] cellHeight:CellHeight]; _selectView.alpha = 0.0; _selectView.delegate = self; [self.view addSubview:_selectView]; // [_selectView release]; //动画 [UIView animateWithDuration:0.3 animations:^{ _selectView.alpha = 1; }]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ - (void)didMenuView:(JX_SelectMenuView *)MenuView WithIndex:(NSInteger)index { long n = _friendStatus;//好友状态 // if(n>[_titleArr count]-1) // return; switch (index) { case 0: [self viewDisMissAction]; break; case 1: [self viewDisMissAction]; break; case 2: if(n == friend_status_black){ [self onDelBlack]; [self viewDisMissAction]; }else{ [self onAddBlack]; [self viewDisMissAction]; } break; case 3: if(n == friend_status_see || n == friend_status_friend){ // [self onCancelSee]; // [self viewDisMissAction]; [self onDeleteFriend]; [self viewDisMissAction]; }else{ [self actionAddFriend:nil]; [self viewDisMissAction]; } break; default: [self viewDisMissAction]; break; } } - (void)viewDisMissAction{ [UIView animateWithDuration:0.4 animations:^{ _bgBlackAlpha.alpha = 0.0; } completion:^(BOOL finished) { [_selectView removeFromSuperview]; _selectView = nil; [_bgBlackAlpha removeFromSuperview]; }]; } -(void)onAddBlack{ [g_server addBlacklist:_user.userId toView:self]; } -(void)onDelBlack{ [g_server delBlacklist:_user.userId toView:self]; } -(void)onCancelSee{ [g_server delAttention:_user.userId toView:self]; } -(void)onDeleteFriend{ // [g_server delAttention:user.userId toView:self]; [g_server delFriend:_user.userId toView:self]; } -(void)doMakeFriend{ _friendStatus = friend_status_friend; // user.status = [NSNumber numberWithInt:_friendStatus]; // if([user haveTheUser]) // [user update]; // else // [user insert]; [self.user doSendMsg:XMPP_TYPE_FRIEND content:nil]; [JXMessageObject msgWithFriendStatus:_user.userId status:_friendStatus]; } -(void)actionAddFriend:(UIView*)sender{ // 验证XMPP是否在线 if(g_xmpp.isLogined != 1){ [g_xmpp showXmppOfflineAlert]; return; } if([_user.isBeenBlack boolValue]){ [g_server showMsg:Localized(@"TO_BLACKLIST")]; return; } switch (_friendStatus) { case friend_status_black:{ // [g_server addAttention:user.userId toView:self]; [self onDelBlack]; // [self viewDisMissAction]; } break; case friend_status_none: case friend_status_see: [g_server addAttention:_user.userId fromAddType:self.fromAddType toView:self]; break; // case friend_status_see: // [self doSayHello]; // break; case friend_status_friend:{//发消息 if([_user haveTheUser]) [_user insert]; else [_user update]; [self actionQuit]; [g_notify postNotificationName:kActionRelayQuitVC object:nil]; // // JXChatViewController *chatVC=[JXChatViewController alloc]; JXChatViewC *chatVC=[JXChatViewC alloc]; chatVC.title =_user.userNickname; chatVC.chatPerson = self.user; chatVC = [chatVC init]; // [g_App.window addSubview:chatVC.view]; [g_navigation pushViewController:chatVC animated:YES]; } break; } } @end