酷店

KDPDrawerVC.m 6.2KB

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