PersonCenterModel.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. //
  2. // PersonCenterModel.m
  3. // FanweApp
  4. //
  5. // Created by 丁凯 on 2017/7/20.
  6. // Copyright © 2017年 xfg. All rights reserved.
  7. //
  8. #import "PersonCenterModel.h"
  9. #import "userPageModel.h"
  10. #import "AccountRechargeVC.h"
  11. #import "IncomeViewController.h"
  12. #import "ChargerViewController.h"
  13. #import "DistributionController.h"
  14. #import "IdentificationViewController.h"
  15. #import "SetViewController.h"
  16. #import "GameDistributionViewController.h"
  17. #import "ShopListViewController.h"
  18. #import "OnLiveViewController.h"
  19. #import "FollowerViewController.h"
  20. #import "EditFamilyViewController.h"
  21. #import "FamilyDesViewController.h"
  22. #import "FamilyListViewController.h"
  23. #import "SocietyListViewController.h"
  24. #import "EditSocietyViewController.h"
  25. #import "SocietyDesViewController.h"
  26. #import "HPheadView.h"
  27. #import "SSearchVC.h"
  28. #import "BGEditInfoController.h"
  29. #import "GetHeadImgViewController.h"
  30. #import "BGConversationSegmentController.h"
  31. @implementation PersonCenterModel
  32. - (void)creatUIWithModel:(userPageModel *)userModel andMArr:(NSMutableArray *)detailArray andMyView:(UIView *)myView
  33. {
  34. for (UIButton *btn in myView.subviews)
  35. {
  36. if ([btn viewWithTag:1])
  37. {
  38. if ([userModel.video_count integerValue] >= 10000)
  39. {
  40. [btn setTitle:[NSString stringWithFormat:@"直播 %.1f万",[userModel.video_count floatValue]/10000] forState:UIControlStateNormal];
  41. }
  42. else
  43. {
  44. [btn setTitle:[NSString stringWithFormat:@"直播 %@",userModel.video_count] forState:UIControlStateNormal];
  45. }
  46. }
  47. if([btn viewWithTag:2])
  48. {
  49. if ([userModel.focus_count floatValue]>=10000)
  50. {
  51. [btn setTitle:[NSString stringWithFormat:@"关注 %.1f万",[userModel.focus_count floatValue]/10000] forState:UIControlStateNormal];
  52. }
  53. else
  54. {
  55. [btn setTitle:[NSString stringWithFormat:@"关注 %@",userModel.focus_count] forState:UIControlStateNormal];
  56. }
  57. }
  58. if([btn viewWithTag:3])
  59. {
  60. if ([userModel.fans_count integerValue]>=10000)
  61. {
  62. [btn setTitle:[NSString stringWithFormat:@"粉丝 %.1f万",[userModel.fans_count floatValue]/10000] forState:UIControlStateNormal];
  63. }
  64. else
  65. {
  66. [btn setTitle:[NSString stringWithFormat:@"粉丝 %@",userModel.fans_count] forState:UIControlStateNormal];
  67. }
  68. }
  69. }
  70. if (userModel.user_level.length)
  71. {
  72. [detailArray replaceObjectAtIndex:0 withObject:[NSString stringWithFormat:@"%@级",userModel.user_level]];
  73. }
  74. if ([userModel.diamonds floatValue] > 10000)
  75. {
  76. [detailArray replaceObjectAtIndex:1 withObject:[NSString stringWithFormat:@"%.2f万钻石",[userModel.diamonds floatValue]/10000]];
  77. }else
  78. {
  79. [detailArray replaceObjectAtIndex:1 withObject:[NSString stringWithFormat:@"%@钻石",userModel.diamonds]];
  80. }
  81. if ([self.fanweApp.appModel.open_vip isEqualToString:@"1"])
  82. {
  83. if ([userModel.is_vip isEqualToString:@"1"])
  84. {
  85. [detailArray replaceObjectAtIndex:2 withObject:@"已开通"];
  86. }
  87. else
  88. {
  89. [detailArray replaceObjectAtIndex:2 withObject:userModel.vip_expire_time];
  90. }
  91. }
  92. else
  93. {
  94. [detailArray replaceObjectAtIndex:2 withObject:@""];
  95. }
  96. if (userModel.coin.length)
  97. {
  98. [detailArray replaceObjectAtIndex:3 withObject:[NSString stringWithFormat:@"%@游戏币",userModel.coin]];
  99. }
  100. if ([userModel.useable_ticket integerValue]>=10000)
  101. {
  102. [detailArray replaceObjectAtIndex:4 withObject:[NSString stringWithFormat:@"%.3f万%@",[userModel.useable_ticket floatValue]/10000,self.fanweApp.appModel.ticket_name]];
  103. }
  104. else
  105. {
  106. [detailArray replaceObjectAtIndex:4 withObject:[NSString stringWithFormat:@"%@%@",userModel.useable_ticket,self.fanweApp.appModel.ticket_name]];
  107. }
  108. if (userModel.podcast_order.length)
  109. {
  110. [detailArray replaceObjectAtIndex:5 withObject:[NSString stringWithFormat:@"%@ 个订单",userModel.podcast_order]];
  111. }
  112. if (userModel.podcast_pai.length)
  113. {
  114. [detailArray replaceObjectAtIndex:6 withObject:[NSString stringWithFormat:@"%@ 个竞拍",userModel.podcast_pai]];
  115. }
  116. if (userModel.show_user_order.length)
  117. {
  118. [detailArray replaceObjectAtIndex:7 withObject:[NSString stringWithFormat:@"%@ 个订单",userModel.show_user_order]];
  119. }
  120. if (userModel.podcast_goods.length)
  121. {
  122. [detailArray replaceObjectAtIndex:8 withObject:[NSString stringWithFormat:@"%@ 个商品",userModel.podcast_goods]];
  123. }
  124. if (userModel.user_pai.length)
  125. {
  126. [detailArray replaceObjectAtIndex:9 withObject:[NSString stringWithFormat:@"%@ 个竞拍",userModel.user_pai]];
  127. }
  128. if (self.fanweApp.appModel.shop_shopping_cart.length)
  129. {
  130. [detailArray replaceObjectAtIndex:10 withObject:[NSString stringWithFormat:@"%@ 个商品",self.fanweApp.appModel.shop_shopping_cart]];
  131. }
  132. if (userModel.open_podcast_goods.length)
  133. {
  134. [detailArray replaceObjectAtIndex:11 withObject:[NSString stringWithFormat:@"%@ 个商品",userModel.open_podcast_goods]];
  135. }
  136. NSString *idStr;
  137. if ([userModel.is_authentication intValue] ==0)
  138. {
  139. idStr = @"未认证";
  140. }
  141. if ([userModel.is_authentication intValue] ==1)
  142. {
  143. idStr = @"等待审核";
  144. }
  145. if ([userModel.is_authentication intValue] ==2)
  146. {
  147. idStr = @"已认证";
  148. }
  149. if ([userModel.is_authentication intValue] ==3)
  150. {
  151. idStr = @"审核不通过";
  152. }
  153. [detailArray replaceObjectAtIndex:13 withObject:idStr];
  154. }
  155. -(void)didSelectWithModel:(userPageModel *)userModel andSection:(int)section
  156. {
  157. self.fanweApp = [GlobalVariables sharedInstance];
  158. if (section == 0)
  159. {
  160. NSString *tmpUrlStr;
  161. #if kSupportH5Shopping
  162. tmpUrlStr = [NSString stringWithFormat:@"%@&user_id=%@",_fanweApp.appModel.h5_url.url_my_grades,_userModel.user_id];
  163. #else
  164. tmpUrlStr = _fanweApp.appModel.h5_url.url_my_grades;
  165. #endif
  166. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:tmpUrlStr isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES];
  167. tmpController.navTitleStr = @"我的等级";
  168. [[AppDelegate sharedAppDelegate] pushViewController:tmpController];
  169. }
  170. else if (section == 1)
  171. {
  172. AccountRechargeVC *acountVC = [[AccountRechargeVC alloc]init];
  173. [[AppDelegate sharedAppDelegate] pushViewController:acountVC];
  174. }
  175. else if(section == 2)
  176. {
  177. AccountRechargeVC *acountVC = [[AccountRechargeVC alloc]init];
  178. acountVC.is_vip = YES;
  179. [[AppDelegate sharedAppDelegate] pushViewController:acountVC];
  180. }
  181. else if(section == 4)
  182. {
  183. IncomeViewController *profitVC = [[IncomeViewController alloc]init];
  184. [[AppDelegate sharedAppDelegate] pushViewController:profitVC];
  185. }else if (section == 5)
  186. {
  187. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:self.fanweApp.appModel.h5_url.url_podcast_order isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:YES];
  188. tmpController.navTitleStr = @"订单管理";
  189. [[AppDelegate sharedAppDelegate] pushViewController:tmpController];
  190. }
  191. else if(section == 6)
  192. {
  193. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:self.fanweApp.appModel.h5_url.url_podcast_pai isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:YES];
  194. tmpController.navTitleStr = @"竞拍管理";
  195. tmpController.isFrontRefresh = YES;
  196. [[AppDelegate sharedAppDelegate] pushViewController:tmpController];
  197. }
  198. else if(section == 7)
  199. {
  200. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:self.fanweApp.appModel.h5_url.url_user_order isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:YES];
  201. tmpController.navTitleStr = @"我的订单";
  202. [[AppDelegate sharedAppDelegate] pushViewController:tmpController];
  203. }
  204. else if(section == 8)
  205. {
  206. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:self.fanweApp.appModel.h5_url.url_podcast_goods isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:YES];
  207. tmpController.navTitleStr = @"商品管理";
  208. [[AppDelegate sharedAppDelegate] pushViewController:tmpController];
  209. }else if(section == 9)
  210. {
  211. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:self.fanweApp.appModel.h5_url.url_user_pai isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:YES];
  212. tmpController.navTitleStr = @"我的竞拍";
  213. tmpController.isFrontRefresh = YES;
  214. [[AppDelegate sharedAppDelegate] pushViewController:tmpController];
  215. }
  216. else if(section == 10)
  217. {
  218. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:self.fanweApp.appModel.h5_url.url_shopping_cart isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:YES];
  219. tmpController.navTitleStr = @"我的购物车";
  220. [[AppDelegate sharedAppDelegate] pushViewController:tmpController];
  221. }
  222. else if(section == 11)
  223. {
  224. ShopListViewController *shopListVC = [[ShopListViewController alloc]init];
  225. shopListVC.user_id = userModel.user_id;
  226. shopListVC.isOTOShop = YES;
  227. shopListVC.hidesBottomBarWhenPushed = YES;
  228. [[AppDelegate sharedAppDelegate] pushViewController:shopListVC];
  229. }else if(section == 12)
  230. {
  231. ContributionListViewController *contributionVC =[[ContributionListViewController alloc]init];
  232. contributionVC.type = @"0";
  233. contributionVC.user_id = userModel.user_id;
  234. contributionVC.hidesBottomBarWhenPushed = YES;
  235. [[AppDelegate sharedAppDelegate] pushViewController:contributionVC];
  236. }else if(section == 13)
  237. {
  238. IdentificationViewController *identificationVC = [[IdentificationViewController alloc]init];
  239. identificationVC.user_id = userModel.user_id;
  240. identificationVC.sexString = userModel.sex;
  241. identificationVC.nameString = userModel.nick_name;
  242. [[AppDelegate sharedAppDelegate] pushViewController:identificationVC];
  243. }else if(section == 15)
  244. {
  245. ChargerViewController *chargerVC = [[ChargerViewController alloc]init];
  246. chargerVC.type = 0;
  247. chargerVC.live_pay_type = _fanweApp.appModel.live_pay_time ? 0:1;
  248. [[AppDelegate sharedAppDelegate] pushViewController:chargerVC];
  249. }else if(section == 17)
  250. {
  251. DistributionController *DistributionVC = [[DistributionController alloc]init];
  252. [[AppDelegate sharedAppDelegate] pushViewController:DistributionVC];
  253. }else if(section == 18)
  254. {
  255. GameDistributionViewController *gameDistributionVC = [[GameDistributionViewController alloc]init];
  256. [[AppDelegate sharedAppDelegate] pushViewController:gameDistributionVC];
  257. }else if(section == 19)
  258. {
  259. SetViewController *setViewController = [[SetViewController alloc]init];
  260. setViewController.userID = userModel.user_id;
  261. [[AppDelegate sharedAppDelegate] pushViewController:setViewController];
  262. }else if(section == 21)//回播
  263. {
  264. OnLiveViewController *onliveVC = [[OnLiveViewController alloc]init];
  265. onliveVC.user_id = userModel.user_id;
  266. [[AppDelegate sharedAppDelegate] pushViewController:onliveVC];
  267. }else if(section == 22 || section == 23)//关注22 粉丝23
  268. {
  269. FollowerViewController *FollowVC = [[FollowerViewController alloc]init];
  270. FollowVC.user_id = userModel.user_id;
  271. FollowVC.type = [NSString stringWithFormat:@"%d",section-21];
  272. [[AppDelegate sharedAppDelegate] pushViewController:FollowVC];
  273. }else if (section == 24)//24搜索
  274. {
  275. SSearchVC *searchVC = [[SSearchVC alloc]init];
  276. searchVC.searchType = @"0";
  277. [[AppDelegate sharedAppDelegate] pushViewController:searchVC];
  278. }else if (section == 25)//25IM消息
  279. {
  280. // ConversationListController* chatlist = [[ConversationListController alloc]initWithNibName:@"ConversationListController" bundle:nil];
  281. // chatlist.mbackbt.hidden = NO;
  282. BGConversationSegmentController *chatListVC = [[BGConversationSegmentController alloc]init];
  283. [[AppDelegate sharedAppDelegate] pushViewController:chatListVC];
  284. }else if (section == 26)//26更换头像
  285. {
  286. GetHeadImgViewController *headVC =[[GetHeadImgViewController alloc]init];
  287. headVC.headImgString =userModel.head_image;
  288. headVC.userId =userModel.user_id;
  289. [[AppDelegate sharedAppDelegate]pushViewController:headVC];
  290. }else if (section == 27)//27编辑
  291. {
  292. BGEditInfoController *editVC = [[BGEditInfoController alloc]init];
  293. [[AppDelegate sharedAppDelegate] pushViewController:editVC];
  294. }
  295. }
  296. #pragma mark ======================兑换游戏币======================
  297. - (void)createExchangeCoinViewWithVC:(UIViewController *)myVC
  298. {
  299. _bgWindow = [[UIApplication sharedApplication].delegate window];
  300. if (!_exchangeView)
  301. {
  302. _exchangeBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  303. _exchangeBgView.backgroundColor = kGrayTransparentColor4;
  304. _exchangeBgView.hidden = YES;
  305. [myVC.view addSubview:_exchangeBgView];
  306. UITapGestureRecognizer *bgViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(exchangeBgViewTap)];
  307. [_exchangeBgView addGestureRecognizer:bgViewTap];
  308. _exchangeView = [ExchangeCoinView EditNibFromXib];
  309. _exchangeView.exchangeType = 1;
  310. _exchangeView.delegate = self;
  311. _exchangeView.frame = CGRectMake((kScreenW - 300)/2, kScreenH, 300, 230);
  312. [_exchangeView createSomething];
  313. [_bgWindow addSubview:_exchangeView];
  314. }
  315. }
  316. - (void)exchangeViewDownWithExchangeCoinView:(ExchangeCoinView *)exchangeCoinView
  317. {
  318. if (_exchangeView == exchangeCoinView)
  319. {
  320. [_exchangeView.diamondLeftTextfield resignFirstResponder];
  321. _exchangeView.diamondLeftTextfield.text = nil;
  322. _exchangeView.coinLabel.text = @"0游戏币";
  323. [UIView animateWithDuration:0.3 animations:^{
  324. _exchangeView.frame = CGRectMake((kScreenW - 300)/2, kScreenH, 300, 230);
  325. } completion:^(BOOL finished) {
  326. _exchangeBgView.hidden = YES;
  327. }];
  328. }
  329. }
  330. - (void)exchangeBgViewTap
  331. {
  332. [self exchangeViewDownWithExchangeCoinView:_exchangeView];
  333. }
  334. - (void)exchangeGaomeCoinsWithModel:(userPageModel *)userModel
  335. {
  336. [_bgWindow bringSubviewToFront:_exchangeBgView];
  337. [_bgWindow bringSubviewToFront:_exchangeView];
  338. [_exchangeView obtainCoinProportion];
  339. [UIView animateWithDuration:0.3 animations:^{
  340. _exchangeBgView.hidden = NO;
  341. [_exchangeView.diamondLeftTextfield becomeFirstResponder];
  342. _exchangeView.ticket = userModel.diamonds;
  343. _exchangeView.diamondLabel.text =[NSString stringWithFormat:@"钻石余额:%@",userModel.diamonds];
  344. _exchangeView.frame = CGRectMake((kScreenW - 300)/2, (kScreenH - 350)/2, 300, 230);
  345. }];
  346. }
  347. #pragma mark ======================我的家族======================
  348. - (void)createFamilyViewWithVC:(UIViewController *)myVC andModel:(userPageModel *)userModel
  349. {
  350. self.userModel = userModel;
  351. if (!self.backgroundView)
  352. {
  353. self.backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  354. self.backgroundView.backgroundColor = kAppGrayColor6;
  355. self.backgroundView.alpha = 0.5;
  356. self.backgroundView.hidden = NO;
  357. [myVC.view addSubview:self.backgroundView];
  358. self.bigButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  359. [self.bigButton addTarget:self action:@selector(closeFamilyView) forControlEvents:UIControlEventTouchUpInside];
  360. [self.backgroundView addSubview:_bigButton];
  361. self.backView = [[UIView alloc] initWithFrame:CGRectMake(10, (kScreenH-170)/2, kScreenW-20, 170)];
  362. self.backView.backgroundColor = [UIColor grayColor];
  363. self.backView.layer.cornerRadius = 5;
  364. self.backView.layer.masksToBounds = YES;
  365. [myVC.view addSubview:_backView];
  366. self.bigView = [[UIView alloc] initWithFrame:CGRectMake(5, 5, kScreenW-30, 160)];
  367. self.bigView.backgroundColor = [UIColor whiteColor];
  368. self.bigView.layer.cornerRadius = 5;
  369. self.bigView.layer.masksToBounds = YES;
  370. [self.backView addSubview:self.bigView];
  371. self.addFamilyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  372. self.addFamilyBtn.frame = CGRectMake(15, 20, kScreenW-60, 48);
  373. self.addFamilyBtn.backgroundColor = kAppMainColor;
  374. self.addFamilyBtn.layer.cornerRadius = 15;
  375. self.addFamilyBtn.layer.masksToBounds = YES;
  376. [self.addFamilyBtn addTarget:self action:@selector(clickAddBtn) forControlEvents:UIControlEventTouchUpInside];
  377. [self.addFamilyBtn setTitle:@"加入家族" forState:UIControlStateNormal];
  378. [self.bigView addSubview:self.addFamilyBtn];
  379. self.createBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  380. self.createBtn.backgroundColor = kAppFamilyBtnColor;
  381. self.createBtn.layer.cornerRadius = 15;
  382. self.createBtn.layer.masksToBounds = YES;
  383. [self.createBtn setTitle:@"创建家族" forState:UIControlStateNormal];
  384. [self.createBtn addTarget:self action:@selector(clickCreateBtn) forControlEvents:UIControlEventTouchUpInside];
  385. [self.bigView addSubview:self.createBtn];
  386. if ([self.fanweApp.appModel.family_join intValue] == 0)
  387. {
  388. self.backView.frame = CGRectMake(10, (kScreenH-85)/2, kScreenW-20, 85);
  389. self.bigView.frame = CGRectMake(5, 2.5, kScreenW-30, 80);
  390. self.addFamilyBtn.hidden = YES;
  391. self.createBtn.frame = CGRectMake(15, CGRectGetMidY(_bigView.frame)-25, kScreenW-60, 48);
  392. }
  393. else if ([self.fanweApp.appModel.family_join intValue] == 1)
  394. {
  395. self.backView.frame = CGRectMake(10, (kScreenH-170)/2, kScreenW-20, 170);
  396. self.bigView.frame = CGRectMake(5, 5, kScreenW-30, 160);
  397. self.addFamilyBtn.hidden = NO;
  398. self.createBtn.frame = CGRectMake(15, 92, kScreenW-60, 48);
  399. }
  400. }
  401. else
  402. {
  403. self.backgroundView.hidden = NO;
  404. self.backView.hidden = NO;
  405. }
  406. }
  407. //关闭家族页面
  408. - (void)closeFamilyView
  409. {
  410. self.backgroundView.hidden = YES;
  411. self.backView.hidden = YES;
  412. }
  413. //加入家族
  414. - (void)clickAddBtn
  415. {
  416. self.backgroundView.hidden = YES;
  417. self.backView.hidden = YES;
  418. FamilyListViewController *familyListVC = [[FamilyListViewController alloc] init];
  419. [[AppDelegate sharedAppDelegate] pushViewController:familyListVC];
  420. }
  421. //创建家族
  422. - (void)clickCreateBtn
  423. {
  424. self.backgroundView.hidden = YES;
  425. self.backView.hidden = YES;
  426. EditFamilyViewController * editFamilyVC = [[EditFamilyViewController alloc] init];
  427. editFamilyVC.hidesBottomBarWhenPushed = YES;
  428. //创建家族时type=0;
  429. editFamilyVC.type = 0;
  430. editFamilyVC.user_id = self.userModel.user_id;
  431. [[AppDelegate sharedAppDelegate] pushViewController:editFamilyVC];
  432. }
  433. //家族详情
  434. - (void)goToFamilyDesVCWithModel:(userPageModel *)userModel
  435. {
  436. FamilyDesViewController * familyDesVc = [[FamilyDesViewController alloc] init];
  437. //是否是族长
  438. familyDesVc.isFamilyHeder = [userModel.family_chieftain intValue];
  439. familyDesVc.jid =userModel.family_id;
  440. familyDesVc.user_id =userModel.user_id;
  441. [[AppDelegate sharedAppDelegate] pushViewController:familyDesVc];
  442. }
  443. #pragma mark ======================我的公会======================
  444. - (void)createSocietyViewWithVC:(UIViewController *)myVC andModel:(userPageModel *)userModel
  445. {
  446. if (!self.backgroundViewTwo)
  447. {
  448. self.backgroundViewTwo = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  449. self.backgroundViewTwo.backgroundColor = kAppGrayColor6;
  450. self.backgroundViewTwo.alpha = 0.5;
  451. self.backgroundViewTwo.hidden = NO;
  452. [myVC.view addSubview:self.backgroundViewTwo];
  453. self.bigBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  454. [self.bigBtn addTarget:self action:@selector(closeSocietyView) forControlEvents:UIControlEventTouchUpInside];
  455. [self.backgroundViewTwo addSubview:self.bigBtn];
  456. self.backViewTwo = [[UIView alloc] initWithFrame:CGRectMake(10, (kScreenH-170)/2, kScreenW-20, 170)];
  457. self.backViewTwo.backgroundColor = [UIColor grayColor];
  458. self.backViewTwo.layer.cornerRadius = 5;
  459. self.backViewTwo.layer.masksToBounds = YES;
  460. [myVC.view addSubview:self.backViewTwo];
  461. self.bigViewTwo = [[UIView alloc] initWithFrame:CGRectMake(5, 5, kScreenW-30, 160)];
  462. self.bigViewTwo.backgroundColor = [UIColor whiteColor];
  463. self.bigViewTwo.layer.cornerRadius = 5;
  464. self.bigViewTwo.layer.masksToBounds = YES;
  465. [self.backViewTwo addSubview:self.bigViewTwo];
  466. self.addSocietyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  467. self.addSocietyBtn.frame = CGRectMake(15, 20, kScreenW-60, 48);
  468. self.addSocietyBtn.backgroundColor = kAppMainColor;
  469. self.addSocietyBtn.layer.cornerRadius = 15;
  470. self.addSocietyBtn.layer.masksToBounds = YES;
  471. [self.addSocietyBtn addTarget:self action:@selector(clickAddSocietyBtn) forControlEvents:UIControlEventTouchUpInside];
  472. [self.addSocietyBtn setTitle:@"加入公会" forState:UIControlStateNormal];
  473. [self.bigViewTwo addSubview:_addSocietyBtn];
  474. self.createSocietyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  475. self.createSocietyBtn.frame = CGRectMake(15, 92, kScreenW-60, 48);
  476. self.createSocietyBtn.backgroundColor = kAppFamilyBtnColor;
  477. self.createSocietyBtn.layer.cornerRadius = 15;
  478. self.createSocietyBtn.layer.masksToBounds = YES;
  479. [self.createSocietyBtn setTitle:@"创建公会" forState:UIControlStateNormal];
  480. [self.createSocietyBtn addTarget:self action:@selector(clickCreateSocietyBtn) forControlEvents:UIControlEventTouchUpInside];
  481. [self.bigViewTwo addSubview:self.createSocietyBtn];
  482. }
  483. else
  484. {
  485. self.backgroundViewTwo.hidden = NO;
  486. self.backViewTwo.hidden = NO;
  487. }
  488. }
  489. //关闭公会页面
  490. - (void)closeSocietyView
  491. {
  492. self.backgroundViewTwo.hidden = YES;
  493. self.backViewTwo.hidden = YES;
  494. }
  495. //加入公会
  496. - (void)clickAddSocietyBtn
  497. {
  498. self.backgroundViewTwo.hidden = YES;
  499. self.backViewTwo.hidden = YES;
  500. SocietyListViewController * societyListVC = [[SocietyListViewController alloc] init];
  501. [[AppDelegate sharedAppDelegate] pushViewController:societyListVC];
  502. }
  503. //创建公会
  504. - (void)clickCreateSocietyBtn
  505. {
  506. self.backgroundViewTwo.hidden = YES;
  507. self.backViewTwo.hidden = YES;
  508. EditSocietyViewController * editSocietyVC = [[EditSocietyViewController alloc] init];
  509. //创建公会时type=0;
  510. editSocietyVC.type = 0;
  511. editSocietyVC.user_id = _userModel.user_id;
  512. [[AppDelegate sharedAppDelegate] pushViewController:editSocietyVC];
  513. }
  514. //公会详情
  515. - (void)goToSocietyDesVCWithModel:(userPageModel *)userModel
  516. {
  517. SocietyDesViewController * societyDesVc = [[SocietyDesViewController alloc] init];
  518. //是否是公会长
  519. societyDesVc.isSocietyHeder = [userModel.society_chieftain intValue];
  520. societyDesVc.society_id =userModel.society_id;
  521. societyDesVc.user_id =userModel.user_id;
  522. [[AppDelegate sharedAppDelegate] pushViewController:societyDesVc];
  523. }
  524. //消息的角标
  525. - (void)loadBadageDataWithView:(HPheadView *)headV
  526. {
  527. [SFriendObj getAllUnReadCountComplete:^(int num) {
  528. int scount = num;
  529. if( scount )
  530. {
  531. if(scount >98){
  532. headV.numLabel.text = @"99+";
  533. }else{
  534. headV.numLabel.text = [NSString stringWithFormat:@"%d",scount];
  535. }
  536. }
  537. else
  538. {
  539. headV.numLabel.text = @"";
  540. }
  541. }];
  542. }
  543. - (GlobalVariables *)fanweApp
  544. {
  545. if (!_fanweApp)
  546. {
  547. _fanweApp = [GlobalVariables sharedInstance];
  548. }
  549. return _fanweApp;
  550. }
  551. @end