Commit 1d81a8e82b9c7b7d87fa6c80c64f17bf1db21988

Authored by iOS-Xiaowen
1 parent c3ad1bee

no message

CNLiveBUserAgreement/Classes/CNLiveUserAgreementController.m
... ... @@ -16,11 +16,12 @@
16 16 #import "TZImagePickerController.h"
17 17 #import <CNLiveRequestBastKit/CNLiveNetworking.h>
18 18 #import "CNLiveManager.h"
  19 +#import "CNLiveEnvironment.h"
19 20  
20 21 #import "CNLiveWebView.h"
21 22  
22 23 @interface CNLiveUserAgreementController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate>
23   -@property (nonatomic, strong) NSMutableArray * images;
  24 +@property (nonatomic, strong) NSMutableArray *images;
24 25  
25 26 @end
26 27  
... ... @@ -73,7 +74,7 @@
73 74 modeltype = [data objectForKey:@"modeltype"];
74 75 }
75 76 if (weakSelf.images.count > 0) {
76   -// [weakSelf getimgToken];
  77 + [weakSelf getToken];
77 78 } else {
78 79 NSArray *array = [NSArray array];
79 80 id data = @{ @"images": array };
... ... @@ -212,4 +213,25 @@
212 213  
213 214 }
214 215  
  216 +// 获取图片的token
  217 +- (void)getToken {
  218 + NSDictionary *param = @{@"appId":AppId,
  219 + @"verb":@"POST",
  220 + @"storageType":@"2",
  221 + @"bucket":API_BucketName
  222 + };
  223 + [QMUITips showLoading:@"正在提交" inView:self.view];
  224 + [CNLiveNetworking setAllowRequestDefaultArgument:NO];
  225 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNUploadAuthForApp Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  226 + NSMutableDictionary *data = [NSMutableDictionary dictionaryWithDictionary:responseObject[@"data"]];
  227 + NSDictionary *dic = (NSDictionary *)data;
  228 + if (!error && dic[@"token"]) {
  229 + // [self QNStartUploadWithtoken:dic[@"token"]];
  230 + }else {
  231 + [QMUITips hideAllToastInView:self.view animated:YES];
  232 + [QMUITips showError:error.localizedDescription inView:self.view hideAfterDelay:1.5];
  233 + }
  234 + }];
  235 +}
  236 +
215 237 @end
... ...
Example/CNLiveBUserAgreement/CNLIVEViewController.m
... ... @@ -32,7 +32,7 @@
32 32 }
33 33  
34 34 - (void)testButtonClicked {
35   - [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementHelp];
  35 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementComplaints];
36 36  
37 37 }
38 38  
... ...