一折买app------返利---------返利宝

YZMAClassifyViewController.m 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. //
  2. // YZMAClassifyViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/4/28.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "YZMAClassifyViewController.h"
  9. #import "YZMAClassifyLeftView.h"
  10. #import "YZMAClassifyRightView.h"
  11. #import "YZMACategoryModel.h"
  12. #import "YZMASecondCategoryModel.h"
  13. #import "YZMAGoodListViewController.h"
  14. #import "YZMAClassifyListController.h"
  15. #import "YZMAFindNavBarStaticView.h"
  16. #import "PYSearchViewController.h"
  17. #import "YZMAFindSearchResultViewController.h"
  18. #import "YZMAFindRequestViewModel.h"
  19. @interface YZMAClassifyViewController ()<YHFindNavBarStaticViewDelegate,PYSearchViewControllerDelegate>
  20. {
  21. }
  22. @property (nonatomic, strong) YZMAClassifyLeftView *leftView; //类别
  23. @property (nonatomic, strong) YZMAClassifyRightView *rightView;//详单
  24. @property (nonatomic, strong) NSMutableArray *dataArr;
  25. @property (nonatomic, strong) NSArray *secondDataArr;
  26. @property (nonatomic, strong) YZMAFindNavBarStaticView *navBarStaticView;
  27. @property (nonatomic, strong) NSMutableArray *everyoneSearchArr;
  28. @property (nonatomic, strong) NSString *classifyName;
  29. @property (nonatomic, strong) NSString *firstCategoryId;
  30. @end
  31. @implementation YZMAClassifyViewController
  32. - (void)viewWillDisappear:(BOOL)animated {
  33. [super viewWillDisappear:animated];
  34. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
  35. [SVProgressHUD dismiss];
  36. }
  37. - (void)viewDidAppear:(BOOL)animated {
  38. [super viewDidAppear:animated];
  39. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
  40. }
  41. - (void)viewWillAppear:(BOOL)animated {
  42. [super viewWillAppear:animated];
  43. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
  44. [self.navigationBar setNavightionBarBackgroundColor:[UIColor baseColor]];
  45. }
  46. - (void)viewDidLoad {
  47. [super viewDidLoad];
  48. [self creatNavBar];
  49. [self createView];
  50. [self requestData];
  51. [self requestEveryoneSearch];
  52. }
  53. - (void)creatNavBar {
  54. [self.navigationBar addSubview:self.navBarStaticView];
  55. self.view.backgroundColor = [UIColor whiteColor];
  56. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  57. // self.navigationBar.backgroundColor = [UIColor baseColor];
  58. [self.navigationBar setNavightionBarBackgroundColor:[UIColor baseColor]];
  59. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeSex) name:ChangeSex object:nil];
  60. }
  61. - (void)createView {
  62. [self createLeftView];
  63. [self createRightView];
  64. }
  65. - (void)changeSex {
  66. [self createLeftView];
  67. [self createRightView];
  68. [self refreshData];
  69. }
  70. - (void)createLeftView{
  71. self.leftView = [[YZMAClassifyLeftView alloc]initWithFrame:CGRectMake(0, NavBarHeight, 92*SCREEN_MUTI, SCREEN_HEIGHT - NavBarHeight - TabbarHeight)];
  72. __weak typeof(self) weakSelf = self;
  73. self.leftView.selectRowBlock = ^(NSInteger index) {
  74. YZMACategoryModel *model = weakSelf.dataArr[index];
  75. weakSelf.secondDataArr = model.itemList;
  76. weakSelf.rightView.dataSource = model.itemList;
  77. weakSelf.classifyName = model.name;
  78. weakSelf.firstCategoryId = model.Id;
  79. };
  80. [self.view addSubview:self.leftView];
  81. }
  82. - (void)createRightView{
  83. self.rightView = [[YZMAClassifyRightView alloc]initWithFrame:CGRectMake(92*SCREEN_MUTI, NavBarHeight, SCREEN_WIDTH - 92*SCREEN_MUTI, SCREEN_HEIGHT -NavBarHeight -TabbarHeight)];
  84. __weak typeof(self) weakSelf = self;
  85. self.rightView.selectItemBlock = ^(NSInteger index) {
  86. YZMAClassifyListController *list = [[YZMAClassifyListController alloc] init];
  87. YZMASecondCategoryModel *model = weakSelf.secondDataArr[index];
  88. list.firstCategoryId = weakSelf.firstCategoryId;
  89. list.cate_id = model.Id;
  90. list.name = model.name;
  91. [weakSelf.navigationController pushViewController:list animated:YES];
  92. NSString *tagStr = [NSString stringWithFormat:@"%@-%@",weakSelf.classifyName,model.name];
  93. [MobClick event:Classify label:tagStr];
  94. };
  95. [self.view addSubview:self.rightView];
  96. }
  97. - (void)requestData {
  98. [SVProgressHUD show];
  99. NSString *urlString = [NSString stringWithFormat:@"%@/api/v2/category/list", BaseURL];
  100. [YZMACacheHttp get:urlString params:nil success:^(id json, BOOL isCache) {
  101. [self.dataArr removeAllObjects];
  102. NSArray *arr = [NSArray yy_modelArrayWithClass:[YZMACategoryModel class] json:json[@"data"]];
  103. [self.dataArr addObjectsFromArray:arr];
  104. self.leftView.dataArray = arr;
  105. YZMACategoryModel *model = arr.firstObject;
  106. self.classifyName = model.name;
  107. self.secondDataArr = model.itemList;
  108. self.rightView.dataSource = model.itemList;
  109. self.firstCategoryId = model.Id;
  110. [SVProgressHUD dismiss];
  111. } failure:^(NSError *error) {
  112. [SVProgressHUD dismiss];
  113. }];
  114. }
  115. - (void)requestEveryoneSearch {
  116. [YZMAFindRequestViewModel requestEveryoneSearchSuccess:^(NSArray *array) {
  117. if (array.count > 0) {
  118. for (NSDictionary *dict in array) {
  119. [self.everyoneSearchArr addObject:dict];
  120. }
  121. }
  122. } failure:^(NSError *error) {
  123. }];
  124. }
  125. - (void)refreshData {
  126. [self.dataArr removeAllObjects];
  127. [self requestData];
  128. }
  129. #pragma mark - navBarView
  130. - (void)yh_FindNavBarStaticViewClickSearch {
  131. [self createSearchViewControllerWith:nil];
  132. }
  133. #pragma mark - -------------search -----------
  134. - (void)createSearchViewControllerWith:(NSString *)text {
  135. PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:@[] searchBarPlaceholder:@"输入商品名或粘贴淘宝标题"];
  136. searchViewController.searchHistoryStyle = PYSearchHistoryStyleARCBorderTag;
  137. searchViewController.hotSearchStyle = PYHotSearchStyleARCBorderTag;
  138. searchViewController.searchTextField.font = [UIFont systemFontOfSize:13];
  139. searchViewController.delegate = self;
  140. searchViewController.searchBar.text = text;
  141. [self getHotSearchToSearchViewController:searchViewController];
  142. UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
  143. [self presentViewController:nav animated:NO completion:^{
  144. for (int i = 0; i < searchViewController.hotSearchTags.count; i++) {
  145. UILabel *tag = searchViewController.hotSearchTags[i];
  146. NSDictionary *dic = self.everyoneSearchArr[i];
  147. if ([dic[@"color"] boolValue]) {
  148. tag.layer.borderColor = [UIColor homeRedColor].CGColor;
  149. tag.textColor = [UIColor homeRedColor];
  150. }
  151. }
  152. }];
  153. searchViewController.didSearchBlock = ^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
  154. [MobClick event:search_count label:Search_Normal];
  155. //处理搜索点击事件
  156. YZMAFindSearchResultViewController *resultVC = [[YZMAFindSearchResultViewController alloc] init];
  157. resultVC.searchBar = searchBar;
  158. resultVC.searchName = searchText;
  159. [nav pushViewController:resultVC animated:NO];
  160. };
  161. }
  162. /**
  163. 加载热搜词汇
  164. */
  165. - (void)getHotSearchToSearchViewController:(PYSearchViewController *)searchViewController {
  166. NSMutableArray *hotSearch = [NSMutableArray array];
  167. for (NSDictionary *dic in self.everyoneSearchArr) {
  168. [hotSearch addObject:dic[@"name"]];
  169. }
  170. searchViewController.hotSearches = hotSearch;
  171. }
  172. #pragma mark - PYSearchViewControllerDelegate
  173. /**
  174. 输入完成时触发
  175. */
  176. - (void)searchViewController:(PYSearchViewController *)searchViewController searchTextDidChange:(UISearchBar *)seachBar searchText:(NSString *)searchText
  177. {
  178. if (searchText.length) {
  179. [YZMAHttp get:SearchAdvice params:@{@"name":searchText} success:^(id json) {
  180. NSArray *list = json[@"data"];
  181. searchViewController.searchSuggestions = list;
  182. } failure:^(NSError *error) {
  183. }];
  184. }
  185. }
  186. /**
  187. 点击建议
  188. */
  189. - (void)searchViewController:(PYSearchViewController *)searchViewController
  190. didSelectSearchSuggestionAtIndex:(NSInteger)index
  191. searchText:(NSString *)searchText {
  192. YZMAFindSearchResultViewController *resultVC = [[YZMAFindSearchResultViewController alloc] init];
  193. resultVC.searchName = searchText;
  194. resultVC.searchBar = searchViewController.searchBar;
  195. [searchViewController.navigationController pushViewController:resultVC animated:NO];
  196. }
  197. /**
  198. 点击热搜
  199. */
  200. - (void)searchViewController:(PYSearchViewController *)searchViewController
  201. didSelectHotSearchAtIndex:(NSInteger)index
  202. searchText:(NSString *)searchText {
  203. YZMAFindSearchResultViewController *resultVC = [[YZMAFindSearchResultViewController alloc] init];
  204. resultVC.searchName = searchText;
  205. resultVC.searchBar = searchViewController.searchBar;
  206. [searchViewController.navigationController pushViewController:resultVC animated:NO];
  207. [MobClick event:search_count label:Search_Hot_String];
  208. }
  209. /**
  210. 点击历史
  211. */
  212. - (void)searchViewController:(PYSearchViewController *)searchViewController
  213. didSelectSearchHistoryAtIndex:(NSInteger)index
  214. searchText:(NSString *)searchText {
  215. YZMAFindSearchResultViewController *resultVC = [[YZMAFindSearchResultViewController alloc] init];
  216. resultVC.searchName = searchText;
  217. resultVC.searchBar = searchViewController.searchBar;
  218. [searchViewController.navigationController pushViewController:resultVC animated:NO];
  219. [MobClick event:search_count label:Search_History_String];
  220. }
  221. #pragma mark -----
  222. - (YZMAFindNavBarStaticView *)navBarStaticView {
  223. if (!_navBarStaticView) {
  224. _navBarStaticView = [[YZMAFindNavBarStaticView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, NavBarHeight)];
  225. _navBarStaticView.backgroundColor = [UIColor baseColor];
  226. _navBarStaticView.delegate = self;
  227. }
  228. return _navBarStaticView;
  229. }
  230. - (NSMutableArray *)dataArr {
  231. if (!_dataArr) {
  232. _dataArr = [NSMutableArray array];
  233. }
  234. return _dataArr;
  235. }
  236. - (NSMutableArray *)everyoneSearchArr {
  237. if (!_everyoneSearchArr) {
  238. _everyoneSearchArr = [NSMutableArray array];
  239. }
  240. return _everyoneSearchArr;
  241. }
  242. - (void)didReceiveMemoryWarning {
  243. [super didReceiveMemoryWarning];
  244. // Dispose of any resources that can be recreated.
  245. }
  246. /*
  247. #pragma mark - Navigation
  248. // In a storyboard-based application, you will often want to do a little preparation before navigation
  249. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  250. // Get the new view controller using [segue destinationViewController].
  251. // Pass the selected object to the new view controller.
  252. }
  253. */
  254. -(void)avGgRPo:(UIApplication*) avGgRPo aTvpoyr:(UIInputView*) aTvpoyr aAyTmCUaI:(UISearchBar*) aAyTmCUaI aYESgtej:(UIBarButtonItem*) aYESgtej aImuNg5RL:(UIControl*) aImuNg5RL awZmTQ:(UIMenuItem*) awZmTQ aENULx:(UICollectionView*) aENULx aMDaz2:(UIScreen*) aMDaz2 aVtu6vg:(UIEvent*) aVtu6vg akETl:(UIVisualEffectView*) akETl awjsE4YdLch:(UIControlEvents*) awjsE4YdLch a9PmoqM:(UIBarButtonItem*) a9PmoqM a7yNCrbJE4f:(UIApplication*) a7yNCrbJE4f aW6jo:(UIBezierPath*) aW6jo ave2wDI:(UIAlertView*) ave2wDI a6haFDzgY:(UIButton*) a6haFDzgY aiEGeTLr:(UICollectionView*) aiEGeTLr {
  255. NSLog(@"gC51VMlkdfR9TnzD");
  256. NSLog(@"YjJgW9pslL6Rkb4XmtM5rzUhHa7yFEQPN");
  257. NSLog(@"vk0KxRyfQdeAhpuVW");
  258. NSLog(@"EMYW47Zxcqmb20DkL9VNwidz8sJaK531C");
  259. NSLog(@"ybG7hWPAmVFxHdJDOTvMQuXZ8S2K5jC6src1pI3");
  260. NSLog(@"4VprS6lh7ucFbansLW8xEkNTBCgR52JZizdQXK");
  261. NSLog(@"Cy2c70SxMZH3D6udgoQRbWGIT4vX19n");
  262. NSLog(@"JulqZx4krnspyijmPcISVWoCRU");
  263. NSLog(@"TK9yU4YMxmpJSBon5vuWjzAhaf2");
  264. NSLog(@"DaHjnROGQPz9MVmw0LN7qr3lcJfhdKbFsg");
  265. NSLog(@"2CH6NfeBq7sjapx4AvED");
  266. NSLog(@"PKhHFm9I4vrdaeUS");
  267. NSLog(@"2E8MdBkPmh51A4fVpHU0rez7w6TOSijQgqcLtlX");
  268. }
  269. -(void)aO60LbvTS:(UILabel*) aO60LbvTS ar2SjqkUp:(UIInputView*) ar2SjqkUp aYHaWUGDAm:(UILabel*) aYHaWUGDAm avgMVE:(UIDocument*) avgMVE a7pPHtViQX:(UIView*) a7pPHtViQX aPxyYT:(UIInputView*) aPxyYT a2dNA:(UIView*) a2dNA aOq4w0zVLK:(UIImage*) aOq4w0zVLK ar9yC7dsZ:(UIEdgeInsets*) ar9yC7dsZ awbUFWvIkz:(UIButton*) awbUFWvIkz avq1QAkB:(UIControl*) avq1QAkB auLqyjs:(UIActivity*) auLqyjs aCQDvSf0J:(UITableView*) aCQDvSf0J ay0e4r:(UIDocument*) ay0e4r aEg4tVXB:(UITableView*) aEg4tVXB aWxDlYr7z6:(UIImage*) aWxDlYr7z6 avpWmkH:(UIDocument*) avpWmkH an7yMQpG9:(UIImage*) an7yMQpG9 {
  270. NSLog(@"Vf6FMo3Gl7");
  271. NSLog(@"UlnEjxNiZJSKYVRzry");
  272. NSLog(@"vEW4zdMFiBAfOQ9DsKGryY");
  273. NSLog(@"N15FvlfCyQIMJWskX");
  274. NSLog(@"LbiDvfF6az1gS82MoNEW");
  275. NSLog(@"sj0G8HxIBrwXh9c");
  276. NSLog(@"D2kyJtUmiPdfgco");
  277. NSLog(@"BJ6mOp9PcuaQL");
  278. NSLog(@"fl2XArLzxyc83psYZbVgqDdv5Jm");
  279. NSLog(@"0EHqCUj3uYmiIGTQs18WVpzLX6hZ4RJxBob");
  280. NSLog(@"0sjzXdewSglkMf5Zxq");
  281. NSLog(@"Vq8ktAIY2yB14hfGnJ");
  282. NSLog(@"XOlW437JH02ePmhM1K");
  283. NSLog(@"2SKzPc1J7MAxmD3hudLnN");
  284. NSLog(@"y81XDuscdY3E4Owkm");
  285. NSLog(@"cwr15sakMoBSt4iyUHpGIj3lXF8nE");
  286. }
  287. -(void)aNf6nE7vBTp:(UIButton*) aNf6nE7vBTp a6hul07AG:(UIBarButtonItem*) a6hul07AG aXJTtHDF8aV:(UIScreen*) aXJTtHDF8aV au4vx:(UILabel*) au4vx aGSjB:(UIApplication*) aGSjB axwvad7UklC:(UIFont*) axwvad7UklC aAc0ofk5:(UIImage*) aAc0ofk5 av0pWPZC:(UIBarButtonItem*) av0pWPZC a1u5x:(UIImage*) a1u5x {
  288. NSLog(@"0oVZxcPtKMJ5wRgCYp9OkWzn84ri");
  289. NSLog(@"vyugRJP0EIQ7kmw9n4Sq32LozaHDd6tWNVbThrBU");
  290. NSLog(@"TYosyKa6VuzG2eg7IFBbj5XW3Z4cwQ");
  291. NSLog(@"42upXJcSDyFwqnxCQT3z7lL");
  292. NSLog(@"FUu9HivaSps8");
  293. NSLog(@"3Ym14eaAcyrVHwpiLqPtg0n7F");
  294. NSLog(@"G9mTaljirYX");
  295. NSLog(@"BDtJPVK95TadMoXhLnx3WA4");
  296. NSLog(@"bdPB1Jn7Kf5sWI40ZQT3q");
  297. NSLog(@"nDJeXAQ6IaT5f");
  298. NSLog(@"tqbVxlH4OBKue6cUwLYNrm1W5opRzi8TDaFSG9v");
  299. NSLog(@"zliBWCbAV2w7k8IEY");
  300. NSLog(@"Lg0cUCv8mdQsaSRJoXDwE4Ifpyj");
  301. NSLog(@"ivFW2K3TuzUNm9PDSR0j8IkyEdMO5cYZfq");
  302. NSLog(@"wSgG65eXE8VlzsWrQ7b1");
  303. NSLog(@"M0xOhI4fLB6el9msGRKvZUgSJaYu");
  304. NSLog(@"xzTqEtB5ImGFe34Mr2af");
  305. NSLog(@"RFf9rhSeqs4GacplLEJ3uwx");
  306. }
  307. -(void)aAQ5MHp1y:(UIScreen*) aAQ5MHp1y aMIEw:(UIFont*) aMIEw aHNm2p4hjv:(UIKeyCommand*) aHNm2p4hjv arCPDUA:(UIVisualEffectView*) arCPDUA a8ZRFmuBq5:(UIDocument*) a8ZRFmuBq5 aGuUPTlhmaj:(UIFontWeight*) aGuUPTlhmaj a2sQCFoycq:(UIControlEvents*) a2sQCFoycq atr6aNcWvXJ:(UIControl*) atr6aNcWvXJ a0GM3:(UIUserInterfaceIdiom*) a0GM3 asNk0oizUR:(UIMenuItem*) asNk0oizUR {
  308. NSLog(@"4yYrsd7xtGDhwMqc");
  309. NSLog(@"vbqX5QyZ4A8jBYdERoPV6aO2xDsSwJf0tFzTkgGu");
  310. NSLog(@"3SmxVzCUjWY75E");
  311. NSLog(@"uTg84NDqlnIxvcVMfW3Qsed5JbFPzaSA");
  312. NSLog(@"P6Miw5EA87FxUVGNun");
  313. NSLog(@"w0xM9tzcX3DO");
  314. NSLog(@"dmUc3iJQAnaFWyLrbIHuG2O5pKf789Rgvjx");
  315. NSLog(@"gltNR4V3pk0vwSecjrPbsFMBJfUYKAn6OuCLX");
  316. NSLog(@"tqoiCTzeBVdx8WDMLhAwusUJ7ykcg");
  317. NSLog(@"z3qfF0knj7ag9");
  318. NSLog(@"Jv4PFEZiw0CxnjGhHWU16Qo8eblpmTzS");
  319. NSLog(@"92EfShL0P4eC15TgkNjaiDAs7xJlqcmbG");
  320. NSLog(@"2bCtsxuZS1weNLv");
  321. NSLog(@"geCnFpEA72zJyWYhdso");
  322. NSLog(@"1Z0KtHFSlIRw3niXaorbVquQ");
  323. NSLog(@"PxhCwFsr8pIJBlK");
  324. }
  325. -(void)a6Ozeqy:(UIViewController*) a6Ozeqy aNX32I6GT:(UIControlEvents*) aNX32I6GT aHj7CI3V:(UIInputView*) aHj7CI3V atFfwmu6bX7:(UIView*) atFfwmu6bX7 a2K3Z0UL:(UICollectionView*) a2K3Z0UL aG7IZPtsXR:(UIEdgeInsets*) aG7IZPtsXR aIykM5F:(UIImageView*) aIykM5F aNOXvYBPazs:(UIKeyCommand*) aNOXvYBPazs armVXdJnAz:(UISearchBar*) armVXdJnAz avIkDb5pU:(UIDevice*) avIkDb5pU {
  326. NSLog(@"Sl9BdQiMY4");
  327. NSLog(@"8iTvfy1GKEAurdRBzeWkgLQ0p4lw");
  328. NSLog(@"axLTMNymGk6YHoEuJf41KF2A7qvPWepcZlUjCb");
  329. NSLog(@"12eXj3VIZkURnfpSP7yHCYTD9iqOot");
  330. NSLog(@"io9splenc0v2OK7");
  331. NSLog(@"tSlJg3BnHmUfRT8QZ2w0FWecMq7vDYayOo9j6hsu");
  332. NSLog(@"N7uS3dUEX2jkl9PeVxwqmitIog0nLA4rYcyQF");
  333. NSLog(@"ZoUFq2Sag1X53LINcuxCEyQnJD8rK");
  334. NSLog(@"7FGL5lA2XUYfWC0BRSM6urHJTv3aE");
  335. NSLog(@"5rPxT8CsNAaIjY2MzmvGB6Ze1lt3HEQL");
  336. }
  337. @end