HomeRootVC.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. //
  2. // HomeRootVC.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/9/14.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "HomeRootVC.h"
  9. #import "HomeCollectionViewCell.h"
  10. #import "ZZCarousel.h"
  11. #import "NewRollButton.h"
  12. #import "OneOnOneViewController.h"
  13. #import "ServiceRecommendViewController.h"
  14. #import "HighidentificationViewController.h"//高新认定
  15. #import "ServiceModel.h"
  16. #import "BusinessModel.h"
  17. #import "GuanggaoModel.h"
  18. #import "ScienceAchievementsViewController.h"//科技成果
  19. #import "SciencedemandViewController.h"//科技需求
  20. #import "ScienceexpertViewController.h"//科技专家
  21. #import "YBPopupMenu.h"
  22. #import "MyattentionViewController.h"
  23. #import "MyOrderViewController.h"
  24. #import "AchievementsReleaseViewController.h"
  25. #import "ReleaserequirementsViewController.h"
  26. #define TITLES @[@"我的关注", @"我的订单",@"发布成果",@"发布需求"]
  27. #define ICONS @[@"wdgz",@"wddd",@"fbcg",@"fbxq"]
  28. @interface HomeRootVC ()<UICollectionViewDataSource,UICollectionViewDelegate,ZZCarouselDelegate,YBPopupMenuDelegate>{
  29. UICollectionView *mainCollectionView;
  30. UICollectionViewFlowLayout *flowLayout;
  31. NSMutableArray *dataArray;
  32. UICollectionReusableView *headerView;
  33. ZZCarousel *_headwheel;//广告图
  34. NSArray *_headwheelArray;
  35. NewRollButton *rollButton;//
  36. NSMutableArray *classArray;
  37. int pageSize;
  38. int pageNumber;
  39. NSString *ID;//品类ID
  40. }
  41. @property (strong ,nonatomic) UIButton * registerAccount;
  42. @end
  43. @implementation HomeRootVC
  44. - (void)viewDidLoad {
  45. [super viewDidLoad];
  46. [self setNavTitle:@"服务"];
  47. [self dataInitialization];
  48. [self VarietyNetworkrequest:nil];
  49. [self CarouselNetworkrequest:nil];
  50. [self loadsView];
  51. [self addRefreshing];
  52. // Do any additional setup after loading the view.
  53. }
  54. #pragma mark ----------轮播网络请求-------------
  55. - (void)CarouselNetworkrequest:(id)object{
  56. NSMutableDictionary *dic = NewMutableDictionaryInit;
  57. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getImagers parameters:dic onSuccess:^(id requestData) {
  58. if ([requestData[@"error"] count] !=0) {
  59. for (NSDictionary *dic in requestData[@"error"]) {
  60. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  61. }
  62. }else{
  63. _headwheelArray = nil;
  64. _headwheelArray = requestData[@"data"];
  65. _headwheel?[_headwheel reloadData]:nil;
  66. }
  67. } onFailure:^{
  68. }];
  69. }
  70. #pragma mark ----------获取品类下项目网络请求--------
  71. - (void)BusinessProjectNetworkrequest:(id)object {
  72. int pageNumberIndex=1;
  73. if (!object) {
  74. [MBProgressHUD showLoadToView:self.view title:@"请稍后..."];
  75. }else if ([object isKindOfClass:[MJRefreshNormalHeader class]]) {
  76. pageNumberIndex = 1;
  77. }else if ([object isKindOfClass:[MJRefreshBackNormalFooter class]]) {
  78. pageNumberIndex = pageNumber+1;
  79. }
  80. NSMutableDictionary *parameters = NewMutableDictionaryInit;
  81. [parameters safeSetObject:ID forKey:@"id"];
  82. [parameters safeSetObject:@(pageSize) forKey:@"pSize"];
  83. [parameters safeSetObject:@(pageNumberIndex) forKey:@"pNo"];
  84. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getBusinessProject parameters:parameters onSuccess:^(id requestData) {
  85. [self dismiss:object];
  86. if ([requestData[@"error"] count] !=0) {
  87. for (NSDictionary *dic in requestData[@"error"]) {
  88. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  89. }
  90. }else{
  91. pageNumber = pageNumberIndex;
  92. if ([object isKindOfClass:[MJRefreshNormalHeader class]]) {
  93. [dataArray removeAllObjects];
  94. }else if ([object isKindOfClass:[MJRefreshBackNormalFooter class]]) {
  95. if ([requestData[@"data"][@"list"] count]<=0) {
  96. [MBProgressHUD showError:NewConnectServerNoMoreDataTitle toView:self.view];
  97. }
  98. }else{
  99. [dataArray removeAllObjects];
  100. }
  101. for (NSDictionary *dic in requestData[@"data"][@"list"]) {
  102. BusinessModel *model = [[BusinessModel alloc] initWithDictionary:dic error:nil];
  103. [dataArray addObject:model];
  104. }
  105. [mainCollectionView reloadData];
  106. }
  107. } onFailure:^{
  108. [self dismiss:object];
  109. }];
  110. }
  111. #pragma mark ----------初级品种目录网络请求--------
  112. - (void)VarietyNetworkrequest:(id)object {
  113. NSMutableDictionary *parameters = NewMutableDictionaryInit;
  114. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getVarieties parameters:parameters onSuccess:^(id requestData) {
  115. if ([requestData[@"error"] count] !=0) {
  116. for (NSDictionary *dic in requestData[@"error"]) {
  117. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  118. }
  119. }else{
  120. [classArray removeAllObjects];
  121. for (NSDictionary *dic in requestData[@"data"]) {
  122. ServiceModel *model = [[ServiceModel alloc] initWithDictionary:dic error:nil];
  123. [classArray addObject:model];
  124. }
  125. [rollButton reloadDatas:classArray];
  126. ServiceModel *model = classArray[0];
  127. ID = model.ID;
  128. [self BusinessProjectNetworkrequest:object];
  129. }
  130. } onFailure:^{
  131. }];
  132. }
  133. #pragma mark - 数据初始化
  134. -(void)dataInitialization
  135. {
  136. pageSize = 10;
  137. pageNumber = 1;
  138. dataArray = NewMutableArrayInit;
  139. _headwheelArray = [NSArray new];
  140. classArray = NewMutableArrayInit;
  141. }
  142. #pragma mark - UI初始化
  143. -(void)loadsView
  144. {
  145. [self.navgationBar addSubview:self.registerAccount];
  146. _registerAccount.sd_layout
  147. .widthIs(30)
  148. .rightSpaceToView(self.navgationBar, 10)
  149. .heightIs(44)
  150. .topSpaceToView(self.navgationBar, 18);
  151. [self.view addSubview:mainCollectionView = [NewControlPackage collectionViewInitWithFrame:CGRectMake(0.0, NavHeader, SCREEN_WIDTH, SCREEN_HEIGHT-TABBAR_HEIGHT-NavHeader) delegate:self dataSource:self backgroundColor:NewGroupTableViewBackgroundColor scrollEnabled:YES alwaysBounceVertical:YES alwaysBounceHorizontal:NO showsHorizontalScrollIndicator:NO showsVerticalScrollIndicator:NO collectionViewFlowLayout:flowLayout sectionInset:UIEdgeInsetsMake(0, 0, 0, 0) headerReference:CGSizeMake(0, 0) footerReference:CGSizeMake(0, 0) minimumInteritemSpacing:0 minimumLineSpacing:0 scrollDirection:0 hidden:NO tag:105 userInteractionEnabled:YES]];
  152. [mainCollectionView registerClass:[HomeCollectionViewCell class] forCellWithReuseIdentifier:@"HomeRootVCCell"];
  153. [mainCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView"];
  154. }
  155. - (UICollectionReusableView *) collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  156. {
  157. UICollectionReusableView *reusableview = nil;
  158. if (kind == UICollectionElementKindSectionHeader)
  159. {
  160. if (!headerView) {
  161. headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView" forIndexPath:indexPath];
  162. headerView.backgroundColor = NewClearColor;
  163. if (!_headwheel) {
  164. _headwheel = nil;
  165. //创建轮播图
  166. _headwheel = [self headViewwheel:500];
  167. [headerView addSubview:_headwheel];
  168. [_headwheel reloadData];
  169. }
  170. UIView *view = [[UIView alloc] init];
  171. view.backgroundColor = NewWhiteColor;
  172. [headerView addSubview:view];
  173. view.sd_layout
  174. .topSpaceToView(_headwheel, 0)
  175. .heightIs(64)
  176. .widthIs(SCREEN_WIDTH);
  177. UIButton *tuijianBT = [UIButton new];
  178. [tuijianBT setImage:[UIImage imageNamed:@"tj"] forState:UIControlStateNormal];
  179. NewTouchUpInside(tuijianBT, tuijianBTclick:);
  180. [view addSubview:tuijianBT];
  181. tuijianBT.sd_layout
  182. .leftSpaceToView(view, 15)
  183. .rightSpaceToView(view, view.width/2+5)
  184. .topSpaceToView(view, 5)
  185. .bottomSpaceToView(view, 5);
  186. UIButton *yiduiyiBT = [UIButton new];
  187. [yiduiyiBT setImage:[UIImage imageNamed:@"ydy"] forState:UIControlStateNormal];
  188. NewTouchUpInside(yiduiyiBT, yiduiyiBTclick:);
  189. [view addSubview:yiduiyiBT];
  190. yiduiyiBT.sd_layout
  191. .leftSpaceToView(view, view.width/2+5)
  192. .rightSpaceToView(view, 5)
  193. .topSpaceToView(view, 5)
  194. .bottomSpaceToView(view, 5);
  195. UILabel *line = [UILabel new];
  196. line.backgroundColor = NewRGBColor(236, 236, 236, 1);
  197. [headerView addSubview:line];
  198. line.sd_layout
  199. .widthIs(SCREEN_WIDTH)
  200. .heightIs(10)
  201. .topSpaceToView(view, 0);
  202. [headerView addSubview:rollButton = [[NewRollButton alloc]init]];
  203. rollButton.sd_layout
  204. .topSpaceToView(line, 0)
  205. .heightIs(fitScreenWidth(54))
  206. .widthIs(SCREEN_WIDTH);
  207. __weak typeof(self) weakSelf = self;
  208. [rollButton setNewRollButtonCallback:^(NSDictionary *dictionary) {
  209. [weakSelf rollButtonClick:dictionary];
  210. }];
  211. }
  212. reusableview = headerView;
  213. }
  214. return reusableview;
  215. }
  216. #pragma mark ---------点击分类按钮---------
  217. - (void)rollButtonClick:(NSDictionary *)dic {
  218. ServiceModel *model = (ServiceModel *)dic;
  219. ID = model.ID;
  220. [self BusinessProjectNetworkrequest:nil];
  221. }
  222. //头视图高度
  223. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
  224. {
  225. return CGSizeMake(SCREEN_WIDTH, 169+64+10+fitScreenWidth(54));
  226. }
  227. //单元格大小
  228. -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  229. {
  230. return CGSizeMake(SCREEN_WIDTH/2-20, 150);
  231. }
  232. //定义每个UICollectionView 的 margin 边距 上左下右
  233. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
  234. {
  235. return UIEdgeInsetsMake(10, 15, 0, 15);
  236. }
  237. -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
  238. {
  239. return 1;
  240. }
  241. -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  242. {
  243. return dataArray.count;
  244. }
  245. -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  246. {
  247. HomeCollectionViewCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeRootVCCell" forIndexPath:indexPath];
  248. if (dataArray.count>0) {
  249. [cell assignment:dataArray[indexPath.row]];
  250. }
  251. return cell;
  252. }
  253. -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
  254. {
  255. if (dataArray.count>0) {
  256. BusinessModel *model = dataArray[indexPath.row];
  257. if ([model.projectUrl isEqualToString:@"/app/discovery/achievementList"]) {//科技成果列表
  258. ScienceAchievementsViewController *vc = [[ScienceAchievementsViewController alloc] init];
  259. NewPushViewController(vc);
  260. }else if ([model.projectUrl isEqualToString:@"/app/discovery/demandList"]){//科技需求列表
  261. SciencedemandViewController *vc = [[SciencedemandViewController alloc] init];
  262. NewPushViewController(vc);
  263. }else if ([model.projectUrl isEqualToString:@"/app/discovery/expertsList"]){//科技专家列表
  264. ScienceexpertViewController *vc = [[ScienceexpertViewController alloc] init];
  265. NewPushViewController(vc);
  266. }else{
  267. HighidentificationViewController *vc = [[HighidentificationViewController alloc] init];
  268. vc.ID = model.ID;
  269. NewPushViewController(vc);
  270. }
  271. }
  272. }
  273. #pragma mark-------------------------ZZCarousel轮播图片----------------------------------
  274. -(ZZCarousel*)headViewwheel:(NSInteger)tag
  275. {
  276. //self.navigationController.navigationBar.frame.size.height (SCREEN_WIDTH * 500 ) / 1080
  277. ZZCarousel* wheel = [[ZZCarousel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH,169)];
  278. wheel.tag = tag;
  279. /*
  280. * carouseScrollTimeInterval --- 此属性为设置轮播多长时间滚动到下一张
  281. */
  282. wheel.carouseScrollTimeInterval = CarouselTime;
  283. // 代理
  284. wheel.delegate = self;
  285. /*
  286. * isAutoScroll --- 默认为NO,当为YES时 才能使轮播进行滚动
  287. */
  288. wheel.isAutoScroll = YES;
  289. /*
  290. * pageType --- 设置轮播样式 默认为系统样式。ZZCarousel 中封装了 两种样式,另外一种为数字样式
  291. */
  292. wheel.pageType = ZZCarouselPageTypeOfNone;
  293. /*
  294. * 设置UIPageControl 在轮播中的位置、系统默认的UIPageControl 的顶层颜色 和底层颜色已经背景颜色
  295. */
  296. if(wheel.tag == 500) {
  297. wheel.pageControlFrame = CGRectMake((SCREEN_WIDTH - 60 ) / 2, wheel.frame.size.height - 10, 60, 5);
  298. wheel.pageIndicatorTintColor = [UIColor whiteColor];
  299. wheel.currentPageIndicatorTintColor = NewRGBColor(191, 191, 191, 1);
  300. wheel.pageControlBackGroundColor = [UIColor whiteColor];
  301. /*
  302. * 设置数字样式的 UIPageControl 中的字体和字体颜色。 背景颜色仍然按照上面pageControlBackGroundColor属性来设置
  303. */
  304. wheel.pageControlOfNumberFont = [UIFont fontWithName:@"Helvetica-Bold" size:18];
  305. wheel.pageContolOfNumberFontColor = [UIColor whiteColor];
  306. }
  307. return wheel;
  308. }
  309. //ZZCarouselDelegate 轮播图片代理方法
  310. -(NSInteger)numberOfZZCarousel:(ZZCarousel *)wheel
  311. {
  312. return _headwheelArray.count;
  313. }
  314. //图片赋值
  315. -(ZZCarouselView *)zzcarousel:(UICollectionView *)zzcarousel viewForItemAtIndex:(NSIndexPath *)index itemsIndex:(NSInteger)itemsIndex identifire:(NSString *)identifire ZZCarousel:(ZZCarousel *)zZCarousel
  316. {
  317. /*
  318. * index参数 ※ 注意
  319. */
  320. ZZCarouselView *cell = [zzcarousel dequeueReusableCellWithReuseIdentifier:identifire forIndexPath:index];
  321. if (!cell) {
  322. cell = [[ZZCarouselView alloc]init];
  323. }
  324. // cell.title.text = [_imagesGroup objectAtIndex:indexPath.row];
  325. // [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"图片地址"]];
  326. /*
  327. * itemsIndex 参数 ※ 注意
  328. */
  329. if(zZCarousel.tag == 500){
  330. if(_headwheelArray.count > itemsIndex){
  331. [cell.imageView sd_setImageWithURL:NewURL([_headwheelArray[itemsIndex] mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"banner")];
  332. }else {
  333. [cell.imageView setImage:NewImageError_T];
  334. }
  335. }
  336. return cell;
  337. }
  338. //图片点击方法
  339. -(void)zzcarouselScrollView:(ZZCarousel *)zzcarouselScrollView didSelectItemAtIndex:(NSInteger)index
  340. {
  341. NSLog(@"%@",[NSString stringWithFormat:@"点击了 第%ld张 轮播图片",(long)index]);
  342. }
  343. #pragma mark -----一对一按钮----
  344. - (void)yiduiyiBTclick:(UIButton *)sender {
  345. OneOnOneViewController *vc = [[OneOnOneViewController alloc] init];
  346. NewPushViewController(vc);
  347. }
  348. #pragma mark -----推荐按钮----
  349. - (void)tuijianBTclick:(UIButton *)sender {
  350. ServiceRecommendViewController *vc = [[ServiceRecommendViewController alloc] init];
  351. NewPushViewController(vc);
  352. }
  353. #pragma mark - 上拉下拉初始化
  354. - (void)addRefreshing
  355. {
  356. __weak typeof(self) weakSelf = self;
  357. __weak UICollectionView *newvc = mainCollectionView;
  358. newvc.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  359. if ([NetworkRequestManager connectedToNetwork]) {
  360. [weakSelf CarouselNetworkrequest:newvc.mj_header];
  361. [weakSelf VarietyNetworkrequest:newvc.mj_header];
  362. [weakSelf BusinessProjectNetworkrequest:newvc.mj_header];
  363. }else{
  364. [newvc.mj_header endRefreshing];
  365. }
  366. }];
  367. newvc.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
  368. if ([NetworkRequestManager connectedToNetwork]) {
  369. [weakSelf BusinessProjectNetworkrequest:newvc.mj_footer];
  370. }else{
  371. [newvc.mj_footer endRefreshing];
  372. }
  373. }];
  374. }
  375. - (void)dismiss:(id)object
  376. {
  377. if ([object isKindOfClass:[MJRefreshNormalHeader class]]) {
  378. __weak UICollectionView *newvc = mainCollectionView;
  379. [newvc.mj_header endRefreshing];
  380. }else if ([object isKindOfClass:[MJRefreshBackNormalFooter class]]){
  381. __weak UICollectionView *newvc = mainCollectionView;
  382. [newvc.mj_footer endRefreshing];
  383. }else {
  384. [MBProgressHUD hideHUDForView:self.view];
  385. }
  386. }
  387. - (UIButton *)registerAccount
  388. {
  389. if (!_registerAccount)
  390. {
  391. _registerAccount = [UIButton buttonWithType:UIButtonTypeCustom];
  392. // [_registerAccount setTitle:@"" forState:UIControlStateNormal];
  393. [_registerAccount setTitleColor:[UIColor colorWithString:@"#9A9A9A"] forState:UIControlStateNormal];
  394. [_registerAccount setBackgroundColor:[UIColor clearColor]];
  395. [_registerAccount setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
  396. [_registerAccount.titleLabel setFont:[UIFont systemFontOfSize:fitScreenWidth(14)]];
  397. [_registerAccount addTarget:self action:@selector(touchRegister:) forControlEvents:UIControlEventTouchUpInside];
  398. // [_registerAccount setupAutoSizeWithHorizontalPadding:5 buttonHeight:44];
  399. [_registerAccount setImage:NewImageNamed(@"gd") forState:UIControlStateNormal];
  400. }
  401. return _registerAccount;
  402. }
  403. - (void)touchRegister:(UIButton *)sender{
  404. [YBPopupMenu showRelyOnView:sender titles:TITLES icons:ICONS menuWidth:140 delegate:self];
  405. }
  406. #pragma mark - YBPopupMenuDelegate
  407. - (void)ybPopupMenuDidSelectedAtIndex:(NSInteger)index ybPopupMenu:(YBPopupMenu *)ybPopupMenu
  408. {
  409. NSLog(@"点击了 %@ 选项",TITLES[index]);
  410. if (index == 0) {
  411. if ([UserHelper isLogin]) {
  412. NSLog(@"%@",@"已登录");
  413. MyattentionViewController *vc = [[MyattentionViewController alloc] init];
  414. NewPushViewController(vc);
  415. }else{
  416. NSLog(@"%@",@"未登录");
  417. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  418. [vc setLoginSuccess:^(NSString *string) {
  419. NewPopViewController;
  420. }];
  421. NewPushViewController(vc);
  422. }
  423. }else if (index == 1){
  424. if ([UserHelper isLogin]) {
  425. NSLog(@"%@",@"已登录");
  426. MyOrderViewController*vc = [[MyOrderViewController alloc] init];
  427. NewPushViewController(vc);
  428. }else{
  429. NSLog(@"%@",@"未登录");
  430. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  431. [vc setLoginSuccess:^(NSString *string) {
  432. NewPopViewController;
  433. }];
  434. NewPushViewController(vc);
  435. }
  436. }else if (index == 2) {
  437. if ([UserHelper isLogin]) {
  438. NSLog(@"%@",@"已登录");
  439. AchievementsReleaseViewController *vc = [[AchievementsReleaseViewController alloc] init];
  440. NewPushViewController(vc);
  441. }else{
  442. NSLog(@"%@",@"未登录");
  443. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  444. [vc setLoginSuccess:^(NSString *string) {
  445. NewPopViewController;
  446. }];
  447. NewPushViewController(vc);
  448. }
  449. }else if (index == 3){
  450. if ([UserHelper isLogin]) {
  451. NSLog(@"%@",@"已登录");
  452. ReleaserequirementsViewController *vc = [[ReleaserequirementsViewController alloc] init];
  453. NewPushViewController(vc);
  454. }else{
  455. NSLog(@"%@",@"未登录");
  456. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  457. [vc setLoginSuccess:^(NSString *string) {
  458. NewPopViewController;
  459. }];
  460. NewPushViewController(vc);
  461. }
  462. }
  463. }
  464. - (void)didReceiveMemoryWarning {
  465. [super didReceiveMemoryWarning];
  466. // Dispose of any resources that can be recreated.
  467. }
  468. /*
  469. #pragma mark - Navigation
  470. // In a storyboard-based application, you will often want to do a little preparation before navigation
  471. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  472. // Get the new view controller using [segue destinationViewController].
  473. // Pass the selected object to the new view controller.
  474. }
  475. */
  476. @end