You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
4.1 KiB
121 lines
4.1 KiB
![]()
2 years ago
|
//
|
||
|
// FeedbackViewController.m
|
||
|
// LekangGuard
|
||
|
//
|
||
|
// Created by ecell on 2023/7/4.
|
||
|
//
|
||
|
|
||
|
#import "FeedbackViewController.h"
|
||
|
#import "FeedbackTableViewCell.h"
|
||
|
#import "AddFeedbackViewController.h"
|
||
|
|
||
|
@interface FeedbackViewController ()
|
||
|
|
||
|
@property (nonatomic ,strong) CommonTableView *feedTable;
|
||
|
|
||
|
@property (nonatomic ,assign) NSInteger page;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation FeedbackViewController
|
||
|
|
||
|
- (void)viewDidLoad {
|
||
|
[super viewDidLoad];
|
||
|
// Do any additional setup after loading the view.
|
||
|
self.zx_navTitle = @"反馈意见";
|
||
|
kWeakSelf(self)
|
||
|
[self zx_setRightBtnWithText:@"新增" clickedBlock:^(ZXNavItemBtn * _Nonnull btn) {
|
||
|
[weakself pusAdd:nil];
|
||
|
}];
|
||
|
[self.view addSubview:self.feedTable];
|
||
|
[self getModelList:TableisReload_h];
|
||
|
}
|
||
|
|
||
|
- (CommonTableView *)feedTable
|
||
|
{
|
||
|
if (!_feedTable)
|
||
|
{
|
||
|
kWeakSelf(self)
|
||
|
_feedTable = [[CommonTableView alloc] initWithFrame:CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH, SCREEN_HEIGHT-iPhoneX_NavHeight) style:UITableViewStylePlain cellHeight:100 cellRow:0 isAdaptive:YES isLine:NO commonCell:FeedbackTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) {
|
||
|
FeedbackTableViewCell *cell = (FeedbackTableViewCell *)cells;
|
||
|
cell.model = weakself.modelListArr[indexPath.row];
|
||
|
|
||
|
} selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) {
|
||
|
[weakself pusAdd:weakself.modelListArr[indexPath.row]];
|
||
|
|
||
|
} DidscrollView:^(UIScrollView * _Nonnull scrollView) {
|
||
|
|
||
|
}];
|
||
|
_feedTable.backgroundColor = KKClearColor;
|
||
|
[_feedTable bindHeadRefreshHandler:^{
|
||
|
[UICommon feedbackGenerator];
|
||
|
[weakself getModelList:TableisReload_h];
|
||
|
} themeColor:KKMainColor refreshStyle:KafkaRefreshStyleReplicatorWoody];
|
||
|
|
||
|
[_feedTable bindFootRefreshHandler:^{
|
||
|
[weakself getModelList:TableisReload_f];
|
||
|
} themeColor:KKMainColor refreshStyle:KafkaRefreshStyleReplicatorWoody];
|
||
|
}
|
||
|
return _feedTable;
|
||
|
}
|
||
|
|
||
|
- (void)pusAdd:(FeedbackModel *)model
|
||
|
{
|
||
|
kWeakSelf(self)
|
||
|
AddFeedbackViewController *vc = [[AddFeedbackViewController alloc] init];
|
||
|
vc.model = model;
|
||
|
[self.navigationController pushViewController:vc animated:YES];
|
||
|
vc.addOk = ^{
|
||
|
[weakself getModelList:TableisReload_h];
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#pragma mark 获取反馈意见
|
||
|
/// 获取反馈意见
|
||
|
- (void)getModelList:(TableisReload)isReload
|
||
|
{
|
||
|
kWeakSelf(self)
|
||
|
[UICommon MessageUpload:@"加载中"];
|
||
|
if (isReload == TableisReload_h)
|
||
|
{
|
||
|
self.page = 1;
|
||
|
[self.modelListArr removeAllObjects];
|
||
|
}
|
||
|
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
|
||
|
[parameters setValue:@(self.page) forKey:@"current"];
|
||
|
[parameters setValue:@(KSizeNO) forKey:@"pageSize"];
|
||
|
[[[APIManager sharedManager] APPOST:FeedbackPageList_URL parameters:parameters isJson:NO resultClass:BaseModel.class] subscribeNext:^(BaseModel *model) {
|
||
|
[UICommon HidenLoading];
|
||
|
NSArray *arr = model.records;
|
||
|
[weakself.feedTable.headRefreshControl endRefreshingWithAlertText:@"已为你加载最新数据~" completion:^{
|
||
|
|
||
|
}];
|
||
|
[weakself.feedTable.footRefreshControl endRefreshing];
|
||
|
for (NSDictionary *dic in arr)
|
||
|
{
|
||
|
FeedbackModel *model = [FeedbackModel yy_modelWithJSON:dic];
|
||
|
[self.modelListArr addObject:model];
|
||
|
}
|
||
|
weakself.page++;
|
||
|
weakself.feedTable.footRefreshControl.hidden = arr.count < KSizeNO ? YES : NO;
|
||
|
weakself.feedTable.cellRow = self.modelListArr.count;
|
||
|
[weakself.feedTable reloadData];
|
||
|
|
||
|
} error:^(NSError * _Nullable error) {
|
||
|
NSDictionary *dic = error.userInfo;
|
||
|
[UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]];
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
#pragma mark - Navigation
|
||
|
|
||
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||
|
// Get the new view controller using [segue destinationViewController].
|
||
|
// Pass the selected object to the new view controller.
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
@end
|