Commit 429d3f5f923379a0396e52ca69bbd3ffbb1e822a

Authored by liushiyu
1 parent c85a2c39

0.0.3

CNLiveCMineModule.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLiveCMineModule'
11   - s.version = '0.0.2'
  11 + s.version = '0.0.3'
12 12 s.summary = '网家家C端个人中心'
13 13  
14 14 # This description is used to generate tags and improve search results.
... ...
CNLiveCMineModule/Classes/CNLiveCMineModule.h
... ... @@ -11,8 +11,11 @@ NS_ASSUME_NONNULL_BEGIN
11 11  
12 12 @interface CNLiveCMineModule : NSObject
13 13  
14   -/// 跳转工程中的我的积分界面
15   -+(void)pushVCWithInteView;
  14 +/// 跳转积分界面
  15 +/// @param from 来源标识符
  16 +/// @param feedback 是不是从反馈意见成功界面过来的,如果是 则直接从当前页面返回回到指定界面
  17 ++(void)pushVCWithInteViewToFrom:(NSString *)from Feedback:(BOOL)feedback;
  18 +
16 19 @end
17 20  
18 21 NS_ASSUME_NONNULL_END
... ...
CNLiveCMineModule/Classes/CNLiveCMineModule.m
... ... @@ -9,10 +9,16 @@
9 9  
10 10 @implementation CNLiveCMineModule
11 11  
12   -/// 跳转工程中的我的积分界面
13   -+(void)pushVCWithInteView
  12 +/// 跳转积分界面
  13 +/// @param from 来源标识符
  14 +/// @param feedback 是不是从反馈意见成功界面过来的,如果是 则直接从当前页面返回回到指定界面
  15 ++(void)pushVCWithInteViewToFrom:(NSString *)from Feedback:(BOOL)feedback;
14 16 {
15   - [[CNLiveCMineModule navigationViewController] pushViewController:[CNLiveCMineInteViewController new] animated:YES];
  17 + CNLiveCMineInteViewController * inteView = [[CNLiveCMineInteViewController alloc] init];
  18 + inteView.isFrom = from;
  19 + inteView.isFeedback = feedback;
  20 + inteView.hidesBottomBarWhenPushed = YES;
  21 + [[CNLiveCMineModule navigationViewController] pushViewController:inteView animated:YES];
16 22 }
17 23  
18 24  
... ...
CNLiveCMineModule/Classes/CNLiveCMineProtocol.h
... ... @@ -18,6 +18,11 @@ NS_ASSUME_NONNULL_BEGIN
18 18 /// @param url 链接地址
19 19 -(void)pushCMineInteContentForCMainWebViewWithURL:(NSString *)url statue:(CNLiveCMineIntePushWebViewStatue)statue;
20 20  
  21 +/// 积分任务跳转到不同界面去完成
  22 +/// @param param 参数
  23 +/// @param currentVC 当前控制器
  24 +-(void)pushCMineInteContentForCMainCustomFunctionVCParam:(NSDictionary *)param CurrentVC:(UIViewController *)currentVC;
  25 +
