Commit 0355bbc0303739d48d8abe22d27b04ccdaed76fa
1 parent
e97fc403
0.0.8
Showing
12 changed files
with
65 additions
and
15 deletions
CNLiveCommunitModule.podspec
CNLiveCommunitModule/Classes/Core/CNLiveCommunitHeader.h
| ... | ... | @@ -59,5 +59,5 @@ |
| 59 | 59 | |
| 60 | 60 | static NSString *const kCNLiveCommuntyNBhdIdIdentifier = @"kCNLiveCommuntyNBhdIdIdentifier"; |
| 61 | 61 | static NSString *const kCNLiveCommuntyNBhdNameIdentifier = @"kCNLiveCommuntyNBhdNameIdentifier"; |
| 62 | - | |
| 62 | +static NSString *const kCNLiveCommuntyNBhdPhoneIdentifier = @"kCNLiveCommuntyNBhdPhoneIdentifier"; | |
| 63 | 63 | #endif /* CNLiveCommunitHeader_h */ | ... | ... |
CNLiveCommunitModule/Classes/Model/CNLiveCommuntyHomeModel.h
| ... | ... | @@ -51,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 51 | 51 | @property (nonatomic, copy) NSString *name; |
| 52 | 52 | @property (nonatomic, copy) NSString *locality; |
| 53 | 53 | @property (nonatomic, copy) NSString *address; |
| 54 | +@property (nonatomic, copy) NSString *propertyPhone; | |
| 54 | 55 | @end |
| 55 | 56 | |
| 56 | 57 | @interface CNLiveCommuntyActivityHomeListModel : NSObject | ... | ... |
CNLiveCommunitModule/Classes/Model/CNLiveCommuntyHomeModel.m
| ... | ... | @@ -126,6 +126,9 @@ MJCodingImplementation |
| 126 | 126 | self.imgUrl = oldValue; |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | + if ([oldValue isNotBlank] && [property.name isEqualToString:@"amount"]) { | |
| 130 | + oldValue = [NSString stringWithFormat:@"%.2f",[oldValue floatValue]/100]; | |
| 131 | + } | |
| 129 | 132 | return oldValue; |
| 130 | 133 | } |
| 131 | 134 | |
| ... | ... | @@ -366,6 +369,9 @@ MJCodingImplementation |
| 366 | 369 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; |
| 367 | 370 | self.signupEndTimeString = [dateFormatter stringFromDate:detaildate]; |
| 368 | 371 | } |
| 372 | + if ([oldValue isNotBlank] && [property.name isEqualToString:@"unitPrice"]) { | |
| 373 | + oldValue = [NSString stringWithFormat:@"%.2f",[oldValue floatValue]/100]; | |
| 374 | + } | |
| 369 | 375 | return oldValue; |
| 370 | 376 | } |
| 371 | 377 | |
| ... | ... | @@ -542,6 +548,9 @@ MJCodingImplementation |
| 542 | 548 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; |
| 543 | 549 | self.updateTimeString = [dateFormatter stringFromDate:detaildate]; |
| 544 | 550 | } |
| 551 | + if ([oldValue isNotBlank] && [property.name isEqualToString:@"unitPrice"]) { | |
| 552 | + oldValue = [NSString stringWithFormat:@"%.2f",[oldValue floatValue]/100]; | |
| 553 | + } | |
| 545 | 554 | } |
| 546 | 555 | |
| 547 | 556 | return oldValue; | ... | ... |
CNLiveCommunitModule/Classes/View/CNLiveCommuntSignUpView.h
| ... | ... | @@ -69,9 +69,10 @@ NS_ASSUME_NONNULL_BEGIN |
| 69 | 69 | @property (nonatomic, strong) UILabel * cententLabel; |
| 70 | 70 | @property (nonatomic, strong) WKWebView * webView; |
| 71 | 71 | |
| 72 | +@property (nonatomic, copy) void(^reloadWebViewBlock)(CGFloat viewHeight); | |
| 72 | 73 | @property (nonatomic, copy) NSString * desc; |
| 73 | 74 | |
| 74 | -+(CNLiveCommuntSignUpTextViewCell *)setTableView:(UITableView *)tableView Desc:(NSString *)desc; | |
| 75 | ++(CNLiveCommuntSignUpTextViewCell *)setTableView:(UITableView *)tableView Desc:(NSString *)desc ReloadWebViewBlock:(void(^)(CGFloat viewHeight))reloadWebViewBlock; | |
| 75 | 76 | @end |
| 76 | 77 | |
| 77 | 78 | @interface CNLiveCommuntSignUpOrderViewCell : UITableViewCell | ... | ... |
CNLiveCommunitModule/Classes/View/CNLiveCommuntSignUpView.m
| ... | ... | @@ -357,12 +357,13 @@ |
| 357 | 357 | |
| 358 | 358 | @implementation CNLiveCommuntSignUpTextViewCell |
| 359 | 359 | |
| 360 | -+(CNLiveCommuntSignUpTextViewCell *)setTableView:(UITableView *)tableView Desc:(nonnull NSString *)desc | |
| 360 | ++(CNLiveCommuntSignUpTextViewCell *)setTableView:(UITableView *)tableView Desc:(nonnull NSString *)desc ReloadWebViewBlock:(nonnull void (^)(CGFloat))reloadWebViewBlock | |
| 361 | 361 | { |
| 362 | 362 | CNLiveCommuntSignUpTextViewCell * textCell = [tableView dequeueReusableCellWithIdentifier:@"CNLiveCommuntSignUpTextViewCell"]; |
| 363 | 363 | if (!textCell) { |
| 364 | 364 | textCell = [[CNLiveCommuntSignUpTextViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CNLiveCommuntSignUpTextViewCell"]; |
| 365 | 365 | } |
| 366 | + textCell.reloadWebViewBlock = reloadWebViewBlock; | |
| 366 | 367 | textCell.desc = desc; |
| 367 | 368 | return textCell; |
| 368 | 369 | } |
| ... | ... | @@ -417,7 +418,7 @@ |
| 417 | 418 | _webView.allowsBackForwardNavigationGestures = NO;//打开网页间的 滑动返回 |
| 418 | 419 | _webView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal; |
| 419 | 420 | if (@available(iOS 9.0, *)) _webView.allowsLinkPreview = NO; |
| 420 | - | |
| 421 | + _webView.scrollView.bounces = NO; | |
| 421 | 422 | } |
| 422 | 423 | return _webView; |
| 423 | 424 | } |
| ... | ... | @@ -851,7 +852,16 @@ |
| 851 | 852 | [_phoneButton setImage:[CNLiveCommuntTools cCommunt_setImageWithName:@"c_communty_order_phone"] forState:UIControlStateNormal]; |
| 852 | 853 | [_phoneButton setImage:[CNLiveCommuntTools cCommunt_setImageWithName:@"c_communty_order_phone"] forState:UIControlStateHighlighted]; |
| 853 | 854 | } |
| 854 | - | |
| 855 | +} | |
| 856 | +-(void)phoneAction | |
| 857 | +{ | |
| 858 | + UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; | |
| 859 | + [alert addAction:[UIAlertAction actionWithTitle:self.createModel.mobile style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | |
| 860 | + NSMutableString* str = [[NSMutableString alloc] initWithFormat:@"tel:%@",self.createModel.mobile]; | |
| 861 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:NULL]; | |
| 862 | + }]]; | |
| 863 | + [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:NULL]]; | |
| 864 | + [[self displayViewController] presentViewController:alert animated:YES completion:nil]; | |
| 855 | 865 | } |
| 856 | 866 | -(void)layoutSubviews |
| 857 | 867 | { |
| ... | ... | @@ -905,6 +915,7 @@ |
| 905 | 915 | _phoneButton.titleLabel.font = [UIFont boldSystemFontOfSize:12]; |
| 906 | 916 | _phoneButton.imagePosition = QMUIButtonImagePositionLeft; |
| 907 | 917 | _phoneButton.spacingBetweenImageAndTitle = 3; |
| 918 | + [_phoneButton addTarget:self action:@selector(phoneAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 908 | 919 | } |
| 909 | 920 | return _phoneButton; |
| 910 | 921 | } | ... | ... |
CNLiveCommunitModule/Classes/View/CNLiveCommuntSubView.m
| ... | ... | @@ -723,7 +723,7 @@ |
| 723 | 723 | { |
| 724 | 724 | NSString * name = [self.subDict stringValueForKey:@"name" default:@""]; |
| 725 | 725 | if ([name isEqualToString:@"联系人"] && textField.text.length > 15) { |
| 726 | - [QMUITips showWithText:@"联系人限制20个以内,超出将进行截取" inView:([UIApplication sharedApplication].delegate).window hideAfterDelay:1.5]; | |
| 726 | + [QMUITips showWithText:@"联系人限制15个以内,超出将进行截取" inView:([UIApplication sharedApplication].delegate).window hideAfterDelay:1.5]; | |
| 727 | 727 | textField.text = [textField.text substringAtRange:NSMakeRange(0, 15)]; |
| 728 | 728 | } |
| 729 | 729 | if ([name isEqualToString:@"联系地址"] && textField.text.length > 50) { | ... | ... |
CNLiveCommunitModule/Classes/ViewController/CNLiveCommuntInformViewController.m
| ... | ... | @@ -103,7 +103,9 @@ |
| 103 | 103 | } |
| 104 | 104 | -(UIView *)setTableViewFooterView |
| 105 | 105 | { |
| 106 | - UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 90)]; | |
| 106 | + NSString * phone = [[NSUserDefaults standardUserDefaults] objectForKey:kCNLiveCommuntyNBhdPhoneIdentifier]; | |
| 107 | + | |
| 108 | + UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, [phone isNotBlank]?90:70)]; | |
| 107 | 109 | footerView.backgroundColor = [UIColor whiteColor]; |
| 108 | 110 | |
| 109 | 111 | YYLabel * phoneLabel = [[YYLabel alloc] initWithFrame:CGRectMake(0, 5, kScreenWidth, 20)]; |
| ... | ... | @@ -111,18 +113,25 @@ |
| 111 | 113 | phoneLabel.textAlignment = NSTextAlignmentCenter; |
| 112 | 114 | phoneLabel.textVerticalAlignment = YYTextVerticalAlignmentCenter; |
| 113 | 115 | phoneLabel.numberOfLines = 0; |
| 116 | + phoneLabel.hidden = ![phone isNotBlank]; | |
| 114 | 117 | phoneLabel.backgroundColor = [UIColor whiteColor]; |
| 115 | - | |
| 116 | - NSString * string = @"您也可以拨打物业电话 400-9001933"; | |
| 118 | + | |
| 119 | + NSString * string = [NSString stringWithFormat:@"您也可以拨打物业电话 %@",phone]; | |
| 117 | 120 | NSMutableAttributedString *textAttributedString = [[NSMutableAttributedString alloc] initWithString:string]; |
| 118 | 121 | textAttributedString.yy_font = [UIFont systemFontOfSize:10]; |
| 119 | 122 | textAttributedString.yy_color = UIColorHex(#B4B4B4); |
| 120 | 123 | textAttributedString.yy_alignment = NSTextAlignmentCenter; |
| 121 | - [textAttributedString yy_setTextHighlightRange:[string rangeOfString:@"400-9001933"] | |
| 124 | + [textAttributedString yy_setTextHighlightRange:[string rangeOfString:phone] | |
| 122 | 125 | color:[UIColor qmui_colorWithHexString:@"0091FF"] |
| 123 | 126 | backgroundColor:[UIColor qmui_colorWithHexString:@"0091FF"] |
| 124 | 127 | tapAction:^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect){ |
| 125 | - NSLog(@"点击电话了"); | |
| 128 | + UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; | |
| 129 | + [alert addAction:[UIAlertAction actionWithTitle:phone style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | |
| 130 | + NSMutableString* str = [[NSMutableString alloc] initWithFormat:@"tel:%@",phone]; | |
| 131 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:NULL]; | |
| 132 | + }]]; | |
| 133 | + [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:NULL]]; | |
| 134 | + [[self displayViewController] presentViewController:alert animated:YES completion:nil]; | |
| 126 | 135 | }]; |
| 127 | 136 | phoneLabel.attributedText = textAttributedString; |
| 128 | 137 | [footerView addSubview:phoneLabel]; | ... | ... |
CNLiveCommunitModule/Classes/ViewController/CNLiveCommuntSignUpViewController.m
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | @property (nonatomic, strong) CNLiveCommuntyActivityDetailModel * detailModel; |
| 12 | 12 | @property (nonatomic, strong) NSMutableArray * userArray; |
| 13 | 13 | @property (nonatomic, copy) NSString * activityId; |
| 14 | +@property (nonatomic, assign) CGFloat viewHeight; | |
| 14 | 15 | @end |
| 15 | 16 | |
| 16 | 17 | @implementation CNLiveCommuntSignUpViewController |
| ... | ... | @@ -21,6 +22,7 @@ |
| 21 | 22 | { |
| 22 | 23 | self = [super initWithStyle:style]; |
| 23 | 24 | if (self) { |
| 25 | + _viewHeight = 0.0; | |
| 24 | 26 | _activityId = activityId; |
| 25 | 27 | } |
| 26 | 28 | return self; |
| ... | ... | @@ -160,7 +162,7 @@ |
| 160 | 162 | CNLiveCommuntyResultViewController * resultVC = [[CNLiveCommuntyResultViewController alloc] initWithSignUpModel:signUpModel activityId:handworkId]; |
| 161 | 163 | [weakSelf.navigationController pushViewController:resultVC animated:YES]; |
| 162 | 164 | }else{ |
| 163 | - [[CNLiveCommuntyModule shareInstance].protocol pushMainProjectWithPayManagerWithOrderId:signUpModel.order.idStr price:weakSelf.detailModel.unitPrice body:weakSelf.detailModel.name]; | |
| 165 | + [[CNLiveCommuntyModule shareInstance].protocol pushMainProjectWithPayManagerWithOrderId:signUpModel.order.idStr price:[NSString stringWithFormat:@"%.2f",(weakSelf.userArray.count * [weakSelf.detailModel.unitPrice floatValue])] body:weakSelf.detailModel.name]; | |
| 164 | 166 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(payResultSuccessNNotification:) name:@"kIMAMSG_CommunityPaySuccessNotification" object:nil]; |
| 165 | 167 | } |
| 166 | 168 | }]; |
| ... | ... | @@ -226,7 +228,11 @@ |
| 226 | 228 | userView.delegate = self; |
| 227 | 229 | return userView; |
| 228 | 230 | }else{ |
| 229 | - return [CNLiveCommuntSignUpTextViewCell setTableView:tableView Desc:self.detailModel.processDesc]; | |
| 231 | + __weak typeof(self) weakSelf = self; | |
| 232 | + return [CNLiveCommuntSignUpTextViewCell setTableView:tableView Desc:self.detailModel.processDesc ReloadWebViewBlock:^(CGFloat viewHeight) { | |
| 233 | + weakSelf.viewHeight = viewHeight; | |
| 234 | + [weakSelf.tableView reloadData]; | |
| 235 | + }]; | |
| 230 | 236 | } |
| 231 | 237 | } |
| 232 | 238 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | ... | ... |
CNLiveCommunitModule/Classes/ViewController/CNLiveCommuntyHomeListViewController.m
| ... | ... | @@ -141,6 +141,8 @@ |
| 141 | 141 | [[NSUserDefaults standardUserDefaults] synchronize]; |
| 142 | 142 | [[NSUserDefaults standardUserDefaults] setObject:listModel.name forKey:kCNLiveCommuntyNBhdNameIdentifier]; |
| 143 | 143 | [[NSUserDefaults standardUserDefaults] synchronize]; |
| 144 | + [[NSUserDefaults standardUserDefaults] setObject:listModel.propertyPhone forKey:kCNLiveCommuntyNBhdPhoneIdentifier]; | |
| 145 | + [[NSUserDefaults standardUserDefaults] synchronize]; | |
| 144 | 146 | CNLiveCommuntViewController * homeView = [[CNLiveCommuntViewController alloc] initWithNBhdId:listModel.idStr]; |
| 145 | 147 | [self.navigationController pushViewController:homeView animated:YES]; |
| 146 | 148 | ... | ... |
CNLiveCommunitModule/Classes/ViewController/CNLiveCommuntyOrderViewController.m
| ... | ... | @@ -161,7 +161,13 @@ |
| 161 | 161 | { |
| 162 | 162 | MJWeakSelf |
| 163 | 163 | if ([button.titleLabel.text isEqualToString:@"咨询电话"]) { |
| 164 | - | |
| 164 | + UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; | |
| 165 | + [alert addAction:[UIAlertAction actionWithTitle:self.createMdoel.phone style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | |
| 166 | + NSMutableString* str = [[NSMutableString alloc] initWithFormat:@"tel:%@",self.createMdoel.phone]; | |
| 167 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:NULL]; | |
| 168 | + }]]; | |
| 169 | + [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:NULL]]; | |
| 170 | + [[self displayViewController] presentViewController:alert animated:YES completion:nil]; | |
| 165 | 171 | } |
| 166 | 172 | if ([button.titleLabel.text isEqualToString:@"取消订单"]) { |
| 167 | 173 | [CNLiveCommuntSignUpView showAlertViewWithMessage:@"确定取消订单后,此订单将失效" CompleterBlock:^{ | ... | ... |
Example/CNLiveCommunitModule/CNLIVEViewController.m
| ... | ... | @@ -78,6 +78,11 @@ |
| 78 | 78 | if (array.count != idx+1) [picString appendString:@","]; |
| 79 | 79 | }]; |
| 80 | 80 | NSLog(@"===>%@",picString); |
| 81 | + NSString * oldValue = @"1"; | |
| 82 | + oldValue = [NSString stringWithFormat:@"%.2f",[oldValue floatValue]/100]; | |
| 83 | + float unitPrice = [oldValue floatValue]; | |
| 84 | + NSString * p = [NSString stringWithFormat:@"合计: ¥%.2f",(8 * unitPrice)]; | |
| 85 | + NSLog(@"%@ =>%f ==>%@",oldValue,unitPrice,p); | |
| 81 | 86 | } |
| 82 | 87 | |
| 83 | 88 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | ... | ... |