123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- //
- // KDPDrawerVC.m
- // KuDianProject
- //
- // Created by 学丽 on 2019/7/4.
- // Copyright © 2019 KDP. All rights reserved.
- //
- #import "KDPDrawerVC.h"
- #import "KDPDrawerListCell.h"
- #import "KDPIDViewController.h"
- #import "KDPSetViewController.h"
- #import "KDPCollectHistoryVC.h"
- #import "KDPWebInteractionVC.h"
- #import "KDPWebVC.h"
- #import "KDPWebInteractionVC.h"
- #import "KDPCollectHistoryPageVC.h"
- @interface KDPDrawerVC ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetDelegate,DZNEmptyDataSetSource>
- {
- UIImageView *headImgV;
- UILabel *headLabel;
- NSArray *infoArray;
- }
- @property(nonatomic,strong)UITableView *listTabView;
- @end
- @implementation KDPDrawerVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.navBar.hidden=YES;
- infoArray=@[@{@"img":@"shoucangliulan",@"title":@"收藏浏览"},@{@"img":@"kefuxiaomi",@"title":@"客服小蜜"},@{@"img":@"zhoashang",@"title":@"招商合作"},@{@"img":@"kuaishouxiaodian",@"title":@"快手小店Pid"},@{@"img":@"shezhi",@"title":@"设置"}];
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(changeEixts ) name:@"exitLogin" object:nil];
-
-
-
-
- [self.view addSubview:self.listTabView];
- }
- -(void)changeEixts
- {
- // 注意:动画要设置为YES
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- KDPDrawerListCell *listC=[tableView dequeueReusableCellWithIdentifier:@"draw"];
- if (!listC) {
- listC=[[KDPDrawerListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"draw"];
- listC.selectionStyle=UITableViewCellSelectionStyleNone;
- }
- NSDictionary *dic=infoArray[indexPath.row];
- listC.iconImg.image=[UIImage imageNamed:dic[@"img"]];
- listC.titleLabel.text=dic[@"title"];
-
- return listC;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return infoArray.count;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- switch (indexPath.row) {
- case 0://收藏浏览
- [self collectVC];
- break;
- case 1://客服小蜜
- [self messageWithweb];
- break;
- case 2://招商合作
- [self webLoad];
- break;
- case 3://快手小店
- [self pidVC];
- break;
- case 4://设置
- [self SetVC];
- break;
-
- default:
- break;
- }
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 50;
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- UIView *headV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3*2, 20)];
- headV.backgroundColor=[UIColor whiteColor];
- return headV;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- return 20;
- }
- - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView{
- return [UIImage imageNamed:@"no_order"];
- }
- - (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView{
- return YES;
- }
- - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView{
- return [[NSAttributedString alloc] initWithString:@"还没有记录" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x333333],NSFontAttributeName:FONT_SYS(12)}];
- }
- - (CGFloat )spaceHeightForEmptyDataSet:(UIScrollView *)scrollView{
- return 30;
- }
- -(UITableView *)listTabView
- {
- if (!_listTabView) {
- _listTabView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3*2, self.view.height)];
- _listTabView.backgroundColor=[UIColor clearColor];
- _listTabView.emptyDataSetDelegate = self;
- _listTabView.emptyDataSetSource = self; _listTabView.separatorStyle=UITableViewCellSeparatorStyleNone;
- _listTabView.scrollEnabled=NO;
- if (@available(iOS 11.0, *)) {
- _listTabView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
-
- _listTabView.delegate=self;
- _listTabView.dataSource=self;
- [self addheadView];
- }
- return _listTabView;
- }
- -(void)addheadView
- {
- UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3*2, 111+KDNavBarHeight)];
- backV.backgroundColor=[UIColor colorWithHexString:@"#2E2E2E"];
- backV.userInteractionEnabled=YES;
- UITapGestureRecognizer *tapget=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(userinfoClickButton)];
- [backV addGestureRecognizer:tapget];
- self.listTabView.tableHeaderView=backV;
-
- headImgV=[[UIImageView alloc]initWithFrame:CGRectMake(0, KDNavBarHeight, 62, 62)];
- headImgV.backgroundColor=[UIColor whiteColor];
- headImgV.layer.cornerRadius=31;
- headImgV.layer.masksToBounds=YES;
- [backV addSubview:headImgV];
- KDPAccountModel *model =[KDPAccountTool account];
- [headImgV sd_setImageWithURL:[NSURL URLWithString:model.img]placeholderImage:[UIImage imageNamed:placholderImg]];
- headImgV.centerX=backV.centerX;
-
- headLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, headImgV.bottom+10, SCREEN_WIDTH/3*2, 21)];
- headLabel.text=model.name;
-
- headLabel.textColor=[UIColor whiteColor];
- headLabel.font=[UIFont systemFontOfSize:15];
- headLabel.textAlignment=NSTextAlignmentCenter;
- [backV addSubview:headLabel];
-
-
- }
- #pragma mark---跳转
- -(void)userinfoClickButton
- {
- KDPUserInfoVC *infoV=[[KDPUserInfoVC alloc]init];
- [self cw_pushViewController:infoV];
- }
- #pragma mark---快手小店
- -(void)pidVC
- {
- KDPIDViewController *pidV=[[KDPIDViewController alloc]init];
- [self cw_pushViewController:pidV];
- }
- #pragma mark---设置
- -(void)SetVC
- {
- KDPSetViewController *pidV=[[KDPSetViewController alloc]init];
- [self cw_pushViewController:pidV];
- }
- #pragma mark---收藏
- -(void)collectVC
- {
- KDPCollectHistoryPageVC *pidV=[[KDPCollectHistoryPageVC alloc]init];
- [self cw_pushViewController:pidV];
- }
- #pragma mark---web
- -(void)webLoad
- {
- KDPWebVC *pidV=[[KDPWebVC alloc]init];
- pidV.webUrl=ZSHZURl;
- [self cw_pushViewController:pidV];
- }
- #pragma mark---客服小蜜
- -(void)messageWithweb
- {
- KDPWebInteractionVC *pidV=[[KDPWebInteractionVC alloc]init];
- pidV.url=custSerURL;
- [self cw_pushViewController:pidV];
- }
- @end
|