123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- //
- // ASHelpListViewController.m
- // Asteria
- //
- // Created by iOS on 2023/7/5.
- //
- #import "ASHelpListViewController.h"
- #import "ASSettingListCell.h"
- #import "ASHelpListUrlModel.h"
- @interface ASHelpListViewController ()<UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic, strong) UITableView *tableV;
- @property (nonatomic, strong) NSArray<ASHelpListUrlModel *> *linkArr;
- @end
- @implementation ASHelpListViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.titleStr = @"Help & Support";
- [self setNavRightSearch:^{
-
- }];
-
- self.statusBgV.backgroundColor = Col_FFF;
- self.customNavBar.backgroundColor = Col_FFF;
-
- [self loadSubVs];
-
-
- [self configData];
- }
- - (void)configData {
- [MBProgressHUD showHUDAddedTo:self.view animated:true];
- __weak typeof(self) weakSelf = self;
- [ASNetTools.shared getWithPath:helpCenterUrl param:@{} success:^(id _Nonnull json) {
- [MBProgressHUD hideHUDForView:weakSelf.view animated:true];
- weakSelf.linkArr = [ASHelpListUrlModel mj_objectArrayWithKeyValuesArray:json];
- [weakSelf.tableV reloadData];
- } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
- [MBProgressHUD hideHUDForView:weakSelf.view animated:true];
- weakSelf.linkArr = @[];
- [weakSelf.tableV reloadData];
- NSLog(@"----code:%@-msg:%@--", code, msg);
- }];
- }
- - (void)loadSubVs {
- [self.view addSubview:self.tableV];
- [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.customNavBar.mas_bottom);
- make.left.right.equalTo(self.view);
- make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
- }];
- }
- - (UITableView *)tableV {
- if (!_tableV) {
- UITableView *tabV = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
- tabV.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
- [tabV registerClass:[ASSettingListCell class] forCellReuseIdentifier:@"ASSettingListCell"];
- tabV.delegate = self;
- tabV.dataSource = self;
- tabV.rowHeight = UITableViewAutomaticDimension;
- tabV.estimatedRowHeight = 100;
- tabV.separatorStyle = UITableViewCellSeparatorStyleNone;
- UIView *v = [UIView new];
- v.frame = CGRectMake(0, 0, KScreenWidth, 10);
- v.backgroundColor = [UIColor colorWithHexString:@"#f8f8f8"];
- tabV.tableHeaderView = v;
- _tableV = tabV;
- }
- return _tableV;
- }
- - (void)toActiveVc:(NSString *)pageUrl title:(NSString *)tit {
- UIViewController *vc = [CTMediator.sharedInstance getWebViewVc:@{
- @"title":tit,
- @"url":pageUrl
- }];
- [self.navigationController pushViewController:vc animated:true];
-
- }
- #pragma mark - UITableViewDelegate,UITableViewDataSource
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- ASHelpListUrlModel *linkM = self.linkArr[indexPath.row];
- [self toActiveVc:linkM.value title:linkM.title];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return self.linkArr.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- ASSettingListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASSettingListCell" forIndexPath:indexPath];
- ASHelpListUrlModel *link = self.linkArr[indexPath.row];
- [cell setTitle:link.title points:@"" enable:true];
- return cell;
- }
- @end
|