123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- //
- // NYComplaintListViewController.m
- // jiaPei
- //
- // Created by Ning.ge on 2023/7/2.
- // Copyright © 2023 JCZ. All rights reserved.
- //
- #import "NYComplaintListViewController.h"
- #import "NYComplaintPageViewController.h"
- #import "NYComplaintListViewCell.h"
- #import "ComplaintDataModel.h"
- @interface NYComplaintListViewController ()<UITableViewDataSource,UITableViewDelegate>
- @property (weak, nonatomic) IBOutlet UIButton *addcomp_button;
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (nonatomic,assign) int currentPage;
- @property (nonatomic,strong) ComplaintDataModel *complaintDataModel;
- @property (nonatomic,strong) NSMutableArray *complaintList;
- @end
- @implementation NYComplaintListViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view from its nib.
- [self setupUI];
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self getComplaintList];
- }
- - (void)dealloc {
-
- NSLog(@"投诉建议列表-NYComplaintListViewController");
- }
- #pragma mark - PublicMethods
- - (void)getComplaintList{
- _currentPage = 1;
- NSMutableArray *arr = [NSMutableArray array];
- [arr addPro:@"stunum" Value:RQ_USER_MANAGER.currentUser.outId];///学员编号
- [arr addPro:@"currentPage" Value:@(_currentPage)];///当前页
- [arr addPro:@"pageSize" Value:@10];
- [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city];///地区编号
- NSString *method = @"getComplaintList";
- @weakify(self)
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
- NSLog(@"%@",dict);
- int code = [dict[@"code"] intValue];
- if(code == 0 ){
- self.complaintDataModel = [ComplaintDataModel yy_modelWithDictionary:dict[@"body"]];
- if(self.complaintDataModel.list.count>0&&self.complaintList.count!=self.complaintDataModel.list.count){
- [self.complaintList removeAllObjects];
- [self.complaintList addObjectsFromArray:self.complaintDataModel.list];
- [self.tableView reloadData];
- }
- }
- }];
- }
- //更多下一页
- - (void)getComplaintListMore {
-
- int total = 10* (_currentPage+1);
- if(self.complaintDataModel.total > total){
- _currentPage +=1;
- NSMutableArray *arr = [NSMutableArray array];
- [arr addPro:@"stunum" Value:RQ_USER_MANAGER.currentUser.outId];///学员编号
- [arr addPro:@"currentPage" Value:@(_currentPage)];///当前页
- [arr addPro:@"pageSize" Value:@10];
- [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city];///地区编号
- NSString *method = @"getComplaintList";
- @weakify(self)
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
- NSLog(@"%@",dict);
- int code = [dict[@"code"] intValue];
- if(code == 0 ){
- self.complaintDataModel = [ComplaintDataModel yy_modelWithDictionary:dict[@"body"]];
- if(self.complaintDataModel.list.count>0&&self.complaintList.count!=self.complaintDataModel.list.count){
- [self.complaintList addObjectsFromArray:self.complaintDataModel.list];
- [self.tableView reloadData];
- }
- }
- }];
- }
-
- }
- #pragma mark - PrivateMethods
- - (void)setupUI {
- self.title = @"投诉建议列表";
- [self configureUI];
- }
- - (void)configureUI {
-
- self.tableView.backgroundColor = UIColorMakeWithRGBA(242, 243, 245, 1);
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- [self.tableView registerNib:[UINib nibWithNibName:@"NYComplaintListViewCell" bundle:nil] forCellReuseIdentifier:@"NYComplaintListViewCell"];
-
- }
- #pragma mark - 事件
- - (IBAction)pushAddCompdo:(UIButton *)sender {
- NYComplaintPageViewController *complaintPageViewController = [[NYComplaintPageViewController alloc] init];
- [RQControllerHelper.currentViewController.navigationController qmui_pushViewController:complaintPageViewController animated:YES completion:nil];
- }
- #pragma mark - UITableViewDataSource
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return self.complaintList.count;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 260;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- NYComplaintListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NYComplaintListViewCell"];
- [cell setComplaintInfoModel:self.complaintList[indexPath.row]];
- return cell;
- }
- #pragma mark - UITableViewDelegate
- #pragma mark - Lazy
- - (NSMutableArray *)complaintList
- {
- if(!_complaintList){
- _complaintList = [NSMutableArray array];
- }
- return _complaintList;
- }
- @end
|