DemandCell.m 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. //
  2. // DemandCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/16.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "DemandCell.h"
  9. @implementation DemandCell{
  10. UILabel *xuansan;
  11. }
  12. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  13. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  14. if (self) {
  15. UILabel *line10 = [UILabel new];
  16. line10.backgroundColor = NewLineGrayColor;
  17. [self.contentView addSubview:line10];
  18. line10.sd_layout
  19. .leftEqualToView(self.contentView)
  20. .heightIs(10)
  21. .rightEqualToView(self.contentView);
  22. UILabel *line = [UILabel new];
  23. line.backgroundColor = NewButtonColor;
  24. ViewRadius(line, 1);
  25. [self.contentView addSubview:line];
  26. line.sd_layout
  27. .leftSpaceToView(self.contentView, 15)
  28. .topSpaceToView(line10, 15)
  29. .heightIs(18)
  30. .widthIs(3);
  31. _title = [UILabel new];
  32. _title.font = NewFont(fitScreenWidth(14));
  33. [self.contentView addSubview:_title];
  34. _title.sd_layout
  35. .leftSpaceToView(self.contentView, 24)
  36. .heightIs(14)
  37. .rightSpaceToView(self.contentView, 15)
  38. .centerYEqualToView(line);
  39. UILabel *line1 = [UILabel new];
  40. line1.backgroundColor = NewLineGrayColor;
  41. [self.contentView addSubview:line1];
  42. line1.sd_layout
  43. .leftEqualToView(self.contentView)
  44. .rightEqualToView(self.contentView)
  45. .heightIs(0.8)
  46. .topSpaceToView(line10, 44);
  47. _technicaltype = [UILabel new];
  48. _technicaltype.font = NewFont(fitScreenWidth(11));
  49. _technicaltype.textColor = NewButtonColor;
  50. [_technicaltype setSingleLineAutoResizeWithMaxWidth:0];
  51. [self.contentView addSubview:_technicaltype];
  52. _technicaltype.sd_layout
  53. .leftSpaceToView(self.contentView, 15)
  54. .topSpaceToView(line1, 15)
  55. .heightIs(11);
  56. _qiatan = [UILabel new];
  57. _qiatan.text = @"加急:";
  58. [_qiatan setSingleLineAutoResizeWithMaxWidth:0];
  59. _qiatan.font = NewFont(fitScreenWidth(12));
  60. [self.contentView addSubview:_qiatan];
  61. _daynumber = [UILabel new];
  62. _daynumber.font = NewBFont(fitScreenWidth(12));
  63. _daynumber.textColor = [UIColor colorWithString:@"#FF8523"];
  64. [_daynumber setSingleLineAutoResizeWithMaxWidth:0];
  65. [self.contentView addSubview:_daynumber];
  66. xuansan = [UILabel new];
  67. xuansan.text = @"悬赏:";
  68. xuansan.font = NewFont(fitScreenWidth(12));
  69. [xuansan setSingleLineAutoResizeWithMaxWidth:0];
  70. [self.contentView addSubview:xuansan];
  71. xuansan.sd_layout
  72. .leftSpaceToView(self.contentView, 15)
  73. .heightIs(12)
  74. .topSpaceToView(_technicaltype, 15);
  75. _rewardamount = [UILabel new];
  76. _rewardamount.font = NewBFont(fitScreenWidth(12));
  77. _rewardamount.textColor = [UIColor colorWithString:@"#FF8523"];
  78. [_rewardamount setSingleLineAutoResizeWithMaxWidth:0];
  79. [self.contentView addSubview:_rewardamount];
  80. _rewardamount.sd_layout
  81. .leftSpaceToView(xuansan, 5)
  82. .heightIs(11)
  83. .centerYEqualToView(xuansan);
  84. UIView *view = [UIView new];
  85. view.backgroundColor = [UIColor colorWithString:@"#f8f8f8"];
  86. [self.contentView addSubview:view];
  87. view.sd_layout
  88. .leftEqualToView(self.contentView)
  89. .rightEqualToView(self.contentView)
  90. .bottomEqualToView(self.contentView)
  91. .topSpaceToView(xuansan, 15);
  92. _fieldapplication = [UILabel new];
  93. _fieldapplication.font = NewFont(fitScreenWidth(12));
  94. [_fieldapplication setSingleLineAutoResizeWithMaxWidth:0];
  95. [view addSubview:_fieldapplication];
  96. _fieldapplication.sd_layout
  97. .leftSpaceToView(view, 15)
  98. .heightIs(11)
  99. .topSpaceToView(view, 15);
  100. _label = [UILabel new];
  101. _label.font = NewFont(fitScreenWidth(11));
  102. [_label setSingleLineAutoResizeWithMaxWidth:0];
  103. [view addSubview:_label];
  104. _label.sd_layout
  105. .leftEqualToView(_fieldapplication)
  106. .heightIs(11)
  107. .topSpaceToView(_fieldapplication, 15);
  108. _place = [UILabel new];
  109. // _place.text = @"湖南长沙";
  110. _place.font = NewFont(fitScreenWidth(11));
  111. [_place setSingleLineAutoResizeWithMaxWidth:80];
  112. _place.textColor = [UIColor colorWithString:@"#9A9A9A"];
  113. [view addSubview:_place];
  114. _place.sd_layout
  115. .leftSpaceToView(_label, 36)
  116. .heightIs(11)
  117. .centerYEqualToView(_label);
  118. UIImageView *image = [UIImageView new];
  119. image.backgroundColor = NewClearColor;
  120. [image setImage:[UIImage imageNamed:@"Check"]];
  121. [view addSubview:image];
  122. image.sd_layout
  123. .leftSpaceToView(view, 15)
  124. .heightIs(16)
  125. .widthIs(16)
  126. .bottomSpaceToView(view, 18);
  127. _follow = [UILabel new];
  128. _follow.textColor = [UIColor colorWithString:@"#9A9A9A"];
  129. _follow.font = NewFont(fitScreenWidth(11));
  130. [_follow setSingleLineAutoResizeWithMaxWidth:0];
  131. [view addSubview:_follow];
  132. _follow.sd_layout
  133. .leftSpaceToView(image, 5)
  134. .heightIs(11)
  135. .centerYEqualToView(image);
  136. UIImageView *image1 = [UIImageView new];
  137. image1.backgroundColor = NewClearColor;
  138. [image1 setImage:[UIImage imageNamed:@"Check"]];
  139. [view addSubview:image1];
  140. image1.sd_layout
  141. .leftSpaceToView(_follow, 15)
  142. .heightIs(16)
  143. .widthIs(16)
  144. .centerYEqualToView(image);
  145. _orderintention = [UILabel new];
  146. _orderintention.textColor = [UIColor colorWithString:@"#9A9A9A"];
  147. _orderintention.font = NewFont(fitScreenWidth(11));
  148. [_orderintention setSingleLineAutoResizeWithMaxWidth:0];
  149. [view addSubview:_orderintention];
  150. _orderintention.sd_layout
  151. .leftSpaceToView(image1, 5)
  152. .heightIs(11)
  153. .centerYEqualToView(image);
  154. UIImageView *image2 = [UIImageView new];
  155. image2.backgroundColor = NewClearColor;
  156. [image2 setImage:[UIImage imageNamed:@"Check"]];
  157. [view addSubview:image2];
  158. image2.sd_layout
  159. .leftSpaceToView(_orderintention, 15)
  160. .heightIs(16)
  161. .widthIs(16)
  162. .centerYEqualToView(image);
  163. _ordersnumber = [UILabel new];
  164. _ordersnumber.textColor = [UIColor colorWithString:@"#9A9A9A"];
  165. _ordersnumber.font = NewFont(fitScreenWidth(11));
  166. [_ordersnumber setSingleLineAutoResizeWithMaxWidth:0];
  167. [view addSubview:_ordersnumber];
  168. _ordersnumber.sd_layout
  169. .leftSpaceToView(image2, 5)
  170. .heightIs(11)
  171. .centerYEqualToView(image);
  172. _place1 = [UILabel new];
  173. _place1.font = NewFont(fitScreenWidth(11));
  174. [_place1 setSingleLineAutoResizeWithMaxWidth:80];
  175. _place1.textColor = [UIColor colorWithString:@"#9A9A9A"];
  176. [view addSubview:_place1];
  177. _place1.sd_layout
  178. .rightSpaceToView(view, 15)
  179. .heightIs(11)
  180. .centerYEqualToView(image);
  181. }
  182. return self;
  183. }
  184. - (void)assignment:(DemanddetailModel *)model {
  185. _title.text = model.name;
  186. if ([model.demandType isEqualToString:@"0"]) {
  187. _technicaltype.text = [NSString stringWithFormat:@"需求类型:%@",@"技术购买需求"];
  188. }else if ([model.demandType isEqualToString:@"1"]){
  189. _technicaltype.text = [NSString stringWithFormat:@"需求类型:%@",@"技术设备类需求"];
  190. }else if ([model.demandType isEqualToString:@"2"]){
  191. _technicaltype.text = [NSString stringWithFormat:@"需求类型:%@",@"技术方案型需求"];
  192. }else if ([model.demandType isEqualToString:@"3"]){
  193. _technicaltype.text = [NSString stringWithFormat:@"需求类型:%@",@"技术攻关型需求"];
  194. }else if ([model.demandType isEqualToString:@"4"]){
  195. _technicaltype.text = [NSString stringWithFormat:@"需求类型:%@",@"技术咨询型需求"];
  196. }else if ([model.demandType isEqualToString:@"5"]){
  197. _technicaltype.text = [NSString stringWithFormat:@"需求类型:%@",@"技术人才型需求"];
  198. }
  199. if (model.urgentMoney == NULL) {
  200. _rewardamount.text = @"";
  201. xuansan.hidden = YES;
  202. _qiatan.sd_layout
  203. .leftSpaceToView(self.contentView, 15)
  204. .heightIs(12)
  205. .topSpaceToView(_technicaltype, 15);
  206. }else{
  207. xuansan.hidden = NO;
  208. _rewardamount.text = [NSString stringWithFormat:@"%@万",model.urgentMoney];
  209. _qiatan.sd_layout
  210. .leftSpaceToView(_rewardamount, 20)
  211. .heightIs(12)
  212. .topSpaceToView(_technicaltype, 15);
  213. }
  214. if (model.urgentDays == NULL) {
  215. _daynumber.text = @"";
  216. _qiatan.hidden = YES;
  217. }else{
  218. _daynumber.text = [NSString stringWithFormat:@"%@天",model.urgentDays];
  219. _qiatan.hidden = NO;
  220. }
  221. _daynumber.sd_layout
  222. .leftSpaceToView(_qiatan, 5)
  223. .heightIs(11)
  224. .centerYEqualToView(_qiatan);
  225. _fieldapplication.text = [NSString stringWithFormat:@"行业:%@/%@",model.industryCategory1,model.industryCategory2];
  226. if (model.budgetCost == NULL||[model.budgetCost isEqualToString:@""]) {
  227. _label.text = [NSString stringWithFormat:@"价格:%@",@"面议"];
  228. }else{
  229. _label.text = [NSString stringWithFormat:@"价格:%@万",model.budgetCost];
  230. }
  231. _follow.text = [NSString stringWithFormat:@"%@次关注",model.countInterest];
  232. _place1.text = model.employerAddress;
  233. _orderintention.text = [NSString stringWithFormat:@"%@次接单意向",model.orderIntentionCount];
  234. _ordersnumber.text = [NSString stringWithFormat:@"%@次接单",model.orderCount];
  235. }
  236. - (void)awakeFromNib {
  237. [super awakeFromNib];
  238. // Initialization code
  239. }
  240. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  241. [super setSelected:selected animated:animated];
  242. // Configure the view for the selected state
  243. }
  244. @end