21 26 /// 我的积分跳转主工程我的客服界面
22 27 -(void)pushCMineInteContentForCMainPlatFromCustomerMedthod;
23 28  
... ...
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteAnnouListViewController.m
... ... @@ -87,7 +87,9 @@
87 87 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
88 88 {
89 89 CNLiveCMineInteListSubModel * annouModel = self.annouModel.list[indexPath.row];
90   - [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainWebViewWithURL:annouModel.shareUrl statue:CNLiveCMineIntePushWebViewStatueAnnotationDetail];
  90 + BOOL isCont = [annouModel.shareUrl cn_containsString:@"?"];
  91 + NSString * shreUrl = [NSString stringWithFormat:@"%@%@contentId=%@",annouModel.shareUrl,isCont?@"&":@"?",annouModel.contentId];
  92 + [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainWebViewWithURL:shreUrl statue:CNLiveCMineIntePushWebViewStatueAnnotationDetail];
91 93 }
92 94 #pragma mark = getter
93 95 - (CNLiveNavigationBar *)navigationBar {
... ...
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteTaskListViewController.h
... ... @@ -6,14 +6,16 @@
6 6 //
7 7  
8 8 #import <CNLiveBusinessBaseModule/CNLiveBusinessBaseModule.h>
9   -
  9 +#import "CNLiveCMineInteTaskViewController.h"
10 10 NS_ASSUME_NONNULL_BEGIN
11 11  
12 12 @interface CNLiveCMineInteTaskListViewController : CNCommonListViewController<JXPagerViewListViewDelegate>
13 13  
14 14 /// 初始化任务列表
15 15 /// @param taskArray 数据源
16   -- (instancetype)initWithTaskArray:(NSArray *)taskArray;
  16 +/// @param taskVC 控制器
  17 +- (instancetype)initWithTaskArray:(NSArray *)taskArray
  18 + TaskVC:(CNLiveCMineInteTaskViewController *)taskVC;
17 19  
18 20 /// 滚动回调
19 21 @property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
... ...
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteTaskListViewController.m
... ... @@ -7,8 +7,9 @@
7 7  
8 8 #import "CNLiveCMineInteTaskListViewController.h"
9 9 #import "CNLiveCMineInteCollectionViewCell.h"
10   -@interface CNLiveCMineInteTaskListViewController ()
11 10  
  11 +@interface CNLiveCMineInteTaskListViewController ()
  12 +@property (nonatomic, weak) CNLiveCMineInteTaskViewController * taskVC;
12 13 @property (nonatomic, strong) NSArray * taskArray;//数据源
13 14  
14 15 @end
... ... @@ -17,18 +18,40 @@
17 18  
18 19 /// 初始化任务列表
19 20 /// @param taskArray 数据源
20   -- (instancetype)initWithTaskArray:(NSArray *)taskArray;
  21 +- (instancetype)initWithTaskArray:(NSArray *)taskArray TaskVC:(CNLiveCMineInteTaskViewController *)taskVC
21 22 {
22 23 self = [super init];
23 24 if (self) {
  25 + _taskVC = taskVC;
24 26 _taskArray = taskArray;
25 27 }
26 28 return self;
27 29 }
  30 +-(void)dealloc
  31 +{
  32 + [[NSNotificationCenter defaultCenter] removeObserver:self name:kCNLiveCMineInteTaskAddScoreRequestSuccessNotification object:nil];
  33 +}
28 34 - (void)viewDidLoad {
29 35 [super viewDidLoad];
30 36 // Do any additional setup after loading the view.
31 37 self.view.backgroundColor = UIColorHex(0xf9f9f9);
  38 +
  39 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(successAddScoreNotification:) name:kCNLiveCMineInteTaskAddScoreRequestSuccessNotification object:nil];
  40 +}
  41 +-(void)successAddScoreNotification:(NSNotification *)note
  42 +{
  43 + NSString *taskId = note.userInfo[@"taskId"];
  44 + //改变任务次数
  45 + NSArray *arr = [self.tableView indexPathsForVisibleRows];
  46 + for (NSIndexPath *indexPath in arr) {
  47 + CNLiveCMineTaskTableViewCell *cell = (CNLiveCMineTaskTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath];
  48 + if ([taskId isEqualToString:cell.taskModel.taskId]) {
  49 + CNLiveCMineInteTaskListItemModel * taskModel = self.taskArray[indexPath.row];
  50 + taskModel.times += 1;
  51 + [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  52 + return;
  53 + }
  54 + }
32 55 }
33 56 - (void)initTableView
34 57 {
... ... @@ -77,7 +100,7 @@
77 100 {
78 101 CNLiveCMineInteTaskListItemModel * taskModel = self.taskArray[indexPath.row];
79 102 if(taskModel.times < taskModel.totalCount) {
80   - NSLog(@"可以点击");
  103 + [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainCustomFunctionVCParam:[taskModel mj_JSONObject] CurrentVC:self.taskVC];
81 104 }
82 105 }
83 106  
... ...
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteTaskViewController.m
... ... @@ -97,8 +97,8 @@ static NSInteger const kCNLiveSectionHeaderHeight = 140;//头视图高度
97 97 {
98 98 if (!_viewControllers) {
99 99 _viewControllers = [[NSMutableArray alloc] initWithArray:@[
100   - [[CNLiveCMineInteTaskListViewController alloc] initWithTaskArray:self.taskModel.dailyTask],
101   - [[CNLiveCMineInteTaskListViewController alloc] initWithTaskArray:self.taskModel.firstTask]
  100 + [[CNLiveCMineInteTaskListViewController alloc] initWithTaskArray:self.taskModel.dailyTask TaskVC:self],
  101 + [[CNLiveCMineInteTaskListViewController alloc] initWithTaskArray:self.taskModel.firstTask TaskVC:self]
102 102 ]];
103 103 }
104 104 return _viewControllers;
... ...
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteViewController.h
... ... @@ -11,6 +11,10 @@ NS_ASSUME_NONNULL_BEGIN
11 11  
12 12 @interface CNLiveCMineInteViewController : CNCommonViewController
13 13  
  14 +@property (nonatomic, copy) NSString *isFrom;
  15 +/// 是不是从反馈意见成功界面过来的,如果是 则直接从当前页面返回回到指定界面
  16 +@property (nonatomic, assign) BOOL isFeedback;
  17 +
14 18 @end
15 19  
16 20 NS_ASSUME_NONNULL_END
... ...
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteViewController.m
... ... @@ -18,6 +18,7 @@
18 18 @property (nonatomic, strong) CNLiveCMineInteListModel * announModel; //公告数据
19 19 @property (nonatomic, strong) CNLiveCMineInteListModel * activModel; //活动数据
20 20  
  21 +@property (nonatomic, strong) CNLiveCMineInteHeaderView *headerView;//头视图
21 22 @property (nonatomic, strong) CNLiveNavigationBar * navigationBar;//导航栏
22 23 @property (nonatomic, strong) UICollectionView * mainCollectionView;//主界面
23 24 @property (nonatomic, strong) UIImageView * backView;
... ... @@ -46,9 +47,16 @@
46 47 weakSelf.taskModel = ![dataArray[1] isKindOfClass:NSString.class]?dataArray[1]:nil;
47 48 weakSelf.announModel = ![dataArray[2] isKindOfClass:NSString.class]?dataArray[2]:nil;
48 49 weakSelf.activModel = ![dataArray[3] isKindOfClass:NSString.class]?dataArray[3]:nil;
  50 +
  51 + weakSelf.taskModel.from = weakSelf.isFrom;
  52 + weakSelf.taskModel.feedback = weakSelf.isFeedback;
49 53 [weakSelf.mainCollectionView reloadData];
50 54 }];
51 55 }
  56 +-(void)dealloc
  57 +{
  58 + [[NSNotificationCenter defaultCenter] removeObserver:self name:kCNLiveCMineInteTaskAddScoreRequestSuccessNotification object:nil];
  59 +}
