12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- //
- // RQExerciseSituationCell.m
- // jiaPei
- //
- // Created by 张嵘 on 2022/8/2.
- // Copyright © 2022 JCZ. All rights reserved.
- //
- #import "RQExerciseSituationCell.h"
- @interface RQExerciseSituationCell ()
- @property (nonatomic, readwrite, strong) RQExerciseSituationItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet UIView *myContentView;
- @property (weak, nonatomic) IBOutlet QMUIButton *toDoExerciseBtn;
- @property (weak, nonatomic) IBOutlet UIProgressView *rightProgress;
- @property (weak, nonatomic) IBOutlet UIProgressView *errorProgress;
- @property (weak, nonatomic) IBOutlet UILabel *hasDoneLabel;
- @property (weak, nonatomic) IBOutlet UILabel *errorLabel;
- @property (weak, nonatomic) IBOutlet UILabel *unDoLabel;
- @end
- @implementation RQExerciseSituationCell
- #pragma mark - PublicMethods
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *ID = @"RQExerciseSituationCell";
- RQExerciseSituationCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
- if (!cell) {
- cell = [self rq_viewFromXib];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return cell;
- }
- - (void)bindViewModel:(RQExerciseSituationItemViewModel *)viewModel {
- _viewModel = viewModel;
- NSInteger allCount = [RQ_YDTQuestion_Module getQuestionNumWithWithSubject:viewModel.homePageSubjectType exerciseType:RQExerciseType_Sequential];
- NSInteger wrongCount = [RQ_YDTQuestion_Module getQuestionNumWithWithSubject:viewModel.homePageSubjectType exerciseType:RQExerciseType_Wrong];
- NSInteger doCount = [RQ_YDTQuestion_Module getQuestionNumWithWithSubject:viewModel.homePageSubjectType exerciseType:RQExerciseType_Do];
-
- _hasDoneLabel.text = [NSString qmui_stringWithNSInteger:doCount];
- _errorLabel.text = [NSString qmui_stringWithNSInteger:wrongCount];
- _unDoLabel.text = [NSString qmui_stringWithNSInteger:allCount - doCount];
-
- CGFloat error = (wrongCount * 1.f / allCount);
- CGFloat right = (doCount * 1.f / allCount);
- _errorProgress.progress = error;
- _rightProgress.progress = right;
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- _toDoExerciseBtn.imagePosition = QMUIButtonImagePositionRight;
- _myContentView.layer.shadowColor = RGBA_COLOR(124, 129, 136, 0.2).CGColor;
- _rightProgress.transform = CGAffineTransformMakeScale(1.0, 3.0);
- _errorProgress.transform = CGAffineTransformMakeScale(1.0, 3.0);
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (IBAction)toDoExerciseBtnAction:(id)sender {
- [RQ_APPDELEGATE.services popToRootViewModelAnimated:YES];
- }
- @end
|