1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309 |
- //
- // myViewController.m
- // sjvodios
- //
- // Created by on 12-5-29.
- // Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
- //
- #import "PSMyViewController.h"
- #import "JXImageView.h"
- #import "JXLabel.h"
- #import "AppDelegate.h"
- #import "JXServer.h"
- #import "JXConnection.h"
- #import "UIFactory.h"
- #import "JXTableView.h"
- #import "JXFriendViewController.h"
- #import "ImageResize.h"
- #import "userWeiboVC.h"
- #import "myMediaVC.h"
- #import "webpageVC.h"
- #import "loginVC.h"
- #import "JXNewFriendViewController.h"
- #import "PSRegisterBaseVC.h"
- #import "photosViewController.h"
- #import "JXSettingVC.h"
- #import "PSUpdateUserVC.h"
- #import "OrganizTreeViewController.h"
- #import "JXCourseListVC.h"
- #import "JXMyMoneyViewController.h"
- #import "JXNearVC.h"
- #import "JXSelFriendVC.h"
- #import "JXSelectFriendsVC.h"
- #ifdef Meeting_Version
- #import "JXAVCallViewController.h"
- #endif
- #ifdef Live_Version
- #import "JXLiveViewController.h"
- #endif
- #import "JXFriendViewController.h"
- #import "JXGroupViewController.h"
- #import "UIImage+Color.h"
- #import "JXScanQRViewController.h"
- #import "JLApplyForWithdrawalViewController.h"
- #import "JLMyBonusViewController.h"
- #import "UILabel+Size.h"
- #import "JLBubbleViewController.h"
- #import "JXChatViewController.h"
- #import "UIView+LK.h"
- #define HEIGHT 55
- #define MY_INSET 0 // 每行左右间隙
- #define SEVICE_INSET 10 // 服务左右间隙
- #define TOP_ADD_HEIGHT 400 // 顶部添加的高度,防止下拉顶部空白
- @interface PSMyViewController()
- @property (nonatomic,weak) UIView *titlesView;
- @property (nonatomic,weak) UIView *indicatorView;
- @property (nonatomic,weak) UIButton *button_n;
- @property (nonatomic,weak) UIButton *selectedButton;
- @property (nonatomic,weak) UILabel *countTipL;
- @end
- @implementation PSMyViewController
- - (void)bubbleFontClick {
- JLBubbleViewController *vc = [[JLBubbleViewController alloc] init];
- [g_navigation pushViewController:vc animated:YES];
- }
- - (void)myBossClick {
- [g_App showAlert:@"暂未开放!"];
- }
- - (void)callServiceClick {
- JXChatViewController *vc = [[JXChatViewController alloc] init];
- JXUserObject *user = [[JXUserObject sharedInstance] getUserById:@"10000"];
- vc.chatPerson = user;
- [g_navigation pushViewController:vc animated:YES];
- }
- - (void)myGiftClick {
- JLMyBonusViewController *myBonusVC = [[JLMyBonusViewController alloc] init];
- [g_navigation pushViewController:myBonusVC animated:YES];
- }
- - (void)suggestionsClick {
-
- JLApplyForWithdrawalViewController *vc = [[JLApplyForWithdrawalViewController alloc] init];
- [g_App.navigation pushViewController:vc animated:YES];
- return;
- [g_App showAlert:@"暂未开放!"];
- }
- - (id)init
- {
- self = [super init];
- if (self) {
- self.isRefresh = YES;
- self.title = Localized(@"JX_My");
- self.heightHeader = 0;
- self.heightFooter = JX_SCREEN_BOTTOM;
- [self createHeadAndFoot];
- // self.tableBody.backgroundColor = HEXCOLOR(0xf0eff4);
- [g_server getUser:MY_USER_ID toView:self];
- int h=-20;
- int w=JX_SCREEN_WIDTH;
-
- float marginHei = 10;
-
- int H = 86;
- JXImageView* iv;
- iv = [self createHeadButtonclick:@selector(onResume)];
- _topImageVeiw = iv;
- // CGFloat height = THE_DEVICE_HAVE_HEAD ? 55 : 75;
- // if (THESIMPLESTYLE) {
- // iv.frame = CGRectMake(0, h-TOP_ADD_HEIGHT, w, 266+TOP_ADD_HEIGHT-H+55);
- // h+=iv.frame.size.height-TOP_ADD_HEIGHT;
- // }else {
- // iv.frame = CGRectMake(0, h-TOP_ADD_HEIGHT, w, 266+TOP_ADD_HEIGHT-H);
- // h+=iv.frame.size.height-TOP_ADD_HEIGHT+ height;
- // }
- iv.frame = CGRectMake(0, THE_DEVICE_HAVE_HEAD ? -TOP_ADD_HEIGHT- 44 : -TOP_ADD_HEIGHT-20, w, 173+TOP_ADD_HEIGHT);
- h = CGRectGetMaxY(iv.frame);
-
- // 好友
- // NSArray *friends = [[JXUserObject sharedInstance] fetchAllUserFromLocal];
- // UIButton *button;
- // button = [self createViewWithFrame:CGRectMake(0, h, JX_SCREEN_WIDTH/2, H) title:[NSString stringWithFormat:@"%ld",friends.count] icon:@"my_topFriends" index:0 showLine:YES];
- //
- // // 群组
- // NSArray *groups = [[JXUserObject sharedInstance] fetchAllRoomsFromLocal];
- // button = [self createViewWithFrame:CGRectMake(CGRectGetMaxX(button.frame), h, JX_SCREEN_WIDTH/2, H) title:[NSString stringWithFormat:@"%ld",groups.count] icon:@"my_groups" index:1 showLine:NO];
- // h+=button.frame.size.height+marginHei;
-
-
- // iv = [self createButton:@"我的名片盒" drawTop:YES drawBottom:YES icon:@"set_card" click:@selector(onFriend)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height;
- // NSArray * titleArray = [NSArray arrayWithObjects:@"我的资料",@"我的朋友",@"我的空间",@"搜索好友",@"我的附件",nil];
- // NSArray * iconArray = [NSArray arrayWithObjects:@"my_friend",@"my_space",@"search_friends",@"my_attachment",@"balance_recharge",@"set_up",nil];
-
- // iv = [self createButton:@"我的资料" drawTop:YES drawBottom:YES icon:@"资料" click:@selector(onResume)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height+marginHei;
-
- // iv = [self createButton:Localized(@"PSMyViewController_MyFirend") drawTop:NO drawBottom:YES icon:@"my_friend" click:@selector(onFriend)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height;
-
- // iv = [self createButton:@"搜索好友" drawTop:NO drawBottom:YES icon:@"search_friends" click:@selector(onSearch)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height;
- _setBaseView = [[UIView alloc] initWithFrame:CGRectMake(0, h-20, JX_SCREEN_WIDTH,JX_SCREEN_HEIGHT - h - JX_SCREEN_BOTTOM)];
- _setBaseView.backgroundColor = [UIColor whiteColor];
- // [self.tableBody addSubview:_setBaseView];
- [self setPartRoundWithView:_setBaseView corners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadius:20];
- //------------------------------------------------------------------------
- _setBaseView2 = [[UIView alloc] initWithFrame:CGRectMake(0, h, JX_SCREEN_WIDTH,JX_SCREEN_HEIGHT - h - JX_SCREEN_BOTTOM+(THE_DEVICE_HAVE_HEAD?68:250))];
- self.tableBody.contentSize =_setBaseView2.frame.size;
- _setBaseView2.backgroundColor = [UIColor whiteColor];
- [self.tableBody addSubview:_setBaseView2];
- h =0;
- // 会员权限头
- iv = [self createButton1:@"会员权限" drawTop:NO drawBottom:NO icon:THESIMPLESTYLE ? @"member_promise" : @"member_promise" click:@selector(onMyBonus)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- iv.userInteractionEnabled = NO;
- h+=iv.frame.size.height;
-
- // 1:1.27 宽高比
-
- iv = [[JXImageView alloc] initWithFrame:CGRectZero];
- iv.image = [UIImage imageNamed:@"member_promise_bubble"];
- iv.frame = CGRectMake(SEVICE_INSET,h, 120, 120*1.27);
- [_setBaseView2 addSubview:iv];
- UITapGestureRecognizer *bubbleFontClick = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(bubbleFontClick)];
- [iv addGestureRecognizer:bubbleFontClick];
- iv.userInteractionEnabled = YES;
- h+=iv.frame.size.height;
-
- // 更多服务头
- iv = [self createButton1:@"更多服务" drawTop:NO drawBottom:NO icon:THESIMPLESTYLE ? @"more_service" : @"more_service" click:nil];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- iv.userInteractionEnabled = NO;
- h+=iv.frame.size.height;
-
- // 1:0.5 宽高比
- CGFloat more_serviceW = (JX_SCREEN_WIDTH-3*SEVICE_INSET)/2;
- CGFloat more_serviceH = more_serviceW * 0.5;
-
- iv = [[JXImageView alloc] initWithFrame:CGRectZero];
- iv.image = [UIImage imageNamed:@"my_boss"];
- iv.frame = CGRectMake(SEVICE_INSET,h, more_serviceW, more_serviceH);
- UITapGestureRecognizer *myBossClick = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myBossClick)];
- [iv addGestureRecognizer:myBossClick];
- iv.userInteractionEnabled = YES;
- [_setBaseView2 addSubview:iv];
- // h+=iv.frame.size.height;
-
-
- iv = [[JXImageView alloc] initWithFrame:CGRectZero];
- iv.image = [UIImage imageNamed:@"call_service"];
- iv.frame = CGRectMake(more_serviceW + SEVICE_INSET+ SEVICE_INSET,h, more_serviceW, more_serviceH);
- UITapGestureRecognizer *callServiceClick = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(callServiceClick)];
- [iv addGestureRecognizer:callServiceClick];
- iv.userInteractionEnabled = YES;
- [_setBaseView2 addSubview:iv];
- h+=iv.frame.size.height;
-
- iv = [[JXImageView alloc] initWithFrame:CGRectZero];
- iv.image = [UIImage imageNamed:@"my_gift"];
- iv.frame = CGRectMake(SEVICE_INSET,h, more_serviceW, more_serviceH);
- UITapGestureRecognizer *myGiftClick = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myGiftClick)];
- [iv addGestureRecognizer:myGiftClick];
- iv.userInteractionEnabled = YES;
- [_setBaseView2 addSubview:iv];
-
- iv = [[JXImageView alloc] initWithFrame:CGRectZero];
- iv.image = [UIImage imageNamed:@"video_sevice"];
- iv.frame = CGRectMake(more_serviceW + SEVICE_INSET+SEVICE_INSET,h, more_serviceW, more_serviceH);
- [_setBaseView2 addSubview:iv];
- UITapGestureRecognizer *videoSeviceClick = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(callServiceClick)];
- [iv addGestureRecognizer:videoSeviceClick];
- iv.userInteractionEnabled = YES;
- h+=iv.frame.size.height;
-
- iv = [[JXImageView alloc] initWithFrame:CGRectZero];
- iv.image = [UIImage imageNamed:@"Suggestions"];
- iv.frame = CGRectMake(SEVICE_INSET,h, more_serviceW, more_serviceH);
- UITapGestureRecognizer *suggestionsClick = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(suggestionsClick)];
- [iv addGestureRecognizer:suggestionsClick];
- iv.userInteractionEnabled = YES;
- [_setBaseView2 addSubview:iv];
- //------------------------------------------------------------------------
- h = 13;
- if ([g_config.enablePayModule boolValue]) {
- iv = [self createButton:Localized(@"JX_MyBalance") drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"balance_recharge_simple" : @"balance_recharge" click:@selector(onRecharge)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
-
- h+=iv.frame.size.height;
- }
-
- iv = [self createButton:@"我的彩金" drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"balance_recharge_simple" : @"balance_recharge" click:@selector(onMyBonus)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
-
- h+=iv.frame.size.height;
-
- iv = [self createButton:Localized(@"JX_MyDynamics") drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"my_space_simple" : @"my_space" click:@selector(onMyBlog)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- h+=iv.frame.size.height;
-
- iv = [self createButton:Localized(@"JX_MyCollection") drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"collection_me_simple" : @"collection_me" click:@selector(onMyFavorite)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- h+=iv.frame.size.height;
-
- // iv = [self createButton:Localized(@"PSMyViewController_MyAtt") drawTop:NO drawBottom:YES icon:@"my_attachment" click:@selector(onVideo)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height;
-
- iv = [self createButton:Localized(@"JX_MyLecture") drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"my_lecture_simple" : @"my_lecture" click:@selector(onCourse)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- // h+=iv.frame.size.height + marginHei;
- h+=iv.frame.size.height;
-
- if ([g_App.isShowApplyForWithdrawal intValue] == 0) {
- iv = [self createButton:@"申请提现" drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"balance_recharge_simple" : @"balance_recharge" click:@selector(onApplyForWithdrawal)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- h+=iv.frame.size.height;
- }
- // 新年活动
- if ([g_App.isOpenActivity intValue] == 0) {
- iv = [self createButton:g_App.activityName drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"my_space_simple" : @"my_space" click:@selector(onActivity)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- h+=iv.frame.size.height;
- }
-
- // iv = [self createButton:Localized(@"JXNearVC_NearHere") drawTop:NO drawBottom:YES icon:@"nearby_normal" click:@selector(onNear)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height;
- //#ifdef Live_Version
- // iv = [self createButton:Localized(@"OrganizVC_Organiz") drawTop:NO drawBottom:YES icon:@"my_organizBook" click:@selector(onOrganiz)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height;
- //#endif
-
-
- // iv = [self createButton:@"收藏职位" drawTop:NO drawBottom:YES icon:@"set_collect" click:@selector(onMoney)];
- // iv.frame = CGRectMake(0,h, w, HEIGHT);
- // h+=iv.frame.size.height;
- BOOL isShowLine = NO;
- #ifdef IS_SHOW_MENU
- #else
- #ifdef Meeting_Version
- isShowLine = YES;
- UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(iv.frame), JX_SCREEN_WIDTH, marginHei)];
- line1.backgroundColor = HEXCOLOR(0xF2F2F2);
- [_setBaseView addSubview:line1];
- iv = [self createButton:Localized(@"JXSettingVC_VideoMeeting") drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"videomeeting_simple" : @"videomeeting" click:@selector(onMeeting)];
- iv.frame = CGRectMake(0,h, w, HEIGHT);
- h+=iv.frame.size.height;
- isShowLine = NO;
- #else
- isShowLine = YES;
- #endif
-
- #ifdef Live_Version
- if ([g_App.isShowRedPacket intValue] == 1 ) {
- if (!isShowLine) {
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(iv.frame), JX_SCREEN_WIDTH, marginHei)];
- line.backgroundColor = HEXCOLOR(0xF2F2F2);
- [_setBaseView addSubview:line];
- }
-
- UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(iv.frame), JX_SCREEN_WIDTH, marginHei)];
- line1.backgroundColor = HEXCOLOR(0xF2F2F2);
- [_setBaseView addSubview:line1];
- iv = [self createButton:Localized(@"JX_LiveDemonstration") drawTop:isShowLine drawBottom:NO icon:THESIMPLESTYLE ? @"videoshow_simple" : @"videoshow" click:@selector(onLive)];
- iv.frame = CGRectMake(0,h, w, HEIGHT);
- h+=iv.frame.size.height + marginHei;
- }
- isShowLine = YES;
- #else
- isShowLine = NO;
- #endif
- #endif
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(iv.frame), JX_SCREEN_WIDTH, marginHei)];
- line.backgroundColor = HEXCOLOR(0xF2F2F2);
- [_setBaseView addSubview:line];
- iv = [self createButton:Localized(@"JXSettingVC_Set") drawTop:NO drawBottom:YES icon:THESIMPLESTYLE ? @"set_up_simple" : @"set_up" click:@selector(onSetting)];
- iv.frame = CGRectMake(MY_INSET,h, w-MY_INSET*2, HEIGHT);
- // h+=iv.frame.size.height;
- CGRect frame = _setBaseView.frame;
- frame.size.height = CGRectGetMaxY(iv.frame);
- _setBaseView.frame = frame;
-
- // if ((h + HEIGHT + 20) > self.tableBody.frame.size.height) {
- // self.tableBody.contentSize = CGSizeMake(self_width, CGRectGetMaxY(_setBaseView2.frame) + 20);
- // }
-
- // w/h = s_w/S_h
- UIImage *topImage = [UIImage imageNamed:@"goucaijiemian"];
-
-
-
- CGFloat topImageW = JX_SCREEN_WIDTH;
- CGFloat topImageH = JX_SCREEN_WIDTH*topImage.size.height/topImage.size.width;
-
- UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, -topImageH-JX_SCREEN_TOP-JX_STATUSBAR_H, topImageW, topImageH)];
- topView.backgroundColor=[UIColor greenColor];
- UIImageView *topImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, topImageW, topImageH)];
- topImageView.image = topImage;
-
- [topView addSubview:topImageView];
- [self.tableBody addSubview:topView];
- _topView = topView;
- self.tableBody.contentInset = UIEdgeInsetsMake(JX_SCREEN_TOP, 0, 0, 0);
- self.tableBody.contentOffset = CGPointMake(0, -JX_SCREEN_TOP-20);
- [g_notify addObserver:self selector:@selector(doRefresh:) name:kUpdateUserNotifaction object:nil];
- [g_notify addObserver:self selector:@selector(updateUserInfo:) name:kXMPPMessageUpadteUserInfoNotification object:nil];
- [g_notify addObserver:self selector:@selector(doRefresh:) name:kOfflineOperationUpdateUserSet object:nil];
- }
- return self;
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- NSLog(@"contentOffset.y = %f contentInset.top = %f", scrollView.contentOffset.y,scrollView.contentInset.top);
- CGFloat offsetY = scrollView.contentOffset.y;
- if(offsetY < 230 * -1) {
- self.tableBody.contentInset = UIEdgeInsetsMake(_topView.frame.size.height+JX_SCREEN_TOP, 0, 0, 0);
- }else {
-
- self.tableBody.contentInset = UIEdgeInsetsMake(JX_SCREEN_TOP+20, 0, 0, 0);
- }
- }
- - (void)updateUserInfo:(NSNotification *)noti {
- [g_server getUser:g_server.myself.userId toView:self];
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server getUserVipInformation:salt andToView:self];
- }
- -(void)dealloc{
- NSLog(@"PSMyViewController.dealloc");
- [g_notify removeObserver:self name:kUpdateUserNotifaction object:nil];
- [g_notify removeObserver:self name:kXMPPMessageUpadteUserInfoNotification object:nil];
- [g_notify removeObserver:self name:kOfflineOperationUpdateUserSet object:nil];
- // [_image release];
- // [super dealloc];
- }
- - (void)didReceiveMemoryWarning
- {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
- }
- //设置状态栏颜色
- - (void)setStatusBarBackgroundColor:(UIColor *)color {
-
- UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
- if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
- statusBar.backgroundColor = color;
- }
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:YES animated:NO];
- [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
- if (_friendLabel) {
- NSArray *friends = [[JXUserObject sharedInstance] fetchAllUserFromLocal];
- _friendLabel.text = [NSString stringWithFormat:@"%ld",friends.count];
- }
- if (_groupLabel) {
- NSArray *groups = [[JXUserObject sharedInstance] fetchAllRoomsFromLocal];
- _groupLabel.text = [NSString stringWithFormat:@"%ld",groups.count];
- }
- }
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- [self.navigationController setNavigationBarHidden:NO animated:NO];
- [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
- }
- - (void)viewDidAppear:(BOOL)animated
- {
- if (self.isRefresh) {
- self.isRefresh = NO;
- }else{
- [super viewDidAppear:animated];
- [self doRefresh:nil];
- }
- }
- -(void)doRefresh:(NSNotification *)notifacation{
- _head.image = nil;
- [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:_head];
- //获取用户余额
- [g_server getUserMoenyToView:self];
- [g_server getUser:MY_USER_ID toView:self];
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server getUserVipInformation:salt andToView:self];
- _userName.text = g_server.myself.userNickname;
- [_userName sizeToFit];
-
- _genderImgV.frame = CGRectMake(CGRectGetMaxX(_userName.frame)+5, CGRectGetMinY(_userName.frame)+5, 13, 13);
-
- _prettyNumberImgV.frame = CGRectMake(CGRectGetMaxX(_genderImgV.frame)+5, CGRectGetMinY(_genderImgV.frame), 13, 13);
-
- }
- //-(void)refreshUserDetail{
- // _moneyLabel.text = [NSString stringWithFormat:@"%.2f%@",g_App.myMoney,Localized(@"JX_ChinaMoney")];
- //}
- - (void)viewDidUnload
- {
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- //服务端返回数据
- -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
- [_wait hide];
-
- if([aDownload.action isEqualToString:act_GetUserVipInformation]){
- NSDictionary * currentDictionary = [dict objectForKey:@"current"];
- NSString * currentLevel = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"name"]];
- if(currentLevel.length != 0 && currentLevel != nil && ![currentLevel isEqualToString:@"<null>"] && ![currentLevel isEqualToString:@"(null)"])
- {
- NSString * currentLevelGradeName = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"gradeName"]];
- _grade.text = [NSString stringWithFormat:@"会员等级: %@", currentLevelGradeName];
- [_grade sizeToFit];
- NSDictionary * nextLevelDictionary = [dict objectForKey:@"next"];
- NSString *nextLevelName = [nextLevelDictionary objectForKey:@"name"];
- NSString *upgradeCoin = [nextLevelDictionary objectForKey:@"upgradeCoin"];
- NSString *nextLevelMoney = [nextLevelDictionary objectForKey:@"money"];
- NSString *currentLevelMoney = [currentDictionary objectForKey:@"money"];
- NSString *totalRecharge = [dict objectForKey:@"totalRecharge"];
- long needMoney = nextLevelMoney.longLongValue - totalRecharge.longLongValue;
-
- if (nextLevelDictionary == nil) {
- _tips.hidden = YES;
- }else {
- _tips.hidden = NO;
- _tips.text = [NSString stringWithFormat:@"距离下次升级(%@)还需%ld可领取%@彩金", nextLevelName,needMoney,upgradeCoin];
- [_tips sizeToFit];
- }
-
- _payAmount.text = [NSString stringWithFormat:@"当前充值金额: %@", totalRecharge];
- [_payAmount sizeToFit];
-
- CGFloat progress = totalRecharge.doubleValue/nextLevelMoney.doubleValue ;
- _progressUP.frame = CGRectMake(CGRectGetMinX(_head.frame), CGRectGetMaxY(_payAmount.frame)+5, CGRectGetWidth(_progress.frame)*progress, 8);
- }
-
-
-
- }
-
- if( [aDownload.action isEqualToString:act_getUserMoeny] ){
- NSString *balance = dict[@"balance"];
- _jixinCoin.text = [NSString stringWithFormat:@"即信币: %@", balance];
-
- //即信币Label
- NSString *bString = [NSString stringWithFormat:@"即信币: %@", balance];
- CGFloat width = [UILabel getWidthWithTitle:bString font:[UIFont systemFontOfSize:14]];
- CGFloat height = [UILabel getHeightByWidth:width title:bString font:[UIFont systemFontOfSize:14]];
- _jixinCoin.frame = CGRectMake(CGRectGetMaxX(_cardView.frame)-width-5, CGRectGetMinY(_userDesc.frame), width, height);
- [_jixinCoin sizeToFit];
-
- _jixinCoinImgV.frame = CGRectMake(CGRectGetMinX(_jixinCoin.frame)-18, CGRectGetMidY(_jixinCoin.frame)-7.5, 15, 15);
-
- }
-
- if( [aDownload.action isEqualToString:act_resumeList] ){
- }
- if( [aDownload.action isEqualToString:act_UserGet] ){
- JXUserObject* user = [[JXUserObject alloc]init];
- [user getDataFromDict:dict];
-
- g_server.myself.userNickname = user.userNickname;
- NSRange range = [user.telephone rangeOfString:@"86"];
-
- // 性别图标
- if ([user.sex isEqualToNumber:@0]) {
- _genderImgV.image = [UIImage imageNamed:@"my_view_female_icon"];
- }else {
- _genderImgV.image = [UIImage imageNamed:@"my_view_male_icon"];
- }
-
- // 会员账号 membershipAccount
- NSString *membershipAccount = dict[@"membershipAccount"];
- _userDesc.text = [NSString stringWithFormat:@"即信号: %@",membershipAccount];
- // 生日
- NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
- [formatter setDateFormat:@"yyyy.MM.dd"];
- // stringFromDate 将日期类型格式化,转为NSString 类型
- NSString *birthday = [formatter stringFromDate:user.birthday];
- _userBirthday.text = [NSString stringWithFormat:@"生日: %@", birthday];
-
- if (range.location != NSNotFound) {
- g_server.myself.telephone = [user.telephone substringFromIndex:range.location + range.length];
- }
-
- if (self.isGetUser) {
- self.isGetUser = NO;
- PSUpdateUserVC* vc = [PSUpdateUserVC alloc];
- vc.headImage = [_head.image copy];
- vc.user = user;
- vc = [vc init];
- [g_navigation pushViewController:vc animated:YES];
- return;
- }
-
- _userName.text = user.userNickname;
- [g_server delHeadImage:g_server.myself.userId];
- [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:_head];
- }
- if ([aDownload.action isEqualToString:act_getUserMoeny]) {
- g_App.myMoney = [dict[@"balance"] doubleValue];
- _moneyLabel.text = [NSString stringWithFormat:@"%.2f%@",g_App.myMoney,Localized(@"JX_ChinaMoney")];
- }
- }
- -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
- [_wait hide]; return 0;
- if( [aDownload.action isEqualToString:act_UserGet] ){
- if (!self.isGetUser) {
- PSUpdateUserVC* vc = [PSUpdateUserVC alloc];
- vc.headImage = [_head.image copy];
- vc.user = g_server.myself;
- vc = [vc init];
- [g_navigation pushViewController:vc animated:YES];
- }
-
- }
- return hide_error;
- }
- -(int) didServerConnectError:(JXConnection*)aDownload error:(NSError *)error{//error为空时,代表超时
- [_wait hide]; return 0;
- if( [aDownload.action isEqualToString:act_UserGet] ){
- if (!self.isGetUser) {
- PSUpdateUserVC* vc = [PSUpdateUserVC alloc];
- vc.headImage = [_head.image copy];
- vc.user = g_server.myself;
- vc = [vc init];
- [g_navigation pushViewController:vc animated:YES];
- }
- }
- return hide_error;
- }
- -(void) didServerConnectStart:(JXConnection*)aDownload{
- // [_wait start];
- }
- -(void)actionClear{
- [_wait start:Localized(@"PSMyViewController_Clearing") delay:100];
- }
- #ifdef Live_Version
- // 直播
- - (void)onLive {
- JXLiveViewController *vc = [[JXLiveViewController alloc] init];
- [g_navigation pushViewController:vc animated:YES];
- }
- #endif
- #ifdef Meeting_Version
- // 视频会议
- - (void)onMeeting {
- if(g_xmpp.isLogined != 1){
- [g_xmpp showXmppOfflineAlert];
- return;
- }
-
- NSString *str1;
- NSString *str2;
- str1 = Localized(@"JXSettingVC_VideoMeeting");
- str2 = Localized(@"JX_Meeting");
- JXActionSheetVC *actionVC = [[JXActionSheetVC alloc] initWithImages:@[@"meeting_tel",@"meeting_video"] names:@[str2,str1]];
- actionVC.delegate = self;
- [self presentViewController:actionVC animated:NO completion:nil];
- }
- - (void)actionSheet:(JXActionSheetVC *)actionSheet didButtonWithIndex:(NSInteger)index {
- if (index == 0) {
- [self onGroupAudioMeeting:nil];
- }else if(index == 1){
- [self onGroupVideoMeeting:nil];
- }
- }
- -(void)onGroupAudioMeeting:(JXMessageObject*)msg{
- self.isAudioMeeting = YES;
- [self onInvite];
- // [g_meeting startAudioMeeting:no roomJid:s];
- }
- -(void)onGroupVideoMeeting:(JXMessageObject*)msg{
- self.isAudioMeeting = NO;
- [self onInvite];
- // [g_meeting startVideoMeeting:no roomJid:s];
- }
- -(void)onInvite{
-
- NSMutableSet* p = [[NSMutableSet alloc]init];
-
- JXSelectFriendsVC* vc = [JXSelectFriendsVC alloc];
- vc.isNewRoom = NO;
- vc.isShowMySelf = NO;
- vc.type = JXSelUserTypeSelFriends;
- // vc.room = _room;
- vc.existSet = p;
- vc.delegate = self;
- vc.didSelect = @selector(meetingAddMember:);
- vc = [vc init];
- // [g_window addSubview:vc.view];
- [g_navigation pushViewController:vc animated:YES];
- }
- -(void)meetingAddMember:(JXSelectFriendsVC*)vc{
- int type;
- if (self.isAudioMeeting) {
- type = kWCMessageTypeAudioMeetingInvite;
- }else {
- type = kWCMessageTypeVideoMeetingInvite;
- }
- for(NSNumber* n in vc.set){
- JXUserObject *user;
- if (vc.seekTextField.text.length > 0) {
- user = vc.searchArray[[n intValue] % 100000-1];
- }else{
- user = [[vc.letterResultArr objectAtIndex:[n intValue] / 100000-1] objectAtIndex:[n intValue] % 100000-1];
- }
- NSString* s = [NSString stringWithFormat:@"%@",user.userId];
- [g_meeting sendMeetingInvite:s toUserName:user.userNickname roomJid:MY_USER_ID callId:nil type:type];
- }
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- if (g_meeting.isMeeting) {
- return;
- }
- JXAVCallViewController *avVC = [[JXAVCallViewController alloc] init];
- avVC.roomNum = MY_USER_ID;
- avVC.isAudio = self.isAudioMeeting;
- avVC.isGroup = YES;
- avVC.toUserName = MY_USER_NAME;
- avVC.view.frame = [UIScreen mainScreen].bounds;
- [g_window addSubview:avVC.view];
-
- });
-
- }
- #endif
- - (void)onApplyForWithdrawal {
- JLApplyForWithdrawalViewController *vc = [[JLApplyForWithdrawalViewController alloc] init];
- [g_App.navigation pushViewController:vc animated:YES];
- }
- - (void)onActivity {
- // 活动
- webpageVC * webVC = [webpageVC alloc];
- webVC.url = g_App.activityUrl;
- webVC.isSend = NO;
- webVC = [webVC init];
- // [g_navigation.navigationView addSubview:webVC.view];
- [g_navigation pushViewController:webVC animated:YES];
- }
- -(void)onMyBlog{
- userWeiboVC* vc = [userWeiboVC alloc];
- vc.user = g_myself;
- vc.isGotoBack = YES;
- vc = [vc init];
- // [g_window addSubview:vc.view];
- [g_navigation pushViewController:vc animated:YES];
- }
- -(void)onNear{
- JXNearVC * nearVc = [[JXNearVC alloc] init];
- // [g_window addSubview:nearVc.view];
- [g_navigation pushViewController:nearVc animated:YES];
- }
- -(void)onFriend{
- JXFriendViewController* vc = [[JXFriendViewController alloc]init];
- // [g_window addSubview:vc.view];
- [g_navigation pushViewController:vc animated:YES];
- }
- -(void)onResume{
- self.isGetUser = YES;
- [g_server getUser:MY_USER_ID toView:self];
- }
- -(void)onSpace{
- // mySpaceViewController* vc = [[mySpaceViewController alloc]init];
- // [g_window addSubview:vc.view];
- }
- -(void)onVideo{
- myMediaVC* vc = [[myMediaVC alloc] init];
- // [g_window addSubview:vc.view];
- [g_navigation pushViewController:vc animated:YES];
- }
- -(void)onMyFavorite{
- WeiboViewControlle * collection = [[WeiboViewControlle alloc] initCollection];
-
- // [g_window addSubview:collection.view];
- [g_navigation pushViewController:collection animated:YES];
- }
- - (void)onCourse {
- JXCourseListVC *vc = [[JXCourseListVC alloc] init];
- // [g_window addSubview:vc.view];
- [g_navigation pushViewController:vc animated:YES];
- }
- -(void)onRecharge{
- JXMyMoneyViewController * moneyVC = [[JXMyMoneyViewController alloc] init];
- // [g_window addSubview:moneyVC.view];
- [g_navigation pushViewController:moneyVC animated:YES];
-
- }
- - (void)onMyBonus {
- JLMyBonusViewController *myBonusVC = [[JLMyBonusViewController alloc] init];
- [g_navigation pushViewController:myBonusVC animated:YES];
- }
- -(void)onOrganiz{
- OrganizTreeViewController * organizVC = [[OrganizTreeViewController alloc] init];
- // [g_window addSubview:organizVC.view];
- [g_navigation pushViewController:organizVC animated:YES];
- }
- -(void)onMyLove{
-
- }
- -(void)onMoney{
- }
- -(void)onSetting{
- JXSettingVC* vc = [[JXSettingVC alloc]init];
- // [g_window addSubview:vc.view];
- [g_navigation pushViewController:vc animated:YES];
- }
- - (void)onAdd {
- JX_SelectMenuView *menuView = [[JX_SelectMenuView alloc] initWithTitle:@[Localized(@"JX_SendImage"),Localized(@"JX_SendVoice"),Localized(@"JX_SendVideo"),Localized(@"JX_SendFile")]image:@[@"menu_add_msg",@"menu_add_voice",@"menu_add_video",@"menu_add_file",@"menu_add_reply"]cellHeight:45];
- menuView.delegate = self;
- [g_App.window addSubview:menuView];
- }
- - (void)didMenuView:(JX_SelectMenuView *)MenuView WithIndex:(NSInteger)index {
- switch (index) {
- case 0:
- case 1:
- case 2:
- case 3:{
- addMsgVC* vc = [[addMsgVC alloc] init];
- vc.dataType = (int)index + 2;
- [g_navigation pushViewController:vc animated:YES];
- }
- break;
- default:
- break;
- }
- }
- -(JXImageView*)createHeadButtonclick:(SEL)click{
- JXImageView* btn = [[JXImageView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, 500)];
- //btn.backgroundColor = [UIColor gre];
- // btn.image = [UIImage imageNamed:@"my_view_head_bg"];
- btn.contentMode = UIViewContentModeScaleAspectFit;
- btn.userInteractionEnabled = YES;
- btn.didTouch = click;
- btn.delegate = self;
- [self.tableBody addSubview:btn];
-
- self.tableBody.delegate = self;
-
- // UIColor *color;
- // if (THESIMPLESTYLE) {
- // color = [UIColor whiteColor];
- // }else {
- // color = THEMECOLOR;
- // }
- // [self setupView:btn colors:@[(__bridge id)color.CGColor,(__bridge id)[color colorWithAlphaComponent:0.5].CGColor]];
- // UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, THE_DEVICE_HAVE_HEAD ? 24+TOP_ADD_HEIGHT : 40+TOP_ADD_HEIGHT, JX_SCREEN_WIDTH, 20)];
- // title.text = Localized(@"JX_PersonalCenter");
- // title.font = SYSFONT(18);
- // title.textColor = [UIColor whiteColor];
- // title.textAlignment = NSTextAlignmentCenter;
- // [btn addSubview:title];
-
- UIView *baseView = [[UIView alloc] initWithFrame:CGRectMake(0, TOP_ADD_HEIGHT-JX_SCREEN_TOP, JX_SCREEN_WIDTH, 173+JX_SCREEN_TOP)];
- [btn addSubview:baseView];
-
- UIImageView *baseBgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, 173+JX_SCREEN_TOP)];
- baseBgImageView.image = [UIImage imageNamed:@"my_view_head_bg"];
- [baseView addSubview:baseBgImageView];
- // 7: 1
- UIImageView *pullView = [[UIImageView alloc] initWithFrame:CGRectMake((JX_SCREEN_WIDTH-105)/2, [UIApplication sharedApplication].statusBarFrame.size.height, 105, 15)];
- pullView.image = [UIImage imageNamed:@"pull_image"];
- [baseView addSubview:pullView];
-
-
- UIImageView *cardView = [[UIImageView alloc] initWithFrame:CGRectMake(20, [UIApplication sharedApplication].statusBarFrame.size.height+25, JX_SCREEN_WIDTH - 40, 300 -JX_SCREEN_TOP)];
- cardView.image = [UIImage imageNamed:@"my_view_head_card_bg"];
- _cardView = cardView;
- [baseView addSubview:cardView];
- baseView.clipsToBounds = YES;
-
- // // 头像阴影
- // JXImageView *shadow = [[JXImageView alloc]initWithFrame:CGRectMake(13, (baseView.frame.size.height-84)/2-5, 100, 100)];
- // shadow.image = [UIImage imageNamed:@"my_icon_shadow"];
- // shadow.didTouch = @selector(onResume);
- // shadow.delegate = self;
- // [baseView addSubview:shadow];
-
- // UIButton *addBtn = [[UIButton alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-15*2-18, THE_DEVICE_HAVE_HEAD ? 59-15 : 35-15, 18+15*2, 18+15*2)];
- // [addBtn setImage:[UIImage imageNamed:@"my_add_white"] forState:UIControlStateNormal];
- // [addBtn addTarget:self action:@selector(onAdd) forControlEvents:UIControlEventTouchUpInside];
- // [baseView addSubview:addBtn];
-
- UIButton *addBtn = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(cardView.frame) - (18+15*2)/2, CGRectGetMinY(cardView.frame) - (18+15*2)/2, 18+15*2, 18+15*2)];
- [addBtn setImage:[UIImage imageNamed:@"my_view_setting_icon"] forState:UIControlStateNormal];
- [addBtn addTarget:self action:@selector(onSetting) forControlEvents:UIControlEventTouchUpInside];
- [baseView addSubview:addBtn];
- //头像
- _head = [[JXImageView alloc]initWithFrame:CGRectMake(CGRectGetMinX(cardView.frame)+10, CGRectGetMinY(cardView.frame)+10, 60, 60)];
- _head.layer.cornerRadius = 5;
- _head.layer.masksToBounds = YES;
- // _head.layer.borderWidth = 3.f;
- // _head.layer.borderColor = [UIColor whiteColor].CGColor;
- _head.didTouch = @selector(onResume);
- _head.delegate = self;
- [baseView addSubview:_head];
-
- //名字Label
- NSString *aString = g_server.myself.userNickname;
- CGSize titleSize = [aString sizeWithFont:SYSFONT(20) constrainedToSize:CGSizeMake(MAXFLOAT, 22)];
- UILabel* p = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_head.frame)+10, CGRectGetMinY(_head.frame), titleSize.width, 22)];
- p.font = SYSFONT(20);
- p.text = MY_USER_NAME;
- p.textColor = [UIColor blackColor];
- p.backgroundColor = [UIColor clearColor];
- [baseView addSubview:p];
- _userName = p;
-
- // 性别
- UIImageView *genderImgV = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(p.frame)+5, CGRectGetMinY(p.frame)+5, 13, 13)];
- genderImgV.image = [UIImage imageNamed:@"my_view_male_icon"];
- _genderImgV = genderImgV;
- [baseView addSubview:genderImgV];
- // 靓号
- UIImageView *prettyNumberImgV = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(genderImgV.frame)+5, CGRectGetMinY(genderImgV.frame), 13, 13)];
- prettyNumberImgV.image = [UIImage imageNamed:@"my_view_prettyNumber_inactivated"];
- _prettyNumberImgV = prettyNumberImgV;
- [baseView addSubview:prettyNumberImgV];
-
-
- //即信号Label
- p = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(p.frame), CGRectGetMaxY(p.frame)+12, 150, 14)];
- p.font = SYSFONT(14);
- // p.text = g_server.myself.telephone;
- p.text = [NSString stringWithFormat:@"即信号:"];
- p.textColor = [UIColor lightGrayColor];
- p.backgroundColor = [UIColor clearColor];
- [baseView addSubview:p];
- _userDesc = p;
-
- //即信币Label
- NSString *bString = @"即信币:";
- CGFloat width = [UILabel getWidthWithTitle:bString font:[UIFont systemFontOfSize:14]];
- CGFloat height = [UILabel getHeightByWidth:width title:bString font:[UIFont systemFontOfSize:14]];
- UILabel* jixinCoin = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(cardView.frame)-width-5, CGRectGetMinY(p.frame), width, height)];
- jixinCoin.font = SYSFONT(14);
- jixinCoin.text = bString;
- jixinCoin.textColor = [UIColor blackColor];
- jixinCoin.backgroundColor = [UIColor clearColor];
- [jixinCoin sizeToFit];
- _jixinCoin = jixinCoin;
- [baseView addSubview:jixinCoin];
-
- // 即信币图标
- UIImageView *jixinCoinImgV = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMinX(jixinCoin.frame)-18, CGRectGetMidY(jixinCoin.frame)-7.5, 15, 15)];
- jixinCoinImgV.image = [UIImage imageNamed:@"jixin_coin"];
- _jixinCoinImgV = jixinCoinImgV;
- [baseView addSubview:jixinCoinImgV];
-
- // 提现按钮
- UIButton *withdrawBtn = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(cardView.frame) - 60 -5, CGRectGetMaxY(jixinCoin.frame)+12, 60, height)];
- [withdrawBtn setImage:[UIImage imageNamed:@"withDraw"] forState:UIControlStateNormal];
- [withdrawBtn setTitle:@"提现" forState:(UIControlStateNormal)];
- [withdrawBtn setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
- [withdrawBtn setFont:[UIFont systemFontOfSize:14]];
- withdrawBtn.layer.cornerRadius = height*0.5;
- withdrawBtn.clipsToBounds = YES;
- withdrawBtn.layer.borderWidth = 0.5;
- withdrawBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
- withdrawBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
- [withdrawBtn addTarget:self action:@selector(onApplyForWithdrawal) forControlEvents:UIControlEventTouchUpInside];
- [baseView addSubview:withdrawBtn];
-
- // 充值按钮
- UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(cardView.frame) - 60 -5, CGRectGetMaxY(withdrawBtn.frame)+12, 60, height)];
- [payBtn setImage:[UIImage imageNamed:@"pay"] forState:UIControlStateNormal];
- [payBtn setTitle:@"充值" forState:(UIControlStateNormal)];
- [payBtn setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
- [payBtn setFont:[UIFont systemFontOfSize:14]];
- payBtn.layer.cornerRadius = height*0.5;
- payBtn.clipsToBounds = YES;
- payBtn.layer.borderWidth = 0.5;
- payBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
- payBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
- [payBtn addTarget:self action:@selector(onRecharge) forControlEvents:UIControlEventTouchUpInside];
- [baseView addSubview:payBtn];
-
-
- //生日Label
- p = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(p.frame), CGRectGetMaxY(p.frame)+12, 150, 14)];
- p.font = SYSFONT(14);
- // p.text = g_server.myself.telephone;
- p.text = [NSString stringWithFormat:@"生日:"];
- p.textColor = [UIColor lightGrayColor];
- p.backgroundColor = [UIColor clearColor];
- _userBirthday = p;
- [baseView addSubview:p];
-
- //会员等级Label
- p = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(p.frame), CGRectGetMaxY(p.frame)+12, 150, 14)];
- p.font = SYSFONT(14);
- // p.text = g_server.myself.telephone;
- p.text = [NSString stringWithFormat:@"会员等级:"];
- p.textColor = [UIColor lightGrayColor];
- p.backgroundColor = [UIColor clearColor];
- _grade = p;
- [baseView addSubview:p];
-
- //当前充值金额Label
- p = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(_head.frame), CGRectGetMaxY(p.frame)+12, 150, 14)];
- p.font = SYSFONT(12);
- // p.text = g_server.myself.telephone;
- p.text = [NSString stringWithFormat:@"当前充值金额: "];
- p.textColor = THEMECOLOR;
- p.backgroundColor = [UIColor clearColor];
- [p sizeToFit];
- _payAmount = p;
- [baseView addSubview:p];
-
- // [self gradentWith:CGRectMake(CGRectGetMinX(p.frame), CGRectGetMaxY(p.frame)+12, 150, 14) view:cardView];
- // 进度条背景
- UIImageView* progress = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMinX(_head.frame), CGRectGetMaxY(p.frame)+5, CGRectGetWidth(cardView.frame)-20, 8)];
- progress.image = [UIImage imageNamed:@"my_view_progress_bg"];
- [baseView addSubview:progress];
- _progress = progress;
-
- // 进度条
- UIImageView* progressUP = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMinX(_head.frame), CGRectGetMaxY(p.frame)+5, CGRectGetWidth(progress.frame)*0, 8)];
- progressUP.image = [UIImage imageNamed:@"my_view_progress_fill_bg"];
- progressUP.layer.cornerRadius = 4;
- progressUP.clipsToBounds = YES;
- [baseView addSubview:progressUP];
- _progressUP = progressUP;
-
-
- //距离下次升级Label
- p = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(_head.frame), CGRectGetMaxY(progressUP.frame)+5, CGRectGetWidth(progress.frame), 14)];
- p.font = SYSFONT(12);
- // p.text = g_server.myself.telephone;
- p.text = [NSString stringWithFormat:@"距离下次升级"];
- p.textColor = THEMECOLOR;
- p.backgroundColor = [UIColor clearColor];
- [p sizeToFit];
- _tips = p;
- [baseView addSubview:p];
-
-
-
-
-
-
- UIImageView* qrImgV = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-20-35, JX_SCREEN_TOP+65, 13, 13)];
- qrImgV.image = [UIImage imageNamed:@"my_qrcode"];
- // [baseView addSubview:qrImgV];
- UIImageView* iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-15-6, CGRectGetMinY(qrImgV.frame), 6, 12)];
- iv.image = [UIImage imageNamed:@"my_next_white"];
- // [baseView addSubview:iv];
-
- return btn;
- }
- - (void)onPay {
-
- }
- - (void)onWithdraw {
-
- }
- // 画圆角
- - (void)setPartRoundWithView:(UIView *)view corners:(UIRectCorner)corners cornerRadius:(float)cornerRadius {
- CAShapeLayer *shapeLayer = [CAShapeLayer layer];
- shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)].CGPath;
- view.layer.mask = shapeLayer;
- }
- - (void)onColleagues:(UITapGestureRecognizer *)tap {
- // 防止好友、群组同时调用
- if (_isSelected)
- return;
- _isSelected = YES;
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- _isSelected = NO;
- });
- switch (tap.view.tag) {
- case 0:{
- JXFriendViewController *friendVC = [JXFriendViewController alloc];
- friendVC.isMyGoIn = YES;
- friendVC = [friendVC init];
- [g_navigation pushViewController:friendVC animated:YES];
- }
- break;
- case 1:{
- JXGroupViewController *groupVC = [[JXGroupViewController alloc] init];
- [g_navigation pushViewController:groupVC animated:YES];
- }
- break;
- default:
- break;
- }
- }
- - (UIButton *)createViewWithFrame:(CGRect)frame title:(NSString *)title icon:(NSString *)icon index:(CGFloat)index showLine:(BOOL)isShow{
- UIButton *view = [[UIButton alloc] init];
- [view setBackgroundImage:[UIImage createImageWithColor:[UIColor whiteColor]] forState:UIControlStateNormal];
- [view setBackgroundImage:[UIImage createImageWithColor:HEXCOLOR(0xF6F5FA)] forState:UIControlStateHighlighted];
- view.frame = frame;
- view.tag = index;
- [self.tableBody addSubview:view];
- int imgH = 40.5;
- UIImageView *imgV = [[UIImageView alloc] init];
- imgV.frame = CGRectMake((view.frame.size.width-imgH)/2, (view.frame.size.height-imgH-15-3)/2, imgH, imgH);
- imgV.image = [UIImage imageNamed:icon];
- [view addSubview:imgV];
-
- UILabel *label = [[UILabel alloc] init];
- label.frame = CGRectMake(0, CGRectGetMaxY(imgV.frame)+3, view.frame.size.width, 15);
- label.text = title;
- label.textAlignment = NSTextAlignmentCenter;
- label.font = SYSFONT(15);
- label.textColor = HEXCOLOR(0x323232);
- [view addSubview:label];
- if (index == 0) {
- _friendLabel = label;
- }else {
- _groupLabel = label;
- }
- if (isShow) {
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(view.frame.size.width-LINE_WH, (view.frame.size.height-24)/2, LINE_WH, 24)];
- line.backgroundColor = THE_LINE_COLOR;
- [view addSubview:line];
- }
-
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onColleagues:)];
- [view addGestureRecognizer:tap];
-
- return view;
- }
- -(JXImageView*)createButton1:(NSString*)title drawTop:(BOOL)drawTop drawBottom:(BOOL)drawBottom icon:(NSString*)icon click:(SEL)click{
- JXImageView* btn = [[JXImageView alloc] init];
- btn.backgroundColor = [UIColor whiteColor];
- btn.userInteractionEnabled = YES;
- btn.didTouch = click;
- btn.delegate = self;
- [_setBaseView2 addSubview:btn];
-
- JXLabel* p = [[JXLabel alloc] initWithFrame:CGRectMake(45, 0, self_width-35-20-5, HEIGHT)];
- p.text = title;
- p.font = [UIFont systemFontOfSize:18 weight:(UIFontWeightBold)];;
- p.backgroundColor = [UIColor clearColor];
- p.textColor = HEXCOLOR(0x323232);
- [btn addSubview:p];
- if(icon){
- UIImageView* iv = [[UIImageView alloc] initWithFrame:CGRectMake(15, (HEIGHT-23)/2, 23, 23)];
- iv.image = [UIImage imageNamed:icon];
- [btn addSubview:iv];
- }
-
- if(drawTop){
- UIView* line = [[UIView alloc] initWithFrame:CGRectMake(53,0,JX_SCREEN_WIDTH-53,LINE_WH)];
- line.backgroundColor = THE_LINE_COLOR;
- [btn addSubview:line];
- }
-
- if(drawBottom){
- UIView* line = [[UIView alloc] initWithFrame:CGRectMake(53,HEIGHT-0.3,JX_SCREEN_WIDTH-53,LINE_WH)];
- line.backgroundColor = THE_LINE_COLOR;
- [btn addSubview:line];
- }
-
- if(click){
- UIImageView* iv;
- iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-15-7, (HEIGHT-13)/2, 7, 13)];
- iv.image = [UIImage imageNamed:@"next_icon"];
- [btn addSubview:iv];
-
- }
- return btn;
- }
- -(JXImageView*)createButton:(NSString*)title drawTop:(BOOL)drawTop drawBottom:(BOOL)drawBottom icon:(NSString*)icon click:(SEL)click{
- JXImageView* btn = [[JXImageView alloc] init];
- btn.backgroundColor = [UIColor whiteColor];
- btn.userInteractionEnabled = YES;
- btn.didTouch = click;
- btn.delegate = self;
- [_setBaseView addSubview:btn];
-
- JXLabel* p = [[JXLabel alloc] initWithFrame:CGRectMake(53, 0, self_width-35-20-5, HEIGHT)];
- p.text = title;
- p.font = g_factory.font16;
- p.backgroundColor = [UIColor clearColor];
- p.textColor = HEXCOLOR(0x323232);
- [btn addSubview:p];
- if(icon){
- UIImageView* iv = [[UIImageView alloc] initWithFrame:CGRectMake(15, (HEIGHT-23)/2, 23, 23)];
- iv.image = [UIImage imageNamed:icon];
- [btn addSubview:iv];
- }
-
- if(drawTop){
- UIView* line = [[UIView alloc] initWithFrame:CGRectMake(53,0,JX_SCREEN_WIDTH-53,LINE_WH)];
- line.backgroundColor = THE_LINE_COLOR;
- [btn addSubview:line];
- }
-
- if(drawBottom){
- UIView* line = [[UIView alloc] initWithFrame:CGRectMake(53,HEIGHT-0.3,JX_SCREEN_WIDTH-53,LINE_WH)];
- line.backgroundColor = THE_LINE_COLOR;
- [btn addSubview:line];
- }
-
- if(click){
- UIImageView* iv;
- iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-15-7, (HEIGHT-13)/2, 7, 13)];
- iv.image = [UIImage imageNamed:@"new_icon_>"];
- [btn addSubview:iv];
-
- }
- return btn;
- }
- //内存泄漏,为啥?
- -(void)onHeadImage{
- [g_server delHeadImage:g_myself.userId];
-
- JXImageScrollVC * imageVC = [[JXImageScrollVC alloc]init];
-
- imageVC.imageSize = CGSizeMake(JX_SCREEN_WIDTH, JX_SCREEN_WIDTH);
-
- imageVC.iv = [[JXImageView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_WIDTH)];
-
- imageVC.iv.center = imageVC.view.center;
-
- [g_server getHeadImageLarge:g_myself.userId userName:g_myself.userNickname imageView:imageVC.iv];
-
- [self addTransition:imageVC];
-
- [self presentViewController:imageVC animated:YES completion:^{
- self.isRefresh = YES;
-
- }];
-
- // [imageVC release];
-
-
- }
- - (void)setupView:(UIView *)view colors:(NSArray *)colors {
- CAGradientLayer *gradientLayer = [CAGradientLayer layer];
- gradientLayer.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, 266+TOP_ADD_HEIGHT-86); // 设置显示的frame
- gradientLayer.colors = colors; // 设置渐变颜色
- gradientLayer.startPoint = CGPointMake(0, 0);
- gradientLayer.endPoint = CGPointMake(1, 0);
- [view.layer addSublayer:gradientLayer];
- }
- //添加VC转场动画
- - (void) addTransition:(JXImageScrollVC *) siv
- {
- self.scaleTransition = [[DMScaleTransition alloc]init];
- [siv setTransitioningDelegate:self.scaleTransition];
-
- }
- //-(void)onSearch{
- // JXNearVC* vc = [[JXNearVC alloc] init];
- // [g_window addSubview:vc.view];
- // [vc onSearch];
- //}
-
- @end
|