ReleaserequirementsViewController.m 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  1. //
  2. // ReleaserequirementsViewController.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/1/16.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "ReleaserequirementsViewController.h"
  9. #import "ResultsdescriptionCell.h"
  10. #import "ResultsTitleCell.h"
  11. #import "TechnicaltypeCell.h"
  12. #import "ReleaseresultsCell.h"
  13. #import "HangYeCell.h"
  14. #import "Hangyemodel.h"
  15. #import "PickerChoiceView.h"
  16. #import "NewPickerChoiceView.h"
  17. #import "UrgentCell.h"
  18. #import "CGPTCell.h"
  19. #import "NewChoiceFileController.h"
  20. @interface ReleaserequirementsViewController ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate,delegateColl,TFPickerDelegate,TFPickerDelegate11,CGPTColldelegate>{
  21. UITableView *newtableView;
  22. BOOL isseemore;//查看更多
  23. NSMutableArray *titledataArray;
  24. NSMutableArray *arr;
  25. NSString *descriptionStr;
  26. NSString *resultsTitleStr;
  27. NSString *industryStr;//行业类型1 UI展示
  28. NSString *industryStr1;//行业类型2 UI展示
  29. NSString *industryStr3;//行业类型1
  30. NSString *industryStr4;//行业类型1
  31. NSString *ID;
  32. NSMutableArray *CGPTdataArray;
  33. NewChoiceFileController *cont;
  34. NSString *TechnicaltypeStr111;
  35. NSString *LocationStr;
  36. NSString *JiajiStr;
  37. NSString *XuanShangStr;
  38. NSString *technicalPictureUrl;
  39. }
  40. @property (strong, nonatomic)NSMutableArray * middataArry;
  41. @property (strong, nonatomic)NSMutableArray * midArry;
  42. @property (strong, nonatomic)NSMutableArray * midArry2;
  43. @property (strong, nonatomic)NSMutableArray * middataArry2;
  44. @end
  45. @implementation ReleaserequirementsViewController
  46. - (void)viewDidLoad {
  47. [super viewDidLoad];
  48. [self setNavTitle:@"发布需求"];
  49. [self dataInitialization];
  50. [self loadsView];
  51. // Do any additional setup after loading the view.
  52. }
  53. - (NSMutableArray *)midArry2{
  54. if (!_midArry2) {
  55. _midArry2 = [NSMutableArray arrayWithCapacity:0];
  56. }
  57. return _midArry2;
  58. }
  59. - (NSMutableArray *)midArry{
  60. if (!_midArry) {
  61. _midArry = [NSMutableArray arrayWithCapacity:0];
  62. }
  63. return _midArry;
  64. }
  65. - (NSMutableArray *)middataArry{
  66. if (!_middataArry) {
  67. _middataArry = NewMutableArrayInit;
  68. }
  69. return _middataArry;
  70. }
  71. - (NSMutableArray *)middataArry2{
  72. if (!_middataArry2) {
  73. _middataArry2 = NewMutableArrayInit;
  74. }
  75. return _middataArry2;
  76. }
  77. - (void)Networkrequest:(NSString *)level pid:(NSString*)pid {
  78. NSMutableDictionary *dic = [NSMutableDictionary new];
  79. [dic safeSetObject:level forKey:@"level"];
  80. [dic safeSetObject:pid forKey:@"pid"];
  81. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getField parameters:dic onSuccess:^(id requestData) {
  82. NSLog(@"服务器返回数据 :%@",requestData);
  83. if ([requestData[@"error"] count] !=0) {
  84. for (NSDictionary *dic in requestData[@"error"]) {
  85. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  86. }
  87. }else{
  88. [self.midArry removeAllObjects];
  89. [self.middataArry removeAllObjects];
  90. for (NSDictionary *dic in requestData[@"data"]) {
  91. Hangyemodel *model = [[Hangyemodel alloc] initWithDictionary:dic error:nil];
  92. [self.middataArry addObject:model];
  93. [self.midArry addObject:model.name];
  94. }
  95. }
  96. } onFailure:^{
  97. }];
  98. }
  99. - (void)Networkrequestlevel:(NSString *)level pid:(NSString*)pid {
  100. NSMutableDictionary *dic = [NSMutableDictionary new];
  101. [dic safeSetObject:level forKey:@"level"];
  102. [dic safeSetObject:pid forKey:@"pid"];
  103. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getField parameters:dic onSuccess:^(id requestData) {
  104. NSLog(@"服务器返回数据 :%@",requestData);
  105. if ([requestData[@"error"] count] !=0) {
  106. for (NSDictionary *dic in requestData[@"error"]) {
  107. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  108. }
  109. }else{
  110. [self.midArry2 removeAllObjects];
  111. [self.middataArry2 removeAllObjects];
  112. for (NSDictionary *dic in requestData[@"data"]) {
  113. Hangyemodel *model = [[Hangyemodel alloc] initWithDictionary:dic error:nil];
  114. [self.middataArry2 addObject:model];
  115. [self.midArry2 addObject:model.name];
  116. }
  117. }
  118. } onFailure:^{
  119. }];
  120. }
  121. - (void)dataInitialization {
  122. isseemore = YES;
  123. titledataArray = [NSMutableArray arrayWithObjects:@"需求描述",@"需求标题",@"需求类型",@"其他",@"需求配图", nil];
  124. arr = NewMutableArrayInit;
  125. CGPTdataArray = NewMutableArrayInit;
  126. for (int i = 0; i<6; i++) {
  127. NSMutableDictionary *dic = [NSMutableDictionary new];
  128. switch (i) {
  129. case 0:
  130. [dic setObject:@"技术购买" forKey:@"name"];
  131. [dic setObject:@"0" forKey:@"state"];
  132. [dic setObject:@"0" forKey:@"number"];
  133. [arr addObject:dic];
  134. break;
  135. case 1:
  136. [dic setObject:@"技术设备类" forKey:@"name"];
  137. [dic setObject:@"0" forKey:@"state"];
  138. [dic setObject:@"1" forKey:@"number"];
  139. [arr addObject:dic];
  140. break;
  141. case 2:
  142. [dic setObject:@"技术方案" forKey:@"name"];
  143. [dic setObject:@"0" forKey:@"state"];
  144. [dic setObject:@"2" forKey:@"number"];
  145. [arr addObject:dic];
  146. break;
  147. case 3:
  148. [dic setObject:@"技术攻关型" forKey:@"name"];
  149. [dic setObject:@"0" forKey:@"state"];
  150. [dic setObject:@"3" forKey:@"number"];
  151. [arr addObject:dic];
  152. break;
  153. case 4:
  154. [dic setObject:@"技术咨询型" forKey:@"name"];
  155. [dic setObject:@"0" forKey:@"state"];
  156. [dic setObject:@"4" forKey:@"number"];
  157. [arr addObject:dic];
  158. break;
  159. case 5:
  160. [dic setObject:@"技术人才型" forKey:@"name"];
  161. [dic setObject:@"0" forKey:@"state"];
  162. [dic setObject:@"5" forKey:@"number"];
  163. [arr addObject:dic];
  164. break;
  165. default:
  166. break;
  167. }
  168. }
  169. }
  170. - (void)loadsView{
  171. cont = [[NewChoiceFileController alloc]init];
  172. cont.view.backgroundColor = NewClearColor;
  173. [self.view addSubview:cont.view];
  174. [self.view sendSubviewToBack:cont.view];
  175. [self.view addSubview:newtableView = [NewControlPackage tableViewInitWithFrame:CGRectMake(0, NavHeader, SCREEN_WIDTH, SCREEN_HEIGHT-NavHeader-44) backgroundColor:NewLineGrayColor style:UITableViewStyleGrouped delegate:self dataSource:self showsHorizontalScrollIndicator:NO showsVerticalScrollIndicator:NO hidden:NO tag:100 userInteractionEnabled:YES]];
  176. newtableView.separatorStyle = NO;
  177. // newtableView.estimatedRowHeight = 0;
  178. // newtableView.estimatedSectionFooterHeight = 0;
  179. // newtableView.estimatedSectionHeaderHeight = 0;
  180. UIView *view = [UIView new];
  181. view.backgroundColor = NewWhiteColor;
  182. [self.view addSubview:view];
  183. view.sd_layout
  184. .bottomEqualToView(self.view)
  185. .heightIs(44)
  186. .widthIs(SCREEN_WIDTH);
  187. UIButton *submissionpurchase = [UIButton new];
  188. [submissionpurchase setTitle:@"现在发布" forState:UIControlStateNormal];
  189. [submissionpurchase setTitleColor:NewWhiteColor forState:UIControlStateNormal];
  190. submissionpurchase.titleLabel.font = NewFont(15);
  191. submissionpurchase.titleLabel.textAlignment = NSTextAlignmentCenter;
  192. submissionpurchase.backgroundColor = NewRGBColor(252, 133, 52, 1);
  193. NewTouchUpInside(submissionpurchase, submissionpurchaseclick:);
  194. [view addSubview:submissionpurchase];
  195. submissionpurchase.sd_layout
  196. .rightEqualToView(view)
  197. .heightIs(44)
  198. .widthIs(fitScreenWidth(121));
  199. UIButton *negotiate = [UIButton new];
  200. [negotiate setTitle:@"取消" forState:UIControlStateNormal];
  201. [negotiate setTitleColor:NewWhiteColor forState:UIControlStateNormal];
  202. negotiate.titleLabel.font = NewFont(15);
  203. negotiate.titleLabel.textAlignment = NSTextAlignmentCenter;
  204. negotiate.backgroundColor = NewButtonColor;
  205. NewTouchUpInside(negotiate, negotiateclick:);
  206. [view addSubview:negotiate];
  207. negotiate.sd_layout
  208. .rightSpaceToView(submissionpurchase, 1)
  209. .heightIs(44)
  210. .widthIs(fitScreenWidth(121));
  211. }
  212. #pragma mark-------------------------UITableView------------------------------------
  213. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  214. {
  215. return 5;
  216. }
  217. //返回每段行数
  218. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  219. {
  220. if (section == 0||section == 1||section == 2) {
  221. return 1;
  222. }else if (section == 3){
  223. return 4;
  224. }else if (section == 4){
  225. return 1;
  226. }
  227. return 3;
  228. }
  229. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  230. {
  231. static NSString *Cell = @"Cell";
  232. static NSString *Cell1 = @"Cell1";
  233. static NSString *Cell2 = @"Cell2";
  234. static NSString *Cell3 = @"Cell3";
  235. static NSString *Cell4 = @"Cell4";
  236. // static NSString *Cell5 = @"Cell5";
  237. static NSString *Cell6 = @"Cell6";
  238. // static NSString *Cell7 = @"Cell7";
  239. // static NSString *Cell8 = @"Cell8";
  240. static NSString *Cell9 = @"Cell9";
  241. if (indexPath.section == 0) {
  242. ResultsdescriptionCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell];
  243. if (cell == nil) {
  244. cell = [[ResultsdescriptionCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell];
  245. }
  246. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  247. cell.accessoryType = UITableViewCellAccessoryNone;
  248. // [cell assignment:dataArray[indexPath.row]];
  249. cell.backgroundColor = NewLineGrayColor;
  250. cell.textview.delegate = self;
  251. if (descriptionStr) {
  252. cell.textview.text = descriptionStr;
  253. }else{
  254. cell.textview.text = @"请描述您的需求~";
  255. }
  256. return cell;
  257. }else if (indexPath.section == 1){
  258. ResultsTitleCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell1];
  259. if (cell == nil) {
  260. cell = [[ResultsTitleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell1];
  261. }
  262. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  263. cell.accessoryType = UITableViewCellAccessoryNone;
  264. cell.backgroundColor = NewLineGrayColor;
  265. [cell.textfield addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  266. cell.textfield.tag = 100;
  267. cell.textfield.placeholder = @"请为您的需求标题配个标题吧~";
  268. return cell;
  269. }else if (indexPath.section == 2){
  270. TechnicaltypeCell* cell = [tableView dequeueReusableCellWithIdentifier:Cell3];
  271. if (cell == nil) {
  272. cell = [[TechnicaltypeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell3];
  273. }
  274. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  275. cell.accessoryType = UITableViewCellAccessoryNone;
  276. cell.backgroundColor = NewLineGrayColor;
  277. //防止出现collerview滚动
  278. [cell.CollView reloadData];
  279. //获取到数据后刷新
  280. cell.CollView.scrollEnabled = NO;
  281. if (isseemore) {
  282. cell.CollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 60);
  283. }else{
  284. cell.CollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 150);
  285. }
  286. cell.delegateColl = self;
  287. [cell reloadDatas:arr];
  288. return cell;
  289. }else if (indexPath.section == 3){
  290. if (indexPath.row == 0) {
  291. ReleaseresultsCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell2];
  292. if (cell == nil) {
  293. cell = [[ReleaseresultsCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell2];
  294. }
  295. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  296. cell.accessoryType = UITableViewCellAccessoryNone;
  297. cell.backgroundColor = NewWhiteColor;
  298. cell.title.text = @"所在地";
  299. cell.view.frame = CGRectMake(60, 10, SCREEN_WIDTH-60-15, fitScreenWidth(44));
  300. [cell.textfield addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  301. cell.textfield.tag = 101;
  302. return cell;
  303. }else if (indexPath.row == 1){
  304. HangYeCell* cell = [tableView dequeueReusableCellWithIdentifier:Cell6];
  305. if (cell == nil) {
  306. cell = [[HangYeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell6];
  307. }
  308. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  309. cell.accessoryType = UITableViewCellAccessoryNone;
  310. cell.backgroundColor = NewWhiteColor;
  311. NewTouchUpInside(cell.industry, industryclick:);
  312. NewTouchUpInside(cell.industry1, industryclick:);
  313. if (industryStr) {
  314. [cell.industry setTitle:industryStr forState:UIControlStateNormal];
  315. }else{
  316. [cell.industry setTitle:@"行业" forState:UIControlStateNormal];
  317. }
  318. if (industryStr1) {
  319. [cell.industry1 setTitle:industryStr1 forState:UIControlStateNormal];
  320. }else{
  321. [cell.industry1 setTitle:@"行业类型" forState:UIControlStateNormal];
  322. }
  323. return cell;
  324. }else if (indexPath.row == 2||indexPath.row == 3){
  325. if (indexPath.row == 2) {
  326. Cell4 = @"cell7";
  327. }else{
  328. Cell4 = @"cell8";
  329. }
  330. UrgentCell* cell = [tableView dequeueReusableCellWithIdentifier:Cell4];
  331. if (cell == nil) {
  332. cell = [[UrgentCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell4];
  333. }
  334. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  335. cell.accessoryType = UITableViewCellAccessoryNone;
  336. cell.backgroundColor = NewWhiteColor;
  337. if (indexPath.row == 2) {
  338. cell.title.text = @"加 急";
  339. cell.Company.text = @"天";
  340. cell.textfield.tag = 103;
  341. }else{
  342. cell.title.text = @"悬 赏";
  343. cell.Company.text = @"万元";
  344. cell.textfield.tag = 104;
  345. }
  346. [cell.textfield addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  347. return cell;
  348. }
  349. }else if (indexPath.section == 4){
  350. CGPTCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell9];
  351. if (cell == nil) {
  352. cell = [[CGPTCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell9];
  353. }
  354. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  355. cell.accessoryType = UITableViewCellAccessoryNone;
  356. cell.backgroundColor = NewWhiteColor;
  357. cell.CollView.scrollEnabled = NO;
  358. [cell.CollView reloadData];
  359. // if (CGPTdataArray.count>2) {
  360. cell.CollView.frame = CGRectMake(0, 0.6, SCREEN_WIDTH, 240);
  361. // }else{
  362. // cell.CollView.frame = CGRectMake(0, 0.6, SCREEN_WIDTH, 120);
  363. // }
  364. cell.delegateColl = self;
  365. [cell reloadDatas:CGPTdataArray];
  366. return cell;
  367. }
  368. return [[UITableViewCell alloc] init];
  369. }
  370. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  371. {
  372. if (indexPath.section == 0) {//成果描述
  373. return fitScreenWidth(134);
  374. }else if (indexPath.section == 1){//成果标题
  375. return fitScreenWidth(64);
  376. }else if (indexPath.section == 2){//技术类型
  377. if (isseemore) {
  378. return 40;
  379. }else{
  380. return 70;
  381. }
  382. }else if (indexPath.section == 3){//其他
  383. if (indexPath.row == 0||indexPath.row == 1) {
  384. return 10+fitScreenWidth(44)+5;
  385. }
  386. return fitScreenWidth(44);
  387. }else if (indexPath.section == 4){
  388. // if (CGPTdataArray.count>2) {
  389. return 240;
  390. // }else{
  391. // return 120;
  392. // }
  393. }
  394. return fitScreenWidth(44);
  395. }
  396. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  397. }
  398. // tableView 如果是Gruop类型的话,section之间的间距变宽,执行返回高度的同时还需要执行return UIView的代理
  399. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  400. if (section == 0) {
  401. return fitScreenWidth(44)+10;
  402. }
  403. return fitScreenWidth(44);
  404. }
  405. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  406. return CGFLOAT_MIN;
  407. }
  408. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  409. static NSString * identy = @"head";
  410. UITableViewHeaderFooterView * hf = [tableView dequeueReusableHeaderFooterViewWithIdentifier:identy];
  411. NSLog(@"%li",section);
  412. hf = [[UITableViewHeaderFooterView alloc]initWithReuseIdentifier:identy];
  413. UIView * view = [[UIView alloc]init];
  414. view.backgroundColor = [UIColor whiteColor];
  415. if (section == 0) {
  416. view.frame = CGRectMake(0, 10, SCREEN_WIDTH, fitScreenWidth(44));
  417. }else{
  418. view.frame = CGRectMake(0, 0, SCREEN_WIDTH, fitScreenWidth(44));
  419. }
  420. [hf addSubview:view];
  421. UILabel *line = [UILabel new];
  422. line.backgroundColor = NewButtonColor;
  423. ViewRadius(line, 1);
  424. [view addSubview:line];
  425. line.sd_layout
  426. .leftSpaceToView(view, 15)
  427. .centerYEqualToView(view)
  428. .heightIs(fitScreenWidth(18))
  429. .widthIs(3);
  430. UILabel *title = [UILabel new];
  431. [title setText:titledataArray[section]];
  432. [title setFont:NewFont(fitScreenWidth(13))];
  433. [title setSingleLineAutoResizeWithMaxWidth:0];
  434. [view addSubview:title];
  435. title.sd_layout
  436. .leftSpaceToView(line, 7)
  437. .heightIs(fitScreenWidth(44))
  438. .topEqualToView(view)
  439. .centerYEqualToView(view);
  440. UIButton *seemore = [UIButton new];
  441. [seemore setBackgroundColor:NewWhiteColor];
  442. [seemore setImage:[UIImage imageNamed:@"上"] forState:UIControlStateNormal];
  443. [seemore setImage:[UIImage imageNamed:@"下"] forState:UIControlStateSelected];
  444. NewTouchUpInside(seemore, seemoreclick:);
  445. [view addSubview:seemore];
  446. seemore.sd_layout
  447. .rightSpaceToView(view, 10)
  448. .heightIs(view.height)
  449. .widthIs(30)
  450. .centerYEqualToView(view);
  451. UIButton *gengduo = [UIButton new];
  452. [gengduo setTitle:@"查看更多" forState:UIControlStateNormal];
  453. gengduo.titleLabel.font = NewFont(fitScreenWidth(12));
  454. [gengduo setTitleColor:[UIColor colorWithString:@"#A1A1A1"] forState:UIControlStateNormal];
  455. [gengduo setupAutoSizeWithHorizontalPadding:0 buttonHeight:30];
  456. // NewTouchUpInside(gengduo, seemoreclick:);
  457. [view addSubview:gengduo];
  458. gengduo.sd_layout
  459. .rightSpaceToView(seemore, 0)
  460. .heightIs(30)
  461. .centerYEqualToView(view);
  462. if (section == 2) {
  463. seemore.hidden = NO;
  464. gengduo.hidden = NO;
  465. }else{
  466. seemore.hidden = YES;
  467. gengduo.hidden = YES;
  468. }
  469. UILabel *line1 = [UILabel new];
  470. line1.backgroundColor = NewLineGrayColor;
  471. [view addSubview:line1];
  472. line1.sd_layout
  473. .leftEqualToView(view)
  474. .heightIs(0.6)
  475. .rightEqualToView(view)
  476. .bottomEqualToView(view);
  477. UILabel *line2 = [UILabel new];
  478. line2.backgroundColor = NewLineGrayColor;
  479. [view addSubview:line2];
  480. line2.sd_layout
  481. .leftEqualToView(view)
  482. .heightIs(0.6)
  483. .rightEqualToView(view)
  484. .topEqualToView(view);
  485. if (section == 4) {
  486. line1.hidden = NO;
  487. line2.hidden = NO;
  488. }else{
  489. line1.hidden = YES;
  490. line2.hidden = YES;
  491. }
  492. return hf;
  493. }
  494. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
  495. return [[UIView alloc] init];
  496. }
  497. #pragma mark - UITextView获得焦点之后,并且已经是第一响应者
  498. -(void)textViewDidBeginEditing:(UITextView *)textView
  499. {
  500. // NSLog(@"UITextView获得焦点之后,并且已经是第一响应者");
  501. if ([textView.text isEqualToString:@"请描述您的需求~"]) {
  502. textView.text = @"";
  503. textView.textColor = NewGrayColor;
  504. }
  505. }
  506. #pragma mark - UITextView失去焦点之后
  507. -(void)textViewDidEndEditing:(UITextView *)textView
  508. {
  509. //NSLog(@"UITextView失去焦点");
  510. if ([textView.text isEqualToString:@""] || textView.text.length == 0) {
  511. textView.text = @"请描述您的需求~";
  512. textView.textColor = NewRGBColor(199, 199, 205, 1);
  513. }
  514. }
  515. #pragma mark - 详细地址限制字数
  516. -(void)textViewDidChangeSelection:(UITextView *)textView
  517. {
  518. if(textView.text.length > 500){
  519. textView.text = [textView.text substringWithRange:NSMakeRange(0,500)];
  520. }
  521. if (textView.text.length > 0) {
  522. NSLog(@"textView.text:%@",textView.text);
  523. if ([textView.text isEqualToString:@"请描述您的需求~"]) {
  524. descriptionStr = @"";
  525. }else{
  526. descriptionStr = nil;
  527. descriptionStr = textView.text;
  528. }
  529. }
  530. }
  531. #pragma mark - 代理用来接收点击的是第几个
  532. -(void)ClickCooRow :(NSInteger)CellRow;
  533. {
  534. printf("\n点击的是==========%ld\n",CellRow);
  535. for (int i = 0; i<arr.count; i++) {
  536. if (i == CellRow) {
  537. arr[i][@"state"] = @"1";
  538. TechnicaltypeStr111 = arr[i][@"number"];
  539. }else{
  540. arr[i][@"state"] = @"0";
  541. }
  542. }
  543. // NSLog(@"%@",TechnicaltypeStr111);
  544. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:2];
  545. [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
  546. }
  547. - (void)seemoreclick:(UIButton *)sender {
  548. NSLog(@"点击查看更多");
  549. sender.selected = !sender.selected;
  550. if (!sender.selected) {
  551. isseemore = YES;
  552. }else{
  553. isseemore = NO;
  554. }
  555. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:2];
  556. [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
  557. }
  558. #pragma mark - TextField作字符输入限制
  559. - (void)textFieldEditingChanged:(UITextField *)textField
  560. {
  561. if (textField.tag == 100) {
  562. if ([textField.text length]>50) {
  563. UITextRange *markedRange = [textField markedTextRange];
  564. if (markedRange) {
  565. return;
  566. }
  567. NSRange range = [textField.text rangeOfComposedCharacterSequenceAtIndex:50];
  568. textField.text = [textField.text substringToIndex:range.location];
  569. [self.view makeToast:@"标题最多输入50个字哦~" duration:1.5 position:CSToastPositionCenter];
  570. }
  571. resultsTitleStr = textField.text;
  572. NSLog(@"%@",resultsTitleStr);
  573. }else if (textField.tag == 103){
  574. NSLog(@"加急%@天",textField.text);
  575. JiajiStr = textField.text;
  576. }else if (textField.tag == 104){
  577. NSLog(@"悬赏%@万",textField.text);
  578. XuanShangStr = textField.text;
  579. }else if (textField.tag == 101){
  580. if ([textField.text length]>30) {
  581. UITextRange *markedRange = [textField markedTextRange];
  582. if (markedRange) {
  583. return;
  584. }
  585. NSRange range = [textField.text rangeOfComposedCharacterSequenceAtIndex:30];
  586. textField.text = [textField.text substringToIndex:range.location];
  587. [self.view makeToast:@"所在地最多输入30个字哦~" duration:1.5 position:CSToastPositionCenter];
  588. }
  589. LocationStr = textField.text;
  590. NSLog(@"%@",LocationStr);
  591. }
  592. }
  593. - (void)industryclick:(UIButton *)sender {
  594. if (sender.tag == 100) {
  595. sender.userInteractionEnabled = NO;
  596. [self Networkrequest:@"1" pid:@"0"];
  597. if (_midArry.count>0) {
  598. PickerChoiceView *picker = [[PickerChoiceView alloc]initWithFrame:self.view.bounds];
  599. picker.delegate = self;
  600. picker.selectLb.text = @"行业";
  601. picker.customArr = _midArry;
  602. [self.view addSubview:picker];
  603. }
  604. sender.userInteractionEnabled = YES;
  605. }else{
  606. if (ID) {
  607. sender.userInteractionEnabled = NO;
  608. if (_midArry2.count>0) {
  609. NewPickerChoiceView *picker = [[NewPickerChoiceView alloc]initWithFrame:self.view.bounds];
  610. picker.delegate = self;
  611. picker.selectLb.text = @"行业";
  612. picker.customArr = _midArry2;
  613. [self.view addSubview:picker];
  614. }
  615. sender.userInteractionEnabled = YES;
  616. }else{
  617. [MBProgressHUD showSuccess:@"请先选择行业~" toView:self.view];
  618. }
  619. }
  620. }
  621. #pragma mark -------- 行业类型 ----------
  622. - (void)PickerSelectorIndixString:(NSString *)str{
  623. NSLog(@"%@",str);
  624. industryStr = str;
  625. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:3];
  626. [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
  627. for (int i = 0; i<self.middataArry.count; i++) {
  628. Hangyemodel *model = self.middataArry[i];
  629. if ([model.name isEqualToString:str]) {
  630. ID = model.ID;
  631. industryStr3 = ID;
  632. }
  633. }
  634. [self Networkrequestlevel:@"2" pid:ID];
  635. NSLog(@"%@",ID);
  636. }
  637. #pragma mark -------- 行业类型1 ----------
  638. - (void)PickerSelectorIndixString111:(NSString *)str{
  639. NSLog(@"%@",str);
  640. // industryStr1 = str;
  641. for (int i = 0; i<self.middataArry2.count; i++) {
  642. Hangyemodel *model = self.middataArry2[i];
  643. if ([model.name isEqualToString:str]) {
  644. industryStr4 = model.ID;
  645. industryStr1 = model.name;
  646. }
  647. }
  648. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:3];
  649. [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
  650. }
  651. -(void)CGPTColldelegateClickCooRow:(NSInteger)CellRow {
  652. NSLog(@"111");
  653. // __weak typeof(self) wself = self;
  654. [cont choiceFile:self type:@"发布需求" action:^(NSString *imagePath) {
  655. if (imagePath.length>0) {
  656. // [wself avatarImageReplacement:imagePath];
  657. [CGPTdataArray addObject:imagePath];
  658. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:4];
  659. [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
  660. }
  661. }];
  662. }
  663. - (void)hahahaha:(NSInteger)tag{
  664. [CGPTdataArray removeObjectAtIndex:tag];
  665. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:4];
  666. [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
  667. }
  668. #pragma mark -----发布成果网络请求--------
  669. - (void)submissionpurchaseclick:(UIButton *)sender {
  670. NSLog(@"成果描述:%@",descriptionStr);
  671. NSLog(@"成果标题:%@",resultsTitleStr);
  672. NSLog(@"技术类型:%@",TechnicaltypeStr111);
  673. NSLog(@"所在地:%@",LocationStr);
  674. NSLog(@"行业:%@",industryStr);
  675. NSLog(@"行业类型:%@",industryStr1);
  676. NSLog(@"加急:%@",JiajiStr);
  677. NSLog(@"悬赏:%@",XuanShangStr);
  678. if (!descriptionStr) {
  679. [MBProgressHUD showError:@"请输入需求描述" toView:self.view];
  680. return;
  681. }
  682. if (!resultsTitleStr) {
  683. [MBProgressHUD showError:@"请输入需求名称" toView:self.view];
  684. return;
  685. }
  686. if (!TechnicaltypeStr111) {
  687. [MBProgressHUD showError:@"请选择需求类型" toView:self.view];
  688. return;
  689. }
  690. if (!LocationStr) {
  691. [MBProgressHUD showError:@"请输入所在地" toView:self.view];
  692. return;
  693. }
  694. if (!industryStr3) {
  695. [MBProgressHUD showError:@"请选择行业" toView:self.view];
  696. return;
  697. }
  698. if (!industryStr4) {
  699. [MBProgressHUD showError:@"请选择行业类型" toView:self.view];
  700. return;
  701. }
  702. if (CGPTdataArray.count<0) {
  703. [MBProgressHUD showError:@"请选择需求配图" toView:self.view];
  704. return;
  705. }
  706. NSMutableDictionary *parameters = NewMutableDictionaryInit;
  707. [parameters safeSetObject:resultsTitleStr forKey:@"name"];//需求名称
  708. [parameters safeSetObject:descriptionStr forKey:@"problemDes"];//成果描述
  709. [parameters safeSetObject:TechnicaltypeStr111 forKey:@"demandType"];//需求类型
  710. [parameters safeSetObject:LocationStr forKey:@"employerAddress"];//所在地
  711. [parameters safeSetObject:industryStr3 forKey:@"industryCategoryA"];//行业1(传入行业的ID)
  712. [parameters safeSetObject:industryStr4 forKey:@"industryCategoryB"];//行业2(传入行业的ID)
  713. [parameters safeSetObject:JiajiStr forKey:@"urgentDays"];//加急天数
  714. [parameters safeSetObject:XuanShangStr forKey:@"urgentMoney"];//加急金额(悬赏)
  715. NSString *url1;
  716. NSString *url2;
  717. NSString *url3;
  718. for (int i = 0; i<CGPTdataArray.count; i++) {
  719. if (i == 0) {
  720. url1 = CGPTdataArray[0];
  721. }else if (i == 1){
  722. url2 = [NSString stringWithFormat:@"%@,%@",CGPTdataArray[0],CGPTdataArray[1]];
  723. }else if (i == 2){
  724. url3 = [NSString stringWithFormat:@"%@,%@,%@",CGPTdataArray[0],CGPTdataArray[1],CGPTdataArray[2]];
  725. }
  726. }
  727. if (CGPTdataArray.count == 1) {
  728. technicalPictureUrl = url1;
  729. }else if(CGPTdataArray.count == 2){
  730. technicalPictureUrl = url2;
  731. }else if (CGPTdataArray.count == 3){
  732. technicalPictureUrl = url3;
  733. }
  734. [parameters safeSetObject:technicalPictureUrl forKey:@"pictureUrl"];//成果配图 拼接
  735. [NetworkRequestManager requestPostWithInterfacePrefix:JT_appAddDemand parameters:parameters onSuccess:^(id requestData) {
  736. NSLog(@"服务器返回数据:%@",requestData);
  737. if ([requestData[@"error"] count] !=0) {
  738. for (NSDictionary *dic in requestData[@"error"]) {
  739. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  740. }
  741. }else{
  742. NSString *str = [NSString stringWithFormat:@"%@",requestData[@"data"]];
  743. if ([str isEqualToString:@"1"]) {
  744. [MBProgressHUD showSuccess:@"发布需求成功" toView:self.view];
  745. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  746. NewPopViewController;
  747. });
  748. }
  749. }
  750. } onFailure:^{
  751. }];
  752. }
  753. - (void)negotiateclick:(UIButton *)sender {
  754. NewPopViewController;
  755. }
  756. - (void)didReceiveMemoryWarning {
  757. [super didReceiveMemoryWarning];
  758. // Dispose of any resources that can be recreated.
  759. }
  760. /*
  761. #pragma mark - Navigation
  762. // In a storyboard-based application, you will often want to do a little preparation before navigation
  763. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  764. // Get the new view controller using [segue destinationViewController].
  765. // Pass the selected object to the new view controller.
  766. }
  767. */
  768. @end