52 60 - (void)viewDidLoad {
53 61 [super viewDidLoad];
54 62 // Do any additional setup after loading the view.
... ... @@ -57,6 +65,16 @@
57 65 [self.view addSubview:self.backView];
58 66 [self.view addSubview:self.mainCollectionView];
59 67 [self reloadDataSource];
  68 +
  69 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(successAddScoreNotification:) name:kCNLiveCMineInteTaskAddScoreRequestSuccessNotification object:nil];
  70 +}
  71 +
  72 +-(void)successAddScoreNotification:(NSNotification *)note
  73 +{
  74 + NSInteger addScore = [note.userInfo[@"score"] integerValue];
  75 + NSInteger scored = [self.taskModel.integral integerValue];
  76 + self.taskModel.integral = [NSString stringWithFormat:@"%ld",scored + addScore];
  77 + [self.headerView setupWithScoreModel:self.scoreModel taskModel:self.taskModel announModel:self.announModel];
60 78 }
61 79 #pragma mark - UICollectionViewDelegate,UICollectionViewDataSource
62 80 - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
... ... @@ -98,9 +116,10 @@
98 116 [weakSelf.navigationController pushViewController:annouView animated:YES];
99 117 } else {
100 118 NSString * url = cn_API_Managemall(@"/html/select_good/1/#/pointsMall");
101   - [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainWebViewWithURL:url statue:CNLiveCMineIntePushWebViewStatueRule];
  119 + [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainWebViewWithURL:url statue:CNLiveCMineIntePushWebViewStatueMall];
102 120 }
103 121 }];
  122 + self.headerView = headerView;
104 123 return headerView;
105 124 }
106 125 return nil;
... ...
CNLiveCMineModule/Classes/inte/Model/CNLiveCMineInteModel.h
... ... @@ -42,6 +42,9 @@ NS_ASSUME_NONNULL_BEGIN
42 42 @property (nonatomic, copy) NSString *integral;
43 43 @property (nonatomic, strong) NSArray *dailyTask;
44 44 @property (nonatomic, strong) NSArray *firstTask;
  45 +
  46 +@property (nonatomic, copy) NSString *from;//自定义
  47 +@property (nonatomic, assign) BOOL feedback;//自定义
45 48 @end
46 49  
47 50 @interface CNLiveCMineInteTaskListItemModel : NSObject<NSCoding>
... ...
CNLiveCMineModule/Classes/inte/View/CNLiveCMineInteCollectionViewCell.m
... ... @@ -317,7 +317,7 @@
317 317 [str addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x23D41E) range:range];
318 318 self.progressLabel.attributedText = str;
319 319  
320   - if(taskModel.times >= taskModel.totalCount) {
  320 + if (taskModel.times >= taskModel.totalCount) {
321 321 [self.completeBtn setTitle:@"已完成" forState:UIControlStateNormal];
322 322 [self.completeBtn setImage:nil forState:UIControlStateNormal];
323 323 self.completeBtn.backgroundColor = UIColorHex(0xF0F0F0);
... ...
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.h
... ... @@ -9,6 +9,8 @@
9 9 #import "CNLiveCMineInteModel.h"
10 10 NS_ASSUME_NONNULL_BEGIN
11 11  
  12 +/**任务完成增加积分通知*/
  13 +static NSString * const kCNLiveCMineInteTaskAddScoreRequestSuccessNotification = @"AddScoreRequestSuccess";
12 14  
13 15 typedef enum : NSUInteger {
14 16 CNLiveCMineInteHeaderClickDetail = 1,//积分明细
... ...
Example/CNLiveCMineModule/CNLiveCMineViewModuleImpl.m
... ... @@ -28,5 +28,11 @@
28 28  
29 29 }
30 30  
  31 +/// 积分任务跳转到不同界面去完成
  32 +/// @param param 参数
  33 +-(void)pushCMineInteContentForCMainCustomFunctionVCParam:(NSDictionary *)param
  34 +{
  35 + NSLog(@"跳转不同积分任务=>%@",param);
  36 +}
31 37  
32 38 @end
... ...