Commit d3b55aceac54e0c332c84b057a855c98b941fa39

Authored by zhangxiaowen
1 parent bf2800a1

no message

CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_doyen.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_doyen@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_doyen@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 \ No newline at end of file 23 \ No newline at end of file
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_doyen.imageset/mine_doyen@2x.png 0 → 100644

1.79 KB

CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_doyen.imageset/mine_doyen@3x.png 0 → 100644

3.32 KB

CNLiveMineModule/Classes/Controller/CNLiveMineController.m
@@ -148,6 +148,7 @@ static const CGFloat timeValue = 1.5; @@ -148,6 +148,7 @@ static const CGFloat timeValue = 1.5;
148 [super viewWillAppear:animated]; 148 [super viewWillAppear:animated];
149 self.navigationController.navigationBarHidden = YES; 149 self.navigationController.navigationBarHidden = YES;
150 150
  151 + [self requestCertification];
151 if(self.headerView){ 152 if(self.headerView){
152 self.headerView.frame = CGRectMake(0, -kHEIGHT, SCREEN_WIDTH, kHEIGHT); 153 self.headerView.frame = CGRectMake(0, -kHEIGHT, SCREEN_WIDTH, kHEIGHT);
153 } 154 }
@@ -233,6 +234,7 @@ static const CGFloat timeValue = 1.5; @@ -233,6 +234,7 @@ static const CGFloat timeValue = 1.5;
233 } 234 }
234 } 235 }
235 236
  237 +#pragma mark - 请求方法
236 // 请求签到赚积分 238 // 请求签到赚积分
237 - (void)requestSignIn{ 239 - (void)requestSignIn{
238 self.headerView.interactionEnabled = NO; 240 self.headerView.interactionEnabled = NO;
@@ -258,6 +260,28 @@ static const CGFloat timeValue = 1.5; @@ -258,6 +260,28 @@ static const CGFloat timeValue = 1.5;
258 }]; 260 }];
259 } 261 }
260 262
  263 +// 请求用户认证
  264 +- (void)requestCertification{
  265 + [CNLiveMineRequest certification:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError * _Nonnull error) {
  266 + if (error.code == -1001 || error.code == -1009) {
  267 + [QMUITips showError:@"网络连接已断开" inView:self.view hideAfterDelay:timeValue];
  268 + return ;
  269 + }
  270 + if (isSuccess) {
  271 + NSString *darenIdentity = [NSString stringWithFormat:@"%@",[data objectForKey:@"darenIdentity"]];
  272 + if ([darenIdentity isEqualToString:@"1"]) { //普通用户
  273 + CNUserShareModel.isDaren = 0;
  274 + self.headerView.certificationImages = @[@"mine_overbadge",@"mine_common", @"mine_wjj_certification"];
  275 +
  276 + } else if ([darenIdentity isEqualToString:@"0"]) { //达人用户
  277 + CNUserShareModel.isDaren = 1;
  278 + self.headerView.certificationImages = @[@"mine_overbadge",@"mine_doyen", @"mine_wjj_certification"];
  279 +
  280 + }
  281 + }
  282 + }];
  283 +}
  284 +
