cdts/xdts-ios 3/TreeHole/Code/Features/Settings/ViewController/FeedbackViewController.m
2023-07-27 09:20:00 +08:00

67 lines
2.0 KiB
Objective-C

//
// FeedbackViewController.m
// Youth
//
// Created by mambaxie on 2022/1/2.
//
#import "FeedbackViewController.h"
#import "FSTextInputView.h"
@interface FeedbackViewController ()
@property (nonatomic, strong) FSTextInputView *inputView;
@end
@implementation FeedbackViewController
- (BOOL)mt_nagationBarTransparent {
return NO;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"意见反馈";
FSTextInputView *inputView = [[FSTextInputView alloc] init];
inputView.placeHolderLabel.text = @"写下你对 小酒馆 的意见,比心💞";
inputView.x = FIX_SIZE(15);
inputView.y = NAVIGATION_BAR_HEIGHT + FIX_SIZE(10);
inputView.width = self.view.width - inputView.x * 2;
inputView.height = inputView.width;
inputView.maxTextLength = 1000;
[self.view addSubview:inputView];
inputView.backgroundColor = SUB_BG_COLOR;
inputView.textview.font = MT_FONT_REGULAR_SIZE(13);
inputView.layer.cornerRadius = FIX_SIZE(13);
inputView.layer.borderWidth = 0.5;
inputView.layer.borderColor = COLOR_WITH_RGB(0xE5E5E5).CGColor;
self.inputView = inputView;
WeakSelf(self);
PYThemeButton *okButton = [PYThemeButton buttonWithTitle:@"提交" action:^(UIButton * _Nonnull button) {
if (!inputView.textview.hasText) {
[SVProgressHUD showInfoWithStatus:@"内容不能为空"];
return;
}
[PYHTTPManager postWithPath:@"suggestion" params:@{
@"suggestion": inputView.textview.text ?: @""
} callback:^(id _Nullable rsp, NSError * _Nullable error) {
if (!error) {
[SVProgressHUD showSuccessWithStatus:@"提交成功"];
[weakself.navigationController popViewControllerAnimated:YES];
}
}];
}];
okButton.bottom = SCREEN_HEIGHT - FIX_SIZE(27);
[self.view addSubview:okButton];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.inputView.textview becomeFirstResponder];
}
@end