123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- //
- // CommonListCell.m
- // smartRhino
- //
- // Created by niuzhen on 2020/4/28.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "CommonListCell.h"
- @implementation CommonListCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- + (CGFloat)configCell0Height{
- return 72;
- }
- + (CommonListCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
- static NSString *cellIdentifer = @"CommonListCell0";
- CommonListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
- if (cell == nil) {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"CommonListCell" owner:nil options:nil] objectAtIndex:0];
- }
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- + (CommonListCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
- static NSString *cellIdentifer = @"CommonListCell1";
- CommonListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
- if (cell == nil) {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"CommonListCell" owner:nil options:nil] objectAtIndex:1];
- }
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- - (void)setCell1Data:(MyFavoriteSubModel *)model
- {
- switch (model.CollectionType) {
- // 文章
- case CollectModel_Aritle:{
- [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.Data.ArticleImgUrl.firstObject] placeholderImage:IMG(@"文章")];
- }break;
- // 话题 || 小组
- case CollectModel_Toipc:
- {
- self.iconV.image = IMG(@"话题");
- }break;
- case CollectModel_NewTopic:
- {
- self.iconV.image = IMG(@"话题");
- }break;
- case CollectModel_Group:{
- self.iconV.image = IMG(@"笔记小组");
- }break;
- // 收藏
- case CollectModel_Collect:{
- self.iconV.image = IMG(@"收藏");
- }break;
- // 笔记
- case CollectModel_NoteBook: {
- self.iconV.image = IMG(@"noteBook_icon");
- }break;
- case CollectModel_CollectFile:{
- self.iconV.image = IMG(@"find_1");
- }break;
- case CollectModel_NoteFile: {
- self.iconV.image = IMG(@"find_1");
- }break;
- // 通知 || 站内信
- case CollectModel_Notice:
- {
- self.iconV.image = IMG(@"通知图标");
- }break;
- case CollectModel_InterMail:{
- self.iconV.image = IMG(@"站内信");
- }break;
- // 会议
- case CollectModel_meetMian:{
- self.iconV.image = IMG(@"会议");
- }break;
- case CollectModel_meetDetail:{
- self.iconV.image = IMG(@"会议");
- }break;
- case CollectModel_file:{
- NSString * imageStr = [ZYCTool getFileNameImage:model.Data.FileName];
- if (imageStr.length == 0) {
- [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.Data.MinFile]];
- }else{
- self.iconV.image = IMG(imageStr);
- }
- }break;
- case CollectModel_work:
- {
- self.iconV.image = IMG(@"审批");
- }
- break;
- case CollectModel_financeCount:
- {
- self.iconV.image = IMG(@"报表");
- }
- break;
- case CollectModel_affairsCount:
- {
- self.iconV.image = IMG(@"报表");
- }
- break;
- case CollectModel_publishCount:
- {
- self.iconV.image = IMG(@"报表");
- }
- break;
- default:{
- NSString * imageStr = [ZYCTool getFileNameImage:model.Data.FileName];
- if (imageStr.length == 0) {
- [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.Data.MinFile]];
- }else{
- self.iconV.image = IMG(imageStr);
- }
- }break;
- }
- self.isTopV.hidden = !model.IsTop;
- [self.titleL mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.iconV.mas_right).offset(15);
- make.top.mas_offset(15);
- make.height.mas_greaterThanOrEqualTo(20);
- make.width.mas_lessThanOrEqualTo(SCREEN_WIDTH - (model.IsTop ? 125 : 85));
- }];
- self.titleL.text = model.Data.Title;
- self.nameL.text = [model.Data.Author length] > 0 ? model.Data.Author : @" ";
- self.desL.text = [model.FolderName length] > 0 ? model.FolderName : @" ";
- }
- - (void)setCellData:(MyFavoriteSubModel *)model withText:(NSString *)text
- {
- switch (model.CollectionType) {
- // 文章
- case CollectModel_Aritle:{
- [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.Data.ArticleImgUrl.firstObject] placeholderImage:IMG(@"文章")];
- }break;
- // 话题 || 小组
- case CollectModel_Toipc:
- {
- self.iconV.image = IMG(@"话题");
- }break;
- case CollectModel_NewTopic:
- {
- self.iconV.image = IMG(@"话题");
- }break;
- case CollectModel_Group:{
- self.iconV.image = IMG(@"笔记小组");
- }break;
- // 收藏
- case CollectModel_Collect:{
- self.iconV.image = IMG(@"收藏");
- }break;
- // 笔记
- case CollectModel_NoteBook: {
- self.iconV.image = IMG(@"noteBook_icon");
- }break;
- case CollectModel_CollectFile:{
- self.iconV.image = IMG(@"find_1");
- }break;
- case CollectModel_NoteFile: {
- self.iconV.image = IMG(@"find_1");
- }break;
- // 通知 || 站内信
- case CollectModel_Notice:
- {
- self.iconV.image = IMG(@"通知图标");
- }break;
- case CollectModel_InterMail:{
- self.iconV.image = IMG(@"站内信");
- }break;
- // 会议
- case CollectModel_meetMian:{
- self.iconV.image = IMG(@"会议");
- }break;
- case CollectModel_meetDetail:{
- self.iconV.image = IMG(@"会议");
- }break;
- case CollectModel_file:{
- NSString * imageStr = [ZYCTool getFileNameImage:model.Data.FileName];
- if (imageStr.length == 0) {
- [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.Data.MinFile]];
- }else{
- self.iconV.image = IMG(imageStr);
- }
- }break;
- case CollectModel_work:
- {
- self.iconV.image = IMG(@"审批");
- }
- break;
- case CollectModel_financeCount:
- {
- self.iconV.image = IMG(@"报表");
- }
- break;
- case CollectModel_affairsCount:
- {
- self.iconV.image = IMG(@"报表");
- }
- break;
- case CollectModel_publishCount:
- {
- self.iconV.image = IMG(@"报表");
- }
- break;
- default:{
- NSString * imageStr = [ZYCTool getFileNameImage:model.Data.FileName];
- if (imageStr.length == 0) {
- [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.Data.MinFile]];
- }else{
- self.iconV.image = IMG(imageStr);
- }
- }break;
- }
- self.isTopV.hidden = !model.IsTop;
- [self.titleL mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.iconV.mas_right).offset(15);
- make.top.mas_offset(15);
- make.height.mas_greaterThanOrEqualTo(20);
- make.width.mas_lessThanOrEqualTo(SCREEN_WIDTH - (model.IsTop ? 125 : 85));
- }];
- self.titleL.attributedText = [ZYCTool checkOfString:model.Data.Title withSearchText:text withColor:UIColorHex(0xFF5252)];
- self.nameL.attributedText = [model.Data.Author length] > 0 ? [ZYCTool checkOfString:model.Data.Author withSearchText:text withColor:UIColorHex(0xFF5252)] : [[NSAttributedString alloc] initWithString:@" "];
- self.desL.attributedText = [model.FolderName length] > 0 ? [ZYCTool checkOfString:model.FolderName withSearchText:text withColor:UIColorHex(0xFF5252)] : [[NSAttributedString alloc] initWithString:@" "];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|