RQHomePageSubjectOneOrFourViewModel.m 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. //
  2. // RQHomePageSubjectOneOrFourViewModel.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2021/7/29.
  6. //
  7. #import "RQHomePageSubjectOneOrFourViewModel.h"
  8. #import "LightingAndSoundVC.h"
  9. #import "TRDetailVC.h"
  10. @interface RQHomePageSubjectOneOrFourViewModel ()
  11. @property (nonatomic, readwrite, assign) RQHomePageCarType homePageCarType;
  12. @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType;
  13. @property (nonatomic, readwrite, strong) RQTreeListModel *treeListModel;
  14. @property (nonatomic, readwrite, copy) NSArray *subjectTwoArr;
  15. @property (nonatomic, readwrite, copy) NSArray *subjectThreeArr;
  16. @property (nonatomic, readwrite, copy) NSArray *currentVideosArr;
  17. @end
  18. @implementation RQHomePageSubjectOneOrFourViewModel
  19. #pragma mark - Public Method
  20. - (instancetype)initWithServices:(id<RQViewModelServices>)services params:(NSDictionary *)params {
  21. if (self = [super initWithServices:services params:params]) {
  22. self.homePageCarType = [params[RQHomePageCarTypeKey] integerValue];
  23. self.homePageSubjectType = [params[RQHomePageSubjectTypeKey] integerValue];
  24. }
  25. return self;
  26. }
  27. - (void)initialize {
  28. [super initialize];
  29. self.title = @"";
  30. // [self getVideos];
  31. ///配置数据
  32. // [self rq_configureData];
  33. [self rq_configureData0];
  34. }
  35. #pragma mark - PrivateMethod
  36. - (void)rq_configureData {
  37. @weakify(self)
  38. /// 当前科目
  39. NSString *subjectStr = (self.homePageSubjectType == RQHomePageSubjectType_SubjectFour)? @"科目四" : ((self.homePageSubjectType == RQHomePageSubjectType_SubjectThree)? @"科目三" : (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo)? @"科目二" : @"科目一");
  40. __block NSMutableArray *mutableArrr = @[].mutableCopy;
  41. /// 第零组
  42. RQCommonGroupViewModel *group0;
  43. RQCommonGroupViewModel *group2 = [RQCommonGroupViewModel groupViewModel];
  44. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree || self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  45. group0 = [[RQHomeSubPageToolBarOneGroupViewModel alloc] initWithRQHomePageSubjectType:self.homePageSubjectType];
  46. group0.footerHeight = (RQ_SCREEN_WIDTH - (16 * 3)) / 4.f * (6.f / 4.f);
  47. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  48. group2.itemViewModels = [self.subjectTwoArr.rac_sequence map:^id _Nullable(NSString *titleStr) {
  49. @strongify(self)
  50. RQHomeSubPageNormalItemViewModel *item = [[RQHomeSubPageNormalItemViewModel alloc] init];
  51. item.icon = @"subject2_standart_icon";
  52. item.title = titleStr;
  53. item.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, 44.f);
  54. item.bottomLineHide = [self.subjectTwoArr indexOfObject:titleStr] == self.subjectTwoArr.count + 1;
  55. item.operation = ^{
  56. @strongify(self)
  57. TRDetailVC *vc=[[TRDetailVC alloc]init];
  58. [vc setFile:titleStr];
  59. [self navPushHideTabbarToVC:vc];
  60. };
  61. return item;
  62. }].array;
  63. } else {
  64. group2.itemViewModels = [self.subjectThreeArr.rac_sequence map:^id _Nullable(NSString *titleStr) {
  65. @strongify(self)
  66. RQHomeSubPageNormalItemViewModel *item = [[RQHomeSubPageNormalItemViewModel alloc] init];
  67. item.icon = @"subject2_standart_icon";
  68. item.title = titleStr;
  69. item.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, 44.f);
  70. item.bottomLineHide = [self.subjectThreeArr indexOfObject:titleStr] == self.subjectTwoArr.count + 1;
  71. item.operation = ^{
  72. @strongify(self)
  73. TRDetailVC *vc=[[TRDetailVC alloc]init];
  74. [vc setFile:titleStr];
  75. [self navPushHideTabbarToVC:vc];
  76. };
  77. return item;
  78. }].array;
  79. }
  80. } else {
  81. group0 = [RQHomeSubPageToolBarGroupViewModel groupViewModel];
  82. group0.footerHeight = RQ_FIT_HORIZONTAL(65.f);
  83. }
  84. group0.headerHeight = RQ_SHARE_FUNCTION.RQADViewHeight;
  85. RQHomeSubPageItemViewModel *homeSubPageItemViewModel = [[RQHomeSubPageItemViewModel alloc] initWithRQHomePageCarType:self.homePageCarType homePageSubjectType:self.homePageSubjectType];
  86. homeSubPageItemViewModel.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(359.f));
  87. homeSubPageItemViewModel.operation = ^{
  88. };
  89. RQCommonGroupViewModel *group3 = [RQCommonGroupViewModel groupViewModel];
  90. group3.headerHeight = 10.f;
  91. group3.headerHeight = 10.f;
  92. RQHomeSubPageNormalItemViewModel *item0 = [[RQHomeSubPageNormalItemViewModel alloc] init];
  93. item0.icon = @"subject3_light_ico";
  94. item0.title = @"灯光操作";
  95. item0.itemSize = CGSizeMake(RQ_SCREEN_WIDTH / 2.f - 8.f, 54.f);
  96. item0.operation = ^{
  97. LightingAndSoundVC *VC = [[LightingAndSoundVC alloc] init];
  98. VC.styleTag = 4;
  99. [self navPushHideTabbarToVC:VC];
  100. };
  101. item0.bottomLineHide = YES;
  102. RQHomeSubPageNormalItemViewModel *item1 = [[RQHomeSubPageNormalItemViewModel alloc] init];
  103. item1.icon = @"subject3_voice_icon";
  104. item1.title = @"语音模拟";
  105. item1.itemSize = CGSizeMake(RQ_SCREEN_WIDTH / 2.f - 8.f, 54.f);
  106. item1.bottomLineHide = YES;
  107. item1.operation = ^{
  108. LightingAndSoundVC *VC = [[LightingAndSoundVC alloc] init];
  109. VC.styleTag = 5;
  110. [self navPushHideTabbarToVC:VC];
  111. };
  112. group3.itemViewModels = @[item0, item1];
  113. /// 数据源
  114. RAC(self, dataSource) = [RACObserve(RQ_COMMON_MANAGER, treeListArr) map:^(NSArray * treeListModelArr) {
  115. @strongify(self)
  116. if (RQObjectIsNil(treeListModelArr)) {
  117. group0.itemViewModels = (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree || self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo)? @[] : @[homeSubPageItemViewModel];
  118. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  119. return @[group0, group2];
  120. } else if (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree) {
  121. return @[group0, group3, group2];
  122. } else {
  123. return @[group0];
  124. }
  125. }
  126. if (treeListModelArr.count > 0) {
  127. /// 第一组
  128. RQHomeSubPageVideoHeaderGroupViewModel *group1 = [RQHomeSubPageVideoHeaderGroupViewModel groupViewModel];
  129. group1.headerHeight = 48.f;
  130. group1.footerHeight = CGFLOAT_MIN;
  131. group1.header = (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree || self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo)? @"基础操作视频" : ((self.homePageSubjectType == RQHomePageSubjectType_SubjectFour)? @"科目四视频教程" : @"科目一视频教程");
  132. __block NSInteger scrollItemSection;
  133. NSArray *arr = [[treeListModelArr.rac_sequence filter:^BOOL(RQTreeListModel *treeListModel) {
  134. return [treeListModel.typeName isEqualToString:subjectStr];
  135. }].array.rac_sequence map:^id _Nullable(RQTreeListModel *treeListModel) {
  136. self.treeListModel = treeListModel;
  137. group1.treeListModel = treeListModel;
  138. group1.homePageSubjectType = self.homePageSubjectType;
  139. return [treeListModel.children.rac_sequence map:^id _Nullable(ChildrenItem *childrenItem) {
  140. NSInteger section = [treeListModel.children indexOfObject:childrenItem];
  141. if (childrenItem.videos.count > 0) {
  142. return [self dataSourceWithItems:childrenItem.videos treeListModel:treeListModel section:section];
  143. } else {
  144. if ([childrenItem.typeName isEqualToString:@"基础操作"]) {
  145. return [childrenItem.children.rac_sequence map:^id _Nullable(ChildrenItem *childrenItemA) {
  146. group1.mySection = section;
  147. return [self dataSourceWithItems:childrenItemA.videos treeListModel:treeListModel section:section];
  148. }].array;
  149. } else {
  150. scrollItemSection = section;
  151. NSArray *arrr = [childrenItem.children.rac_sequence map:^id _Nullable(ChildrenItem *childrenItemA) {
  152. if (childrenItemA.videos.count > 0) {
  153. return childrenItemA;
  154. } else {
  155. return nil;
  156. }
  157. }].array;
  158. [mutableArrr addObjectsFromArray:arrr];
  159. return nil;
  160. }
  161. }
  162. }].array;
  163. }].array;
  164. [self dataDealWithDataArr:arr completion:^(NSArray *arr) {
  165. group1.itemViewModels = arr;
  166. }];
  167. RQHomeSubPageVideoScrollItemViewModel *homeSubPageVideoScrollItemViewModel = [[RQHomeSubPageVideoScrollItemViewModel alloc] initWithChildrenItemArr:mutableArrr.copy treeListModel:self.treeListModel homePageSubjectType:self.homePageSubjectType section:scrollItemSection];
  168. homeSubPageVideoScrollItemViewModel.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(239.f));
  169. homeSubPageVideoScrollItemViewModel.operation = ^{
  170. };
  171. group0.itemViewModels = @[(self.homePageSubjectType == RQHomePageSubjectType_SubjectThree || self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo)? homeSubPageVideoScrollItemViewModel : homeSubPageItemViewModel];
  172. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  173. return group1.itemViewModels.count > 0? @[group0, group1, group2] : @[group0, group2];
  174. } else if (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree) {
  175. return group1.itemViewModels.count > 0? @[group0, group1, group3, group2] : @[group0, group3 ,group2];
  176. } else {
  177. return group1.itemViewModels.count > 0? @[group0, group1] : @[group0];
  178. }
  179. } else {
  180. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  181. return @[group0, group2];
  182. } else if (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree) {
  183. return @[group0, group3, group2];
  184. } else {
  185. return @[group0];
  186. }
  187. }
  188. }];
  189. }
  190. - (void)rq_configureData0 {
  191. @weakify(self)
  192. /// 第零组
  193. RQCommonGroupViewModel *group0;
  194. RQCommonGroupViewModel *group2 = [RQCommonGroupViewModel groupViewModel];
  195. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree || self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  196. group0 = [[RQHomeSubPageToolBarOneGroupViewModel alloc] initWithRQHomePageSubjectType:self.homePageSubjectType];
  197. group0.footerHeight = (RQ_SCREEN_WIDTH - (16 * 3)) / 4.f * (6.f / 4.f);
  198. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  199. group2.itemViewModels = [self.subjectTwoArr.rac_sequence map:^id _Nullable(NSString *titleStr) {
  200. @strongify(self)
  201. RQHomeSubPageNormalItemViewModel *item = [[RQHomeSubPageNormalItemViewModel alloc] init];
  202. item.icon = @"subject2_standart_icon";
  203. item.title = titleStr;
  204. item.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, 44.f);
  205. item.bottomLineHide = [self.subjectTwoArr indexOfObject:titleStr] == self.subjectTwoArr.count + 1;
  206. item.operation = ^{
  207. @strongify(self)
  208. TRDetailVC *vc=[[TRDetailVC alloc]init];
  209. [vc setFile:titleStr];
  210. [self navPushHideTabbarToVC:vc];
  211. };
  212. return item;
  213. }].array;
  214. } else {
  215. group2.itemViewModels = [self.subjectThreeArr.rac_sequence map:^id _Nullable(NSString *titleStr) {
  216. @strongify(self)
  217. RQHomeSubPageNormalItemViewModel *item = [[RQHomeSubPageNormalItemViewModel alloc] init];
  218. item.icon = @"subject2_standart_icon";
  219. item.title = titleStr;
  220. item.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, 44.f);
  221. item.bottomLineHide = [self.subjectThreeArr indexOfObject:titleStr] == self.subjectTwoArr.count + 1;
  222. item.operation = ^{
  223. @strongify(self)
  224. TRDetailVC *vc=[[TRDetailVC alloc]init];
  225. [vc setFile:titleStr];
  226. [self navPushHideTabbarToVC:vc];
  227. };
  228. return item;
  229. }].array;
  230. }
  231. } else {
  232. group0 = [RQHomeSubPageToolBarGroupViewModel groupViewModel];
  233. group0.footerHeight = RQ_FIT_HORIZONTAL(65.f);
  234. }
  235. group0.headerHeight = RQ_SHARE_FUNCTION.RQADViewHeight;
  236. RQHomeSubPageItemViewModel *homeSubPageItemViewModel = [[RQHomeSubPageItemViewModel alloc] initWithRQHomePageCarType:self.homePageCarType homePageSubjectType:self.homePageSubjectType];
  237. homeSubPageItemViewModel.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(359.f));
  238. homeSubPageItemViewModel.operation = ^{
  239. };
  240. group0.itemViewModels = (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree || self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo)? @[] : @[homeSubPageItemViewModel];
  241. RQCommonGroupViewModel *group3 = [RQCommonGroupViewModel groupViewModel];
  242. group3.headerHeight = 10.f;
  243. group3.headerHeight = 10.f;
  244. RQHomeSubPageNormalItemViewModel *item0 = [[RQHomeSubPageNormalItemViewModel alloc] init];
  245. item0.icon = @"subject3_light_ico";
  246. item0.title = @"灯光操作";
  247. item0.itemSize = CGSizeMake(RQ_SCREEN_WIDTH / 2.f - 8.f, 54.f);
  248. item0.operation = ^{
  249. LightingAndSoundVC *VC = [[LightingAndSoundVC alloc] init];
  250. VC.styleTag = 4;
  251. [self navPushHideTabbarToVC:VC];
  252. };
  253. item0.bottomLineHide = YES;
  254. RQHomeSubPageNormalItemViewModel *item1 = [[RQHomeSubPageNormalItemViewModel alloc] init];
  255. item1.icon = @"subject3_voice_icon";
  256. item1.title = @"语音模拟";
  257. item1.itemSize = CGSizeMake(RQ_SCREEN_WIDTH / 2.f - 8.f, 54.f);
  258. item1.bottomLineHide = YES;
  259. item1.operation = ^{
  260. LightingAndSoundVC *VC = [[LightingAndSoundVC alloc] init];
  261. VC.styleTag = 5;
  262. [self navPushHideTabbarToVC:VC];
  263. };
  264. group3.itemViewModels = @[item0, item1];
  265. RAC(self, dataSource) = [RACObserve(self, currentVideosArr) map:^(NSArray * treeListModelArr) {
  266. @strongify(self)
  267. if (self.currentVideosArr.count > 0) {
  268. /// 第一组
  269. RQHomeSubPageVideoHeaderGroupViewModel *group1 = [RQHomeSubPageVideoHeaderGroupViewModel groupViewModel];
  270. group1.headerHeight = 48.f;
  271. group1.footerHeight = CGFLOAT_MIN;
  272. group1.header = @"视频教程";
  273. group1.itemViewModels = [self dataSourceWithItems:self.currentVideosArr treeListModel:nil section:1];
  274. group1.currentVideoesArr = self.currentVideosArr;
  275. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  276. return group1.itemViewModels.count > 0? @[group0, group1, group2] : @[group0, group2];
  277. } else if (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree) {
  278. return group1.itemViewModels.count > 0? @[group0, group1, group3, group2] : @[group0, group3 ,group2];
  279. } else {
  280. return group1.itemViewModels.count > 0? @[group0, group1] : @[group0];
  281. }
  282. } else {
  283. if (self.homePageSubjectType == RQHomePageSubjectType_SubjectTwo) {
  284. return @[group0, group2];
  285. } else if (self.homePageSubjectType == RQHomePageSubjectType_SubjectThree) {
  286. return @[group0, group3, group2];
  287. } else {
  288. return @[group0];
  289. }
  290. }
  291. }];
  292. }
  293. - (void)dataDealWithDataArr:(NSArray *)dataArr completion:(void (^)(NSArray *arr))completion {
  294. if (dataArr.count > 0) {
  295. for (id value in dataArr) {
  296. if ([value isKindOfClass:[NSArray class]]) {
  297. [self dataDealWithDataArr:value completion:completion];
  298. break;
  299. } else {
  300. completion(dataArr);
  301. break;
  302. }
  303. }
  304. } else {
  305. completion(dataArr);
  306. }
  307. }
  308. - (NSArray *)dataSourceWithItems:(NSArray *)items treeListModel:(RQTreeListModel *)treeListModel section:(NSInteger)section {
  309. NSArray *viewModels = [items.rac_sequence map:^(VideosItem *videosItem) {
  310. RQHomeSubPageVideoItemViewModel *homeSubPageVideoItemViewModel = [[RQHomeSubPageVideoItemViewModel alloc] initWithVideosItem:videosItem];
  311. CGFloat cellWidth = (RQ_SCREEN_WIDTH - (16 * 3)) / 2.f;
  312. homeSubPageVideoItemViewModel.itemSize = CGSizeMake(cellWidth, cellWidth * (122.f / 167.f));
  313. homeSubPageVideoItemViewModel.operation = ^{
  314. RQVideoDetailViewModel *videoDetailViewModel = [[RQVideoDetailViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  315. RQViewModelUtilKey : treeListModel? treeListModel : self.currentVideosArr,
  316. RQVideoItemIndexKey : @(0),
  317. RQVideoItemIndexPathKey : [NSIndexPath indexPathForRow:[items indexOfObject:videosItem] inSection:section],
  318. RQHomePageSubjectTypeKey : @(self.homePageSubjectType),
  319. }];
  320. [RQ_APPDELEGATE.services pushViewModel:videoDetailViewModel animated:YES];
  321. };
  322. return homeSubPageVideoItemViewModel;
  323. }].array;
  324. return viewModels ?: @[];
  325. }
  326. - (void)getVideos {
  327. if (![Util connectedToNetWork]) {
  328. showMsgUnconnect();
  329. return;
  330. }
  331. NSMutableArray *aArray=[NSMutableArray array];
  332. [aArray addPro:@"chapterId" Value:[NSString stringWithFormat:@"%ld",self.homePageSubjectType + 1]];
  333. [aArray addPro:@"subject" Value:[NSString stringWithFormat:@"%ld",self.homePageSubjectType + 1]];
  334. [aArray addPro:@"isPage" Value:@"0"];
  335. [aArray addPro:@"pageSize" Value:@"0"];
  336. [aArray addPro:@"currentPage" Value:@"0"];
  337. NSString* method = @"getVideos";
  338. [jiaPeiManager requestAnythingWithURL:method array:aArray data:nil completion:^(NSDictionary *root) {
  339. NSDictionary *dic = @{
  340. @"body": @[@{
  341. @"chapter": @"1",
  342. @"content": @"交通信号灯",
  343. @"crdate": @"",
  344. @"id": @"19",
  345. @"image": @"http://lnxzzfile.oss-cn-beijing.aliyuncs.com/public/video/170906/1-1.jpg",
  346. @"playNum": @"",
  347. @"source": @"网络",
  348. @"subject": @"1",
  349. @"taglib": @"交通信号灯",
  350. @"times": @"400",
  351. @"title": @"【理论】交通信号灯_学车视频",
  352. @"vHtml": @"",
  353. @"videoPath": @"http://218.60.2.75:8081/sp/upload/1/1-1.mp4",
  354. @"videoType": @"1"
  355. }, @{
  356. @"chapter":@"1",
  357. @"content":@"交通标志",
  358. @"crdate":@"",
  359. @"id":@"20",
  360. @"image":@"http://lnxzzfile.oss-cn-beijing.aliyuncs.com/public/video/170906/1-2.jpg",
  361. @"playNum":@"",
  362. @"source":@"网络",
  363. @"subject":@"1",
  364. @"taglib":@"交通标志",
  365. @"times":@"1566",
  366. @"title":@"【理论】交通标志_ 学车视频",
  367. @"vHtml":@"",
  368. @"videoPath":@"http://218.60.2.75:8081/sp/upload/1/1-2.mp4",
  369. @"videoType":@"1"
  370. }, @{
  371. @"chapter":@"1",
  372. @"content":@"交通标线",
  373. @"crdate":@"",
  374. @"id":@"21",
  375. @"image":@"http://lnxzzfile.oss-cn-beijing.aliyuncs.com/public/video/170906/1-3.jpg",
  376. @"playNum":@"",
  377. @"source":@"网络",
  378. @"subject":@"1",
  379. @"taglib":@"交通标线",
  380. @"times":@"548",
  381. @"title":@"【理论】交通标线_学车视频",
  382. @"vHtml":@"",
  383. @"videoPath":@"http://218.60.2.75:8081/sp/upload/1/1-3.mp4",
  384. @"videoType":@"1"
  385. }, @{
  386. @"chapter":@"1",
  387. @"content":@"交通警察指挥手势信号",
  388. @"crdate":@"",
  389. @"id":@"22",
  390. @"image":@"http://lnxzzfile.oss-cn-beijing.aliyuncs.com/public/video/170906/1-4.jpg",
  391. @"playNum":@"",
  392. @"source":@"网络",
  393. @"subject":@"1",
  394. @"taglib":@"交通警察指挥手势信号",
  395. @"times":@"767",
  396. @"title":@"【理论】交通警察指挥手势信号_学车视频",
  397. @"vHtml":@"",
  398. @"videoPath":@"http://218.60.2.75:8081/sp/upload/1/1-4.mp4",
  399. @"videoType":@"1"
  400. }],
  401. @"code":@"0",
  402. @"msg":@"",
  403. @"other":@""
  404. };
  405. // root = dic;
  406. if (!root) {
  407. return ;
  408. }
  409. if ([root[@"code"] isEqualToString:@"1"]) {
  410. ShowMsg(root[@"body"]);
  411. return;
  412. }
  413. if ([root[@"body"] isKindOfClass:[NSArray class]]) {
  414. NSMutableArray *arr = @[].mutableCopy;
  415. for (NSDictionary *dic in root[@"body"]) {
  416. VideosItem *videoItem = [VideosItem videoItemModelWithDictionary:dic];
  417. if (arr.count < 4) {
  418. [arr addObject:videoItem];
  419. }
  420. }
  421. self.currentVideosArr = arr.copy;
  422. }
  423. }];
  424. }
  425. - (void)navPushHideTabbarToVC:(UIViewController *)vc {
  426. if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
  427. [RQControllerHelper.topNavigationController qmui_pushViewController:vc animated:YES completion:nil];
  428. } else {
  429. vc.hidesBottomBarWhenPushed = YES;
  430. [RQControllerHelper.topNavigationController qmui_pushViewController:vc animated:YES completion:nil];
  431. vc.hidesBottomBarWhenPushed = NO;
  432. }
  433. }
  434. - (NSArray *)subjectTwoArr {
  435. NSArray *arr = @[@"科目二小错误千万别大意",
  436. @"科目二到底考什么?全部都在这",
  437. @"科目二考试不过的原因大解析",
  438. @"侧方停车只是倒车速度慢一点,为什么判不过?",
  439. @"考官说扣分:“驾考科目二场考五项讲解全攻略”",
  440. @"科目二考试技巧口诀,小伙伴要记牢哦",
  441. @"科目二考试详细流程",
  442. @"科目二之直角拐弯",
  443. @"科目二考场温馨提示要点图",
  444. @"侧方停车技巧,超详细!",
  445. @"四张图让你秒变倒车界的独孤求败!",
  446. @"倒车入库再也不发愁,蜀黍教你各种倒车技巧!",
  447. @"科目二五项过关神技巧,超级详细!",
  448. @"因为这些挂掉,冤枉死!",
  449. @"科目二坡道,这些不良动作是你考试不过关的根源!",
  450. @"倒车入位用这三招,想怎么钻就怎么钻!",
  451. @"科目二失分点都在这,想过来看!",
  452. @"倒车入库究竟有多难?",
  453. @"学车入门级知识问题",
  454. @"科二全程解剖,让“菜鸟级”的你轻松通过考试",
  455. @"直角转弯操作技巧,一看秒懂",
  456. @"六张图,教会你“侧方停车”神技能",
  457. @"全程考试技巧汇总",
  458. @"坡道定点停车技巧(图解)",
  459. @"坡道定点找三十公分线的技巧方法",
  460. @"考驾照14条关键经验,学员含泪总结",
  461. @"科目二考前准备",
  462. @"科目二合格标准",
  463. @"科目二必过考试经验分享",
  464. @"坡道起步怎么预防倒溜和熄火?",
  465. @"科目二全程“难点”独家解析!",
  466. @"科二最难的:倒车入口+坡道起步独家秘笈",
  467. @"你必须注意的科目二考试须知!"];
  468. NSMutableArray *array = [NSMutableArray arrayWithArray:arr];
  469. NSMutableArray *dataArray = [NSMutableArray array];
  470. for (int i = 0; i < 6; i ++) {
  471. int index = arc4random()%(array.count - 1);
  472. [dataArray addObject:array[index]];
  473. [array removeObjectAtIndex:index];
  474. }
  475. return @[];
  476. return dataArray.copy;
  477. }
  478. - (NSArray *)subjectThreeArr {
  479. NSArray *arr = @[@"科目三考试评判标准,提前了解不失分",
  480. @"科目三原来是这样丢分的",
  481. @"三招提高科目三考试成功率",
  482. @"科目三考试详细流程",
  483. @"科三再升级“人考”改“机考”车内多名安全员",
  484. @"科目三--加减档位操作",
  485. @"夜考,用这几招轻轻松松过",
  486. @"科目三大路考之靠边停车小技巧",
  487. @"科目三:模拟夜间行驶场景灯光使用技巧",
  488. @"超详细科目三考试口令速记口诀!",
  489. @"控制科目三方向的几个生死关键点",
  490. @"2015年科目三考试新规则和扣分标准",
  491. @"科目三:路考超车须知",
  492. @"科目三:电子路考需要注意什么",
  493. @"科目三:老手教你靠边停车技术",
  494. @"科目三:路考变更车道须知",
  495. @"科目三:路考通过人行横道线须知",
  496. @"科目三:路考中14项细节必需注意",
  497. @"考试指南 - 科目三路考评判标准",
  498. @"考试指南 - 科目三路考秘诀",
  499. @"考试指南 - 科目三必过的考场经验分享",
  500. @"考试指南 - 科目三抽到夜间考试怎么办?",
  501. @"考试指南 - 夜考灯光使用攻略,看完就过了!",
  502. @"考试指南 - 科目三路考会车攻略"];
  503. NSMutableArray *array = [NSMutableArray arrayWithArray:arr];
  504. NSMutableArray *dataArray = [NSMutableArray array];
  505. for (int i = 0; i < 5; i ++) {
  506. int index = arc4random()%(array.count - 1);
  507. [dataArray addObject:array[index]];
  508. [array removeObjectAtIndex:index];
  509. }
  510. return @[];
  511. return dataArray.copy;
  512. }
  513. @end