RQErrorAndCollectHeaderView.m 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // RQErrorAndCollectHeaderView.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/8/3.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQErrorAndCollectHeaderView.h"
  9. @interface RQErrorAndCollectHeaderView ()
  10. @property (weak, nonatomic) IBOutlet UISwitch *isAntoRemoveError;
  11. @end
  12. @implementation RQErrorAndCollectHeaderView
  13. + (instancetype)errorAndCollectHeaderView {
  14. return [super rq_viewFromXib];
  15. }
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. _todayErrorBtn.layer.borderColor = RQ_MAIN_COLOR.CGColor;
  19. _todayErrorBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(40.f) / 2.f;
  20. _allErrorBtn.layer.borderColor = RQ_MAIN_COLOR.CGColor;
  21. _allErrorBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(40.f) / 2.f;
  22. [_toLookBtn setBackgroundImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
  23. graColor.fromColor = RQColorFromHexString(@"#FF4C52");
  24. graColor.toColor = RQColorFromHexString(@"#FC8269");
  25. graColor.type = QQGradualChangeTypeLeftToRight;
  26. } size:CGSizeMake(RQ_FIT_HORIZONTAL(76.f), RQ_FIT_HORIZONTAL(30.f)) cornerRadius:QQRadiusMakeSame(RQ_FIT_HORIZONTAL(30.f) / 2.f)] forState:UIControlStateNormal];
  27. _isAntoRemoveError.on = RQ_Exercise_Module.isRightAutoRemoveError;
  28. }
  29. - (IBAction)toLookBtnAction:(id)sender {
  30. [RQ_VIP_Module isVipWithSubject:0 complete:^(BOOL isVip) {
  31. if (RQ_VIP_Module.isVip) {
  32. [RQ_VIP_Module gotoVipCenter];
  33. } else {
  34. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  35. }
  36. }];
  37. }
  38. - (IBAction)clearAllErrorAction:(id)sender {
  39. [MBProgressHUD rq_showProgressHUD:@"删除中..."];
  40. [[RQ_HTTP_Service deleteQuestionFavAllWithType:RQSaveFavQuestionType_Wrong] subscribeNext:^(id _Nullable x) {
  41. [MBProgressHUD rq_hideHUD];
  42. [MBProgressHUD rq_showTips:@"删除成功!"];
  43. [RQ_YDT_USER_Question_Module deleteWrongRecordithCarType:RQ_YDTQuestion_Module.carType subject:RQ_YDTQuestion_Module.subject];
  44. [RQNotificationCenter postNotificationName:RQCancelWrongNotification object:nil];
  45. } error:^(NSError * _Nullable error) {
  46. [MBProgressHUD rq_hideHUD];
  47. [MBProgressHUD rq_showErrorTips:error];
  48. }];
  49. }
  50. - (IBAction)isAutoRemoveErrorAction:(id)sender {
  51. RQ_Exercise_Module.isRightAutoRemoveError = _isAntoRemoveError.isOn;
  52. }
  53. @end