Commit 58835df82959f5746a9041fb366f1a11ca88ea79
1 parent
78024900
添加图片预览
Showing
16 changed files
with
340 additions
and
110 deletions
CNLiveCommuntyModule.podspec
| ... | ... | @@ -75,6 +75,8 @@ TODO: Add long description of the pod here. |
| 75 | 75 | s.dependency 'DSBaseModule' |
| 76 | 76 | # 自定义 UI |
| 77 | 77 | s.dependency 'CNLiveCustomUI' |
| 78 | + # 图片视频预览器 | |
| 79 | + s.dependency 'CNLivePhotoBrowser' | |
| 78 | 80 | # #输入控制器 |
| 79 | 81 | s.dependency 'CNLiveNewTripartiteManagement/IQKeyboardManager' |
| 80 | 82 | end | ... | ... |
CNLiveCommuntyModule/Classes/Core/CNLiveCommunitHeader.h
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | #import <JXPagingView/JXPagerView.h> |
| 17 | 17 | #import <Masonry/Masonry.h> |
| 18 | 18 | #import <YYText/YYText.h> |
| 19 | +#import <CNLivePhotoBrowser/CNLivePhotoBrowser.h> | |
| 19 | 20 | #import <CNLiveUploadManager/CNLiveUploadManager.h> |
| 20 | 21 | #import <CNLiveBusinessTools/CNLiveBusinessTools.h> |
| 21 | 22 | #import <CNLiveBusinessTools/CNLiveRespCacheManager.h> | ... | ... |
CNLiveCommuntyModule/Classes/Model/CNLiveCommuntyHomeModel.h
| ... | ... | @@ -158,6 +158,8 @@ NS_ASSUME_NONNULL_BEGIN |
| 158 | 158 | @property (nonatomic, copy) NSString *remark; |
| 159 | 159 | @property (nonatomic, copy) NSString *name; |
| 160 | 160 | @property (nonatomic, copy) NSString *mobile; |
| 161 | +@property (nonatomic, copy) NSString *img; | |
| 162 | +@property (nonatomic, strong) NSMutableArray *imgs; | |
| 161 | 163 | @property (nonatomic, strong) NSNumber *intentBeginTime; |
| 162 | 164 | @property (nonatomic, copy) NSString *intentBeginTimeString; |
| 163 | 165 | @property (nonatomic, strong) NSNumber *intentEndTime; | ... | ... |
CNLiveCommuntyModule/Classes/View/CNLiveCommuntSubView.h
| ... | ... | @@ -69,12 +69,18 @@ NS_ASSUME_NONNULL_BEGIN |
| 69 | 69 | /// @param index 点击的位置 |
| 70 | 70 | -(void)setCommuntSubInputTableViewWithSelectForIndex:(NSInteger)index; |
| 71 | 71 | |
| 72 | +/// 点击预览图片视频 | |
| 73 | +/// @param index 点击的位置 | |
| 74 | +-(void)setCommuntSubInputTableViewWithPreviewForIndex:(NSInteger)index ImageViews:(NSArray *)imageViews; | |
| 75 | + | |
| 72 | 76 | /// 点击删除图片视频 |
| 73 | 77 | /// @param image 点击的位置 |
| 74 | 78 | -(void)setCommuntSubInputTableViewWithDelectForImage:(UIImage *)image; |
| 75 | 79 | |
| 76 | 80 | @end |
| 77 | 81 | |
| 82 | + | |
| 83 | +typedef void(^ReloadInputViewWithBlock)(NSDictionary * paramDict,NSString * contentString); | |
| 78 | 84 | @interface CNLiveCommuntSubInputTableView : UITableViewCell<QMUITextViewDelegate,UITextFieldDelegate> |
| 79 | 85 | |
| 80 | 86 | @property (nonatomic, weak) id<CNLiveCommuntSubInputTableViewDelegate> delegate; |
| ... | ... | @@ -93,6 +99,8 @@ NS_ASSUME_NONNULL_BEGIN |
| 93 | 99 | @property (nonatomic, strong) UIButton * delectBtn02; |
| 94 | 100 | @property (nonatomic, strong) UIButton * delectBtn03; |
| 95 | 101 | |
| 102 | +@property (nonatomic, copy) ReloadInputViewWithBlock reloadBlock; | |
| 103 | + | |
| 96 | 104 | @property (nonatomic, strong) CNLiveCommuntCheckView * checkView_m; |
| 97 | 105 | @property (nonatomic, strong) CNLiveCommuntCheckView * checkView_w; |
| 98 | 106 | |
| ... | ... | @@ -103,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 103 | 111 | @property (nonatomic, assign) NSInteger index; |
| 104 | 112 | @property (nonatomic, copy) NSString * sex;//男 女 |
| 105 | 113 | |
| 106 | -+(CNLiveCommuntSubInputTableView *)setTableView:(UITableView *)tableView SubDict:(NSDictionary *)subDict indexs:(NSInteger)indexs UserInfo:(NSDictionary *)userInfo; | |
| 114 | ++(CNLiveCommuntSubInputTableView *)setTableView:(UITableView *)tableView SubDict:(NSDictionary *)subDict indexs:(NSInteger)indexs UserInfo:(NSDictionary *)userInfo ReloadBlock:(ReloadInputViewWithBlock)reloadBlock; | |
| 107 | 115 | |
| 108 | 116 | @end |
| 109 | 117 | ... | ... |
CNLiveCommuntyModule/Classes/View/CNLiveCommuntSubView.m
| ... | ... | @@ -575,14 +575,15 @@ |
| 575 | 575 | |
| 576 | 576 | @implementation CNLiveCommuntSubInputTableView |
| 577 | 577 | |
| 578 | -+(CNLiveCommuntSubInputTableView *)setTableView:(UITableView *)tableView SubDict:(NSDictionary *)subDict indexs:(NSInteger)indexs UserInfo:(nonnull NSDictionary *)userInfo | |
| 578 | ++(CNLiveCommuntSubInputTableView *)setTableView:(UITableView *)tableView SubDict:(NSDictionary *)subDict indexs:(NSInteger)indexs UserInfo:(nonnull NSDictionary *)userInfo ReloadBlock:(nonnull ReloadInputViewWithBlock)reloadBlock | |
| 579 | 579 | { |
| 580 | - CNLiveCommuntSubInputTableView * inputView = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"CNLiveCommuntSubInputTableView_%ld",(long)indexs]]; | |
| 580 | + CNLiveCommuntSubInputTableView * inputView = [tableView dequeueReusableCellWithIdentifier:@"CNLiveCommuntSubInputTableView"];//[NSString stringWithFormat:@"CNLiveCommuntSubInputTableView_%ld",(long)indexs]]; | |
| 581 | 581 | if (!inputView) { |
| 582 | - inputView = [[CNLiveCommuntSubInputTableView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[NSString stringWithFormat:@"CNLiveCommuntSubInputTableView_%ld",(long)indexs]]; | |
| 582 | + inputView = [[CNLiveCommuntSubInputTableView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CNLiveCommuntSubInputTableView"];//[NSString stringWithFormat:@"CNLiveCommuntSubInputTableView_%ld",(long)indexs]]; | |
| 583 | 583 | } |
| 584 | 584 | inputView.subDict = subDict; |
| 585 | 585 | if ([userInfo allValues].count > 0) inputView.userInfo = userInfo; |
| 586 | + inputView.reloadBlock = reloadBlock; | |
| 586 | 587 | return inputView; |
| 587 | 588 | } |
| 588 | 589 | -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier |
| ... | ... | @@ -627,6 +628,7 @@ |
| 627 | 628 | self.checkView_m.selectCenterView.hidden = [[userInfo stringValueForKey:@"gender" default:@""] isEqualToString:@"0"]; |
| 628 | 629 | self.checkView_w.selectCenterView.hidden = [[userInfo stringValueForKey:@"gender" default:@""] isEqualToString:@"1"]; |
| 629 | 630 | } |
| 631 | + | |
| 630 | 632 | -(void)setSubDict:(NSDictionary *)subDict |
| 631 | 633 | { |
| 632 | 634 | _subDict = subDict; |
| ... | ... | @@ -643,11 +645,17 @@ |
| 643 | 645 | self.contentField.keyboardType = [self.nameLabel.text isEqualToString:@"*年龄"]?UIKeyboardTypeNumberPad:UIKeyboardTypeDefault; |
| 644 | 646 | self.contentField.keyboardType = [self.nameLabel.text isEqualToString:@"*联系方式"]?UIKeyboardTypeNumberPad:UIKeyboardTypeDefault; |
| 645 | 647 | self.contentField.placeholder = [subDict stringValueForKey:@"placeholder" default:@""]; |
| 648 | + self.contentField.text = [subDict stringValueForKey:@"content" default:@""]; | |
| 646 | 649 | self.contentField.hidden = ![subDict boolValueForKey:@"isTextField" default:YES]; |
| 647 | 650 | self.descTextView.placeholder = [subDict stringValueForKey:@"placeholder" default:@""]; |
| 648 | 651 | self.descTextView.hidden = ![subDict boolValueForKey:@"isTextView" default:YES]; |
| 652 | + self.descTextView.text = [subDict stringValueForKey:@"content" default:@""]; | |
| 649 | 653 | self.moreButton.hidden = ![subDict boolValueForKey:@"isClick" default:YES]; |
| 650 | 654 | if ([subDict boolValueForKey:@"isClick" default:YES]) [self.moreButton setTitle:[subDict stringValueForKey:@"placeholder" default:@""] forState:UIControlStateNormal]; |
| 655 | + if ([[subDict stringValueForKey:@"content" default:@""] isNotBlank] && [subDict boolValueForKey:@"isClick" default:YES]) { | |
| 656 | + self.moreButton.hidden = ![[subDict stringValueForKey:@"content" default:@""] isNotBlank]; | |
| 657 | + [self.moreButton setTitle:[subDict stringValueForKey:@"content" default:@""] forState:UIControlStateNormal]; | |
| 658 | + } | |
| 651 | 659 | self.lineLabel.hidden = [subDict boolValueForKey:@"isImage" default:YES]; |
| 652 | 660 | self.lineLabel.hidden = [subDict boolValueForKey:@"isTextView" default:YES]; |
| 653 | 661 | |
| ... | ... | @@ -785,6 +793,7 @@ |
| 785 | 793 | [QMUITips showWithText:@"联系地址限制50个以内,超出将进行截取" inView:([UIApplication sharedApplication].delegate).window hideAfterDelay:1.5]; |
| 786 | 794 | textField.text = [textField.text substringAtRange:NSMakeRange(0, 50)]; |
| 787 | 795 | } |
| 796 | + if (self.reloadBlock) self.reloadBlock(self.subDict,textField.text); | |
| 788 | 797 | return YES; |
| 789 | 798 | } |
| 790 | 799 | #pragma mark = QMUITextViewDelegate = |
| ... | ... | @@ -801,6 +810,11 @@ |
| 801 | 810 | |
| 802 | 811 | [QMUITips showWithText:[NSString stringWithFormat:@"问题描述限制%@字以内", @(textView.maximumTextLength)] inView:([UIApplication sharedApplication].delegate).window hideAfterDelay:1.5]; |
| 803 | 812 | } |
| 813 | +- (BOOL)textViewShouldEndEditing:(UITextView *)textView | |
| 814 | +{ | |
| 815 | + if (self.reloadBlock) self.reloadBlock(self.subDict,textView.text); | |
| 816 | + return YES; | |
| 817 | +} | |
| 804 | 818 | - (BOOL)textViewShouldReturn:(QMUITextView *)textView |
| 805 | 819 | { |
| 806 | 820 | [textView resignFirstResponder]; |
| ... | ... | @@ -826,9 +840,17 @@ |
| 826 | 840 | } |
| 827 | 841 | -(void)selectWithImageViewForIndex:(NSInteger)index |
| 828 | 842 | { |
| 829 | - if (self.imageArray.count >= index + 1) return; | |
| 830 | - if ([self.delegate respondsToSelector:@selector(setCommuntSubInputTableViewWithSelectForIndex:)]) { | |
| 831 | - [self.delegate setCommuntSubInputTableViewWithSelectForIndex:index]; | |
| 843 | + if (self.imageArray.count >= index + 1) { | |
| 844 | + if ([self.delegate respondsToSelector:@selector(setCommuntSubInputTableViewWithPreviewForIndex: ImageViews:)]) { | |
| 845 | + NSArray * imageViews = @[self.imageView01]; | |
| 846 | + if (self.imageArray.count == 2) imageViews = @[self.imageView01,self.imageView02]; | |
| 847 | + if (self.imageArray.count == 3) imageViews = @[self.imageView01,self.imageView02,self.imageView03]; | |
| 848 | + [self.delegate setCommuntSubInputTableViewWithPreviewForIndex:index ImageViews:imageViews]; | |
| 849 | + } | |
| 850 | + } else { | |
| 851 | + if ([self.delegate respondsToSelector:@selector(setCommuntSubInputTableViewWithSelectForIndex:)]) { | |
| 852 | + [self.delegate setCommuntSubInputTableViewWithSelectForIndex:index]; | |
| 853 | + } | |
| 832 | 854 | } |
| 833 | 855 | } |
| 834 | 856 | -(void)checkMAction:(UIButton *)button | ... | ... |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntEvaluaViewController.m
| ... | ... | @@ -235,35 +235,43 @@ |
| 235 | 235 | } |
| 236 | 236 | -(void)selectWithImageViewForIndex:(NSInteger)index |
| 237 | 237 | { |
| 238 | - if (self.imageArray.count >= index + 1) return; | |
| 239 | - __weak typeof(self) weakSelf = self; | |
| 240 | - [self.view endEditing:YES]; | |
| 241 | - [self.view createAlertViewTitleArray:@[@"拍摄",@"从手机相册选择"] subTitleArr:@[@"",@""] textColor:UIColorMake(40, 40, 40) subTitleColor:UIColorMake(152, 152, 152) font:UIFontMake(15) subFont:UIFontMake(12) actionBlock:^(UIButton *button, NSInteger didRow) { | |
| 242 | - switch (didRow) { | |
| 243 | - case 0: | |
| 244 | - { | |
| 245 | - if (IOS14_SDK_ALLOWED) { | |
| 246 | - [weakSelf requestCNLiveALAssetsLibraryAuthorizationWithCompletion:^(BOOL isAuth) { | |
| 247 | - if (isAuth) { | |
| 248 | - dispatch_async_on_main_queue(^{ | |
| 249 | - [weakSelf takeToXFPhoto:index]; | |
| 250 | - }); | |
| 251 | - } | |
| 252 | - }]; | |
| 253 | - }else{ | |
| 254 | - [weakSelf takeToXFPhoto:index]; | |
| 238 | + if (self.imageArray.count >= index + 1) | |
| 239 | + { | |
| 240 | + NSArray * imageViews = @[self.imageView01]; | |
| 241 | + if (self.imageArray.count == 2) imageViews = @[self.imageView01,self.imageView02]; | |
| 242 | + if (self.imageArray.count == 3) imageViews = @[self.imageView01,self.imageView02,self.imageView03]; | |
| 243 | + [CNLivePhotoBrowser photoBrowserForDefultWithSourceViews:imageViews MediaURLArray:self.imageArray CurrentIndex:index ShowType:CNLivePhotoBrowserShowTypeImage Sheet:nil CompleterBlock:NULL]; | |
| 244 | + | |
| 245 | + }else{ | |
| 246 | + __weak typeof(self) weakSelf = self; | |
| 247 | + [self.view endEditing:YES]; | |
| 248 | + [self.view createAlertViewTitleArray:@[@"拍摄",@"从手机相册选择"] subTitleArr:@[@"",@""] textColor:UIColorMake(40, 40, 40) subTitleColor:UIColorMake(152, 152, 152) font:UIFontMake(15) subFont:UIFontMake(12) actionBlock:^(UIButton *button, NSInteger didRow) { | |
| 249 | + switch (didRow) { | |
| 250 | + case 0: | |
| 251 | + { | |
| 252 | + if (IOS14_SDK_ALLOWED) { | |
| 253 | + [weakSelf requestCNLiveALAssetsLibraryAuthorizationWithCompletion:^(BOOL isAuth) { | |
| 254 | + if (isAuth) { | |
| 255 | + dispatch_async_on_main_queue(^{ | |
| 256 | + [weakSelf takeToXFPhoto:index]; | |
| 257 | + }); | |
| 258 | + } | |
| 259 | + }]; | |
| 260 | + }else{ | |
| 261 | + [weakSelf takeToXFPhoto:index]; | |
| 262 | + } | |
| 255 | 263 | } |
| 264 | + break; | |
| 265 | + case 1: | |
| 266 | + { | |
| 267 | + [self pushTZImagePickerController:index]; | |
| 268 | + } | |
| 269 | + break; | |
| 270 | + default: | |
| 271 | + break; | |
| 256 | 272 | } |
| 257 | - break; | |
| 258 | - case 1: | |
| 259 | - { | |
| 260 | - [self pushTZImagePickerController:index]; | |
| 261 | - } | |
| 262 | - break; | |
| 263 | - default: | |
| 264 | - break; | |
| 265 | - } | |
| 266 | - }]; | |
| 273 | + }]; | |
| 274 | + } | |
| 267 | 275 | } |
| 268 | 276 | -(void)requestCNLiveALAssetsLibraryAuthorizationWithCompletion:(void(^)(BOOL isAuth))requestAssetsLibraryAuthCompletion |
| 269 | 277 | { | ... | ... |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntInformViewController.m
| ... | ... | @@ -13,6 +13,8 @@ |
| 13 | 13 | @property (nonatomic, strong) NSMutableArray * imageArray; |
| 14 | 14 | @property (nonatomic, strong) NSMutableArray * assetArray; |
| 15 | 15 | |
| 16 | +@property (nonatomic, strong) MBProgressHUD * progressHud; | |
| 17 | + | |
| 16 | 18 | @property (nonatomic, strong) NSMutableArray * cameraArray; |
| 17 | 19 | @property (nonatomic, strong) NSMutableArray * cameraAssetArray; |
| 18 | 20 | @property (nonatomic, strong) NSMutableArray * photoArray; |
| ... | ... | @@ -23,6 +25,7 @@ |
| 23 | 25 | @property (nonatomic, strong) CNLiveCommuntSubAlertTableView * typeView; |
| 24 | 26 | @property (nonatomic, strong) CNLiveCommuntSubAlertTableView * dateView; |
| 25 | 27 | @property (nonatomic, copy) NSString *project; |
| 28 | +@property (nonatomic, copy) NSString *projectString; | |
| 26 | 29 | @property (nonatomic, copy) NSString *timeString; |
| 27 | 30 | @property (nonatomic, copy) NSString *nbhdId; |
| 28 | 31 | @end |
| ... | ... | @@ -106,7 +109,7 @@ |
| 106 | 109 | @{@"name":@"报修项目",@"placeholder":@"请选择报修项目",@"isClick":@YES,@"isTextField":@NO,@"isTextView":@NO,@"isImage":@NO,@"isChick":@NO}, |
| 107 | 110 | @{@"name":@"上门时间",@"placeholder":@"请选择上门时间",@"isClick":@YES,@"isTextField":@NO,@"isTextView":@NO,@"isImage":@NO,@"isChick":@NO}, |
| 108 | 111 | @{@"name":@"问题描述",@"placeholder":@"您遇到什么问题,请留言",@"isClick":@NO,@"isTextField":@NO,@"isTextView":@YES,@"isImage":@NO,@"isChick":@NO}, |
| 109 | -// @{@"name":@"",@"placeholder":@"",@"isClick":@NO,@"isTextField":@NO,@"isTextView":@NO,@"isImage":@YES,@"isChick":@NO}, | |
| 112 | + @{@"name":@"",@"placeholder":@"",@"isClick":@NO,@"isTextField":@NO,@"isTextView":@NO,@"isImage":@YES,@"isChick":@NO}, | |
| 110 | 113 | ]]; |
| 111 | 114 | } |
| 112 | 115 | return _dataSource; |
| ... | ... | @@ -170,22 +173,13 @@ |
| 170 | 173 | } |
| 171 | 174 | -(void)submitRequestAction:(UIButton *)button |
| 172 | 175 | { |
| 176 | + NSArray * names = @[@"userName",@"address",@"phone",@"repairProject",@"time",@"remark",@""]; | |
| 173 | 177 | NSMutableDictionary * paramDict = [[NSMutableDictionary alloc] init]; |
| 174 | - for (int i = 0; i < 6; i ++) { | |
| 175 | - CNLiveCommuntSubInputTableView * userCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]]; | |
| 176 | - if (i == 0) [paramDict addString:[userCell.contentField.text isNotBlank]?userCell.contentField.text:@"" forKey:@"userName"]; | |
| 177 | - if (i == 1) [paramDict addString:[userCell.contentField.text isNotBlank]?userCell.contentField.text:@"" forKey:@"address"]; | |
| 178 | - if (i == 2) { | |
| 179 | - NSString * phone = [userCell.contentField.text isNotBlank]?userCell.contentField.text:@""; | |
| 180 | - if ([phone isNotBlank] && phone.length == 11) { | |
| 181 | - [paramDict addString:phone forKey:@"phone"]; | |
| 182 | - }else{ | |
| 183 | - [QMUITips showWithText:phone.length == 0 ? @"联系电话不能为空" : @"联系电话填写错误"]; | |
| 184 | - return; | |
| 185 | - } | |
| 186 | - } | |
| 187 | - if (i == 3) [paramDict addString:[self.project isNotBlank]?self.project:@"" forKey:@"repairProject"]; | |
| 188 | - if (i == 4) { | |
| 178 | + for (int i = 0; i < self.dataSource.count; i++) { | |
| 179 | + NSString * tempContent = [self.dataSource[i] stringValueForKey:@"content" default:@""]; | |
| 180 | + NSString * name = names[i]; | |
| 181 | + if ([name isEqualToString:@""]) break; | |
| 182 | + if ([name isEqualToString:@"time"]) { | |
| 189 | 183 | NSString * timeString = [self.timeString isNotBlank]?self.timeString:@""; |
| 190 | 184 | NSString * dayString = [timeString componentsSeparatedByString:@" "].firstObject; |
| 191 | 185 | NSString * startString = [[timeString componentsSeparatedByString:@" "].lastObject componentsSeparatedByString:@"~"].firstObject; |
| ... | ... | @@ -199,9 +193,59 @@ |
| 199 | 193 | [paramDict addString:@"" forKey:@"beginTime"]; |
| 200 | 194 | [paramDict addString:@"" forKey:@"endTime"]; |
| 201 | 195 | } |
| 196 | + }else if ([name isEqualToString:@"repairProject"]) { | |
| 197 | + [paramDict addString:[self.project isNotBlank]?self.project:@"" forKey:@"repairProject"]; | |
| 198 | + }else if ([name isEqualToString:@"phone"]) { | |
| 199 | + if ([tempContent isNotBlank] && tempContent.length == 11) { | |
| 200 | + [paramDict addString:tempContent forKey:@"phone"]; | |
| 201 | + }else{ | |
| 202 | + [QMUITips showWithText:tempContent.length == 0 ? @"联系电话不能为空" : @"联系电话填写错误"]; | |
| 203 | + return; | |
| 204 | + } | |
| 205 | + }else{ | |
| 206 | + [paramDict setObject:tempContent forKey:name]; | |
| 202 | 207 | } |
| 203 | - if (i == 5) [paramDict addString:[userCell.descTextView.text isNotBlank]?userCell.descTextView.text:@"" forKey:@"remark"]; | |
| 204 | 208 | } |
| 209 | +// for (int i = 0; i < 6; i ++) { | |
| 210 | +// CNLiveCommuntSubInputTableView * userCell = [self.tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"CNLiveCommuntSubInputTableView_%ld",(long)i]]; | |
| 211 | +// if (i == 0) { | |
| 212 | +// [paramDict addString:[userCell.contentField.text isNotBlank]?userCell.contentField.text:@"" forKey:@"userName"]; | |
| 213 | +// } | |
| 214 | +// if (i == 1) { | |
| 215 | +// [paramDict addString:[userCell.contentField.text isNotBlank]?userCell.contentField.text:@"" forKey:@"address"]; | |
| 216 | +// } | |
| 217 | +// if (i == 2) { | |
| 218 | +// NSString * phone = [userCell.contentField.text isNotBlank]?userCell.contentField.text:@""; | |
| 219 | +// if ([phone isNotBlank] && phone.length == 11) { | |
| 220 | +// [paramDict addString:phone forKey:@"phone"]; | |
| 221 | +// }else{ | |
| 222 | +// [QMUITips showWithText:phone.length == 0 ? @"联系电话不能为空" : @"联系电话填写错误"]; | |
| 223 | +// return; | |
| 224 | +// } | |
| 225 | +// } | |
| 226 | +// if (i == 3) { | |
| 227 | +// [paramDict addString:[self.project isNotBlank]?self.project:@"" forKey:@"repairProject"]; | |
| 228 | +// } | |
| 229 | +// if (i == 4) { | |
| 230 | +// NSString * timeString = [self.timeString isNotBlank]?self.timeString:@""; | |
| 231 | +// NSString * dayString = [timeString componentsSeparatedByString:@" "].firstObject; | |
| 232 | +// NSString * startString = [[timeString componentsSeparatedByString:@" "].lastObject componentsSeparatedByString:@"~"].firstObject; | |
| 233 | +// NSString * endString = [[timeString componentsSeparatedByString:@" "].lastObject componentsSeparatedByString:@"~"].lastObject; | |
| 234 | +// if ([startString isNotBlank] && [endString isNotBlank]) { | |
| 235 | +// NSString * temp_start_time = [NSString stringWithFormat:@"%@ %@:00",dayString,startString]; | |
| 236 | +// NSString * temp_end_time = [NSString stringWithFormat:@"%@ %@:00",dayString,endString]; | |
| 237 | +// [paramDict addString:[temp_start_time isNotBlank]?temp_start_time:@"" forKey:@"beginTime"]; | |
| 238 | +// [paramDict addString:[temp_end_time isNotBlank]?temp_end_time:@"" forKey:@"endTime"]; | |
| 239 | +// }else{ | |
| 240 | +// [paramDict addString:@"" forKey:@"beginTime"]; | |
| 241 | +// [paramDict addString:@"" forKey:@"endTime"]; | |
| 242 | +// } | |
| 243 | +// } | |
| 244 | +// if (i == 5) { | |
| 245 | +// [paramDict addString:[userCell.descTextView.text isNotBlank]?userCell.descTextView.text:@"" forKey:@"remark"]; | |
| 246 | +// } | |
| 247 | +// | |
| 248 | +// } | |
| 205 | 249 | if ([[paramDict allValues] containsObject:@""]) { |
| 206 | 250 | NSInteger index = [[paramDict allValues] indexOfObject:@""]; |
| 207 | 251 | NSString * key = [[paramDict allKeys] objectAtIndex:index]; |
| ... | ... | @@ -216,17 +260,82 @@ |
| 216 | 260 | } |
| 217 | 261 | } |
| 218 | 262 | __weak typeof(self) weakSelf = self; |
| 219 | - [CNLiveCommuntViewModel requestWithCommuntyHomeMaintenPushWithParamDict:paramDict nbhdId:self.nbhdId CompleterBlock:^(CNLiveCommuntyActivityMaintainsCreateModel * _Nonnull createModel) { | |
| 220 | - if (createModel) { | |
| 221 | - | |
| 222 | - CNLiveCommuntyOrderViewController * vc = [[CNLiveCommuntyOrderViewController alloc] initWithShowType:CNLiveCommuntyOrderShowTypeListYetOrder CreateModel:createModel]; | |
| 223 | - [weakSelf.navigationController pushViewController:vc animated:YES]; | |
| 263 | + if (self.imageArray.count == 0) { | |
| 264 | + [paramDict addString:@"" forKey:@"img"]; | |
| 265 | + [CNLiveCommuntViewModel requestWithCommuntyHomeMaintenPushWithParamDict:paramDict nbhdId:self.nbhdId CompleterBlock:^(CNLiveCommuntyActivityMaintainsCreateModel * _Nonnull createModel) { | |
| 266 | + if (createModel) { | |
| 267 | + | |
| 268 | + CNLiveCommuntyOrderViewController * vc = [[CNLiveCommuntyOrderViewController alloc] initWithShowType:CNLiveCommuntyOrderShowTypeListYetOrder CreateModel:createModel]; | |
| 269 | + [weakSelf.navigationController pushViewController:vc animated:YES]; | |
| 270 | + | |
| 271 | + #ifdef DEBUG | |
| 272 | + [[NSUserDefaults standardUserDefaults] setObject:createModel.idStr forKey:@"cmnt_id"]; | |
| 273 | + [[NSUserDefaults standardUserDefaults] synchronize]; | |
| 274 | + #else | |
| 275 | + #endif | |
| 276 | + } | |
| 277 | + }]; | |
| 278 | + }else{ | |
| 279 | + [self uploadImageWithCompleterBlock:^(NSString *imageUrl) { | |
| 280 | + [paramDict addString:imageUrl forKey:@"img"]; | |
| 281 | + [CNLiveCommuntViewModel requestWithCommuntyHomeMaintenPushWithParamDict:paramDict nbhdId:self.nbhdId CompleterBlock:^(CNLiveCommuntyActivityMaintainsCreateModel * _Nonnull createModel) { | |
| 282 | + if (createModel) { | |
| 224 | 283 | |
| 225 | -#ifdef DEBUG | |
| 226 | - [[NSUserDefaults standardUserDefaults] setObject:createModel.idStr forKey:@"cmnt_id"]; | |
| 227 | - [[NSUserDefaults standardUserDefaults] synchronize]; | |
| 228 | -#else | |
| 229 | -#endif | |
| 284 | + CNLiveCommuntyOrderViewController * vc = [[CNLiveCommuntyOrderViewController alloc] initWithShowType:CNLiveCommuntyOrderShowTypeListYetOrder CreateModel:createModel]; | |
| 285 | + [weakSelf.navigationController pushViewController:vc animated:YES]; | |
| 286 | + | |
| 287 | + #ifdef DEBUG | |
| 288 | + [[NSUserDefaults standardUserDefaults] setObject:createModel.idStr forKey:@"cmnt_id"]; | |
| 289 | + [[NSUserDefaults standardUserDefaults] synchronize]; | |
| 290 | + #else | |
| 291 | + #endif | |
| 292 | + } | |
| 293 | + }]; | |
| 294 | + }]; | |
| 295 | + } | |
| 296 | +} | |
| 297 | +-(void)uploadImageWithCompleterBlock:(void(^)(NSString * imageUrl))completerBlock | |
| 298 | +{ | |
| 299 | + __weak typeof(self) weakSelf = self; | |
| 300 | + NSDictionary *param = @{@"appId":AppId, | |
| 301 | + @"verb":@"POST", | |
| 302 | + @"storageType":@"2", | |
| 303 | + @"bucket":API_BucketName | |
| 304 | + }; | |
| 305 | + self.progressHud.hidden = NO; | |
| 306 | + self.progressHud.mode = MBProgressHUDModeIndeterminate; | |
| 307 | + self.progressHud.bezelView.backgroundColor = [UIColor blackColor]; | |
| 308 | + [CNLiveUploadManager uploadRequestType:CNLiveUploadTypeQN url:CNUploadAuthForApp dic:param imageArray:self.imageArray assetArray:self.assetArray isOriginal:NO limitType:AppPhototLimitTypeFriendsCircle progress:^(float progress) { | |
| 309 | + NSLog(@"上传进度测试:%.2f",progress); | |
| 310 | + weakSelf.progressHud.mode = MBProgressHUDModeDeterminate; | |
| 311 | + weakSelf.progressHud.label.text = @"上传图片中..."; | |
| 312 | + weakSelf.progressHud.bezelView.color = [UIColor colorWithWhite:0.95f alpha:0.6f]; | |
| 313 | + weakSelf.progressHud.detailsLabel.text = [NSString stringWithFormat:@"%.2f %%",(progress * 100)]; | |
| 314 | + } success:^(NSMutableArray *fileArray) { | |
| 315 | + NSLog(@"输出结果测试:%@",fileArray); | |
| 316 | + __block NSMutableString *picString = [[NSMutableString alloc] init]; | |
| 317 | + [fileArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | |
| 318 | + CNLiveUploadModel *model = fileArray[idx]; | |
| 319 | + if ([model.code isEqualToString:@"200"]) { | |
| 320 | + [picString appendString:model.imageUrl]; | |
| 321 | + if (fileArray.count != idx + 1) [picString appendString:@","]; | |
| 322 | + }else { | |
| 323 | + weakSelf.progressHud.hidden = YES; | |
| 324 | + weakSelf.progressHud = nil; | |
| 325 | + [QMUITips showError:model.info.error.localizedDescription inView:weakSelf.view hideAfterDelay:1.5f]; | |
| 326 | + } | |
| 327 | + }]; | |
| 328 | + weakSelf.progressHud.hidden = YES; | |
| 329 | + weakSelf.progressHud = nil; | |
| 330 | + if (completerBlock) completerBlock(picString); | |
| 331 | + } failure:^(NSMutableArray *errorArray, NSError *error) { | |
| 332 | + weakSelf.progressHud.hidden = YES; | |
| 333 | + weakSelf.progressHud = nil; | |
| 334 | + NSLog(@"输出结果测试:%@,错误:%@---%ld",errorArray,error,error.code); | |
| 335 | + if (error.code == 0) { | |
| 336 | + [QMUITips showError:@"上传失败" inView:[CNLiveCommuntTools cCommunt_currentViewController].view hideAfterDelay:1.5f]; | |
| 337 | + }else { | |
| 338 | + [QMUITips showWithText:error.localizedDescription inView:[CNLiveCommuntTools cCommunt_currentViewController].view hideAfterDelay:1.5]; | |
| 230 | 339 | } |
| 231 | 340 | }]; |
| 232 | 341 | } |
| ... | ... | @@ -241,7 +350,13 @@ |
| 241 | 350 | } |
| 242 | 351 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath |
| 243 | 352 | { |
| 244 | - CNLiveCommuntSubInputTableView * inpView = [CNLiveCommuntSubInputTableView setTableView:tableView SubDict:self.dataSource[indexPath.row] indexs:indexPath.row UserInfo:@{}]; | |
| 353 | + __weak typeof(self) weakSelf = self; | |
| 354 | + CNLiveCommuntSubInputTableView * inpView = [CNLiveCommuntSubInputTableView setTableView:tableView SubDict:self.dataSource[indexPath.row] indexs:indexPath.row UserInfo:@{} ReloadBlock:^(NSDictionary * _Nonnull paramDict, NSString * _Nonnull contentString) { | |
| 355 | + NSMutableDictionary * tempDict = [paramDict mutableCopy]; | |
| 356 | + [tempDict setObject:contentString forKey:@"content"]; | |
| 357 | + NSInteger index = [weakSelf.dataSource indexOfObject:paramDict]; | |
| 358 | + [weakSelf.dataSource replaceObjectAtIndex:index withObject:tempDict]; | |
| 359 | + }]; | |
| 245 | 360 | inpView.delegate = self; |
| 246 | 361 | inpView.imageArray = self.imageArray; |
| 247 | 362 | return inpView; |
| ... | ... | @@ -265,6 +380,10 @@ |
| 265 | 380 | [inpView.moreButton setTitle:content forState:UIControlStateNormal]; |
| 266 | 381 | [inpView.moreButton setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; |
| 267 | 382 | weakSelf.project = idStr; |
| 383 | + weakSelf.projectString = content; | |
| 384 | + NSMutableDictionary * tempDict = [[weakSelf.dataSource objectAtIndex:3] mutableCopy]; | |
| 385 | + [tempDict setObject:content forKey:@"content"]; | |
| 386 | + [weakSelf.dataSource replaceObjectAtIndex:3 withObject:tempDict]; | |
| 268 | 387 | }]; |
| 269 | 388 | }else{ |
| 270 | 389 | NSString * nb_info = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"%@%@",kCNLiveCommuntyNBhdInfoIdentifier,[CNUserInfoManager manager].userInfoModel.uid]]; |
| ... | ... | @@ -286,6 +405,9 @@ |
| 286 | 405 | [inpView.moreButton setTitle:content forState:UIControlStateNormal]; |
| 287 | 406 | [inpView.moreButton setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal]; |
| 288 | 407 | weakSelf.timeString = content; |
| 408 | + NSMutableDictionary * tempDict = [[weakSelf.dataSource objectAtIndex:4] mutableCopy]; | |
| 409 | + [tempDict setObject:content forKey:@"content"]; | |
| 410 | + [weakSelf.dataSource replaceObjectAtIndex:4 withObject:tempDict]; | |
| 289 | 411 | }]; |
| 290 | 412 | }]; |
| 291 | 413 | } |
| ... | ... | @@ -300,6 +422,10 @@ |
| 300 | 422 | [self.tableView reloadData]; |
| 301 | 423 | } |
| 302 | 424 | } |
| 425 | +-(void)setCommuntSubInputTableViewWithPreviewForIndex:(NSInteger)index ImageViews:(nonnull NSArray *)imageViews | |
| 426 | +{ | |
| 427 | + [CNLivePhotoBrowser photoBrowserForDefultWithSourceViews:imageViews MediaURLArray:self.imageArray CurrentIndex:index ShowType:CNLivePhotoBrowserShowTypeImage Sheet:nil CompleterBlock:NULL]; | |
| 428 | +} | |
| 303 | 429 | /// 点击选择图片视频 |
| 304 | 430 | /// @param index 点击的位置 |
| 305 | 431 | -(void)setCommuntSubInputTableViewWithSelectForIndex:(NSInteger)index |
| ... | ... | @@ -357,23 +483,22 @@ |
| 357 | 483 | { |
| 358 | 484 | __weak typeof(self) weakSelf = self; |
| 359 | 485 | XFCameraController *cameraController = [[XFCameraController alloc] init]; |
| 360 | - cameraController.isCanShootVideo = YES; | |
| 361 | -// cameraController.outPutPath = [CNLiveBusinessTools chatFilePathByUserId:[IMAPlatform sharedInstance].host.userId]; | |
| 486 | + cameraController.isCanShootVideo = NO; | |
| 362 | 487 | cameraController.modalPresentationStyle = UIModalPresentationFullScreen; |
| 363 | 488 | __weak XFCameraController *weakCameraController = cameraController; |
| 364 | - cameraController.zxshootCompletionBlock = ^(PHAsset *asset, NSURL *videoUrl, CGFloat videoTimeLength, UIImage *thumbnailImage, NSError *error) { | |
| 365 | - if (!error) { | |
| 366 | - dispatch_async_on_main_queue(^{ | |
| 367 | - [weakCameraController dismissViewControllerAnimated:YES completion:^{ | |
| 368 | - [weakSelf.videoArray removeAllObjects]; | |
| 369 | - [weakSelf.videoAssetArray removeAllObjects]; | |
| 370 | - [weakSelf.videoArray addObject:thumbnailImage]; | |
| 371 | - [weakSelf.videoAssetArray addObject:asset]; | |
| 372 | - [weakSelf.tableView reloadData]; | |
| 373 | - }]; | |
| 374 | - }); | |
| 375 | - } | |
| 376 | - }; | |
| 489 | +// cameraController.zxshootCompletionBlock = ^(PHAsset *asset, NSURL *videoUrl, CGFloat videoTimeLength, UIImage *thumbnailImage, NSError *error) { | |
| 490 | +// if (!error) { | |
| 491 | +// dispatch_async_on_main_queue(^{ | |
| 492 | +// [weakCameraController dismissViewControllerAnimated:YES completion:^{ | |
| 493 | +// [weakSelf.videoArray removeAllObjects]; | |
| 494 | +// [weakSelf.videoAssetArray removeAllObjects]; | |
| 495 | +// [weakSelf.videoArray addObject:thumbnailImage]; | |
| 496 | +// [weakSelf.videoAssetArray addObject:asset]; | |
| 497 | +// [weakSelf.tableView reloadData]; | |
| 498 | +// }]; | |
| 499 | +// }); | |
| 500 | +// } | |
| 501 | +// }; | |
| 377 | 502 | cameraController.takePhotosCompletionBlock = ^(UIImage *image, NSError *error) { |
| 378 | 503 | if (!error) { |
| 379 | 504 | NSMutableArray *imageIds = [NSMutableArray array]; |
| ... | ... | @@ -389,19 +514,20 @@ |
| 389 | 514 | PHFetchResult *result = [PHAsset fetchAssetsWithLocalIdentifiers:imageIds options:nil]; |
| 390 | 515 | [result enumerateObjectsUsingBlock:^(PHAsset * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { |
| 391 | 516 | dispatch_async_on_main_queue(^{ |
| 392 | - [weakCameraController dismissViewControllerAnimated:YES completion:^{ | |
| 393 | - [weakSelf.imageArray removeObject:weakSelf.cameraArray.firstObject]; | |
| 394 | - [weakSelf.assetArray removeObject:weakSelf.cameraAssetArray.firstObject]; | |
| 395 | - | |
| 396 | - [weakSelf.cameraAssetArray removeAllObjects]; | |
| 397 | - [weakSelf.cameraArray removeAllObjects]; | |
| 398 | - [weakSelf.cameraAssetArray addObject:obj]; | |
| 399 | - [weakSelf.cameraArray addObject:image]; | |
| 517 | +// [weakSelf.imageArray removeObject:weakSelf.cameraArray.firstObject]; | |
| 518 | +// [weakSelf.assetArray removeObject:weakSelf.cameraAssetArray.firstObject]; | |
| 519 | +// | |
| 520 | +// [weakSelf.cameraAssetArray removeAllObjects]; | |
| 521 | +// [weakSelf.cameraArray removeAllObjects]; | |
| 522 | +// [weakSelf.cameraAssetArray addObject:obj]; | |
| 523 | +// [weakSelf.cameraArray addObject:image]; | |
| 524 | +// | |
| 525 | +// [weakSelf.imageArray addObject:image]; | |
| 526 | +// [weakSelf.assetArray addObject:obj]; | |
| 400 | 527 | |
| 401 | - [weakSelf.imageArray addObject:image]; | |
| 402 | - [weakSelf.assetArray addObject:obj]; | |
| 403 | - [weakSelf.tableView reloadData]; | |
| 404 | - }]; | |
| 528 | + [weakSelf.imageArray addObjectsFromArray:@[image]]; | |
| 529 | + [weakSelf.assetArray addObjectsFromArray:@[obj]]; | |
| 530 | + [weakSelf.tableView reloadData]; | |
| 405 | 531 | }); |
| 406 | 532 | }]; |
| 407 | 533 | } |
| ... | ... | @@ -442,4 +568,13 @@ |
| 442 | 568 | |
| 443 | 569 | [self.tableView reloadData]; |
| 444 | 570 | } |
| 571 | +- (MBProgressHUD *)progressHud { | |
| 572 | + if (!_progressHud) { | |
| 573 | + _progressHud= [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES]; | |
| 574 | + _progressHud.mode = MBProgressHUDModeDeterminate; | |
| 575 | + _progressHud.animationType = MBProgressHUDAnimationZoomIn; | |
| 576 | + _progressHud.bezelView.backgroundColor = [UIColor blackColor]; | |
| 577 | + } | |
| 578 | + return _progressHud; | |
| 579 | +} | |
| 445 | 580 | @end | ... | ... |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntListViewController.m
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | #import "CNLiveCommuntSignUpViewController.h" |
| 11 | 11 | @interface CNLiveCommuntListViewController ()<DZNEmptyDataSetSource,DZNEmptyDataSetDelegate> |
| 12 | 12 | @property (nonatomic, assign) CNLiveCommuntListShowType showType; |
| 13 | -@property (nonatomic, strong) CNLiveRefreshFooter * footerView; | |
| 13 | +@property (nonatomic, strong) MJRefreshAutoNormalFooter * footerView; | |
| 14 | 14 | @property (nonatomic, strong) NSMutableArray * dataArray; |
| 15 | 15 | @property (nonatomic, strong) NSIndexPath * selectIndexPath; |
| 16 | 16 | @property (nonatomic, copy) NSString * nbhdId; |
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | weakSelf.page = 1; |
| 64 | 64 | [weakSelf loadDataSourceWithPage:1 nbhdId:weakSelf.nbhdId index:weakSelf.index CompleterBlock:NULL]; |
| 65 | 65 | }]; |
| 66 | - self.footerView = [CNLiveRefreshFooter footerWithRefreshingBlock:^{ | |
| 66 | + self.footerView = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{ | |
| 67 | 67 | weakSelf.page ++; |
| 68 | 68 | [weakSelf loadDataSourceWithPage:weakSelf.page nbhdId:weakSelf.nbhdId index:weakSelf.index CompleterBlock:NULL]; |
| 69 | 69 | }]; |
| ... | ... | @@ -81,11 +81,11 @@ |
| 81 | 81 | [weakSelf.tableView.mj_footer endRefreshing]; |
| 82 | 82 | if (isLastPage) [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData]; |
| 83 | 83 | if (page == 1 && weakSelf.dataArray.count == 0 && weakSelf.tableView.mj_footer) weakSelf.tableView.mj_footer = nil; |
| 84 | - if (weakSelf.selectIndexPath) { | |
| 85 | - BOOL isEnough = weakSelf.dataArray.count <= weakSelf.selectIndexPath.row; | |
| 86 | - if (!isEnough) weakSelf.selectIndexPath = [NSIndexPath indexPathForRow:0 inSection:0]; | |
| 87 | - [weakSelf.tableView scrollToRowAtIndexPath:weakSelf.selectIndexPath atScrollPosition:isEnough?UITableViewScrollPositionNone:UITableViewScrollPositionTop animated:NO]; | |
| 88 | - } | |
| 84 | +// if (weakSelf.selectIndexPath) { | |
| 85 | +// BOOL isEnough = weakSelf.dataArray.count <= weakSelf.selectIndexPath.row; | |
| 86 | +// if (!isEnough) weakSelf.selectIndexPath = [NSIndexPath indexPathForRow:0 inSection:0]; | |
| 87 | +// [weakSelf.tableView scrollToRowAtIndexPath:weakSelf.selectIndexPath atScrollPosition:isEnough?UITableViewScrollPositionNone:UITableViewScrollPositionTop animated:NO]; | |
| 88 | +// } | |
| 89 | 89 | }]; |
| 90 | 90 | } |
| 91 | 91 | ... | ... |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntViewController.m
| ... | ... | @@ -72,10 +72,17 @@ |
| 72 | 72 | [weakSelf addChildViewController:vc noralImage:nomal_image selectImage:select_image]; |
| 73 | 73 | }else{ |
| 74 | 74 | if ([homeModel.type isEqualToString:@"3"]) {//生活服务界面 原生 |
| 75 | - CNLiveCommuntServiceViewController * vc = [[CNLiveCommuntServiceViewController alloc] initWithHomeModel:homeModel isRootVC:YES isShowLocation:YES]; | |
| 76 | - vc.title = homeModel.columnName; | |
| 77 | - vc.view.backgroundColor = [UIColor whiteColor]; | |
| 78 | - [weakSelf addChildViewController:vc noralImage:nomal_image selectImage:select_image]; | |
| 75 | + if ([homeModel.cmsPageType isEqualToString:@"4"]) { | |
| 76 | + CNLiveCommuntActiviViewController * vc = [[CNLiveCommuntActiviViewController alloc] initWithWebUrl:homeModel.cmsPageUrl isRootVC:YES Type:@"1"]; | |
| 77 | + vc.title = homeModel.columnName; | |
| 78 | + vc.view.backgroundColor = [UIColor whiteColor]; | |
| 79 | + [weakSelf addChildViewController:vc noralImage:nomal_image selectImage:select_image]; | |
| 80 | + }else{ | |
| 81 | + CNLiveCommuntServiceViewController * vc = [[CNLiveCommuntServiceViewController alloc] initWithHomeModel:homeModel isRootVC:YES isShowLocation:YES]; | |
| 82 | + vc.title = homeModel.columnName; | |
| 83 | + vc.view.backgroundColor = [UIColor whiteColor]; | |
| 84 | + [weakSelf addChildViewController:vc noralImage:nomal_image selectImage:select_image]; | |
| 85 | + } | |
| 79 | 86 | } |
| 80 | 87 | if ([homeModel.type isEqualToString:@"2"]) { |
| 81 | 88 | CNLiveCommuntListViewController * vc = [[CNLiveCommuntListViewController alloc] initWithShowType:CNLiveCommuntListShowTypeHome NBhdId:homeModel.idStr]; |
| ... | ... | @@ -107,8 +114,14 @@ |
| 107 | 114 | }]; |
| 108 | 115 | } |
| 109 | 116 | }else{ |
| 110 | - [QMUITips hideAllTipsInView:weakSelf.view]; | |
| 111 | - [weakSelf.navigationController popViewControllerAnimated:YES]; | |
| 117 | + NSString * nb_info = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"%@%@",kCNLiveCommuntyNBhdInfoIdentifier,[CNUserInfoManager manager].userInfoModel.uid]]; | |
| 118 | + if ([nb_info isNotBlank]) { | |
| 119 | + CNLiveCommuntyHomeListViewController * listView = [[CNLiveCommuntyHomeListViewController alloc] init]; | |
| 120 | + [weakSelf.navigationController dsPushViewController:listView animated:YES]; | |
| 121 | + }else{ | |
| 122 | + [QMUITips hideAllTipsInView:weakSelf.view]; | |
| 123 | + [weakSelf.navigationController popViewControllerAnimated:YES]; | |
| 124 | + } | |
| 112 | 125 | } |
| 113 | 126 | }]; |
| 114 | 127 | } | ... | ... |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntyOrderViewController.m
| ... | ... | @@ -432,26 +432,49 @@ |
| 432 | 432 | } |
| 433 | 433 | -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section |
| 434 | 434 | { |
| 435 | - return section == 0 || ((self.showType == CNLiveCommuntyOrderShowTypeListReadyOrder || self.showType == CNLiveCommuntyOrderShowTypeListYetOrder || self.showType == CNLiveCommuntyOrderShowTypeListFailureOrder) && section == 1) || (self.showType == CNLiveCommuntyOrderShowTypeListCompletOrder && section == 2) ? 10 : 0; | |
| 435 | + CGFloat height = section == 0 && self.createMdoel.imgs.count > 0 ? (kScreenWidth - 60)/3 + 20 : 10; | |
| 436 | + return section == 0 || ((self.showType == CNLiveCommuntyOrderShowTypeListReadyOrder || self.showType == CNLiveCommuntyOrderShowTypeListYetOrder || self.showType == CNLiveCommuntyOrderShowTypeListFailureOrder) && section == 1) || (self.showType == CNLiveCommuntyOrderShowTypeListCompletOrder && section == 2) ? height : 0; | |
| 436 | 437 | } |
| 437 | 438 | -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section |
| 438 | 439 | { |
| 440 | + CGFloat height = section == 0 && self.createMdoel.imgs.count > 0 ? (kScreenWidth - 60)/3 + 20 : 10; | |
| 439 | 441 | if (section == 0 || ((self.showType == CNLiveCommuntyOrderShowTypeListReadyOrder || self.showType == CNLiveCommuntyOrderShowTypeListYetOrder || self.showType == CNLiveCommuntyOrderShowTypeListFailureOrder) && section == 1) || (self.showType == CNLiveCommuntyOrderShowTypeListCompletOrder && section == 2)) { |
| 440 | - UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)]; | |
| 442 | + UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)]; | |
| 441 | 443 | view.backgroundColor = [UIColor clearColor]; |
| 442 | 444 | |
| 443 | - UIView * radiusView = [[UIView alloc] initWithFrame:CGRectMake(10, 0, kScreenWidth - 20, 10)]; | |
| 445 | + UIView * radiusView = [[UIView alloc] initWithFrame:CGRectMake(10, 0, kScreenWidth - 20, height)]; | |
| 444 | 446 | radiusView.backgroundColor = [UIColor whiteColor]; |
| 445 | 447 | radiusView.layer.shadowColor = [UIColor blackColor].CGColor; |
| 446 | 448 | radiusView.layer.shadowOffset = CGSizeMake(0, 0); |
| 447 | 449 | radiusView.layer.shadowOpacity = 0.3; |
| 448 | 450 | radiusView.layer.shadowRadius = 10; |
| 449 | - UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_WIDTH - 20, 10) byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)]; | |
| 451 | + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_WIDTH - 20, height) byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)]; | |
| 450 | 452 | CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; |
| 451 | 453 | maskLayer.path = maskPath.CGPath; |
| 452 | 454 | radiusView.layer.mask = maskLayer; |
| 453 | 455 | [view insertSubview:radiusView belowSubview:view]; |
| 454 | - | |
| 456 | + | |
| 457 | + if (section == 0 && self.createMdoel.imgs.count > 0) { | |
| 458 | + CGFloat itemW = (kScreenWidth - 60)/3; | |
| 459 | + __block NSMutableArray * tempArray = [[NSMutableArray alloc] init]; | |
| 460 | + for (int i = 0; i < self.createMdoel.imgs.count; i++) { | |
| 461 | + UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20 + (i * (itemW + 10)), 10, itemW, itemW)]; | |
| 462 | + imageView.backgroundColor = UIColorHex(#f9f9f9); | |
| 463 | + imageView.tag = 1000 + i; | |
| 464 | + imageView.layer.cornerRadius = 7; | |
| 465 | + imageView.layer.masksToBounds = YES; | |
| 466 | + imageView.contentMode = UIViewContentModeScaleAspectFill; | |
| 467 | + [imageView setUserInteractionEnabled:YES]; | |
| 468 | + [imageView sd_setImageWithURL:[NSURL URLWithString:self.createMdoel.imgs[i]] placeholderImage:[UIImage imageWithColor:UIColorHex(#f9f9f9)]]; | |
| 469 | + __weak typeof(self) weakSelf = self; | |
| 470 | + [imageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithActionBlock:^(UITapGestureRecognizer * _Nonnull sender) { | |
| 471 | + UIImageView * imageView = (UIImageView *)sender.view; | |
| 472 | + [CNLivePhotoBrowser photoBrowserForDefultWithSourceViews:tempArray MediaURLArray:weakSelf.createMdoel.imgs CurrentIndex:imageView.tag - 1000 ShowType:CNLivePhotoBrowserShowTypeImage Sheet:nil CompleterBlock:NULL]; | |
| 473 | + }]]; | |
| 474 | + [view addSubview:imageView]; | |
| 475 | + [tempArray addObject:imageView]; | |
| 476 | + } | |
| 477 | + } | |
| 455 | 478 | return view; |
| 456 | 479 | }else{ |
| 457 | 480 | return nil; | ... | ... |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntyUserEditViewController.m
| ... | ... | @@ -157,7 +157,9 @@ |
| 157 | 157 | } |
| 158 | 158 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath |
| 159 | 159 | { |
| 160 | - CNLiveCommuntSubInputTableView * inpView = [CNLiveCommuntSubInputTableView setTableView:tableView SubDict:self.dataSource[indexPath.row] indexs:indexPath.row UserInfo:self.userDict]; | |
| 160 | + CNLiveCommuntSubInputTableView * inpView = [CNLiveCommuntSubInputTableView setTableView:tableView SubDict:self.dataSource[indexPath.row] indexs:indexPath.row UserInfo:self.userDict ReloadBlock:^(NSDictionary * _Nonnull paramDict, NSString * _Nonnull contentString) { | |
| 161 | + | |
| 162 | + }]; | |
| 161 | 163 | return inpView; |
| 162 | 164 | } |
| 163 | 165 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | ... | ... |
CNLiveCommuntyModule/Classes/ViewModel/CNLiveCommuntViewModel.m
| ... | ... | @@ -71,6 +71,8 @@ |
| 71 | 71 | if (tempArray.count > 0) { |
| 72 | 72 | if (completerBlock) completerBlock(tempArray); |
| 73 | 73 | }else{ |
| 74 | + [[NSUserDefaults standardUserDefaults] setObject:@"" forKey:[NSString stringWithFormat:@"%@%@",kCNLiveCommuntyNBhdInfoIdentifier,[CNUserInfoManager manager].userInfoModel.uid]]; | |
| 75 | + [[NSUserDefaults standardUserDefaults] synchronize]; | |
| 74 | 76 | if (completerBlock) completerBlock(nil); |
| 75 | 77 | } |
| 76 | 78 | }else{ |
| ... | ... | @@ -286,6 +288,8 @@ |
| 286 | 288 | [CNLiveCommuntViewModel communty_chooseRequestWithResponseObject:responseObject Error:error isData:YES CompleterBlock:^(id responseObject) { |
| 287 | 289 | if (responseObject) { |
| 288 | 290 | CNLiveCommuntyActivityMaintainsCreateModel * createModel = [CNLiveCommuntyActivityMaintainsCreateModel mj_objectWithKeyValues:responseObject]; |
| 291 | + createModel.imgs = [createModel.img componentsSeparatedByString:@","].mutableCopy; | |
| 292 | + [createModel.imgs removeObject:@""]; | |
| 289 | 293 | if (createModel.showType == 1 && [createModel.repairId isNotBlank] && ![createModel.userId isEqualToString:createModel.repairId]) createModel.showType = 0; |
| 290 | 294 | if (isChat && createModel.showType == 0) createModel.showType = 4; |
| 291 | 295 | if (isChat && createModel.showType == 1) createModel.showType = 5; | ... | ... |
Example/CNLiveCommuntyModule.xcodeproj/project.pbxproj
| ... | ... | @@ -366,10 +366,12 @@ |
| 366 | 366 | inputPaths = ( |
| 367 | 367 | "${PODS_ROOT}/Target Support Files/Pods-CNLiveCommuntyModule_Example/Pods-CNLiveCommuntyModule_Example-resources.sh", |
| 368 | 368 | "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveCommuntyModule/CNLiveCommuntyModule.bundle", |
| 369 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLivePhotoBrowser/CNLivePhotoBrowser.bundle", | |
| 369 | 370 | ); |
| 370 | 371 | name = "[CP] Copy Pods Resources"; |
| 371 | 372 | outputPaths = ( |
| 372 | 373 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveCommuntyModule.bundle", |
| 374 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLivePhotoBrowser.bundle", | |
| 373 | 375 | ); |
| 374 | 376 | runOnlyForDeploymentPostprocessing = 0; |
| 375 | 377 | shellPath = /bin/sh; |
| ... | ... | @@ -401,6 +403,7 @@ |
| 401 | 403 | "${BUILT_PRODUCTS_DIR}/DSBaseModule/DSBaseModule.framework", |
| 402 | 404 | "${BUILT_PRODUCTS_DIR}/DSGTMBase64/DSGTMBase64.framework", |
| 403 | 405 | "${BUILT_PRODUCTS_DIR}/DZNEmptyDataSet/DZNEmptyDataSet.framework", |
| 406 | + "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", | |
| 404 | 407 | "${BUILT_PRODUCTS_DIR}/HappyDNS/HappyDNS.framework", |
| 405 | 408 | "${BUILT_PRODUCTS_DIR}/IQKeyboardManager/IQKeyboardManager.framework", |
| 406 | 409 | "${BUILT_PRODUCTS_DIR}/JXCategoryView/JXCategoryView.framework", |
| ... | ... | @@ -415,6 +418,7 @@ |
| 415 | 418 | "${BUILT_PRODUCTS_DIR}/SDAutoLayout/SDAutoLayout.framework", |
| 416 | 419 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", |
| 417 | 420 | "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", |
| 421 | + "${BUILT_PRODUCTS_DIR}/YBImageBrowser/YBImageBrowser.framework", | |
| 418 | 422 | "${BUILT_PRODUCTS_DIR}/YYAsyncLayer/YYAsyncLayer.framework", |
| 419 | 423 | "${BUILT_PRODUCTS_DIR}/YYCache/YYCache.framework", |
| 420 | 424 | "${BUILT_PRODUCTS_DIR}/YYCategories/YYCategories.framework", |
| ... | ... | @@ -445,6 +449,7 @@ |
| 445 | 449 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DSBaseModule.framework", |
| 446 | 450 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DSGTMBase64.framework", |
| 447 | 451 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DZNEmptyDataSet.framework", |
| 452 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework", | |
| 448 | 453 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HappyDNS.framework", |
| 449 | 454 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardManager.framework", |
| 450 | 455 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JXCategoryView.framework", |
| ... | ... | @@ -459,6 +464,7 @@ |
| 459 | 464 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDAutoLayout.framework", |
| 460 | 465 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", |
| 461 | 466 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", |
| 467 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YBImageBrowser.framework", | |
| 462 | 468 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYAsyncLayer.framework", |
| 463 | 469 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYCache.framework", |
| 464 | 470 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYCategories.framework", | ... | ... |
Example/CNLiveCommuntyModule/CNLIVEAppDelegate.m
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | [IQKeyboardManager sharedManager].enable = YES; |
| 25 | 25 | [IQKeyboardManager sharedManager].enableAutoToolbar = YES; |
| 26 | 26 | |
| 27 | - [CNUserInfoManager manager].userInfoModel.uid = @"10458139";//@"145680";//@"10458139";//@"145680";//@"395098";//@"10545988";//@"353001";//@"353417";//@"10511059";//@"10537318";//@"10499533";//@"11973842";//@"1342671" | |
| 27 | + [CNUserInfoManager manager].userInfoModel.uid = @"145680";//@"10458139";//@"11174272";//@"145680";//@"395098";//@"10545988";//@"353001";//@"353417";//@"10511059";//@"10537318";//@"10499533";//@"11973842";//@"1342671" | |
| 28 | 28 | |
| 29 | 29 | // [[NSUserDefaults standardUserDefaults] setObject:@"38" forKey:@"kCNLiveCommuntyNBhdIdIdentifier"]; |
| 30 | 30 | // [[NSUserDefaults standardUserDefaults] synchronize]; | ... | ... |
Example/CNLiveCommuntyModule/CNLIVEViewController.m
| ... | ... | @@ -148,6 +148,10 @@ |
| 148 | 148 | if ([cmnt_id isNotBlank]) { |
| 149 | 149 | CNLiveCommuntyOrderViewController * orderVC = [[CNLiveCommuntyOrderViewController alloc] initWithMaintenId:cmnt_id]; |
| 150 | 150 | [self.navigationController pushViewController:orderVC animated:YES]; |
| 151 | + }else{ | |
| 152 | + | |
| 153 | + CNLiveCommuntyOrderViewController * orderVC = [[CNLiveCommuntyOrderViewController alloc] initWithMaintenId:@"cmnt2022032232427862564"]; | |
| 154 | + [self.navigationController pushViewController:orderVC animated:YES]; | |
| 151 | 155 | } |
| 152 | 156 | |
| 153 | 157 | } | ... | ... |
Example/CNLiveCommuntyModule/main.m
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | int main(int argc, char * argv[]) |
| 13 | 13 | { |
| 14 | 14 | @autoreleasepool { |
| 15 | - [CNLiveEnvironmentManager setAppType:CNLiveAppTypeUser environmentType:CNLiveProductionAppStore];//CNLiveDebugAppStore]; | |
| 15 | + [CNLiveEnvironmentManager setAppType:CNLiveAppTypeUser environmentType:CNLiveDebugAppStore];//CNLiveProductionAppStore//CNLiveDebugAppStore]; | |
| 16 | 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CNLIVEAppDelegate class])); |
| 17 | 17 | } |
| 18 | 18 | } | ... | ... |