261 #pragma mark - CNLiveMineCellDelegate 285 #pragma mark - CNLiveMineCellDelegate
262 - (void)cell:(CNLiveMineCell *)cell didSelectItemAtItem:(NSInteger)item{ 286 - (void)cell:(CNLiveMineCell *)cell didSelectItemAtItem:(NSInteger)item{
263 switch (cell.model.type) { 287 switch (cell.model.type) {
@@ -385,12 +409,6 @@ static const CGFloat timeValue = 1.5; @@ -385,12 +409,6 @@ static const CGFloat timeValue = 1.5;
385 } 409 }
386 410
387 #pragma mark - 状态栏 411 #pragma mark - 状态栏
388 -/**  
389 - * 状态栏的颜色  
390 - *  
391 - * @return UIStatusBarStyle  
392 - *  
393 - */  
394 - (UIStatusBarStyle)preferredStatusBarStyle{ 412 - (UIStatusBarStyle)preferredStatusBarStyle{
395 return UIStatusBarStyleLightContent; 413 return UIStatusBarStyleLightContent;
396 414
CNLiveMineModule/Classes/Model/CNLiveMineRequest.h
@@ -9,10 +9,16 @@ @@ -9,10 +9,16 @@
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 10
11 NS_ASSUME_NONNULL_BEGIN 11 NS_ASSUME_NONNULL_BEGIN
  12 +typedef void(^CertificationBlock)(BOOL isSuccess, NSDictionary *data, NSError *error);
12 typedef void(^SignInBlock)(BOOL isSuccess, NSDictionary *data, NSError *error); 13 typedef void(^SignInBlock)(BOOL isSuccess, NSDictionary *data, NSError *error);
13 14
14 @interface CNLiveMineRequest : NSObject 15 @interface CNLiveMineRequest : NSObject
15 16
  17 +// 请求用户认证
  18 ++ (void)certification:(CertificationBlock)block;
  19 +
  20 +
  21 +// 签到
16 + (void)signIn:(SignInBlock)block; 22 + (void)signIn:(SignInBlock)block;
17 23
18 @end 24 @end
CNLiveMineModule/Classes/Model/CNLiveMineRequest.m
@@ -15,6 +15,25 @@ @@ -15,6 +15,25 @@
15 #import "CNLiveCollectionModel.h" 15 #import "CNLiveCollectionModel.h"
16 16
17 @implementation CNLiveMineRequest 17 @implementation CNLiveMineRequest
  18 +// 请求用户认证
  19 ++ (void)certification:(CertificationBlock)block {
  20 + NSDictionary *params = @{
  21 + @"witSid":CNUserShareModel.uid ? CNUserShareModel.uid : @""
  22 + };
  23 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  24 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNCheckWitnessUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  25 + if (responseObject && [responseObject isKindOfClass:[NSDictionary class]] && responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]) {
  26 + NSString *errorCode = [NSString stringWithFormat:@"%@", responseObject[@"errorCode"]];
  27 + NSDictionary *data = responseObject[@"data"];
  28 + block?block([errorCode isEqualToString:@"0"], data, error):@"";
  29 + }else{
  30 + block?block(NO, @{}, error):@"";
  31 +
  32 + }
  33 +
  34 + }];
  35 +
  36 +}
18 37
19 + (void)signIn:(SignInBlock)block { 38 + (void)signIn:(SignInBlock)block {
20 NSDictionary *params = @{@"sid":CNUserShareModel.uid}; 39 NSDictionary *params = @{@"sid":CNUserShareModel.uid};
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.h
@@ -27,6 +27,9 @@ typedef NS_ENUM(NSInteger, CNLiveMineHeaderViewType) { @@ -27,6 +27,9 @@ typedef NS_ENUM(NSInteger, CNLiveMineHeaderViewType) {
27 @property (nonatomic, weak) id<CNLiveMineHeaderViewDelegate> delegate; 27 @property (nonatomic, weak) id<CNLiveMineHeaderViewDelegate> delegate;
28 @property (nonatomic, assign) BOOL interactionEnabled; 28 @property (nonatomic, assign) BOOL interactionEnabled;
29 @property (nonatomic, assign) BOOL isRefresh; 29 @property (nonatomic, assign) BOOL isRefresh;
  30 +
  31 +@property (nonatomic, strong) NSArray *certificationImages;
  32 +
30 - (void)layoutSubviews; 33 - (void)layoutSubviews;
31 34
32 @end 35 @end
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.m
@@ -148,6 +148,10 @@ static const NSInteger margin = 20; @@ -148,6 +148,10 @@ static const NSInteger margin = 20;
148 } 148 }
149 } 149 }
150 150
  151 +- (void)setCertificationImages:(NSArray *)certificationImages{
  152 + _certificationImages = certificationImages;
  153 + _certification.attributedText = [self createAttributedImages:certificationImages];
  154 +}
151 /* 155 /*
152 // Only override drawRect: if you perform custom drawing. 156 // Only override drawRect: if you perform custom drawing.
153 // An empty implementation adversely affects performance during animation. 157 // An empty implementation adversely affects performance during animation.
Example/CNLiveMineModule/CNLiveWebViewController.m
@@ -102,7 +102,6 @@ static const NSInteger margin = 10; @@ -102,7 +102,6 @@ static const NSInteger margin = 10;
102 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler{ 102 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler{
103 //允许跳转 103 //允许跳转
104 decisionHandler(WKNavigationActionPolicyAllow); 104 decisionHandler(WKNavigationActionPolicyAllow);
105 -  
106 } 105 }
107 106
108 // 页面开始加载时调用 107 // 页面开始加载时调用
@@ -131,7 +130,6 @@ static const NSInteger margin = 10; @@ -131,7 +130,6 @@ static const NSInteger margin = 10;
131 // 页面加载失败时调用 130 // 页面加载失败时调用
132 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(nonnull NSError *)error{ 131 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(nonnull NSError *)error{
133 NSLog(@"打印这个error%@",error); 132 NSLog(@"打印这个error%@",error);
134 -  
135 } 133 }
136 134
137 // 接收到服务器跳转请求之后调用(重定向) 135 // 接收到服务器跳转请求之后调用(重定向)
@@ -161,15 +159,6 @@ static const NSInteger margin = 10; @@ -161,15 +159,6 @@ static const NSInteger margin = 10;
161 } 159 }
162 } 160 }
163 161
164 -/*  
165 -#pragma mark - Navigation  
166 -  
167 -// In a storyboard-based application, you will often want to do a little preparation before navigation  
168 -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {  
169 - // Get the new view controller using [segue destinationViewController].  
170 - // Pass the selected object to the new view controller.  
171 -}  
172 -*/  
173 #pragma mark - KVO 162 #pragma mark - KVO
174 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context { 163 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
175 if ([keyPath isEqualToString:@"estimatedProgress"]) { 164 if ([keyPath isEqualToString:@"estimatedProgress"]) {
@@ -211,6 +200,17 @@ static const NSInteger margin = 10; @@ -211,6 +200,17 @@ static const NSInteger margin = 10;
211 200
212 } 201 }
213 } 202 }
  203 +
  204 +/*
  205 +#pragma mark - Navigation
  206 +
  207 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  208 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  209 + // Get the new view controller using [segue destinationViewController].
  210 + // Pass the selected object to the new view controller.
  211 +}
  212 +*/
  213 +
214 #pragma mark - 懒加载 214 #pragma mark - 懒加载
215 - (UIView *)navigationBar{ 215 - (UIView *)navigationBar{
216 if(!_navigationBar){ 216 if(!_navigationBar){