ProfileModule.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. //
  2. // ProfileModule.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2021/7/30.
  6. //
  7. #import "ProfileModule.h"
  8. /// VIP价格路径
  9. NSString * const RQVipPricePath = @"vip_price";
  10. /// 销售价格路径
  11. NSString * const RQVipPriceOriginalPath = @"vip_price_original";
  12. /// XXX路径
  13. NSString * const RQButtonSwitchOriginalPath = @"button_switch";
  14. /// 线上路径
  15. NSString * const RQOnlineVersionPath = @"Online_Version";
  16. /// 题库更新路径
  17. NSString * const RQUpdateDbOriginalPaDth = @"update_db";
  18. /// app图标是否更改
  19. NSString * const RQSDJKAPPICONNEEDCHANGEPath = @"SDJK_APP_ICON_NEED_CHANGE";
  20. /// VIP类型
  21. NSString * const RQVipTypePath = @"sd_package";
  22. @interface RQAlertTextField : UITextField
  23. @end
  24. @implementation RQAlertTextField
  25. - (CGRect)leftViewRectForBounds:(CGRect)bounds {
  26. CGRect iconRect = [super leftViewRectForBounds:bounds];
  27. iconRect.origin.x += 12; //像右边偏12
  28. return iconRect;
  29. }
  30. //UITextField 文字与输入框的距离
  31. - (CGRect)textRectForBounds:(CGRect)bounds {
  32. return CGRectInset(bounds, 35, 0);
  33. }
  34. //控制文本的位置
  35. - (CGRect)editingRectForBounds:(CGRect)bounds {
  36. return CGRectInset(bounds, 35, 0);
  37. }
  38. @end
  39. @implementation ProfileModule
  40. @def_singleton(ProfileModule);
  41. - (void)rq_ActivateVIPAlertWithComplete:(VoidBlock_Bool)complete {
  42. // if (DEBUG) {
  43. // [[RQ_HTTP_Service getVipCodeList] subscribeNext:^(id _Nullable x) {
  44. //
  45. // }];
  46. // }
  47. SCLAlertView *alert = [[SCLAlertView alloc] initWithNewWindowWidth:RQ_SCREEN_WIDTH - 80.f];
  48. @weakify(alert)
  49. [alert removeTopCircle];
  50. alert.tintTopCircle = NO;
  51. alert.useLargerIcon = NO;
  52. alert.shouldDismissOnTapOutside = YES;
  53. alert.iconTintColor = RQ_MAIN_COLOR;
  54. alert.cornerRadius = 10;
  55. alert.labelTitle.textColor = RQ_MAIN_TEXT_COLOR_1;
  56. alert.labelTitle.font = [UIFont boldSystemFontOfSize:20.f];
  57. [alert.labelTitle mas_remakeConstraints:^(MASConstraintMaker *make) {
  58. make.top.mas_offset(20);
  59. make.centerX.mas_offset(0);
  60. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH/3.f, 21.f));
  61. }];
  62. QMUIButton *leftBtn = [[QMUIButton alloc] qmui_initWithImage:nil title:@"激活码开通"];
  63. QMUIButton *rightBtn = [[QMUIButton alloc] qmui_initWithImage:nil title:@"邀请码绑定"];
  64. [alert addCustomView:leftBtn];
  65. [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.top.mas_equalTo(alert.labelTitle.mas_bottom).mas_offset(20);
  67. make.left.mas_offset(16);
  68. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH/3.f, 21.f));
  69. }];
  70. [alert addCustomView:rightBtn];
  71. [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.top.mas_equalTo(alert.labelTitle.mas_bottom).mas_offset(20);
  73. make.right.mas_offset(-16);
  74. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH/3.f, 21.f));
  75. }];
  76. alert.viewText.textColor = RQ_MAIN_TEXT_COLOR_3;
  77. alert.viewText.font = [UIFont systemFontOfSize:16.f];
  78. [alert.viewText mas_remakeConstraints:^(MASConstraintMaker *make) {
  79. make.top.mas_equalTo(leftBtn.mas_bottom).mas_offset(20);
  80. make.left.mas_offset(16);
  81. make.right.mas_offset(-16);
  82. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 32.f, 36.f));
  83. }];
  84. UIImageView *textFieldBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageWithColor:RQ_LIST_BACKGROUNDCOLOR]];
  85. [alert addCustomView:textFieldBgImageView];
  86. [textFieldBgImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
  87. make.top.mas_equalTo(alert.viewText.mas_bottom).mas_offset(20);
  88. make.centerX.mas_offset(0);
  89. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 40.f, 30.f));
  90. textFieldBgImageView.layer.cornerRadius = 15;
  91. textFieldBgImageView.layer.borderWidth = 1;
  92. textFieldBgImageView.layer.borderColor = RQ_MAIN_LINE_COLOR_1.CGColor;
  93. textFieldBgImageView.layer.masksToBounds = YES;
  94. }];
  95. RQAlertTextField *textField = [[RQAlertTextField alloc] initWithFrame:CGRectMake(0, 0, 250, 30)];
  96. textField.backgroundColor = UIColor.clearColor;
  97. textField.borderStyle = UITextBorderStyleNone;
  98. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
  99. UIImageView *imageView = [[UIImageView alloc]initWithImage:RQImageNamed(@"activationIcon")];
  100. imageView.center = leftView.center;
  101. [leftView addSubview:imageView];
  102. textField.leftView = imageView;
  103. textField.leftViewMode = UITextFieldViewModeAlways; //此处用来设置leftview现实时机
  104. textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
  105. textField.placeholder = @"请输入激活码";
  106. textField.tintColor = [UIColor colorWithHexString:@"#BFBFBF"];
  107. textField.textColor = RQ_MAIN_TEXT_COLOR_3;
  108. textField.font = [UIFont systemFontOfSize:16];
  109. [alert addCustomTextField:textField];
  110. [textField mas_remakeConstraints:^(MASConstraintMaker *make) {
  111. make.top.mas_equalTo(alert.viewText.mas_bottom).mas_offset(20);
  112. make.centerX.mas_offset(0);
  113. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 40.f, 30.f));
  114. }];
  115. SCLButton *activateBtn = [alert addButton:@"立即开通" validationBlock:^BOOL{
  116. @strongify(alert)
  117. if (textField.text.length <= 0) {
  118. [MBProgressHUD rq_showTips:@"请输入激活码" addedToView:alert.view];
  119. }
  120. return textField.text.length > 0;
  121. } actionBlock:^{
  122. [[RQ_HTTP_Service putVipCodeWithVipCode:textField.text] subscribeNext:^(RQBaseModel *baseModel) {
  123. [RQ_CACHE_MANAGER removeCacheWithPath:RQ_GET_VipInfo parameters:nil];
  124. [RQ_USER_MANAGER isVipWithComplete:^(NSInteger isVip) {
  125. if (complete) {
  126. complete(isVip);
  127. }
  128. if (isVip > 0) {
  129. [MBProgressHUD rq_showTips:@"购买VIP成功"];
  130. } else {
  131. [MBProgressHUD rq_showTips:@"VIP激活中!请稍等片刻!!!"];
  132. }
  133. }];
  134. } error:^(NSError * _Nullable error) {
  135. [MBProgressHUD rq_showErrorTips:error];
  136. }];
  137. }];
  138. activateBtn.buttonFormatBlock = ^NSDictionary* (void) {
  139. NSMutableDictionary *buttonConfig = [[NSMutableDictionary alloc] init];
  140. buttonConfig[@"cornerRadius"] = @"20.f";
  141. buttonConfig[@"backgroundColor"] = RQ_MAIN_COLOR;
  142. buttonConfig[@"textColor"] = RQ_MAIN_TEXT_COLOR_WHITE;
  143. buttonConfig[@"font"] = [UIFont systemFontOfSize:16];
  144. return buttonConfig;
  145. };
  146. [activateBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  147. make.top.mas_equalTo(textField.mas_bottom).mas_offset(20);
  148. make.right.mas_offset(-36.f);
  149. make.size.mas_equalTo(CGSizeMake((RQ_SCREEN_WIDTH - 80.f - 40.f - 15.f - 72.f) * (1.f / 2.f), 40.f));
  150. }];
  151. UILabel *noteLabel = [[UILabel alloc] init];
  152. noteLabel.font = [UIFont systemFontOfSize:16.f];
  153. noteLabel.textColor = RQ_MAIN_TEXT_COLOR_3;
  154. noteLabel.textAlignment = NSTextAlignmentCenter;
  155. noteLabel.text = @"速达驾考";
  156. [alert addCustomView:noteLabel];
  157. [noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  158. make.top.mas_equalTo(activateBtn.mas_bottom).mas_offset(20);
  159. make.centerX.mas_offset(0);
  160. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 40.f, 21.f));
  161. make.bottom.mas_offset(-26);
  162. }];
  163. SCLButton *closeButton = [alert addButton:@"" actionBlock:^{
  164. @strongify(alert);
  165. [alert hideView];
  166. if (complete) {
  167. complete(NO);
  168. }
  169. }];
  170. closeButton.imageEdgeInsets = UIEdgeInsetsMake(6, 6, 6, 6);
  171. [closeButton setImage:RQImageNamed(@"close") forState:UIControlStateNormal];
  172. [closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
  173. make.top.mas_offset(14);
  174. make.right.mas_offset(-14);
  175. make.size.mas_equalTo(CGSizeMake(30.f, 30.f));
  176. }];
  177. alert.showAnimationType = SCLAlertViewShowAnimationFadeIn;
  178. [alert showTitle:@"提示" subTitle:@"您还未开通系统,请输入激活码开通!" style:SCLAlertViewStyleCustom closeButtonTitle:nil duration:0.f];
  179. }
  180. - (void)showVIPAlertWithComplete:(VoidBlock_Bool)complete {
  181. QMUIDialogViewController *dialogViewController = [[QMUIDialogViewController alloc] init];
  182. dialogViewController.headerSeparatorColor = nil;
  183. dialogViewController.headerViewBackgroundColor = UIColor.whiteColor;
  184. NSString *message = @"您还未开通系统,请输入激活码开通!";
  185. CGFloat textHeight = [message heightForFont:RQRegularFont_16 width:RQ_SCREEN_WIDTH - 80.f - 32.f] + 16 > RQ_SCREEN_HEIGHT / 2.f? RQ_SCREEN_HEIGHT / 2.f : [message heightForFont:RQRegularFont_16 width:RQ_SCREEN_WIDTH - 80.f - 32.f] + 16;
  186. dialogViewController.headerViewHeight = (24.f + 22.f + 16.f + textHeight + 16.f) + 57.f + 13.f;
  187. QMUILabel *titleLabel = [[QMUILabel alloc] qmui_initWithFont:RQSemiboldFont(20) textColor:[UIColor qmui_colorWithHexString:@"#040B26"]];
  188. titleLabel.text = @"提示";
  189. titleLabel.textAlignment = NSTextAlignmentCenter;
  190. [dialogViewController.headerView addSubview:titleLabel];
  191. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  192. make.top.mas_equalTo(dialogViewController.headerView.mas_top).mas_offset(24);
  193. make.centerX.mas_offset(0);
  194. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f, 22.f));
  195. }];
  196. QMUIButton *leftBtn = [[QMUIButton alloc] qmui_initWithImage:nil title:@"激活码开通"];
  197. [leftBtn setTitleColor:RQ_MAIN_TEXT_COLOR_2 forState:UIControlStateNormal];
  198. [leftBtn setTitleColor:RQ_MAIN_COLOR forState:UIControlStateSelected];
  199. [leftBtn setSelected:YES];
  200. // QMUIButton *rightBtn = [[QMUIButton alloc] qmui_initWithImage:nil title:@"邀请码绑定"];
  201. // [rightBtn setTitleColor:RQ_MAIN_TEXT_COLOR_2 forState:UIControlStateNormal];
  202. // [rightBtn setTitleColor:RQ_MAIN_COLOR forState:UIControlStateSelected];
  203. // [rightBtn setSelected:NO];
  204. [dialogViewController.headerView addSubview:leftBtn];
  205. [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  206. make.top.mas_equalTo(titleLabel.mas_bottom).mas_offset(20);
  207. // make.left.mas_offset(16);
  208. make.centerX.mas_offset(0);
  209. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH/3.f, 21.f));
  210. }];
  211. // [dialogViewController.headerView addSubview:rightBtn];
  212. // [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  213. // make.top.mas_equalTo(titleLabel.mas_bottom).mas_offset(20);
  214. // make.right.mas_offset(-16);
  215. // make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH/3.f, 21.f));
  216. // }];
  217. // UIProgressView *progress = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
  218. // progress.progress = 0.5f;
  219. // progress.trackTintColor = RQColorFromHexString(@"#E5EDF8");
  220. // progress.progressTintColor = RQ_MAIN_COLOR;
  221. // [dialogViewController.headerView addSubview:progress];
  222. // [progress mas_makeConstraints:^(MASConstraintMaker *make) {
  223. // make.top.mas_equalTo(leftBtn.mas_bottom).mas_offset(8.f);
  224. // make.centerX.mas_offset(0);
  225. // make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 32.f, 5.f));
  226. // }];
  227. QMUILabel *messageLabel = [[QMUILabel alloc] qmui_initWithFont:RQRegularFont_16 textColor:[UIColor qmui_colorWithHexString:@"#5C6066"]];
  228. messageLabel.text = message;
  229. messageLabel.textAlignment = NSTextAlignmentCenter;
  230. messageLabel.numberOfLines = 0;
  231. [dialogViewController.headerView addSubview:messageLabel];
  232. [messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  233. make.top.mas_equalTo(leftBtn.mas_bottom).mas_offset(16);
  234. make.centerX.mas_offset(0);
  235. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 32.f, textHeight));
  236. }];
  237. QMUIButton *closeButton = [[QMUIButton alloc] qmui_initWithImage:RQImageNamed(@"close") title:@""];
  238. @weakify(dialogViewController)
  239. [closeButton setBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) {
  240. @strongify(dialogViewController)
  241. [dialogViewController hide];
  242. if (complete) {
  243. complete(NO);
  244. }
  245. }];
  246. [dialogViewController.headerView addSubview:closeButton];
  247. [closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
  248. make.top.mas_offset(14);
  249. make.right.mas_offset(-14);
  250. make.size.mas_equalTo(CGSizeMake(30.f, 30.f));
  251. }];
  252. UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, RQ_SCREEN_WIDTH - 80.f, 55.f)];
  253. contentView.backgroundColor = UIColorWhite;
  254. UIImageView *textFieldBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageWithColor:RQ_LIST_BACKGROUNDCOLOR]];
  255. [contentView addSubview:textFieldBgImageView];
  256. [textFieldBgImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
  257. make.top.mas_equalTo(contentView.mas_top).mas_offset(10);
  258. make.centerX.mas_offset(0);
  259. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 40.f, 35.f));
  260. textFieldBgImageView.layer.cornerRadius = 15;
  261. textFieldBgImageView.layer.borderWidth = 1;
  262. textFieldBgImageView.layer.borderColor = RQ_MAIN_LINE_COLOR_1.CGColor;
  263. textFieldBgImageView.layer.masksToBounds = YES;
  264. }];
  265. RQAlertTextField *textField = [[RQAlertTextField alloc] initWithFrame:CGRectMake(0, 0, 250, 35)];
  266. textField.backgroundColor = UIColor.clearColor;
  267. textField.borderStyle = UITextBorderStyleNone;
  268. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 35, 35)];
  269. UIImageView *imageView = [[UIImageView alloc]initWithImage:RQImageNamed(@"activationIcon")];
  270. imageView.center = leftView.center;
  271. [leftView addSubview:imageView];
  272. textField.leftView = imageView;
  273. textField.leftViewMode = UITextFieldViewModeAlways; //此处用来设置leftview现实时机
  274. textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
  275. textField.placeholder = @"请输入激活码";
  276. textField.tintColor = [UIColor colorWithHexString:@"#BFBFBF"];
  277. textField.textColor = RQ_MAIN_TEXT_COLOR_3;
  278. textField.font = [UIFont systemFontOfSize:16];
  279. [contentView addSubview:textField];
  280. [textField mas_remakeConstraints:^(MASConstraintMaker *make) {
  281. make.top.mas_equalTo(contentView.mas_top).mas_offset(10);
  282. make.centerX.mas_offset(0);
  283. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 40.f, 35.f));
  284. }];
  285. dialogViewController.contentView = contentView;
  286. dialogViewController.footerSeparatorColor = nil;
  287. dialogViewController.footerViewBackgroundColor = UIColor.whiteColor;
  288. dialogViewController.footerViewHeight = 117.f;
  289. dialogViewController.footerView.hidden = NO;
  290. CGFloat btnWidth = (RQ_SCREEN_WIDTH - 80.f - 16.f - 72.f) / 2.f;
  291. // QMUIButton *buyBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  292. // [buyBtn setTitle:@"在线购买" textColor:UIColor.whiteColor Font:15 fotState:UIControlStateNormal];
  293. // [buyBtn setBackgroundImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
  294. // graColor.fromColor = [UIColor qmui_colorWithHexString:@"#FF4D53"];
  295. // graColor.toColor = [UIColor qmui_colorWithHexString:@"#FF7E4D"];
  296. // graColor.type = QQGradualChangeTypeLeftToRight;
  297. // } size:CGSizeMake(btnWidth, 40.f) cornerRadius:QQRadiusMakeSame(20.f)] forState:UIControlStateNormal];
  298. // [buyBtn setBackgroundImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
  299. // graColor.fromColor = [UIColor qmui_colorWithHexString:@"#8A9099"];
  300. // graColor.toColor = [UIColor qmui_colorWithHexString:@"#8A9099"];
  301. // graColor.type = QQGradualChangeTypeLeftToRight;
  302. // } size:CGSizeMake(btnWidth, 40.f) cornerRadius:QQRadiusMakeSame(20.f)] forState:UIControlStateDisabled];
  303. // [buyBtn setBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) {
  304. // [dialogViewController hide];
  305. // RQActivateVIPViewModel *activateVIPViewModel = [[RQActivateVIPViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil];
  306. // [RQ_APPDELEGATE.services pushViewModel:activateVIPViewModel animated:YES];
  307. // }];
  308. // [dialogViewController.footerView addSubview:buyBtn];
  309. // [buyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  310. // make.top.mas_offset(10.f);
  311. // make.left.mas_offset(36.f);
  312. // make.size.mas_equalTo(CGSizeMake(btnWidth, 40.f));
  313. // }];
  314. QMUIButton *confirmBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  315. [confirmBtn setTitle:@"立即开通" textColor:UIColor.whiteColor Font:15 fotState:UIControlStateNormal];
  316. [confirmBtn setBackgroundImage:[UIImage qmui_imageWithColor:RQ_MAIN_COLOR size:CGSizeMake(btnWidth, 40.f) cornerRadius:0] forState:UIControlStateNormal];
  317. [confirmBtn setBackgroundImage:[UIImage qmui_imageWithColor:[UIColor qmui_colorWithHexString:@"#8A9099"] size:CGSizeMake(btnWidth, 40.f) cornerRadius:0] forState:UIControlStateDisabled];
  318. confirmBtn.layer.cornerRadius = 20;
  319. confirmBtn.layer.masksToBounds = YES;
  320. @weakify(confirmBtn, textField)
  321. [confirmBtn setBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) {
  322. [dialogViewController hide];
  323. @strongify(confirmBtn, textField)
  324. if ([confirmBtn.titleLabel.text isEqualToString:@"立即开通"]) {
  325. [[RQ_HTTP_Service putVipCodeWithVipCode:textField.text] subscribeNext:^(RQBaseModel *baseModel) {
  326. [RQ_CACHE_MANAGER removeCacheWithPath:RQ_GET_VipInfo parameters:nil];
  327. [RQ_USER_MANAGER isVipWithComplete:^(NSInteger isVip) {
  328. if (complete) {
  329. complete(isVip);
  330. }
  331. if (isVip > 0) {
  332. [MBProgressHUD rq_showTips:@"购买VIP成功"];
  333. } else {
  334. [MBProgressHUD rq_showTips:@"VIP激活中!请稍等片刻!!!"];
  335. }
  336. }];
  337. } error:^(NSError * _Nullable error) {
  338. [MBProgressHUD rq_showErrorTips:error];
  339. }];
  340. } else {
  341. [[RQ_HTTP_Service getRecommendCodeWithRecommendCode:textField.text] subscribeNext:^(RQBaseModel *baseModel) {
  342. [MBProgressHUD rq_showTips:@"绑定成功"];
  343. [[RQ_HTTP_Service postPrepareOrderWithDictCode:@"45"] subscribeNext:^(RQPrepareOrderModel *prepareOrderModel) {
  344. [RQ_WECHAT_MANAGER clickToWechatPayWithPrepareOrder:prepareOrderModel];
  345. } error:^(NSError * _Nullable error) {
  346. [MBProgressHUD rq_showErrorTips:error];
  347. }];
  348. } error:^(NSError * _Nullable error) {
  349. [MBProgressHUD rq_showErrorTips:error];
  350. }];
  351. }
  352. }];
  353. [dialogViewController.footerView addSubview:confirmBtn];
  354. [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  355. make.top.mas_offset(10.f);
  356. // make.right.mas_offset(-36.f);
  357. make.centerX.mas_offset(0);
  358. make.size.mas_equalTo(CGSizeMake(btnWidth, 40.f));
  359. }];
  360. UILabel *noteLabel = [[UILabel alloc] init];
  361. noteLabel.font = [UIFont systemFontOfSize:16.f];
  362. noteLabel.textColor = RQ_MAIN_TEXT_COLOR_3;
  363. noteLabel.textAlignment = NSTextAlignmentCenter;
  364. noteLabel.text = @"速达驾考";
  365. [dialogViewController.footerView addSubview:noteLabel];
  366. [noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  367. make.top.mas_equalTo(confirmBtn.mas_bottom).mas_offset(20);
  368. make.centerX.mas_offset(0);
  369. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 40.f, 21.f));
  370. make.bottom.mas_offset(-26);
  371. }];
  372. [dialogViewController show];
  373. // @weakify(leftBtn, rightBtn, messageLabel, progress)
  374. @weakify(leftBtn, messageLabel)
  375. [leftBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
  376. // @strongify(leftBtn, rightBtn, messageLabel, confirmBtn, progress, textField, dialogViewController)
  377. // if (!leftBtn.selected) leftBtn.selected = YES;
  378. // if (rightBtn.selected) rightBtn.selected = NO;
  379. // messageLabel.text = @"您还未开通系统,请输入激活码开通!";
  380. // CGFloat textNewHeight = [messageLabel.text heightForFont:RQRegularFont_16 width:RQ_SCREEN_WIDTH - 80.f - 32.f] + 16 > RQ_SCREEN_HEIGHT / 2.f? RQ_SCREEN_HEIGHT / 2.f : [messageLabel.text heightForFont:RQRegularFont_16 width:RQ_SCREEN_WIDTH - 80.f - 32.f] + 16;
  381. //
  382. // dialogViewController.headerViewHeight = (24.f + 22.f + 16.f + textHeight + 16.f) + 57.f;
  383. // [messageLabel mas_updateConstraints:^(MASConstraintMaker *make) {
  384. // make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 32.f, textNewHeight));
  385. // }];
  386. //
  387. // textField.placeholder = @"请输入激活码";
  388. // [confirmBtn setTitleNormal:@"立即开通"];
  389. //
  390. // progress.trackTintColor = RQColorFromHexString(@"#E5EDF8");
  391. // progress.progressTintColor = RQ_MAIN_COLOR;
  392. }];
  393. // [rightBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
  394. // @strongify(leftBtn, rightBtn, messageLabel, confirmBtn, progress, textField, dialogViewController)
  395. // if (!rightBtn.selected) rightBtn.selected = YES;
  396. // if (leftBtn.selected) leftBtn.selected = NO;
  397. // messageLabel.text = @"如有老师推荐请输入邀请码(没有无需填写)";
  398. // CGFloat textNewHeight = [messageLabel.text heightForFont:RQRegularFont_16 width:RQ_SCREEN_WIDTH - 80.f - 32.f] + 16 > RQ_SCREEN_HEIGHT / 2.f? RQ_SCREEN_HEIGHT / 2.f : [messageLabel.text heightForFont:RQRegularFont_16 width:RQ_SCREEN_WIDTH - 80.f - 32.f] + 16;
  399. //
  400. // dialogViewController.headerViewHeight = (24.f + 22.f + 16.f + textHeight + 16.f) + 57.f;
  401. // [messageLabel mas_updateConstraints:^(MASConstraintMaker *make) {
  402. // make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH - 80.f - 32.f, textNewHeight));
  403. // }];
  404. //
  405. // textField.placeholder = @"请输入邀请码";
  406. // [confirmBtn setTitleNormal:@"立即绑定"];
  407. //
  408. // progress.trackTintColor = RQ_MAIN_COLOR;
  409. // progress.progressTintColor = RQColorFromHexString(@"#E5EDF8");
  410. // }];
  411. }
  412. @end