123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //
- // RQSynExerciseCell.m
- // SDJK
- //
- // Created by 张嵘 on 2022/5/24.
- //
- #import "RQSynExerciseCell.h"
- @interface RQSynExerciseCell ()
- @property (nonatomic, readwrite, strong) RQWrongAndCollectionItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet QMUIButton *synExerciseBtn;
- @end
- @implementation RQSynExerciseCell
- #pragma mark - PublicMethods
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *ID = @"RQSynExerciseCell";
- RQSynExerciseCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
- if (!cell) {
- cell = [self rq_viewFromXib];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.synExerciseBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(44.f) / 2.f;
- }
- return cell;
- }
- - (void)bindViewModel:(RQWrongAndCollectionItemViewModel *)viewModel {
- _viewModel = viewModel;
- }
- #pragma mark - SystemMethods
- - (void)awakeFromNib {
- [super awakeFromNib];
- [_synExerciseBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
- [MBProgressHUD rq_showProgressHUD:@"同步中..."];
- [RQ_UPDATE_LOCALDATA_MANAGER updateLocalWrongAndCollectionWithComplete:^(BOOL isSuccess, NSError * _Nullable error) {
- [MBProgressHUD rq_hideHUD];
- if (isSuccess) {
- [MBProgressHUD rq_showTips:@"同步成功"];
- } else {
- [MBProgressHUD rq_showErrorTips:error];
- }
- [RQ_SDJK_DB_MANAGER refreshWrongAndCollectCount];
- }];
- }];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- @end
|