MineHomeVC.m 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. //
  2. // MineHomeVC.m
  3. // Telemarketing
  4. //
  5. // Created by 刘惠萍 on 2020/10/30.
  6. // Copyright © 2020 刘惠萍. All rights reserved.
  7. //
  8. #import "MineHomeVC.h"
  9. #import "FBLeftAndRightCell.h"
  10. @interface MineHomeVC ()
  11. @property (strong, nonatomic) MineHomePageNavView *navView;
  12. @end
  13. @implementation MineHomeVC
  14. -(MineHomePageNavView *)navView{
  15. if (!_navView) {
  16. _navView = [MineHomePageNavView new];
  17. _navView.frame = CGRectMake(0, 0, SCREEN_WIDTH, _navView.height);
  18. }
  19. return _navView;
  20. }
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. [self.view addSubview:self.navView];
  24. [self reset];
  25. [self.tableView registerClass:[FBLeftAndRightCell class] forCellReuseIdentifier:@"FBLeftAndRightCell"];
  26. [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
  27. }
  28. - (void)reset{
  29. WEAKSELF
  30. [self.aryDatas removeAllObjects];
  31. [self.aryDatas addObjectsFromArray:@[^(){
  32. ModelBaseData * model = [ModelBaseData new];
  33. model.enumType = ENUM_PRODUCTLISTINFOCELL_EMPTY;
  34. return model;
  35. }(),^(){
  36. ModelBaseData * model = [ModelBaseData new];
  37. model.string = @"我的政策";
  38. model.imageName=@"文案库";
  39. model.blockClick = ^(ModelBaseData *model) {
  40. // [GB_Nav pushVCName:@"DocumentLibraryHomeVC" animated:true];
  41. };
  42. return model;
  43. }(),^(){
  44. ModelBaseData * model = [ModelBaseData new];
  45. model.string = @"我的订单";
  46. model.imageName=@"意见反馈";
  47. model.blockClick = ^(ModelBaseData *model) {
  48. // [GB_Nav pushVCName:@"FBFeedbackAndSuggestionsVC" animated:true];
  49. };
  50. return model;
  51. }(),^(){
  52. ModelBaseData * model = [ModelBaseData new];
  53. model.string = @"实名认证";
  54. model.imageName=@"意见反馈";
  55. model.blockClick = ^(ModelBaseData *model) {
  56. // [GB_Nav pushVCName:@"ComplainListVC" animated:true];
  57. };
  58. return model;
  59. }(),^(){
  60. ModelBaseData * model = [ModelBaseData new];
  61. model.string = @"提现签约认证";
  62. model.imageName=@"修改密码";
  63. model.blockClick = ^(ModelBaseData *model) {
  64. // [GB_Nav pushVCName:@"ChangePasswordVC" animated:true];
  65. };
  66. return model;
  67. }(),^(){
  68. ModelBaseData * model = [ModelBaseData new];
  69. model.string = @"修改结算卡";
  70. model.imageName=@"帮助中心";
  71. model.blockClick = ^(ModelBaseData *model) {
  72. // [GB_Nav pushVCName:@"HelpCenterList" animated:true];
  73. };
  74. return model;
  75. }(),^(){
  76. ModelBaseData * model = [ModelBaseData new];
  77. model.enumType = ENUM_PRODUCTLISTINFOCELL_EMPTY;
  78. return model;
  79. }(),^(){
  80. ModelBaseData * model = [ModelBaseData new];
  81. model.string = @"展业守则";
  82. model.imageName=@"个人中心";
  83. model.blockClick = ^(ModelBaseData *model) {
  84. // [GB_Nav pushVCName:@"PerfectInformationVC" animated:true];
  85. };
  86. return model;
  87. }(),^(){
  88. ModelBaseData * model = [ModelBaseData new];
  89. model.string = @"帮助中心";
  90. model.imageName=@"个人中心";
  91. model.blockClick = ^(ModelBaseData *model) {
  92. // [GB_Nav pushVCName:@"PerfectInformationVC" animated:true];
  93. };
  94. return model;
  95. }(),^(){
  96. ModelBaseData * model = [ModelBaseData new];
  97. model.string = @"安全设置";
  98. model.imageName=@"个人中心";
  99. model.blockClick = ^(ModelBaseData *model) {
  100. // [GB_Nav pushVCName:@"PerfectInformationVC" animated:true];
  101. };
  102. return model;
  103. }(),^(){
  104. ModelBaseData * model = [ModelBaseData new];
  105. model.enumType = ENUM_PRODUCTLISTINFOCELL_EMPTY;
  106. return model;
  107. }(),^(){
  108. ModelBaseData * model = [ModelBaseData new];
  109. model.string = @"退出登录";
  110. model.imageName=@"退出登录";
  111. model.blockClick = ^(ModelBaseData *model) {
  112. ModelBtn * modelDismiss = [ModelBtn modelWithTitle:@"取消" imageName:nil highImageName:nil tag:TAG_LINE color:[UIColor blackColor]];
  113. ModelBtn * modelConfirm = [ModelBtn modelWithTitle:@"退出" imageName:nil highImageName:nil tag:TAG_LINE color:COLOR_TEXT];
  114. modelConfirm.blockClick = ^(void){
  115. [GlobalMethod logoutSuccess];
  116. };
  117. [BaseAlertView initWithTitle:@"是否要退出登录" content:@"确定要退出该账号吗?" aryBtnModels:@[modelDismiss,modelConfirm] viewShow:[UIApplication sharedApplication].keyWindow];
  118. };
  119. return model;
  120. }()]];
  121. [self.tableView reloadData];
  122. }
  123. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  124. return 1;
  125. }
  126. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  127. return self.aryDatas.count;
  128. }
  129. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  130. ModelBaseData *model =self.aryDatas[indexPath.row];
  131. if (model.enumType == ENUM_PRODUCTLISTINFOCELL_EMPTY) {
  132. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
  133. [cell.contentView removeAllSubViews];
  134. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  135. cell.contentView.backgroundColor = COLOR_BACKGROUND;
  136. return cell;
  137. }
  138. FBLeftAndRightCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FBLeftAndRightCell"];
  139. [cell resetCellWithModel:self.aryDatas[indexPath.row]];
  140. return cell;
  141. }
  142. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  143. ModelBaseData *model =self.aryDatas[indexPath.row];
  144. if (model.enumType == ENUM_PRODUCTLISTINFOCELL_EMPTY) {
  145. return W(10);
  146. }
  147. static FBLeftAndRightCell *cell = nil;
  148. if (!cell) {
  149. cell=[[FBLeftAndRightCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:@"FBLeftAndRightCell"];
  150. }
  151. [cell resetCellWithModel:self.aryDatas[indexPath.row]];
  152. return cell.height;
  153. }
  154. @end
  155. @implementation MineHomePageNavView
  156. #pragma mark 懒加载
  157. - (UIImageView *)iconImg{
  158. if (_iconImg == nil) {
  159. _iconImg = [UIImageView new];
  160. _iconImg.image = [UIImage imageNamed:@"logo_headImg"];
  161. _iconImg.widthHeight = XY(W(20),W(20));
  162. }
  163. return _iconImg;
  164. }
  165. - (UILabel *)labelName{
  166. if (_labelName == nil) {
  167. _labelName = [UILabel new];
  168. [GlobalMethod setLabel:_labelName widthLimit:0 numLines:0 fontNum:F(15) textColor:COLOR_LABEL text:@""];
  169. }
  170. return _labelName;
  171. }
  172. -(UIButton *)attBtn{
  173. if (_attBtn == nil) {
  174. _attBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  175. _attBtn.tag = 1;
  176. [_attBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  177. _attBtn.widthHeight = XY(W(30),W(40));
  178. [_attBtn setImage:[UIImage imageNamed:@"通知"] forState:(UIControlStateNormal)];
  179. }
  180. return _attBtn;
  181. }
  182. #pragma mark 初始化
  183. - (instancetype)initWithFrame:(CGRect)frame{
  184. self = [super initWithFrame:frame];
  185. if (self) {
  186. self.backgroundColor = [UIColor whiteColor];
  187. self.width = SCREEN_WIDTH;
  188. [self addSubView];
  189. }
  190. return self;
  191. }
  192. //添加subview
  193. - (void)addSubView{
  194. [self addSubview:self.iconImg];
  195. [self addSubview:self.labelName];
  196. [self addSubview:self.attBtn];
  197. //初始化页面
  198. [self resetViewWithModel:nil];
  199. }
  200. #pragma mark 刷新view
  201. - (void)resetViewWithModel:(id)model{
  202. [self removeSubViewWithTag:TAG_LINE];//移除线
  203. //刷新view
  204. self.height= NAVIGATIONBAR_HEIGHT;
  205. [self.iconImg setImageWithURL:[NSURL URLWithString:@""] placeholder:[UIImage imageNamed:IMAGE_HEAD_DEFAULT]];
  206. self.iconImg.leftCenterY = XY(W(15),self.height/2+STATUSBAR_HEIGHT/2);
  207. self.attBtn.rightCenterY = XY(SCREEN_WIDTH-W(15),self.iconImg.centerY);
  208. [self.labelName fitTitle:[GlobalData sharedInstance].GB_UserModel.nickName variable:self.attBtn.left-self.labelName.right-W(30)];
  209. self.labelName.leftCenterY = XY(self.iconImg.right+W(8),self.iconImg.centerY);
  210. }
  211. #pragma mark 点击事件
  212. - (void)btnClick:(UIButton *)sender{
  213. switch (sender.tag) {
  214. case 1:
  215. {
  216. }
  217. break;
  218. default:
  219. break;
  220. }
  221. }
  222. @end