| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 | 
							- //
 
- //  ASMessageListViewController.m
 
- //  Asteria
 
- //
 
- //  Created by iOS on 2023/7/4.
 
- //
 
- #import "ASMessageListViewController.h"
 
- #import "ASMessageListCell.h"
 
- @interface ASMessageListViewController () <UITableViewDelegate,UITableViewDataSource>
 
- @property (nonatomic, strong) UITableView *tableV;
 
- @end
 
- @implementation ASMessageListViewController
 
- - (void)viewDidLoad {
 
-     [super viewDidLoad];
 
-     [self loadSubVs];
 
- //    self.vm = [KWMessageListViewModel new];
 
-     self.titleStr = @"Message";
 
-     [self setNav];
 
-     
 
- }
 
- - (void)viewWillAppear:(BOOL)animated {
 
-     [super viewWillAppear:animated];
 
-     [self.tableV.mj_header beginRefreshing];
 
- }
 
- - (void)getData {
 
-     [self.tableV.mj_header endRefreshing];
 
- //    [MBProgressHUD showHUDAddedTo:self.view animated:true];
 
- //    @weakify(self);
 
- //    [self.vm getMessageList:self.tableV page:1 complate:^{
 
- //        @strongify(self);
 
- //        [MBProgressHUD hideHUDForView:self.view animated:true];
 
- //        if (self.vm.messageList.count == 0) {
 
- //            [self showNoDataV:self.tableV mes:@"No News Yet"];
 
- //        } else {
 
- //            [self hideNoDataV];
 
- //        }
 
- //        [self.tableV reloadData];
 
- //    }];
 
-     
 
-     
 
- }
 
- - (void)setNav {
 
-     self.customNavBar.backgroundColor = UIColor.whiteColor;
 
-     self.statusBgV.backgroundColor = UIColor.whiteColor;
 
-     
 
-     [self setNavRightSearch:^{
 
-         
 
-     }];
 
-     
 
-     return;
 
-     
 
-     UIButton *readAllBt = [UIButton buttonWithType:UIButtonTypeCustom];
 
-     [readAllBt setImage:[UIImage imageNamed:@"nav_message_read"] forState:UIControlStateNormal];
 
-     UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
 
-     v.backgroundColor = UIColor.clearColor;
 
-     readAllBt.frame = v.bounds;
 
-     [readAllBt addTarget:self action:@selector(rightBtAction) forControlEvents:UIControlEventTouchUpInside];
 
-     [v addSubview:readAllBt];
 
-     [self.customNavBar addSubview:v];
 
-     [v mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.centerY.equalTo(self.customNavBar);
 
-         make.right.equalTo(self.customNavBar).offset(-15);
 
-         make.width.height.equalTo(@40);
 
-     }];
 
- //    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:v];
 
- //    self.navigationItem.rightBarButtonItem = rightItem;
 
- }
 
- - (void)rightBtAction {
 
-     [MBProgressHUD showHUDAddedTo:self.view animated:true];
 
- //    @weakify(self);
 
- //    [self.vm getMessageRead:self.tableV messageId:@"" type:@"2" complate:^{
 
- //        [MBProgressHUD hideHUDForView:weak_self.view animated:true];
 
- //        [self.tableV.mj_header beginRefreshing];
 
- //    }];
 
- }
 
- - (void)loadSubVs {
 
-     [self.view addSubview:self.tableV];
 
-     [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.left.right.equalTo(self.view);
 
-         make.top.equalTo(self.customNavBar.mas_bottom);
 
-         make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
 
-     }];
 
-     
 
- }
 
- - (UITableView *)tableV {
 
-     if (!_tableV) {
 
-         UITableView *tabV = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
 
-         tabV.backgroundColor = [UIColor colorWithHexString:@"#ffffff"];
 
-         [tabV registerClass:[ASMessageListCell class] forCellReuseIdentifier:@"ASMessageListCell"];
 
-         tabV.delegate = self;
 
-         tabV.dataSource = self;
 
-         tabV.rowHeight = UITableViewAutomaticDimension;
 
-         tabV.estimatedRowHeight = 100;
 
-         tabV.separatorStyle = UITableViewCellSeparatorStyleNone;
 
-         @weakify(self);
 
-         tabV.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
 
-             [weak_self getData];
 
-         }];
 
-         _tableV = tabV;
 
-     }
 
-     return _tableV;
 
- }
 
- -(void)pushToProductList:(NSString *)name typeid:(NSString *)typeId {
 
-     if (typeId == nil || [typeId isEqualToString:@""]) {
 
-         return;
 
-     }
 
-     if (name == nil || [name isEqualToString:@""]) {
 
-         name = @"Products";
 
-     }
 
- //    KWProductListViewController *vc = [[KWProductListViewController alloc] init];
 
- //    vc.titleName = name;
 
- //    vc.type = typeId;
 
- //    [self.navigationController pushViewController:vc animated:YES];
 
- }
 
- -(void)goto_WKM_GoodsDetailsC:(NSString *)entity_id {
 
- //    WKM_GoodsDetailsC *vc = [[WKM_GoodsDetailsC alloc]init];
 
- //    vc.entity_id = entity_id;
 
- //    [self.navigationController pushViewController:vc animated:YES];
 
- }
 
- #pragma mark - UITableViewDelegate,UITableViewDataSource
 
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 
- //    KWMessageListModel *m = self.vm.messageList[indexPath.row];
 
- //
 
- //    [[KWPushMessageHandler shareInstance] handleMessage:m.title messageId:m.message_id pushPara:m.push_para pushType:m.push_type];
 
-     
 
-     UIViewController *vc = [CTMediator.sharedInstance getWebViewVc:@{
 
-         @"title":@"Message",
 
-         @"url":@"https://baidu.com"
 
-     }];
 
-     [self.navigationController pushViewController:vc animated:true];
 
-     
 
-     return;
 
-     
 
- }
 
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 
-     if (arc4random()%2 == 1) {
 
-         [self showEmptyV:self.tableV];
 
-         return  0;
 
-     }
 
-     [self hiddenEmpty];
 
-     return  40;//self.vm.messageList.count;
 
- }
 
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 
-     ASMessageListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASMessageListCell" forIndexPath:indexPath];
 
- //    KWMessageListModel *m = self.vm.messageList[indexPath.row];
 
- //    [cell setData:m];
 
-     
 
-     return  cell;
 
- }
 
- @end
 
 
  |