酷店

KDPDrawerVC.m 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. _listTabView.scrollEnabled=NO;
  114. if (@available(iOS 11.0, *)) {
  115. _listTabView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  116. } else {
  117. self.automaticallyAdjustsScrollViewInsets = NO;
  118. }
  119. _listTabView.delegate=self;
  120. _listTabView.dataSource=self;
  121. [self addheadView];
  122. }
  123. return _listTabView;
  124. }
  125. -(void)addheadView
  126. {
  127. UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3*2, 111+KDNavBarHeight)];
  128. backV.backgroundColor=[UIColor colorWithHexString:@"#2E2E2E"];
  129. backV.userInteractionEnabled=YES;
  130. UITapGestureRecognizer *tapget=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(userinfoClickButton)];
  131. [backV addGestureRecognizer:tapget];
  132. self.listTabView.tableHeaderView=backV;
  133. headImgV=[[UIImageView alloc]initWithFrame:CGRectMake(0, KDNavBarHeight, 62, 62)];
  134. headImgV.backgroundColor=[UIColor whiteColor];
  135. headImgV.layer.cornerRadius=31;
  136. headImgV.layer.masksToBounds=YES;
  137. [backV addSubview:headImgV];
  138. KDPAccountModel *model =[KDPAccountTool account];
  139. [headImgV sd_setImageWithURL:[NSURL URLWithString:model.img]placeholderImage:[UIImage imageNamed:placholderImg]];
  140. headImgV.centerX=backV.centerX;
  141. headLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, headImgV.bottom+10, SCREEN_WIDTH/3*2, 21)];
  142. headLabel.text=model.name;
  143. headLabel.textColor=[UIColor whiteColor];
  144. headLabel.font=[UIFont systemFontOfSize:15];
  145. headLabel.textAlignment=NSTextAlignmentCenter;
  146. [backV addSubview:headLabel];
  147. }
  148. #pragma mark---跳转
  149. -(void)userinfoClickButton
  150. {
  151. KDPUserInfoVC *infoV=[[KDPUserInfoVC alloc]init];
  152. [self cw_pushViewController:infoV];
  153. }
  154. #pragma mark---快手小店
  155. -(void)pidVC
  156. {
  157. KDPIDViewController *pidV=[[KDPIDViewController alloc]init];
  158. [self cw_pushViewController:pidV];
  159. }
  160. #pragma mark---设置
  161. -(void)SetVC
  162. {
  163. KDPSetViewController *pidV=[[KDPSetViewController alloc]init];
  164. [self cw_pushViewController:pidV];
  165. }
  166. #pragma mark---收藏
  167. -(void)collectVC
  168. {
  169. KDPCollectHistoryPageVC *pidV=[[KDPCollectHistoryPageVC alloc]init];
  170. [self cw_pushViewController:pidV];
  171. }
  172. #pragma mark---web
  173. -(void)webLoad
  174. {
  175. KDPWebVC *pidV=[[KDPWebVC alloc]init];
  176. pidV.webUrl=ZSHZURl;
  177. [self cw_pushViewController:pidV];
  178. }
  179. #pragma mark---客服小蜜
  180. -(void)messageWithweb
  181. {
  182. KDPWebInteractionVC *pidV=[[KDPWebInteractionVC alloc]init];
  183. pidV.url=custSerURL;
  184. [self cw_pushViewController:pidV];
  185. }
  186. @end