AmoytechniqueViewController.m 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  1. //
  2. // AmoytechniqueViewController.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/2/5.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. // 淘技
  8. #import "AmoytechniqueViewController.h"
  9. #import "YBPopupMenu.h"
  10. #import "MyattentionViewController.h"
  11. #import "AchievementsReleaseViewController.h"
  12. #import "MyOrderViewController.h"
  13. #import "AchievementsReleaseViewController.h"
  14. #import "ReleaserequirementsViewController.h"
  15. #import "ZZCarousel.h"
  16. #import "AssetsCollectionViewCell.h"
  17. #import "HeadlinesCollectionViewCell.h"
  18. #import "GBTopLineViewModel.h"
  19. #import "GBTopLineView.h"
  20. #import "ImmediatelyCollectionViewCell.h"
  21. #import "JiTaoRecommendCollectionViewCell.h"
  22. #import "RecommendedresultsCell.h"
  23. #import "ExpertCollectionViewCell.h"
  24. #import "HomeDataModel.h"
  25. #import "HomeRecommendedModel.h"
  26. #import "HomedemandModel.h"
  27. #import "TechnologyModel.h"
  28. #import "CarouselModel.h"
  29. #import "KnowledgeproductionModel.h"
  30. #import "HomeExpertModel.h"
  31. #import "AchievementsdetailViewController.h"
  32. #import "DemanddetailViewController.h"
  33. #import "ExpertdetailsViewController.h"
  34. #import "ScienceAchievementsViewController.h"
  35. #import "SciencedemandViewController.h"
  36. #import "ScienceexpertViewController.h"
  37. #import "DemanddetailViewController.h"
  38. #import "ExpertdetailsViewController.h"
  39. #import "HighidentificationViewController.h"
  40. #define TITLES @[@"我的关注", @"我的订单",@"发布成果",@"发布需求"]
  41. #define ICONS @[@"wdgz",@"wddd",@"fbcg",@"fbxq"]
  42. @interface AmoytechniqueViewController ()<YBPopupMenuDelegate,UICollectionViewDataSource,UICollectionViewDelegate,ZZCarouselDelegate>{
  43. UICollectionView *mainCollectionView;
  44. UICollectionViewFlowLayout *flowLayout;
  45. NSMutableArray *dataArray;
  46. UICollectionReusableView *headerView;
  47. ZZCarousel *_headwheel;//广告图
  48. NSMutableArray *_headwheelArray;
  49. UILabel *label1;
  50. UIImageView *_topIndicatorView;
  51. NSMutableArray *_titleLabelArray;
  52. NSInteger status;
  53. NSMutableArray *JTheadlinesArray;
  54. NSMutableArray *JTKnowledgeArray;
  55. NSMutableArray *Achievements;//成果数组
  56. NSMutableArray *demandArray;//需求数组
  57. NSMutableArray *expertArray;//专家数组
  58. }
  59. @property (strong ,nonatomic) UIButton * registerAccount;
  60. @property(nonatomic,strong)NSMutableArray*dataArr;
  61. @property (nonatomic,strong) GBTopLineView *TopLineView;
  62. @end
  63. @implementation AmoytechniqueViewController
  64. - (void)viewDidLoad {
  65. [super viewDidLoad];
  66. [self setNavTitle:@"淘技"];
  67. [self dataInitialization];
  68. [self loadsView];
  69. [self Networkrequest];
  70. [self RecommendedNetworkrequest:@"1"];
  71. [self addRefreshing];
  72. // Do any additional setup after loading the view.
  73. }
  74. #pragma mark - 上拉下拉初始化
  75. - (void)addRefreshing
  76. {
  77. __weak typeof(self) weakSelf = self;
  78. __weak UICollectionView *newvc = mainCollectionView;
  79. newvc.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  80. if ([NetworkRequestManager connectedToNetwork]) {
  81. // [weakSelf CarouselNetworkrequest:newvc.mj_header];
  82. // [weakSelf VarietyNetworkrequest:newvc.mj_header];
  83. // [weakSelf BusinessProjectNetworkrequest:newvc.mj_header];
  84. [weakSelf Networkrequest];
  85. [weakSelf RecommendedNetworkrequest:[NSString stringWithFormat:@"%i",status+1]];
  86. [newvc.mj_header endRefreshing];
  87. }else{
  88. [newvc.mj_header endRefreshing];
  89. }
  90. }];
  91. }
  92. - (void)dismiss:(id)object
  93. {
  94. if ([object isKindOfClass:[MJRefreshNormalHeader class]]) {
  95. __weak UICollectionView *newvc = mainCollectionView;
  96. [newvc.mj_header endRefreshing];
  97. }else {
  98. [MBProgressHUD hideHUDForView:self.view];
  99. }
  100. }
  101. - (void)RecommendedNetworkrequest:(NSString *)type {
  102. NSMutableDictionary *dic = [NSMutableDictionary new];
  103. [dic safeSetObject:type forKey:@"type"];
  104. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getHomeRecommended parameters:dic onSuccess:^(id requestData) {
  105. NSLog(@"服务器返回数据 :%@",requestData);
  106. if ([requestData[@"error"] count] !=0) {
  107. for (NSDictionary *dic in requestData[@"error"]) {
  108. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  109. }
  110. }else{
  111. if ([type isEqualToString:@"1"]) {
  112. [Achievements removeAllObjects];
  113. for (NSDictionary *dic in requestData[@"data"]) {
  114. HomeRecommendedModel*model = [[HomeRecommendedModel alloc] initWithDictionary:dic error:nil];
  115. [Achievements addObject:model];
  116. [mainCollectionView reloadSections:[NSIndexSet indexSetWithIndex:3]];
  117. }
  118. }else if ([type isEqualToString:@"2"]){
  119. [demandArray removeAllObjects];
  120. for (NSDictionary *dic in requestData[@"data"]) {
  121. HomedemandModel*model = [[HomedemandModel alloc] initWithDictionary:dic error:nil];
  122. [demandArray addObject:model];
  123. [mainCollectionView reloadSections:[NSIndexSet indexSetWithIndex:3]];
  124. }
  125. }else if ([type isEqualToString:@"3"]){
  126. [expertArray removeAllObjects];
  127. for (NSDictionary *dic in requestData[@"data"]) {
  128. HomeExpertModel*model = [[HomeExpertModel alloc] initWithDictionary:dic error:nil];
  129. [expertArray addObject:model];
  130. [mainCollectionView reloadSections:[NSIndexSet indexSetWithIndex:3]];
  131. }
  132. }
  133. }
  134. } onFailure:^{
  135. }];
  136. }
  137. - (void)Networkrequest {
  138. NSMutableDictionary *dic = [NSMutableDictionary new];
  139. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getHomePageData parameters:dic onSuccess:^(id requestData) {
  140. NSLog(@"服务器返回数据 :%@",requestData);
  141. if ([requestData[@"error"] count] !=0) {
  142. for (NSDictionary *dic in requestData[@"error"]) {
  143. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  144. }
  145. }else{
  146. [_headwheelArray removeAllObjects];
  147. for (NSDictionary *dic in requestData[@"data"][@"homeImg"]) {
  148. CarouselModel *model = [[CarouselModel alloc] initWithDictionary:dic error:nil];
  149. [_headwheelArray addObject:model];
  150. }
  151. _headwheel?[_headwheel reloadData]:nil;
  152. for (NSDictionary *dic in requestData[@"data"][@"advertising"]) {
  153. HomeDataModel*model = [[HomeDataModel alloc] initWithDictionary:dic error:nil];
  154. [JTheadlinesArray addObject:model];
  155. }
  156. [JTKnowledgeArray removeAllObjects];
  157. for (NSDictionary *dic in requestData[@"data"][@"achievemend"]) {
  158. KnowledgeproductionModel*model = [[KnowledgeproductionModel alloc] initWithDictionary:dic error:nil];
  159. [JTKnowledgeArray addObject:model];
  160. }
  161. [_dataArr removeAllObjects];
  162. for (int i=0; i<JTheadlinesArray.count; i++) {
  163. HomeDataModel*homemodel = JTheadlinesArray[i];
  164. GBTopLineViewModel *model = [[GBTopLineViewModel alloc]init];
  165. // model.type = homemodel.type;
  166. model.titleArray = homemodel.ads;
  167. [_dataArr addObject:model];
  168. }
  169. [mainCollectionView reloadData];
  170. }
  171. } onFailure:^{
  172. }];
  173. }
  174. #pragma mark - 数据初始化
  175. -(void)dataInitialization
  176. {
  177. expertArray = NewMutableArrayInit;
  178. JTKnowledgeArray = NewMutableArrayInit;
  179. demandArray = NewMutableArrayInit;
  180. Achievements = NewMutableArrayInit;
  181. JTheadlinesArray = NewMutableArrayInit;
  182. status = 0;
  183. _titleLabelArray = NewMutableArrayInit;
  184. _dataArr=[[NSMutableArray alloc]init];
  185. dataArray = NewMutableArrayInit;
  186. [dataArray addObject:@"1"];
  187. _headwheelArray = [NSMutableArray new];
  188. }
  189. #pragma mark ----加载界面
  190. - (void)loadsView{
  191. [self.navgationBar addSubview:self.registerAccount];
  192. _registerAccount.sd_layout
  193. .widthIs(30)
  194. .rightSpaceToView(self.navgationBar, 10)
  195. .heightIs(44)
  196. .topSpaceToView(self.navgationBar, 18);
  197. [self.view addSubview:mainCollectionView = [NewControlPackage collectionViewInitWithFrame:CGRectMake(0.0, NavHeader, SCREEN_WIDTH, SCREEN_HEIGHT-TABBAR_HEIGHT-NavHeader) delegate:self dataSource:self backgroundColor:NewWhiteColor 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]];
  198. [mainCollectionView registerClass:[AssetsCollectionViewCell class] forCellWithReuseIdentifier:@"HomeRootVCCell"];
  199. [mainCollectionView registerClass:[HeadlinesCollectionViewCell class] forCellWithReuseIdentifier:@"HomeRootVCCell1"];
  200. [mainCollectionView registerClass:[ImmediatelyCollectionViewCell class] forCellWithReuseIdentifier:@"HomeRootVCCell2"];
  201. [mainCollectionView registerClass:[JiTaoRecommendCollectionViewCell class] forCellWithReuseIdentifier:@"HomeRootVCCell3"];
  202. [mainCollectionView registerClass:[RecommendedresultsCell class] forCellWithReuseIdentifier:@"HomeRootVCCell4"];
  203. [mainCollectionView registerClass:[ExpertCollectionViewCell class] forCellWithReuseIdentifier:@"HomeRootVCCell5"];
  204. [mainCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView"];
  205. [mainCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView1"];
  206. [mainCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView2"];
  207. [mainCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView3"];
  208. }
  209. - (UICollectionReusableView *) collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  210. {
  211. UICollectionReusableView *reusableview = nil;
  212. UICollectionReusableView *reusableview1 = nil;
  213. UICollectionReusableView *reusableview2 = nil;
  214. UICollectionReusableView *reusableview3 = nil;
  215. if (indexPath.section == 0) {
  216. if (kind == UICollectionElementKindSectionHeader)
  217. {
  218. if (!headerView) {
  219. headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView" forIndexPath:indexPath];
  220. headerView.backgroundColor = NewClearColor;
  221. if (!_headwheel) {
  222. _headwheel = nil;
  223. //创建轮播图
  224. _headwheel = [self headViewwheel:500];
  225. [headerView addSubview:_headwheel];
  226. [_headwheel reloadData];
  227. }
  228. UIView *view = [[UIView alloc] init];
  229. view.backgroundColor = NewRedColor;
  230. [headerView addSubview:view];
  231. view.sd_layout
  232. .topSpaceToView(_headwheel, 0)
  233. .heightIs(64)
  234. .widthIs(SCREEN_WIDTH);
  235. UIButton *button1 = [UIButton new];
  236. button1.backgroundColor = [UIColor whiteColor];
  237. NewTouchUpInside(button1, button1click:);
  238. [view addSubview:button1];
  239. button1.sd_layout
  240. .leftEqualToView(view)
  241. .widthIs(view.width/3)
  242. .heightIs(64);
  243. UIImageView *image = [UIImageView new];
  244. image.backgroundColor = NewClearColor;
  245. [image setImage:NewImageNamed(@"mcg")];
  246. [button1 addSubview:image];
  247. image.sd_layout
  248. .centerYEqualToView(button1)
  249. .heightIs(45)
  250. .widthIs(44)
  251. .leftSpaceToView(button1, 15);
  252. UILabel *titlelaber = [UILabel new];
  253. titlelaber.text = @"买成果";
  254. titlelaber.font = NewFont(15);
  255. [titlelaber setSingleLineAutoResizeWithMaxWidth:0];
  256. [button1 addSubview:titlelaber];
  257. titlelaber.sd_layout
  258. .leftSpaceToView(image, 10)
  259. .heightIs(20)
  260. .centerYEqualToView(button1);
  261. UIButton *button2 = [UIButton new];
  262. button2.backgroundColor = [UIColor whiteColor];
  263. NewTouchUpInside(button2, button2click:);
  264. [view addSubview:button2];
  265. button2.sd_layout
  266. .leftSpaceToView(button1, 0)
  267. .widthIs(view.width/3)
  268. .heightIs(64);
  269. UIImageView *image1 = [UIImageView new];
  270. image1.backgroundColor = NewClearColor;
  271. [image1 setImage:NewImageNamed(@"axq")];
  272. [button2 addSubview:image1];
  273. image1.sd_layout
  274. .centerYEqualToView(button2)
  275. .heightIs(45)
  276. .widthIs(44)
  277. .leftSpaceToView(button2, 15);
  278. UILabel *titlelaber1 = [UILabel new];
  279. titlelaber1.text = @"按需求";
  280. titlelaber1.font = NewFont(15);
  281. [titlelaber setSingleLineAutoResizeWithMaxWidth:0];
  282. [button2 addSubview:titlelaber1];
  283. titlelaber1.sd_layout
  284. .leftSpaceToView(image1, 10)
  285. .heightIs(20)
  286. .centerYEqualToView(button2);
  287. UIButton *button3 = [UIButton new];
  288. button3.backgroundColor = [UIColor whiteColor];
  289. NewTouchUpInside(button3, button3click:);
  290. [view addSubview:button3];
  291. button3.sd_layout
  292. .rightEqualToView(view)
  293. .widthIs(view.width/3)
  294. .heightIs(64);
  295. UIImageView *image2 = [UIImageView new];
  296. image2.backgroundColor = NewClearColor;
  297. [image2 setImage:NewImageNamed(@"zzj")];
  298. [button3 addSubview:image2];
  299. image2.sd_layout
  300. .centerYEqualToView(button3)
  301. .heightIs(45)
  302. .widthIs(44)
  303. .leftSpaceToView(button3, 15);
  304. UILabel *titlelaber2 = [UILabel new];
  305. titlelaber2.text = @"找专家";
  306. titlelaber2.font = NewFont(15);
  307. [titlelaber2 setSingleLineAutoResizeWithMaxWidth:0];
  308. [button3 addSubview:titlelaber2];
  309. titlelaber2.sd_layout
  310. .leftSpaceToView(image2, 10)
  311. .heightIs(20)
  312. .centerYEqualToView(button3);
  313. //
  314. UILabel *line = [UILabel new];
  315. line.backgroundColor = NewRGBColor(236, 236, 236, 1);
  316. [headerView addSubview:line];
  317. line.sd_layout
  318. .widthIs(SCREEN_WIDTH)
  319. .heightIs(10)
  320. .topSpaceToView(view, 0);
  321. UIView *headview1 = [UIView new];
  322. headview1.backgroundColor = [UIColor whiteColor];
  323. [headerView addSubview:headview1];
  324. headview1.sd_layout
  325. .leftEqualToView(headerView)
  326. .heightIs(44)
  327. .rightEqualToView(headerView)
  328. .topSpaceToView(line, 0);
  329. UILabel *line1 = [UILabel new];
  330. line1.backgroundColor = NewButtonColor;
  331. ViewRadius(line1, 1.5);
  332. [headview1 addSubview:line1];
  333. line1.sd_layout
  334. .leftSpaceToView(headview1, 15)
  335. .heightIs(18)
  336. .widthIs(3)
  337. .centerYEqualToView(headview1);
  338. UILabel *headtitle = [UILabel new];
  339. headtitle.text = @"知 产";
  340. headtitle.font = NewBFont(15);
  341. [headtitle setSingleLineAutoResizeWithMaxWidth:0];
  342. [headview1 addSubview:headtitle];
  343. headtitle.sd_layout
  344. .leftSpaceToView(line1, 10)
  345. .heightIs(15)
  346. .centerYEqualToView(headview1);
  347. UILabel *headtitle1 = [UILabel new];
  348. headtitle1.text = @"聚焦潜力价值项目";
  349. headtitle1.font = NewFont(13);
  350. headtitle1.textColor = [UIColor colorWithString:@"#9A9A9A"];
  351. [headtitle1 setSingleLineAutoResizeWithMaxWidth:0];
  352. [headview1 addSubview:headtitle1];
  353. headtitle1.sd_layout
  354. .leftSpaceToView(headtitle, 8)
  355. .heightIs(13)
  356. .centerYEqualToView(headview1);
  357. UIButton *CKGD = [UIButton new];
  358. CKGD.backgroundColor = NewWhiteColor;
  359. NewTouchUpInside(CKGD, CKGDclick:);
  360. [headview1 addSubview:CKGD];
  361. CKGD.sd_layout
  362. .rightEqualToView(headview1)
  363. .heightIs(44)
  364. .topEqualToView(headview1)
  365. .widthIs(80);
  366. UIImageView *backimage = [UIImageView new];
  367. [backimage setImage:[UIImage imageNamed:@"括号"]];
  368. [CKGD addSubview:backimage];
  369. backimage.sd_layout
  370. .centerYEqualToView(CKGD)
  371. .heightIs(13)
  372. .widthIs(7)
  373. .rightSpaceToView(CKGD, 15);
  374. UILabel *cjgdlabel = [UILabel new];
  375. cjgdlabel.text = @"查看更多";
  376. cjgdlabel.font = NewFont(fitScreenWidth(12));
  377. cjgdlabel.textColor = [UIColor colorWithString:@"#9A9A9A"];
  378. [cjgdlabel setSingleLineAutoResizeWithMaxWidth:0];
  379. [CKGD addSubview:cjgdlabel];
  380. cjgdlabel.sd_layout
  381. .rightSpaceToView(backimage, 5)
  382. .heightIs(15)
  383. .centerYEqualToView(CKGD);
  384. }
  385. reusableview = headerView;
  386. }
  387. return reusableview;
  388. }else if(indexPath.section == 1){
  389. if (kind == UICollectionElementKindSectionHeader)
  390. {
  391. UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView1" forIndexPath:indexPath];
  392. view.backgroundColor = NewRGBColor(236, 236, 236, 1);
  393. reusableview1 = view;
  394. }
  395. return reusableview1;
  396. }else if(indexPath.section == 2){
  397. if (kind == UICollectionElementKindSectionHeader)
  398. {
  399. UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView2" forIndexPath:indexPath];
  400. view.backgroundColor = NewRGBColor(236, 236, 236, 1);
  401. reusableview2 = view;
  402. }
  403. return reusableview2;
  404. }else{
  405. if (kind == UICollectionElementKindSectionHeader)
  406. {
  407. UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HomeRootVCHeaderView3" forIndexPath:indexPath];
  408. view.backgroundColor = NewWhiteColor;
  409. UIView *bgview = [UIView new];
  410. bgview.backgroundColor = NewWhiteColor;
  411. [view addSubview:bgview];
  412. bgview.sd_layout
  413. .leftEqualToView(view)
  414. .rightEqualToView(view)
  415. .topSpaceToView(view, 0)
  416. .heightIs(44);
  417. UILabel *line1 = [UILabel new];
  418. line1.backgroundColor = NewButtonColor;
  419. ViewRadius(line1, 1.5);
  420. [bgview addSubview:line1];
  421. line1.sd_layout
  422. .leftSpaceToView(bgview, 15)
  423. .heightIs(18)
  424. .widthIs(3)
  425. .centerYEqualToView(bgview);
  426. UILabel *headtitle = [UILabel new];
  427. headtitle.text = @"技淘推荐";
  428. headtitle.font = NewBFont(15);
  429. [headtitle setSingleLineAutoResizeWithMaxWidth:0];
  430. [bgview addSubview:headtitle];
  431. headtitle.sd_layout
  432. .leftSpaceToView(line1, 10)
  433. .heightIs(15)
  434. .centerYEqualToView(bgview);
  435. UILabel *headtitle1 = [UILabel new];
  436. headtitle1.text = @"最新最热专家成果,深度解签企业困惑";
  437. headtitle1.font = NewFont(13);
  438. headtitle1.textColor = [UIColor colorWithString:@"#9A9A9A"];
  439. [headtitle1 setSingleLineAutoResizeWithMaxWidth:0];
  440. [bgview addSubview:headtitle1];
  441. headtitle1.sd_layout
  442. .leftSpaceToView(headtitle, 8)
  443. .heightIs(13)
  444. .centerYEqualToView(bgview);
  445. UIView *sliderView = [UIView new];
  446. sliderView.backgroundColor = NewRGBColor(236, 236, 236, 1);
  447. [view addSubview:sliderView];
  448. sliderView.sd_layout
  449. .leftEqualToView(view)
  450. .rightEqualToView(view)
  451. .heightIs(40)
  452. .topSpaceToView(bgview, 0);
  453. NSArray *arr = @[@"成果",@"需求",@"专家"];
  454. [_titleLabelArray removeAllObjects];
  455. for (int i=0; i<arr.count; i++) {
  456. CGFloat titleLabelWidth = SCREEN_WIDTH/3;
  457. label1 = [[UILabel alloc] initWithFrame:CGRectMake(titleLabelWidth * i, 0, titleLabelWidth, 40)];
  458. label1.text = arr[i];
  459. label1.userInteractionEnabled = YES;
  460. label1.tag = i+100;
  461. label1.font = [UIFont systemFontOfSize:14];
  462. label1.textAlignment = NSTextAlignmentCenter;
  463. [_titleLabelArray addObject:label1];
  464. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dealTap:)];
  465. [label1 addGestureRecognizer:tap];
  466. [sliderView addSubview:label1];
  467. }
  468. //添加提示视图
  469. _topIndicatorView = [[UIImageView alloc] init];
  470. CGFloat indicatorViewW = label1.frame.size.width/2;
  471. CGFloat indicatorViewCenterX = label1.center.x;
  472. _topIndicatorView.frame = CGRectMake(indicatorViewCenterX - indicatorViewW / 2, 38, indicatorViewW, 2);
  473. _topIndicatorView.backgroundColor = NewButtonColor;
  474. [sliderView addSubview:_topIndicatorView];
  475. [self topScrollViewShowPage:(int)status];
  476. reusableview3 = view;
  477. }
  478. return reusableview3;
  479. }
  480. }
  481. -(void)dealTap:(UITapGestureRecognizer *)tap
  482. {
  483. int page = (int)tap.view.tag - 100;
  484. [self topScrollViewShowPage:page];
  485. NSLog(@"%i",page);
  486. status = page;
  487. [self RecommendedNetworkrequest:[NSString stringWithFormat:@"%i",status+1]];
  488. [UIView performWithoutAnimation:^{
  489. [mainCollectionView reloadSections:[NSIndexSet indexSetWithIndex:3]];
  490. }];
  491. }
  492. -(void)topScrollViewShowPage:(int)page
  493. {
  494. for (UILabel *label in _titleLabelArray) {
  495. label.textColor = [UIColor blackColor];
  496. }
  497. UILabel *selectLabel = _titleLabelArray[page];
  498. selectLabel.textColor = NewButtonColor;
  499. [UIView animateWithDuration:0.2 animations:^{
  500. CGFloat indicatorViewW = selectLabel.frame.size.width/2;
  501. CGFloat indicatorViewCenterX = selectLabel.center.x;
  502. _topIndicatorView.frame = CGRectMake(indicatorViewCenterX - indicatorViewW / 2, 38, indicatorViewW, 2);
  503. }];
  504. }
  505. #pragma mark----买成果----
  506. - (void)button1click:(UIButton *)sender {
  507. NSLog(@"买成果");
  508. ScienceAchievementsViewController *vc = [[ScienceAchievementsViewController alloc] init];
  509. NewPushViewController(vc);
  510. }
  511. #pragma mark----按需求----
  512. - (void)button2click:(UIButton *)sender {
  513. NSLog(@"按需求");
  514. SciencedemandViewController *vc = [[SciencedemandViewController alloc] init];
  515. NewPushViewController(vc);
  516. }
  517. #pragma mark----找专家----
  518. - (void)button3click:(UIButton *)sender {
  519. ScienceexpertViewController *vc = [[ScienceexpertViewController alloc] init];
  520. NewPushViewController(vc);
  521. }
  522. #pragma mark----在线评估----
  523. - (void)assessmentBTclick:(UIButton*)sender{
  524. HighidentificationViewController *vc = [[HighidentificationViewController alloc] init];
  525. vc.ID = @"182d1324-c63d-419e-95aa-8d6f90a7bd7b";
  526. NewPushViewController(vc);
  527. }
  528. #pragma mark----项目创投----
  529. - (void)projectventureBTclick:(UIButton*)sender{
  530. ScienceAchievementsViewController *vc = [[ScienceAchievementsViewController alloc] init];
  531. NewPushViewController(vc);
  532. }
  533. #pragma mark----发布需求----
  534. - (void)releaserequirementsBTclick:(UIButton*)sender{
  535. // if ([UserHelper isLogin]) {
  536. NSLog(@"%@",@"已登录");
  537. ReleaserequirementsViewController *vc = [[ReleaserequirementsViewController alloc] init];
  538. NewPushViewController(vc);
  539. // }else{
  540. // NSLog(@"%@",@"未登录");
  541. // NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  542. // [vc setLoginSuccess:^(NSString *string) {
  543. // NewDismissNavigationController;
  544. // }];
  545. // NewPresentNavigationController(vc);
  546. // }
  547. }
  548. #pragma mark----发布成果----
  549. - (void)releaseresultsBTBTclick:(UIButton*)sender{
  550. if ([UserHelper isLogin]) {
  551. NSLog(@"%@",@"已登录");
  552. AchievementsReleaseViewController *vc = [[AchievementsReleaseViewController alloc] init];
  553. NewPushViewController(vc);
  554. }else{
  555. NSLog(@"%@",@"未登录");
  556. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  557. [vc setLoginSuccess:^(NSString *string) {
  558. NewPopViewController;
  559. }];
  560. NewPushViewController(vc);
  561. }
  562. }
  563. - (void)CKGDclick:(UIButton *)sender {
  564. NSLog(@"查看更多");
  565. ScienceAchievementsViewController *vc = [[ScienceAchievementsViewController alloc] init];
  566. NewPushViewController(vc);
  567. }
  568. //头视图高度
  569. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
  570. {
  571. if (section == 0) {
  572. return CGSizeMake(SCREEN_WIDTH, 169+64+10+44);
  573. }else if (section == 1){
  574. return CGSizeMake(SCREEN_WIDTH, 10);
  575. }else if (section == 2){
  576. return CGSizeMake(SCREEN_WIDTH, 10);
  577. }else if(section == 3){
  578. return CGSizeMake(SCREEN_WIDTH, 84);
  579. }
  580. return CGSizeMake(SCREEN_WIDTH, 40);
  581. }
  582. //单元格大小
  583. -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  584. {
  585. if (indexPath.section == 0) {
  586. return CGSizeMake(SCREEN_WIDTH/2-20, 140);
  587. }else if (indexPath.section == 1){
  588. return CGSizeMake(SCREEN_WIDTH, 162);
  589. }else if (indexPath.section == 2){
  590. return CGSizeMake(SCREEN_WIDTH, 114);
  591. }else if (indexPath.section == 3){
  592. if (status == 0) {
  593. if (indexPath.row == Achievements.count-1) {
  594. return CGSizeMake(SCREEN_WIDTH, 137+44);
  595. }else{
  596. return CGSizeMake(SCREEN_WIDTH, 137);
  597. }
  598. }else if(status == 1){
  599. if (indexPath.row == demandArray.count-1) {
  600. return CGSizeMake(SCREEN_WIDTH, 132+44);
  601. }else{
  602. return CGSizeMake(SCREEN_WIDTH, 132);
  603. }
  604. }else{
  605. if (indexPath.row == expertArray.count-1) {
  606. return CGSizeMake(SCREEN_WIDTH, 120+44);
  607. }else{
  608. return CGSizeMake(SCREEN_WIDTH, 120);
  609. }
  610. }
  611. }
  612. return CGSizeMake(SCREEN_WIDTH, 10);
  613. }
  614. //定义每个UICollectionView 的 margin 边距 上左下右
  615. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
  616. {
  617. if (section == 0) {
  618. return UIEdgeInsetsMake(10, 15, 0, 15);
  619. }else{
  620. return UIEdgeInsetsMake(0, 0, 0, 0);
  621. }
  622. }
  623. -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
  624. {
  625. return 4;
  626. }
  627. -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  628. {
  629. if (section == 0) {
  630. return JTKnowledgeArray.count;
  631. }else if (section == 1){
  632. return 1;
  633. }else if (section == 2){
  634. return 1;
  635. }else if (section == 3){
  636. if (status == 0) {
  637. return Achievements.count;
  638. }else if (status == 1){
  639. return demandArray.count;
  640. }
  641. return expertArray.count;
  642. }
  643. return dataArray.count;
  644. }
  645. -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  646. {
  647. if (indexPath.section == 0) {
  648. AssetsCollectionViewCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeRootVCCell" forIndexPath:indexPath];
  649. if (JTKnowledgeArray.count>0) {
  650. [cell assignment:JTKnowledgeArray[indexPath.row]];
  651. cell.backgroundColor = NewWhiteColor;
  652. }
  653. return cell;
  654. }else if (indexPath.section == 1){
  655. HeadlinesCollectionViewCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeRootVCCell1" forIndexPath:indexPath];
  656. if (JTheadlinesArray.count>0) {
  657. cell.backgroundColor = NewWhiteColor;
  658. _TopLineView = [[GBTopLineView alloc]initWithFrame:CGRectMake(65, 0, SCREEN_WIDTH-65, 91)];
  659. _TopLineView.backgroundColor = [UIColor whiteColor];
  660. __weak __typeof(self)weakSelf = self;
  661. _TopLineView.clickBlock = ^(NSInteger index){
  662. GBTopLineViewModel *model = weakSelf.dataArr[index];
  663. // NSLog(@"%@,%@",model.type,model.title);
  664. };
  665. [cell addSubview:_TopLineView];
  666. [_TopLineView setVerticalShowDataArr:_dataArr];
  667. UIImageView *zcjd = [UIImageView new];
  668. [zcjd setImage:NewImageNamed(@"zcjx")];
  669. zcjd.backgroundColor = NewClearColor;
  670. [cell addSubview:zcjd];
  671. zcjd.sd_layout
  672. .leftSpaceToView(cell, 20)
  673. .topSpaceToView(cell, 20)
  674. .heightIs(92/2)
  675. .widthIs(100/2);
  676. UIImageView *lineimage = [UIImageView new];
  677. [lineimage setImage:NewImageNamed(@"zcbx")];
  678. [cell addSubview:lineimage];
  679. lineimage.sd_layout
  680. .topSpaceToView(cell, 20)
  681. .heightIs(100/2)
  682. .leftSpaceToView(zcjd, 15)
  683. .widthIs(1);
  684. UILabel *line = [UILabel new];
  685. line.backgroundColor = NewLineGrayColor;
  686. [cell addSubview:line];
  687. line.sd_layout
  688. .leftEqualToView(cell)
  689. .rightEqualToView(cell)
  690. .heightIs(0.8)
  691. .topSpaceToView(_TopLineView, 0);
  692. UILabel *line1 = [UILabel new];
  693. line1.backgroundColor = NewLineGrayColor;
  694. [cell addSubview:line1];
  695. line1.sd_layout
  696. .leftSpaceToView(cell, SCREEN_WIDTH/2)
  697. .widthIs(0.8)
  698. .topSpaceToView(line, 0)
  699. .bottomEqualToView(cell);
  700. UIButton *assessmentBT = [UIButton new];
  701. assessmentBT.backgroundColor = NewWhiteColor;
  702. NewTouchUpInside(assessmentBT, assessmentBTclick:);
  703. [cell addSubview:assessmentBT];
  704. assessmentBT.sd_layout
  705. .leftEqualToView(cell)
  706. .topSpaceToView(line, 0)
  707. .bottomEqualToView(cell)
  708. .rightSpaceToView(line1, 0);
  709. UIImageView *assessmentimage = [UIImageView new];
  710. [assessmentimage setImage:NewImageNamed(@"zxpg")];
  711. assessmentimage.backgroundColor = NewClearColor;
  712. [assessmentBT addSubview:assessmentimage];
  713. assessmentimage.sd_layout
  714. .centerYEqualToView(assessmentBT)
  715. .heightIs(23)
  716. .widthIs(33)
  717. .leftSpaceToView(assessmentBT, 15);
  718. UILabel *pinggu = [UILabel new];
  719. [pinggu setText:@"在线评估"];
  720. pinggu.font = NewFont(14);
  721. [pinggu setSingleLineAutoResizeWithMaxWidth:0];
  722. [assessmentBT addSubview:pinggu];
  723. pinggu.sd_layout
  724. .leftSpaceToView(assessmentimage, 10)
  725. .heightIs(14)
  726. .topEqualToView(assessmentimage);
  727. UILabel *liaojie = [UILabel new];
  728. liaojie.text = @"立即了解您的技术价值";
  729. liaojie.font = NewFont(12);
  730. [liaojie setSingleLineAutoResizeWithMaxWidth:0];
  731. liaojie.textColor = [UIColor colorWithString:@"#9A9A9A"];
  732. [assessmentBT addSubview:liaojie];
  733. liaojie.sd_layout
  734. .leftEqualToView(pinggu)
  735. .heightIs(12)
  736. .topSpaceToView(pinggu, 5);
  737. UIButton *projectventureBT = [UIButton new];
  738. projectventureBT.backgroundColor = NewWhiteColor;
  739. NewTouchUpInside(projectventureBT, projectventureBTclick:);
  740. [cell addSubview:projectventureBT];
  741. projectventureBT.sd_layout
  742. .leftSpaceToView(line1, 0)
  743. .topSpaceToView(line, 0)
  744. .bottomEqualToView(cell)
  745. .rightEqualToView(cell);
  746. UIImageView *assessmentimage1 = [UIImageView new];
  747. [assessmentimage1 setImage:NewImageNamed(@"xmct")];
  748. assessmentimage1.backgroundColor = NewClearColor;
  749. [projectventureBT addSubview:assessmentimage1];
  750. assessmentimage1.sd_layout
  751. .centerYEqualToView(projectventureBT)
  752. .heightIs(25)
  753. .widthIs(28)
  754. .leftSpaceToView(projectventureBT, 15);
  755. UILabel *xiangmu = [UILabel new];
  756. [xiangmu setText:@"项目创投"];
  757. xiangmu.font = NewFont(14);
  758. [xiangmu setSingleLineAutoResizeWithMaxWidth:0];
  759. [projectventureBT addSubview:xiangmu];
  760. xiangmu.sd_layout
  761. .leftSpaceToView(assessmentimage1, 10)
  762. .heightIs(14)
  763. .topEqualToView(assessmentimage1);
  764. UILabel *liebian = [UILabel new];
  765. liebian.text = @"让资产迅速裂变";
  766. liebian.font = NewFont(12);
  767. [liebian setSingleLineAutoResizeWithMaxWidth:0];
  768. liebian.textColor = [UIColor colorWithString:@"#9A9A9A"];
  769. [projectventureBT addSubview:liebian];
  770. liebian.sd_layout
  771. .leftEqualToView(xiangmu)
  772. .heightIs(12)
  773. .topSpaceToView(xiangmu, 5);
  774. }
  775. return cell;
  776. }else if (indexPath.section == 2){
  777. ImmediatelyCollectionViewCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeRootVCCell2" forIndexPath:indexPath];
  778. if (dataArray.count>0) {
  779. cell.backgroundColor = NewWhiteColor;
  780. NewTouchUpInside(cell.releaserequirementsBT, releaserequirementsBTclick:);
  781. NewTouchUpInside(cell.releaseresultsBT, releaseresultsBTBTclick:);
  782. }
  783. return cell;
  784. }else if (indexPath.section == 3){
  785. if (status == 0) {
  786. JiTaoRecommendCollectionViewCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeRootVCCell3" forIndexPath:indexPath];
  787. if (Achievements.count>0) {
  788. cell.backgroundColor = NewWhiteColor;
  789. [cell assignment:Achievements[indexPath.row]];
  790. if (indexPath.row == Achievements.count-1) {
  791. cell.line4.hidden = NO;
  792. cell.seemoreBT.hidden = NO;
  793. }else{
  794. cell.line4.hidden = YES;
  795. cell.seemoreBT.hidden = YES;
  796. }
  797. cell.seemoreBT.tag = 100;
  798. NewTouchUpInside(cell.seemoreBT, seemoreBTclick:);
  799. }
  800. return cell;
  801. }else if (status == 1){
  802. RecommendedresultsCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeRootVCCell4" forIndexPath:indexPath];
  803. if (demandArray.count>0) {
  804. cell.backgroundColor = NewWhiteColor;
  805. [cell assignment:demandArray[indexPath.row]];
  806. if (indexPath.row == demandArray.count-1) {
  807. cell.line3.hidden = YES;
  808. cell.line4.hidden = NO;
  809. cell.seemoreBT.hidden = NO;
  810. }else{
  811. cell.line4.hidden = YES;
  812. cell.line3.hidden = NO;
  813. cell.seemoreBT.hidden = YES;
  814. }
  815. cell.seemoreBT.tag = 101;
  816. NewTouchUpInside(cell.seemoreBT, seemoreBTclick:);
  817. }
  818. return cell;
  819. }else if (status == 2){
  820. ExpertCollectionViewCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeRootVCCell5" forIndexPath:indexPath];
  821. if (expertArray.count>0) {
  822. cell.backgroundColor = NewWhiteColor;
  823. [cell assignment:expertArray[indexPath.row]];
  824. if (indexPath.row == expertArray.count-1) {
  825. cell.line3.hidden = YES;
  826. cell.line4.hidden = NO;
  827. cell.seemoreBT.hidden = NO;
  828. }else{
  829. cell.line4.hidden = YES;
  830. cell.line3.hidden = NO;
  831. cell.seemoreBT.hidden = YES;
  832. }
  833. cell.seemoreBT.tag = 102;
  834. NewTouchUpInside(cell.seemoreBT, seemoreBTclick:);
  835. }
  836. return cell;
  837. }
  838. }
  839. return [[UICollectionViewCell alloc] init];
  840. }
  841. -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
  842. {
  843. if (indexPath.section == 0) {
  844. KnowledgeproductionModel *model = JTKnowledgeArray[indexPath.row];
  845. AchievementsdetailViewController *vc = [[AchievementsdetailViewController alloc] init];
  846. vc.ID = model.ID;
  847. NewPushViewController(vc);
  848. }
  849. if (indexPath.section == 3) {
  850. if (status == 0) {
  851. KnowledgeproductionModel *model = Achievements[indexPath.row];
  852. AchievementsdetailViewController *vc = [[AchievementsdetailViewController alloc] init];
  853. vc.ID = model.ID;
  854. NewPushViewController(vc);
  855. }else if (status == 1){
  856. HomedemandModel*model = demandArray[indexPath.row];
  857. DemanddetailViewController *vc = [[DemanddetailViewController alloc] init];
  858. vc.ID = model.ID;
  859. NewPushViewController(vc);
  860. }else if (status == 2){
  861. HomeExpertModel*model = expertArray[indexPath.row];
  862. ExpertdetailsViewController *vc = [[ExpertdetailsViewController alloc] init];
  863. vc.uid = model.ID;
  864. NewPushViewController(vc);
  865. }
  866. NSLog(@"%lo",indexPath.row);
  867. }
  868. }
  869. - (UIButton *)registerAccount
  870. {
  871. if (!_registerAccount)
  872. {
  873. _registerAccount = [UIButton buttonWithType:UIButtonTypeCustom];
  874. // [_registerAccount setTitle:@"" forState:UIControlStateNormal];
  875. [_registerAccount setTitleColor:[UIColor colorWithString:@"#9A9A9A"] forState:UIControlStateNormal];
  876. [_registerAccount setBackgroundColor:[UIColor clearColor]];
  877. [_registerAccount setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
  878. [_registerAccount.titleLabel setFont:[UIFont systemFontOfSize:fitScreenWidth(14)]];
  879. [_registerAccount addTarget:self action:@selector(touchRegister:) forControlEvents:UIControlEventTouchUpInside];
  880. // [_registerAccount setupAutoSizeWithHorizontalPadding:5 buttonHeight:44];
  881. [_registerAccount setImage:NewImageNamed(@"gd") forState:UIControlStateNormal];
  882. }
  883. return _registerAccount;
  884. }
  885. - (void)touchRegister:(UIButton *)sender{
  886. [YBPopupMenu showRelyOnView:sender titles:TITLES icons:ICONS menuWidth:140 delegate:self];
  887. }
  888. #pragma mark - YBPopupMenuDelegate
  889. - (void)ybPopupMenuDidSelectedAtIndex:(NSInteger)index ybPopupMenu:(YBPopupMenu *)ybPopupMenu
  890. {
  891. NSLog(@"点击了 %@ 选项",TITLES[index]);
  892. if (index == 0) {
  893. if ([UserHelper isLogin]) {
  894. NSLog(@"%@",@"已登录");
  895. MyattentionViewController *vc = [[MyattentionViewController alloc] init];
  896. NewPushViewController(vc);
  897. }else{
  898. NSLog(@"%@",@"未登录");
  899. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  900. [vc setLoginSuccess:^(NSString *string) {
  901. NewPopViewController;
  902. }];
  903. NewPushViewController(vc);
  904. }
  905. }else if (index == 1){
  906. if ([UserHelper isLogin]) {
  907. NSLog(@"%@",@"已登录");
  908. MyOrderViewController*vc = [[MyOrderViewController alloc] init];
  909. NewPushViewController(vc);
  910. }else{
  911. NSLog(@"%@",@"未登录");
  912. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  913. [vc setLoginSuccess:^(NSString *string) {
  914. NewPopViewController;
  915. }];
  916. NewPushViewController(vc);
  917. }
  918. }else if (index == 2) {
  919. if ([UserHelper isLogin]) {
  920. NSLog(@"%@",@"已登录");
  921. AchievementsReleaseViewController *vc = [[AchievementsReleaseViewController alloc] init];
  922. NewPushViewController(vc);
  923. }else{
  924. NSLog(@"%@",@"未登录");
  925. NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  926. [vc setLoginSuccess:^(NSString *string) {
  927. NewPopViewController;
  928. }];
  929. NewPushViewController(vc);
  930. }
  931. }else if (index == 3){
  932. // if ([UserHelper isLogin]) {
  933. NSLog(@"%@",@"已登录");
  934. ReleaserequirementsViewController *vc = [[ReleaserequirementsViewController alloc] init];
  935. NewPushViewController(vc);
  936. // }else{
  937. // NSLog(@"%@",@"未登录");
  938. // NewLoginViewController *vc = [[NewLoginViewController alloc] init];
  939. // [vc setLoginSuccess:^(NSString *string) {
  940. // NewDismissNavigationController;
  941. // }];
  942. // NewPresentNavigationController(vc);
  943. // }
  944. }
  945. }
  946. #pragma mark-------------------------ZZCarousel轮播图片----------------------------------
  947. -(ZZCarousel*)headViewwheel:(NSInteger)tag
  948. {
  949. //self.navigationController.navigationBar.frame.size.height (SCREEN_WIDTH * 500 ) / 1080
  950. ZZCarousel* wheel = [[ZZCarousel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH,169)];
  951. wheel.tag = tag;
  952. /*
  953. * carouseScrollTimeInterval --- 此属性为设置轮播多长时间滚动到下一张
  954. */
  955. wheel.carouseScrollTimeInterval = CarouselTime;
  956. // 代理
  957. wheel.delegate = self;
  958. /*
  959. * isAutoScroll --- 默认为NO,当为YES时 才能使轮播进行滚动
  960. */
  961. wheel.isAutoScroll = YES;
  962. /*
  963. * pageType --- 设置轮播样式 默认为系统样式。ZZCarousel 中封装了 两种样式,另外一种为数字样式
  964. */
  965. wheel.pageType = ZZCarouselPageTypeOfNone;
  966. /*
  967. * 设置UIPageControl 在轮播中的位置、系统默认的UIPageControl 的顶层颜色 和底层颜色已经背景颜色
  968. */
  969. if(wheel.tag == 500) {
  970. wheel.pageControlFrame = CGRectMake((SCREEN_WIDTH - 60 ) / 2, wheel.frame.size.height - 10, 60, 5);
  971. wheel.pageIndicatorTintColor = [UIColor whiteColor];
  972. wheel.currentPageIndicatorTintColor = NewRGBColor(191, 191, 191, 1);
  973. wheel.pageControlBackGroundColor = [UIColor whiteColor];
  974. /*
  975. * 设置数字样式的 UIPageControl 中的字体和字体颜色。 背景颜色仍然按照上面pageControlBackGroundColor属性来设置
  976. */
  977. wheel.pageControlOfNumberFont = [UIFont fontWithName:@"Helvetica-Bold" size:18];
  978. wheel.pageContolOfNumberFontColor = [UIColor whiteColor];
  979. }
  980. return wheel;
  981. }
  982. //ZZCarouselDelegate 轮播图片代理方法
  983. -(NSInteger)numberOfZZCarousel:(ZZCarousel *)wheel
  984. {
  985. return _headwheelArray.count;
  986. }
  987. //图片赋值
  988. -(ZZCarouselView *)zzcarousel:(UICollectionView *)zzcarousel viewForItemAtIndex:(NSIndexPath *)index itemsIndex:(NSInteger)itemsIndex identifire:(NSString *)identifire ZZCarousel:(ZZCarousel *)zZCarousel
  989. {
  990. /*
  991. * index参数 ※ 注意
  992. */
  993. ZZCarouselView *cell = [zzcarousel dequeueReusableCellWithReuseIdentifier:identifire forIndexPath:index];
  994. if (!cell) {
  995. cell = [[ZZCarouselView alloc]init];
  996. }
  997. // cell.title.text = [_imagesGroup objectAtIndex:indexPath.row];
  998. // [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"图片地址"]];
  999. /*
  1000. * itemsIndex 参数 ※ 注意
  1001. */
  1002. if(zZCarousel.tag == 500){
  1003. if(_headwheelArray.count > itemsIndex){
  1004. CarouselModel *model = _headwheelArray[itemsIndex];
  1005. [cell.imageView sd_setImageWithURL:NewURL([model.imgUrl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"banner")];
  1006. }else {
  1007. [cell.imageView setImage:NewImageError_T];
  1008. }
  1009. }
  1010. return cell;
  1011. }
  1012. //图片点击方法
  1013. -(void)zzcarouselScrollView:(ZZCarousel *)zzcarouselScrollView didSelectItemAtIndex:(NSInteger)index
  1014. {
  1015. NSLog(@"%@",[NSString stringWithFormat:@"点击了 第%ld张 轮播图片",(long)index]);
  1016. if (_headwheelArray.count>0) {
  1017. CarouselModel *model = _headwheelArray[index];
  1018. if ([model.type isEqualToString:@"成果"]) {
  1019. AchievementsdetailViewController *vc = [[AchievementsdetailViewController alloc] init];
  1020. vc.ID = model.ID;
  1021. NewPushViewController(vc);
  1022. }else if ([model.type isEqualToString:@"需求"]){
  1023. DemanddetailViewController *vc = [[DemanddetailViewController alloc] init];
  1024. vc.ID = model.ID;
  1025. NewPushViewController(vc);
  1026. }else if ([model.type isEqualToString:@"专家"]){
  1027. ExpertdetailsViewController *vc = [[ExpertdetailsViewController alloc] init];
  1028. vc.uid = model.ID;
  1029. NewPushViewController(vc);
  1030. }
  1031. }
  1032. }
  1033. - (void)didReceiveMemoryWarning {
  1034. [super didReceiveMemoryWarning];
  1035. // Dispose of any resources that can be recreated.
  1036. }
  1037. #pragma mark------查看更多成果 需求 专家---------
  1038. - (void)seemoreBTclick:(UIButton *)sender {
  1039. if (sender.tag == 100) {
  1040. NSLog(@"查看更多成果");
  1041. ScienceAchievementsViewController *vc = [[ScienceAchievementsViewController alloc] init];
  1042. NewPushViewController(vc);
  1043. }else if (sender.tag == 101){
  1044. NSLog(@"查看更多需求");
  1045. SciencedemandViewController *vc = [[SciencedemandViewController alloc] init];
  1046. NewPushViewController(vc);
  1047. }else if (sender.tag == 102){
  1048. NSLog(@"查看更多专家");
  1049. ScienceexpertViewController *vc = [[ScienceexpertViewController alloc] init];
  1050. NewPushViewController(vc);
  1051. }
  1052. }
  1053. /*
  1054. #pragma mark - Navigation
  1055. // In a storyboard-based application, you will often want to do a little preparation before navigation
  1056. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  1057. // Get the new view controller using [segue destinationViewController].
  1058. // Pass the selected object to the new view controller.
  1059. }
  1060. */
  1061. @end