Commit d1b707a1 cgx

优化首页轮播图逻辑

1 个父辈 7f49ef22
...@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *info_url; @property (nonatomic, copy) NSString *info_url;
// banner图描述 // banner图描述
@property (nonatomic, copy) NSString *banner_desc; @property (nonatomic, copy) NSString *banner_desc;
// 登录标识
@property (nonatomic, assign) int login_flag;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -85,37 +85,42 @@ ...@@ -85,37 +85,42 @@
#pragma mark - CWCarouselDelegate #pragma mark - CWCarouselDelegate
- (void)CWCarousel:(CWCarousel *)carousel didSelectedAtIndex:(NSInteger)index { - (void)CWCarousel:(CWCarousel *)carousel didSelectedAtIndex:(NSInteger)index {
// 判断是否登录成功 BannerModel *model = self.bannerDatas[index];
if ([LoginUtils getUserLoginData]) { if (model.login_flag == 0) { // 用户无需登录直接跳转
BannerModel *model = self.bannerDatas[index]; [self jumpToBannerPageWithModel:model];
} else {
[DataStatisticsUtil event:Banner_Click attributes:@{@"name":model.banner_name, @"url":model.banner_url}]; if ([LoginUtils getUserLoginData]) {
[self jumpToBannerPageWithModel:model];
} else {
// 跳转到登录页面
[LoginUtils jumpToLoginControllerWithTarget:self.ds_viewController];
}
}
}
switch (model.banner_id) { - (void)jumpToBannerPageWithModel:(BannerModel *)model {
case 13: { // 进入失眠拯救计划页面 [DataStatisticsUtil event:Banner_Click attributes:@{@"name":model.banner_name, @"url":model.banner_url}];
[self.ds_viewController.navigationController pushViewController:[[DsWebController alloc] initWithLink:model.info_url isShowNavi:NO] animated:YES];
} BOOL isNative = [model.info_url containsString:@"native"];
break; // 跳转到原生页面
case 11: { // 切换到AI睡眠教练标签 if (isNative) {
self.ds_viewController.tabBarController.selectedIndex = 1; int type = [[[model.info_url componentsSeparatedByString:@"type="] lastObject] intValue];
} if (type == 1) { // 切换到AI睡眠教练标签
break; self.ds_viewController.tabBarController.selectedIndex = 1;
case 10: { // 进入哄睡页面 } else if (type == 2) { // 首页
UnityGameController *gameVC = [UnityGameController new]; self.ds_viewController.tabBarController.selectedIndex = 0;
gameVC.gameType = GameTypeCoax; } else if (type == 3) { // 哄睡页面
[self.ds_viewController.navigationController pushViewController:gameVC animated:YES]; UnityGameController *gameVC = [UnityGameController new];
} gameVC.gameType = GameTypeCoax;
break; [self.ds_viewController.navigationController pushViewController:gameVC animated:YES];
case 8: { // 进入睡眠评测页面 } else if (type == 4) { // 小球游戏
[self.ds_viewController.navigationController pushViewController:[[DsWebController alloc] initWithLink:model.info_url isShowNavi:NO] animated:YES]; UnityGameController *gameVC = [UnityGameController new];
} gameVC.gameType = GameTypeBall;
break; [self.ds_viewController.navigationController pushViewController:gameVC animated:YES];
default:
break;
} }
} else { } else {
// 跳转到登录页面 // 跳转到H5页面
[LoginUtils jumpToLoginControllerWithTarget:self.ds_viewController]; [self.ds_viewController.navigationController pushViewController:[[DsWebController alloc] initWithLink:model.info_url isShowNavi:NO] animated:YES];
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!