添加反馈接口
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#import "KBFeedBackVC.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "KBMyVM.h"
|
||||
#import "KBHUD.h"
|
||||
|
||||
@interface KBFeedBackVC () <UITextViewDelegate>
|
||||
|
||||
@@ -17,6 +19,8 @@
|
||||
/// 最大输入字数
|
||||
@property (nonatomic, assign) NSInteger maxCount;
|
||||
|
||||
@property (nonatomic, strong) KBMyVM *viewModel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation KBFeedBackVC
|
||||
@@ -81,8 +85,16 @@
|
||||
|
||||
/// 提交按钮点击(后续在此方法内实现具体提交逻辑)
|
||||
- (void)onTapCommit {
|
||||
NSString *content = self.textView.text ?: @"";
|
||||
// TODO: 在这里处理提交逻辑,例如校验 + 上报接口等
|
||||
NSString *content = [self.textView.text ?: @"" stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (content.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"Please Enter The Content")];
|
||||
return;
|
||||
}
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.viewModel submitFeedbackWithContent:content completion:^(BOOL success, NSError * _Nullable error) {
|
||||
if (!success) { return; }
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UITextViewDelegate
|
||||
@@ -161,4 +173,11 @@
|
||||
return _commitButton;
|
||||
}
|
||||
|
||||
- (KBMyVM *)viewModel {
|
||||
if (!_viewModel) {
|
||||
_viewModel = [[KBMyVM alloc] init];
|
||||
}
|
||||
return _viewModel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user