酷店

KDPDrawerVC.m 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //
  2. // KDPDrawerVC.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPDrawerVC.h"
  9. #import "KDPDrawerListCell.h"
  10. #import "KDPIDViewController.h"
  11. #import "KDPSetViewController.h"
  12. #import "KDPCollectHistoryVC.h"
  13. #import "KDPWebInteractionVC.h"
  14. #import "KDPWebVC.h"
  15. #import "KDPWebInteractionVC.h"
  16. #import "KDPCollectHistoryPageVC.h"
  17. @interface KDPDrawerVC ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetDelegate,DZNEmptyDataSetSource>
  18. {
  19. UIImageView *headImgV;
  20. UILabel *headLabel;
  21. NSArray *infoArray;
  22. }
  23. @property(nonatomic,strong)UITableView *listTabView;
  24. @end
  25. @implementation KDPDrawerVC
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. self.navBar.hidden=YES;
  29. infoArray=@[@{@"img":@"shoucangliulan",@"title":@"收藏浏览"},@{@"img":@"kefuxiaomi",@"title":@"客服小蜜"},@{@"img":@"zhoashang",@"title":@"招商合作"},@{@"img":@"kuaishouxiaodian",@"title":@"快手小店Pid"},@{@"img":@"shezhi",@"title":@"设置"}];
  30. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(changeEixts ) name:@"exitLogin" object:nil];
  31. [self.view addSubview:self.listTabView];
  32. }
  33. -(void)changeEixts
  34. {
  35. // 注意:动画要设置为YES
  36. [self dismissViewControllerAnimated:YES completion:nil];
  37. }
  38. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  39. {
  40. KDPDrawerListCell *listC=[tableView dequeueReusableCellWithIdentifier:@"draw"];
  41. if (!listC) {
  42. listC=[[KDPDrawerListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"draw"];
  43. listC.selectionStyle=UITableViewCellSelectionStyleNone;
  44. }
  45. NSDictionary *dic=infoArray[indexPath.row];
  46. listC.iconImg.image=[UIImage imageNamed:dic[@"img"]];
  47. listC.titleLabel.text=dic[@"title"];
  48. return listC;
  49. }
  50. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  51. {
  52. return infoArray.count;
  53. }
  54. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  55. {
  56. switch (indexPath.row) {
  57. case 0://收藏浏览
  58. [self collectVC];
  59. break;
  60. case 1://客服小蜜
  61. [self messageWithweb];
  62. break;
  63. case 2://招商合作
  64. [self webLoad];
  65. break;
  66. case 3://快手小店
  67. [self pidVC];
  68. break;
  69. case 4://设置
  70. [self SetVC];
  71. break;
  72. default:
  73. break;
  74. }
  75. }
  76. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  77. {
  78. return 50;
  79. }
  80. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  81. {
  82. return 1;
  83. }
  84. -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  85. {
  86. UIView *headV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3*2, 20)];
  87. headV.backgroundColor=[UIColor whiteColor];
  88. return headV;
  89. }
  90. -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  91. {
  92. return 20;
  93. }
  94. - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView{
  95. return [UIImage imageNamed:@"no_order"];
  96. }
  97. - (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView{
  98. return YES;
  99. }
  100. - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView{
  101. return [[NSAttributedString alloc] initWithString:@"还没有记录" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x333333],NSFontAttributeName:FONT_SYS(12)}];
  102. }
  103. - (CGFloat )spaceHeightForEmptyDataSet:(UIScrollView *)scrollView{
  104. return 30;
  105. }
  106. -(UITableView *)listTabView
  107. {
  108. if (!_listTabView) {
  109. _listTabView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3*2, self.view.height)];
  110. _listTabView.backgroundColor=[UIColor clearColor];
  111. _listTabView.emptyDataSetDelegate = self;
  112. _listTabView.emptyDataSetSource = self; _listTabView.separatorStyle=UITableViewCellSeparatorStyleNone;
  113. if (@available(iOS 11.0, *)) {
  114. _listTabView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  115. } else {
  116. self.automaticallyAdjustsScrollViewInsets = NO;
  117. }
  118. _listTabView.delegate=self;
  119. _listTabView.dataSource=self;
  120. [self addheadView];
  121. }
  122. return _listTabView;
  123. }
  124. -(void)addheadView
  125. {
  126. UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3*2, 111+KDNavBarHeight)];
  127. backV.backgroundColor=[UIColor colorWithHexString:@"#2E2E2E"];
  128. backV.userInteractionEnabled=YES;
  129. UITapGestureRecognizer *tapget=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(userinfoClickButton)];
  130. [backV addGestureRecognizer:tapget];
  131. self.listTabView.tableHeaderView=backV;
  132. headImgV=[[UIImageView alloc]initWithFrame:CGRectMake(0, KDNavBarHeight, 62, 62)];
  133. headImgV.backgroundColor=[UIColor whiteColor];
  134. headImgV.layer.cornerRadius=31;
  135. headImgV.layer.masksToBounds=YES;
  136. [backV addSubview:headImgV];
  137. KDPAccountModel *model =[KDPAccountTool account];
  138. [headImgV sd_setImageWithURL:[NSURL URLWithString:model.img]placeholderImage:[UIImage imageNamed:placholderImg]];
  139. headImgV.centerX=backV.centerX;
  140. headLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, headImgV.bottom+10, SCREEN_WIDTH/3*2, 21)];
  141. headLabel.text=model.name;
  142. headLabel.textColor=[UIColor whiteColor];
  143. headLabel.font=[UIFont systemFontOfSize:15];
  144. headLabel.textAlignment=NSTextAlignmentCenter;
  145. [backV addSubview:headLabel];
  146. }
  147. #pragma mark---跳转
  148. -(void)userinfoClickButton
  149. {
  150. KDPUserInfoVC *infoV=[[KDPUserInfoVC alloc]init];
  151. [self cw_pushViewController:infoV];
  152. }
  153. #pragma mark---快手小店
  154. -(void)pidVC
  155. {
  156. KDPIDViewController *pidV=[[KDPIDViewController alloc]init];
  157. [self cw_pushViewController:pidV];
  158. }
  159. #pragma mark---设置
  160. -(void)SetVC
  161. {
  162. KDPSetViewController *pidV=[[KDPSetViewController alloc]init];
  163. [self cw_pushViewController:pidV];
  164. }
  165. #pragma mark---收藏
  166. -(void)collectVC
  167. {
  168. KDPCollectHistoryPageVC *pidV=[[KDPCollectHistoryPageVC alloc]init];
  169. [self cw_pushViewController:pidV];
  170. }
  171. #pragma mark---web
  172. -(void)webLoad
  173. {
  174. KDPWebVC *pidV=[[KDPWebVC alloc]init];
  175. pidV.webUrl=ZSHZURl;
  176. [self cw_pushViewController:pidV];
  177. }
  178. #pragma mark---客服小蜜
  179. -(void)messageWithweb
  180. {
  181. KDPWebInteractionVC *pidV=[[KDPWebInteractionVC alloc]init];
  182. pidV.url=custSerURL;
  183. [self cw_pushViewController:pidV];
  184. }
  185. @end