| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819 |
- //
- // ReleaserequirementsViewController.m
- // jitao
- //
- // Created by 罗云飞 on 2018/1/16.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "ReleaserequirementsViewController.h"
- #import "ResultsdescriptionCell.h"
- #import "ResultsTitleCell.h"
- #import "TechnicaltypeCell.h"
- #import "ReleaseresultsCell.h"
- #import "HangYeCell.h"
- #import "Hangyemodel.h"
- #import "PickerChoiceView.h"
- #import "NewPickerChoiceView.h"
- #import "UrgentCell.h"
- #import "CGPTCell.h"
- #import "NewChoiceFileController.h"
- @interface ReleaserequirementsViewController ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate,delegateColl,TFPickerDelegate,TFPickerDelegate11,CGPTColldelegate>{
- UITableView *newtableView;
- BOOL isseemore;//查看更多
- NSMutableArray *titledataArray;
- NSMutableArray *arr;
- NSString *descriptionStr;
- NSString *resultsTitleStr;
- NSString *industryStr;//行业类型1 UI展示
- NSString *industryStr1;//行业类型2 UI展示
-
- NSString *industryStr3;//行业类型1
- NSString *industryStr4;//行业类型1
- NSString *ID;
- NSMutableArray *CGPTdataArray;
- NewChoiceFileController *cont;
- NSString *TechnicaltypeStr111;
- NSString *LocationStr;
- NSString *JiajiStr;
- NSString *XuanShangStr;
- NSString *technicalPictureUrl;
- }
- @property (strong, nonatomic)NSMutableArray * middataArry;
- @property (strong, nonatomic)NSMutableArray * midArry;
- @property (strong, nonatomic)NSMutableArray * midArry2;
- @property (strong, nonatomic)NSMutableArray * middataArry2;
- @end
- @implementation ReleaserequirementsViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setNavTitle:@"发布需求"];
- [self dataInitialization];
- [self loadsView];
- // Do any additional setup after loading the view.
- }
- - (NSMutableArray *)midArry2{
- if (!_midArry2) {
- _midArry2 = [NSMutableArray arrayWithCapacity:0];
- }
- return _midArry2;
- }
- - (NSMutableArray *)midArry{
- if (!_midArry) {
- _midArry = [NSMutableArray arrayWithCapacity:0];
- }
- return _midArry;
- }
- - (NSMutableArray *)middataArry{
- if (!_middataArry) {
- _middataArry = NewMutableArrayInit;
- }
- return _middataArry;
- }
- - (NSMutableArray *)middataArry2{
- if (!_middataArry2) {
- _middataArry2 = NewMutableArrayInit;
- }
- return _middataArry2;
- }
- - (void)Networkrequest:(NSString *)level pid:(NSString*)pid {
- NSMutableDictionary *dic = [NSMutableDictionary new];
- [dic safeSetObject:level forKey:@"level"];
- [dic safeSetObject:pid forKey:@"pid"];
- [NetworkRequestManager requestGetWithInterfacePrefix:JT_getField parameters:dic onSuccess:^(id requestData) {
- NSLog(@"服务器返回数据 :%@",requestData);
- if ([requestData[@"error"] count] !=0) {
- for (NSDictionary *dic in requestData[@"error"]) {
- [MBProgressHUD showError:dic[@"message"] toView:self.view];
- }
- }else{
- [self.midArry removeAllObjects];
- [self.middataArry removeAllObjects];
- for (NSDictionary *dic in requestData[@"data"]) {
- Hangyemodel *model = [[Hangyemodel alloc] initWithDictionary:dic error:nil];
- [self.middataArry addObject:model];
- [self.midArry addObject:model.name];
- }
-
- }
- } onFailure:^{
-
- }];
- }
- - (void)Networkrequestlevel:(NSString *)level pid:(NSString*)pid {
- NSMutableDictionary *dic = [NSMutableDictionary new];
- [dic safeSetObject:level forKey:@"level"];
- [dic safeSetObject:pid forKey:@"pid"];
- [NetworkRequestManager requestGetWithInterfacePrefix:JT_getField parameters:dic onSuccess:^(id requestData) {
- NSLog(@"服务器返回数据 :%@",requestData);
- if ([requestData[@"error"] count] !=0) {
- for (NSDictionary *dic in requestData[@"error"]) {
- [MBProgressHUD showError:dic[@"message"] toView:self.view];
- }
- }else{
- [self.midArry2 removeAllObjects];
- [self.middataArry2 removeAllObjects];
- for (NSDictionary *dic in requestData[@"data"]) {
- Hangyemodel *model = [[Hangyemodel alloc] initWithDictionary:dic error:nil];
- [self.middataArry2 addObject:model];
- [self.midArry2 addObject:model.name];
- }
- }
- } onFailure:^{
-
- }];
- }
- - (void)dataInitialization {
- isseemore = YES;
- titledataArray = [NSMutableArray arrayWithObjects:@"需求描述",@"需求标题",@"需求类型",@"其他",@"需求配图", nil];
- arr = NewMutableArrayInit;
- CGPTdataArray = NewMutableArrayInit;
- for (int i = 0; i<6; i++) {
- NSMutableDictionary *dic = [NSMutableDictionary new];
- switch (i) {
- case 0:
- [dic setObject:@"技术购买" forKey:@"name"];
- [dic setObject:@"0" forKey:@"state"];
- [dic setObject:@"0" forKey:@"number"];
- [arr addObject:dic];
- break;
- case 1:
- [dic setObject:@"技术设备类" forKey:@"name"];
- [dic setObject:@"0" forKey:@"state"];
- [dic setObject:@"1" forKey:@"number"];
- [arr addObject:dic];
- break;
- case 2:
- [dic setObject:@"技术方案" forKey:@"name"];
- [dic setObject:@"0" forKey:@"state"];
- [dic setObject:@"2" forKey:@"number"];
- [arr addObject:dic];
- break;
- case 3:
- [dic setObject:@"技术攻关型" forKey:@"name"];
- [dic setObject:@"0" forKey:@"state"];
- [dic setObject:@"3" forKey:@"number"];
- [arr addObject:dic];
- break;
- case 4:
- [dic setObject:@"技术咨询型" forKey:@"name"];
- [dic setObject:@"0" forKey:@"state"];
- [dic setObject:@"4" forKey:@"number"];
- [arr addObject:dic];
- break;
- case 5:
- [dic setObject:@"技术人才型" forKey:@"name"];
- [dic setObject:@"0" forKey:@"state"];
- [dic setObject:@"5" forKey:@"number"];
- [arr addObject:dic];
- break;
- default:
- break;
- }
- }
- }
- - (void)loadsView{
- cont = [[NewChoiceFileController alloc]init];
- cont.view.backgroundColor = NewClearColor;
- [self.view addSubview:cont.view];
- [self.view sendSubviewToBack:cont.view];
-
- [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]];
- newtableView.separatorStyle = NO;
- // newtableView.estimatedRowHeight = 0;
- // newtableView.estimatedSectionFooterHeight = 0;
- // newtableView.estimatedSectionHeaderHeight = 0;
-
- UIView *view = [UIView new];
- view.backgroundColor = NewWhiteColor;
- [self.view addSubview:view];
-
- view.sd_layout
- .bottomEqualToView(self.view)
- .heightIs(44)
- .widthIs(SCREEN_WIDTH);
-
- UIButton *submissionpurchase = [UIButton new];
- [submissionpurchase setTitle:@"现在发布" forState:UIControlStateNormal];
- [submissionpurchase setTitleColor:NewWhiteColor forState:UIControlStateNormal];
- submissionpurchase.titleLabel.font = NewFont(15);
- submissionpurchase.titleLabel.textAlignment = NSTextAlignmentCenter;
- submissionpurchase.backgroundColor = NewRGBColor(252, 133, 52, 1);
- NewTouchUpInside(submissionpurchase, submissionpurchaseclick:);
- [view addSubview:submissionpurchase];
-
- submissionpurchase.sd_layout
- .rightEqualToView(view)
- .heightIs(44)
- .widthIs(fitScreenWidth(121));
-
- UIButton *negotiate = [UIButton new];
- [negotiate setTitle:@"取消" forState:UIControlStateNormal];
- [negotiate setTitleColor:NewWhiteColor forState:UIControlStateNormal];
- negotiate.titleLabel.font = NewFont(15);
- negotiate.titleLabel.textAlignment = NSTextAlignmentCenter;
- negotiate.backgroundColor = NewButtonColor;
- NewTouchUpInside(negotiate, negotiateclick:);
- [view addSubview:negotiate];
-
- negotiate.sd_layout
- .rightSpaceToView(submissionpurchase, 1)
- .heightIs(44)
- .widthIs(fitScreenWidth(121));
- }
- #pragma mark-------------------------UITableView------------------------------------
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 5;
- }
- //返回每段行数
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- if (section == 0||section == 1||section == 2) {
- return 1;
- }else if (section == 3){
- return 4;
- }else if (section == 4){
- return 1;
- }
- return 3;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *Cell = @"Cell";
- static NSString *Cell1 = @"Cell1";
- static NSString *Cell2 = @"Cell2";
- static NSString *Cell3 = @"Cell3";
- static NSString *Cell4 = @"Cell4";
- // static NSString *Cell5 = @"Cell5";
- static NSString *Cell6 = @"Cell6";
- // static NSString *Cell7 = @"Cell7";
- // static NSString *Cell8 = @"Cell8";
- static NSString *Cell9 = @"Cell9";
-
- if (indexPath.section == 0) {
- ResultsdescriptionCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell];
- if (cell == nil) {
- cell = [[ResultsdescriptionCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- // [cell assignment:dataArray[indexPath.row]];
- cell.backgroundColor = NewLineGrayColor;
- cell.textview.delegate = self;
- if (descriptionStr) {
- cell.textview.text = descriptionStr;
- }else{
- cell.textview.text = @"请描述您的需求~";
- }
- return cell;
- }else if (indexPath.section == 1){
- ResultsTitleCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell1];
- if (cell == nil) {
- cell = [[ResultsTitleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell1];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- cell.backgroundColor = NewLineGrayColor;
- [cell.textfield addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- cell.textfield.tag = 100;
- cell.textfield.placeholder = @"请为您的需求标题配个标题吧~";
- return cell;
- }else if (indexPath.section == 2){
- TechnicaltypeCell* cell = [tableView dequeueReusableCellWithIdentifier:Cell3];
- if (cell == nil) {
- cell = [[TechnicaltypeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell3];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- cell.backgroundColor = NewLineGrayColor;
- //防止出现collerview滚动
- [cell.CollView reloadData];
- //获取到数据后刷新
- cell.CollView.scrollEnabled = NO;
- if (isseemore) {
- cell.CollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 60);
- }else{
- cell.CollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 150);
- }
- cell.delegateColl = self;
- [cell reloadDatas:arr];
- return cell;
- }else if (indexPath.section == 3){
- if (indexPath.row == 0) {
- ReleaseresultsCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell2];
- if (cell == nil) {
- cell = [[ReleaseresultsCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell2];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- cell.backgroundColor = NewWhiteColor;
- cell.title.text = @"所在地";
- cell.view.frame = CGRectMake(60, 10, SCREEN_WIDTH-60-15, fitScreenWidth(44));
- [cell.textfield addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- cell.textfield.tag = 101;
- return cell;
- }else if (indexPath.row == 1){
- HangYeCell* cell = [tableView dequeueReusableCellWithIdentifier:Cell6];
- if (cell == nil) {
- cell = [[HangYeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell6];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- cell.backgroundColor = NewWhiteColor;
- NewTouchUpInside(cell.industry, industryclick:);
- NewTouchUpInside(cell.industry1, industryclick:);
-
- if (industryStr) {
- [cell.industry setTitle:industryStr forState:UIControlStateNormal];
- }else{
- [cell.industry setTitle:@"行业" forState:UIControlStateNormal];
- }
- if (industryStr1) {
- [cell.industry1 setTitle:industryStr1 forState:UIControlStateNormal];
- }else{
- [cell.industry1 setTitle:@"行业类型" forState:UIControlStateNormal];
- }
- return cell;
- }else if (indexPath.row == 2||indexPath.row == 3){
- if (indexPath.row == 2) {
- Cell4 = @"cell7";
- }else{
- Cell4 = @"cell8";
- }
- UrgentCell* cell = [tableView dequeueReusableCellWithIdentifier:Cell4];
- if (cell == nil) {
- cell = [[UrgentCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell4];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- cell.backgroundColor = NewWhiteColor;
- if (indexPath.row == 2) {
- cell.title.text = @"加 急";
- cell.Company.text = @"天";
- cell.textfield.tag = 103;
- }else{
- cell.title.text = @"悬 赏";
- cell.Company.text = @"万元";
- cell.textfield.tag = 104;
- }
- [cell.textfield addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
-
- return cell;
- }
- }else if (indexPath.section == 4){
- CGPTCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell9];
- if (cell == nil) {
- cell = [[CGPTCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell9];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- cell.backgroundColor = NewWhiteColor;
- cell.CollView.scrollEnabled = NO;
- [cell.CollView reloadData];
- // if (CGPTdataArray.count>2) {
- cell.CollView.frame = CGRectMake(0, 0.6, SCREEN_WIDTH, 240);
- // }else{
- // cell.CollView.frame = CGRectMake(0, 0.6, SCREEN_WIDTH, 120);
- // }
- cell.delegateColl = self;
- [cell reloadDatas:CGPTdataArray];
- return cell;
- }
- return [[UITableViewCell alloc] init];
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (indexPath.section == 0) {//成果描述
- return fitScreenWidth(134);
- }else if (indexPath.section == 1){//成果标题
- return fitScreenWidth(64);
- }else if (indexPath.section == 2){//技术类型
- if (isseemore) {
- return 40;
- }else{
- return 70;
- }
- }else if (indexPath.section == 3){//其他
- if (indexPath.row == 0||indexPath.row == 1) {
- return 10+fitScreenWidth(44)+5;
- }
- return fitScreenWidth(44);
- }else if (indexPath.section == 4){
- // if (CGPTdataArray.count>2) {
- return 240;
- // }else{
- // return 120;
- // }
- }
- return fitScreenWidth(44);
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-
- }
- // tableView 如果是Gruop类型的话,section之间的间距变宽,执行返回高度的同时还需要执行return UIView的代理
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- if (section == 0) {
- return fitScreenWidth(44)+10;
- }
- return fitScreenWidth(44);
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- static NSString * identy = @"head";
- UITableViewHeaderFooterView * hf = [tableView dequeueReusableHeaderFooterViewWithIdentifier:identy];
- NSLog(@"%li",section);
- hf = [[UITableViewHeaderFooterView alloc]initWithReuseIdentifier:identy];
- UIView * view = [[UIView alloc]init];
- view.backgroundColor = [UIColor whiteColor];
- if (section == 0) {
- view.frame = CGRectMake(0, 10, SCREEN_WIDTH, fitScreenWidth(44));
- }else{
- view.frame = CGRectMake(0, 0, SCREEN_WIDTH, fitScreenWidth(44));
- }
- [hf addSubview:view];
-
- UILabel *line = [UILabel new];
- line.backgroundColor = NewButtonColor;
- ViewRadius(line, 1);
- [view addSubview:line];
-
- line.sd_layout
- .leftSpaceToView(view, 15)
- .centerYEqualToView(view)
- .heightIs(fitScreenWidth(18))
- .widthIs(3);
-
- UILabel *title = [UILabel new];
- [title setText:titledataArray[section]];
- [title setFont:NewFont(fitScreenWidth(13))];
- [title setSingleLineAutoResizeWithMaxWidth:0];
- [view addSubview:title];
-
- title.sd_layout
- .leftSpaceToView(line, 7)
- .heightIs(fitScreenWidth(44))
- .topEqualToView(view)
- .centerYEqualToView(view);
-
- UIButton *seemore = [UIButton new];
- [seemore setBackgroundColor:NewWhiteColor];
- [seemore setImage:[UIImage imageNamed:@"上"] forState:UIControlStateNormal];
- [seemore setImage:[UIImage imageNamed:@"下"] forState:UIControlStateSelected];
- NewTouchUpInside(seemore, seemoreclick:);
- [view addSubview:seemore];
-
- seemore.sd_layout
- .rightSpaceToView(view, 10)
- .heightIs(view.height)
- .widthIs(30)
- .centerYEqualToView(view);
-
- UIButton *gengduo = [UIButton new];
- [gengduo setTitle:@"查看更多" forState:UIControlStateNormal];
- gengduo.titleLabel.font = NewFont(fitScreenWidth(12));
- [gengduo setTitleColor:[UIColor colorWithString:@"#A1A1A1"] forState:UIControlStateNormal];
- [gengduo setupAutoSizeWithHorizontalPadding:0 buttonHeight:30];
- // NewTouchUpInside(gengduo, seemoreclick:);
- [view addSubview:gengduo];
-
- gengduo.sd_layout
- .rightSpaceToView(seemore, 0)
- .heightIs(30)
- .centerYEqualToView(view);
- if (section == 2) {
- seemore.hidden = NO;
- gengduo.hidden = NO;
- }else{
- seemore.hidden = YES;
- gengduo.hidden = YES;
-
- }
- UILabel *line1 = [UILabel new];
- line1.backgroundColor = NewLineGrayColor;
- [view addSubview:line1];
-
- line1.sd_layout
- .leftEqualToView(view)
- .heightIs(0.6)
- .rightEqualToView(view)
- .bottomEqualToView(view);
- UILabel *line2 = [UILabel new];
- line2.backgroundColor = NewLineGrayColor;
- [view addSubview:line2];
-
- line2.sd_layout
- .leftEqualToView(view)
- .heightIs(0.6)
- .rightEqualToView(view)
- .topEqualToView(view);
- if (section == 4) {
- line1.hidden = NO;
- line2.hidden = NO;
-
- }else{
- line1.hidden = YES;
- line2.hidden = YES;
- }
- return hf;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
- return [[UIView alloc] init];
- }
- #pragma mark - UITextView获得焦点之后,并且已经是第一响应者
- -(void)textViewDidBeginEditing:(UITextView *)textView
- {
- // NSLog(@"UITextView获得焦点之后,并且已经是第一响应者");
- if ([textView.text isEqualToString:@"请描述您的需求~"]) {
- textView.text = @"";
- textView.textColor = NewGrayColor;
- }
- }
- #pragma mark - UITextView失去焦点之后
- -(void)textViewDidEndEditing:(UITextView *)textView
- {
- //NSLog(@"UITextView失去焦点");
- if ([textView.text isEqualToString:@""] || textView.text.length == 0) {
- textView.text = @"请描述您的需求~";
- textView.textColor = NewRGBColor(199, 199, 205, 1);
- }
- }
- #pragma mark - 详细地址限制字数
- -(void)textViewDidChangeSelection:(UITextView *)textView
- {
- if(textView.text.length > 500){
- textView.text = [textView.text substringWithRange:NSMakeRange(0,500)];
- }
- if (textView.text.length > 0) {
- NSLog(@"textView.text:%@",textView.text);
- if ([textView.text isEqualToString:@"请描述您的需求~"]) {
- descriptionStr = @"";
- }else{
- descriptionStr = nil;
- descriptionStr = textView.text;
- }
- }
- }
- #pragma mark - 代理用来接收点击的是第几个
- -(void)ClickCooRow :(NSInteger)CellRow;
- {
- printf("\n点击的是==========%ld\n",CellRow);
- for (int i = 0; i<arr.count; i++) {
- if (i == CellRow) {
- arr[i][@"state"] = @"1";
- TechnicaltypeStr111 = arr[i][@"number"];
- }else{
- arr[i][@"state"] = @"0";
- }
- }
- // NSLog(@"%@",TechnicaltypeStr111);
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:2];
- [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- - (void)seemoreclick:(UIButton *)sender {
- NSLog(@"点击查看更多");
- sender.selected = !sender.selected;
- if (!sender.selected) {
- isseemore = YES;
- }else{
- isseemore = NO;
- }
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:2];
- [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- #pragma mark - TextField作字符输入限制
- - (void)textFieldEditingChanged:(UITextField *)textField
- {
- if (textField.tag == 100) {
- if ([textField.text length]>50) {
- UITextRange *markedRange = [textField markedTextRange];
- if (markedRange) {
- return;
- }
- NSRange range = [textField.text rangeOfComposedCharacterSequenceAtIndex:50];
- textField.text = [textField.text substringToIndex:range.location];
- [self.view makeToast:@"标题最多输入50个字哦~" duration:1.5 position:CSToastPositionCenter];
- }
- resultsTitleStr = textField.text;
- NSLog(@"%@",resultsTitleStr);
- }else if (textField.tag == 103){
- NSLog(@"加急%@天",textField.text);
- JiajiStr = textField.text;
- }else if (textField.tag == 104){
- NSLog(@"悬赏%@万",textField.text);
- XuanShangStr = textField.text;
- }else if (textField.tag == 101){
- if ([textField.text length]>30) {
- UITextRange *markedRange = [textField markedTextRange];
- if (markedRange) {
- return;
- }
- NSRange range = [textField.text rangeOfComposedCharacterSequenceAtIndex:30];
- textField.text = [textField.text substringToIndex:range.location];
- [self.view makeToast:@"所在地最多输入30个字哦~" duration:1.5 position:CSToastPositionCenter];
- }
- LocationStr = textField.text;
- NSLog(@"%@",LocationStr);
- }
- }
- - (void)industryclick:(UIButton *)sender {
- if (sender.tag == 100) {
- sender.userInteractionEnabled = NO;
- [self Networkrequest:@"1" pid:@"0"];
- if (_midArry.count>0) {
- PickerChoiceView *picker = [[PickerChoiceView alloc]initWithFrame:self.view.bounds];
- picker.delegate = self;
- picker.selectLb.text = @"行业";
- picker.customArr = _midArry;
- [self.view addSubview:picker];
- }
- sender.userInteractionEnabled = YES;
- }else{
- if (ID) {
- sender.userInteractionEnabled = NO;
- if (_midArry2.count>0) {
- NewPickerChoiceView *picker = [[NewPickerChoiceView alloc]initWithFrame:self.view.bounds];
- picker.delegate = self;
- picker.selectLb.text = @"行业";
- picker.customArr = _midArry2;
- [self.view addSubview:picker];
- }
- sender.userInteractionEnabled = YES;
- }else{
- [MBProgressHUD showSuccess:@"请先选择行业~" toView:self.view];
- }
- }
- }
- #pragma mark -------- 行业类型 ----------
- - (void)PickerSelectorIndixString:(NSString *)str{
- NSLog(@"%@",str);
- industryStr = str;
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:3];
- [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
- for (int i = 0; i<self.middataArry.count; i++) {
- Hangyemodel *model = self.middataArry[i];
- if ([model.name isEqualToString:str]) {
- ID = model.ID;
- industryStr3 = ID;
- }
- }
- [self Networkrequestlevel:@"2" pid:ID];
- NSLog(@"%@",ID);
- }
- #pragma mark -------- 行业类型1 ----------
- - (void)PickerSelectorIndixString111:(NSString *)str{
- NSLog(@"%@",str);
- // industryStr1 = str;
- for (int i = 0; i<self.middataArry2.count; i++) {
- Hangyemodel *model = self.middataArry2[i];
- if ([model.name isEqualToString:str]) {
- industryStr4 = model.ID;
- industryStr1 = model.name;
- }
- }
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:3];
- [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void)CGPTColldelegateClickCooRow:(NSInteger)CellRow {
- NSLog(@"111");
- // __weak typeof(self) wself = self;
- [cont choiceFile:self type:@"发布需求" action:^(NSString *imagePath) {
- if (imagePath.length>0) {
- // [wself avatarImageReplacement:imagePath];
- [CGPTdataArray addObject:imagePath];
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:4];
- [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- }];
- }
- - (void)hahahaha:(NSInteger)tag{
- [CGPTdataArray removeObjectAtIndex:tag];
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:4];
- [newtableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- #pragma mark -----发布成果网络请求--------
- - (void)submissionpurchaseclick:(UIButton *)sender {
- NSLog(@"成果描述:%@",descriptionStr);
- NSLog(@"成果标题:%@",resultsTitleStr);
- NSLog(@"技术类型:%@",TechnicaltypeStr111);
- NSLog(@"所在地:%@",LocationStr);
- NSLog(@"行业:%@",industryStr);
- NSLog(@"行业类型:%@",industryStr1);
- NSLog(@"加急:%@",JiajiStr);
- NSLog(@"悬赏:%@",XuanShangStr);
-
- if (!descriptionStr) {
- [MBProgressHUD showError:@"请输入需求描述" toView:self.view];
- return;
- }
- if (!resultsTitleStr) {
- [MBProgressHUD showError:@"请输入需求名称" toView:self.view];
- return;
- }
- if (!TechnicaltypeStr111) {
- [MBProgressHUD showError:@"请选择需求类型" toView:self.view];
- return;
- }
- if (!LocationStr) {
- [MBProgressHUD showError:@"请输入所在地" toView:self.view];
- return;
- }
- if (!industryStr3) {
- [MBProgressHUD showError:@"请选择行业" toView:self.view];
- return;
- }
- if (!industryStr4) {
- [MBProgressHUD showError:@"请选择行业类型" toView:self.view];
- return;
- }
- if (CGPTdataArray.count<0) {
- [MBProgressHUD showError:@"请选择需求配图" toView:self.view];
- return;
- }
- NSMutableDictionary *parameters = NewMutableDictionaryInit;
- [parameters safeSetObject:resultsTitleStr forKey:@"name"];//需求名称
- [parameters safeSetObject:descriptionStr forKey:@"problemDes"];//成果描述
- [parameters safeSetObject:TechnicaltypeStr111 forKey:@"demandType"];//需求类型
- [parameters safeSetObject:LocationStr forKey:@"employerAddress"];//所在地
- [parameters safeSetObject:industryStr3 forKey:@"industryCategoryA"];//行业1(传入行业的ID)
- [parameters safeSetObject:industryStr4 forKey:@"industryCategoryB"];//行业2(传入行业的ID)
- [parameters safeSetObject:JiajiStr forKey:@"urgentDays"];//加急天数
- [parameters safeSetObject:XuanShangStr forKey:@"urgentMoney"];//加急金额(悬赏)
- NSString *url1;
- NSString *url2;
- NSString *url3;
- for (int i = 0; i<CGPTdataArray.count; i++) {
- if (i == 0) {
- url1 = CGPTdataArray[0];
- }else if (i == 1){
- url2 = [NSString stringWithFormat:@"%@,%@",CGPTdataArray[0],CGPTdataArray[1]];
- }else if (i == 2){
- url3 = [NSString stringWithFormat:@"%@,%@,%@",CGPTdataArray[0],CGPTdataArray[1],CGPTdataArray[2]];
- }
- }
- if (CGPTdataArray.count == 1) {
- technicalPictureUrl = url1;
- }else if(CGPTdataArray.count == 2){
- technicalPictureUrl = url2;
- }else if (CGPTdataArray.count == 3){
- technicalPictureUrl = url3;
- }
- [parameters safeSetObject:technicalPictureUrl forKey:@"pictureUrl"];//成果配图 拼接
- [NetworkRequestManager requestPostWithInterfacePrefix:JT_appAddDemand parameters:parameters onSuccess:^(id requestData) {
- NSLog(@"服务器返回数据:%@",requestData);
- if ([requestData[@"error"] count] !=0) {
- for (NSDictionary *dic in requestData[@"error"]) {
- [MBProgressHUD showError:dic[@"message"] toView:self.view];
- }
- }else{
- NSString *str = [NSString stringWithFormat:@"%@",requestData[@"data"]];
- if ([str isEqualToString:@"1"]) {
- [MBProgressHUD showSuccess:@"发布需求成功" toView:self.view];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- NewPopViewController;
- });
- }
- }
- } onFailure:^{
-
- }];
-
- }
- - (void)negotiateclick:(UIButton *)sender {
- NewPopViewController;
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|