123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- //
- // MineHomeVC.m
- // Telemarketing
- //
- // Created by 刘惠萍 on 2020/10/30.
- // Copyright © 2020 刘惠萍. All rights reserved.
- //
- #import "MineHomeVC.h"
- #import "FBLeftAndRightCell.h"
- @interface MineHomeVC ()
- @property (strong, nonatomic) MineHomePageNavView *navView;
- @end
- @implementation MineHomeVC
- -(MineHomePageNavView *)navView{
- if (!_navView) {
- _navView = [MineHomePageNavView new];
- _navView.frame = CGRectMake(0, 0, SCREEN_WIDTH, _navView.height);
- }
- return _navView;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.view addSubview:self.navView];
- [self reset];
- [self.tableView registerClass:[FBLeftAndRightCell class] forCellReuseIdentifier:@"FBLeftAndRightCell"];
- [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
- }
- - (void)reset{
- WEAKSELF
- [self.aryDatas removeAllObjects];
- [self.aryDatas addObjectsFromArray:@[^(){
- ModelBaseData * model = [ModelBaseData new];
- model.enumType = ENUM_PRODUCTLISTINFOCELL_EMPTY;
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"我的政策";
- model.imageName=@"文案库";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"DocumentLibraryHomeVC" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"我的订单";
- model.imageName=@"意见反馈";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"FBFeedbackAndSuggestionsVC" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"实名认证";
- model.imageName=@"意见反馈";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"ComplainListVC" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"提现签约认证";
- model.imageName=@"修改密码";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"ChangePasswordVC" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"修改结算卡";
- model.imageName=@"帮助中心";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"HelpCenterList" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.enumType = ENUM_PRODUCTLISTINFOCELL_EMPTY;
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"展业守则";
- model.imageName=@"个人中心";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"PerfectInformationVC" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"帮助中心";
- model.imageName=@"个人中心";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"PerfectInformationVC" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"安全设置";
- model.imageName=@"个人中心";
- model.blockClick = ^(ModelBaseData *model) {
- // [GB_Nav pushVCName:@"PerfectInformationVC" animated:true];
- };
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.enumType = ENUM_PRODUCTLISTINFOCELL_EMPTY;
- return model;
- }(),^(){
- ModelBaseData * model = [ModelBaseData new];
- model.string = @"退出登录";
- model.imageName=@"退出登录";
- model.blockClick = ^(ModelBaseData *model) {
- ModelBtn * modelDismiss = [ModelBtn modelWithTitle:@"取消" imageName:nil highImageName:nil tag:TAG_LINE color:[UIColor blackColor]];
- ModelBtn * modelConfirm = [ModelBtn modelWithTitle:@"退出" imageName:nil highImageName:nil tag:TAG_LINE color:COLOR_TEXT];
- modelConfirm.blockClick = ^(void){
- [GlobalMethod logoutSuccess];
- };
- [BaseAlertView initWithTitle:@"是否要退出登录" content:@"确定要退出该账号吗?" aryBtnModels:@[modelDismiss,modelConfirm] viewShow:[UIApplication sharedApplication].keyWindow];
- };
- return model;
- }()]];
- [self.tableView reloadData];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.aryDatas.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- ModelBaseData *model =self.aryDatas[indexPath.row];
- if (model.enumType == ENUM_PRODUCTLISTINFOCELL_EMPTY) {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
- [cell.contentView removeAllSubViews];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.contentView.backgroundColor = COLOR_BACKGROUND;
- return cell;
- }
- FBLeftAndRightCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FBLeftAndRightCell"];
- [cell resetCellWithModel:self.aryDatas[indexPath.row]];
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- ModelBaseData *model =self.aryDatas[indexPath.row];
- if (model.enumType == ENUM_PRODUCTLISTINFOCELL_EMPTY) {
- return W(10);
- }
- static FBLeftAndRightCell *cell = nil;
- if (!cell) {
- cell=[[FBLeftAndRightCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:@"FBLeftAndRightCell"];
- }
- [cell resetCellWithModel:self.aryDatas[indexPath.row]];
- return cell.height;
-
- }
- @end
- @implementation MineHomePageNavView
- #pragma mark 懒加载
- - (UIImageView *)iconImg{
- if (_iconImg == nil) {
- _iconImg = [UIImageView new];
- _iconImg.image = [UIImage imageNamed:@"logo_headImg"];
- _iconImg.widthHeight = XY(W(20),W(20));
- }
- return _iconImg;
- }
- - (UILabel *)labelName{
- if (_labelName == nil) {
- _labelName = [UILabel new];
- [GlobalMethod setLabel:_labelName widthLimit:0 numLines:0 fontNum:F(15) textColor:COLOR_LABEL text:@""];
- }
- return _labelName;
- }
- -(UIButton *)attBtn{
- if (_attBtn == nil) {
- _attBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _attBtn.tag = 1;
- [_attBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- _attBtn.widthHeight = XY(W(30),W(40));
- [_attBtn setImage:[UIImage imageNamed:@"通知"] forState:(UIControlStateNormal)];
- }
- return _attBtn;
- }
- #pragma mark 初始化
- - (instancetype)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
- self.width = SCREEN_WIDTH;
- [self addSubView];
- }
- return self;
- }
- //添加subview
- - (void)addSubView{
- [self addSubview:self.iconImg];
- [self addSubview:self.labelName];
- [self addSubview:self.attBtn];
- //初始化页面
- [self resetViewWithModel:nil];
- }
- #pragma mark 刷新view
- - (void)resetViewWithModel:(id)model{
- [self removeSubViewWithTag:TAG_LINE];//移除线
- //刷新view
- self.height= NAVIGATIONBAR_HEIGHT;
- [self.iconImg setImageWithURL:[NSURL URLWithString:@""] placeholder:[UIImage imageNamed:IMAGE_HEAD_DEFAULT]];
- self.iconImg.leftCenterY = XY(W(15),self.height/2+STATUSBAR_HEIGHT/2);
- self.attBtn.rightCenterY = XY(SCREEN_WIDTH-W(15),self.iconImg.centerY);
- [self.labelName fitTitle:[GlobalData sharedInstance].GB_UserModel.nickName variable:self.attBtn.left-self.labelName.right-W(30)];
- self.labelName.leftCenterY = XY(self.iconImg.right+W(8),self.iconImg.centerY);
- }
- #pragma mark 点击事件
- - (void)btnClick:(UIButton *)sender{
- switch (sender.tag) {
- case 1:
- {
- }
- break;
- default:
- break;
- }
- }
- @end
|