| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- //
- // MyOrderController.m
- // model
- //
- // Created by JuYi on 2018/7/17.
- // Copyright © 2018年 Mine. All rights reserved.
- // 我的订单
- #import "MyOrderController.h"
- #import "VideoOrderController.h"
- #import "SkillOrderController.h"
- #import "MyOrderCell.h"
- @interface MyOrderController ()<UITableViewDelegate, UITableViewDataSource>
- @property (nonatomic, strong) UITableView *tableView;
- @property (nonatomic, strong) NSArray *orderArr; //订单数组
- @end
- @implementation MyOrderController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- if ([[ModelUser user].modelpk isEqualToString:@"51"]) {
- self.orderArr = @[@{@"iconName":@"jineng-1",@"title":@"技能订单"}];
- }else{
- self.orderArr = @[@{@"iconName":@"shipin",@"title":@"视频订单"},@{@"iconName":@"jineng-1",@"title":@"技能订单"}];
- }
-
- //设置导航条
- [self creatNavBar];
- //设置子试图
- [self creatSubViews];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (void)creatNavBar {
- self.title = @"我的订单";
- //
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- btn.frame = CGRectMake(0, 0, 40, 40);
- [btn setImage:[UIImage imageNamed:@"fanhui2"] forState:UIControlStateNormal];
- btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0); // backBtn2
- [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
- UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
- UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
- // nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
- self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
- }
- - (void)backClick {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)creatSubViews {
- //
- self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) style:UITableViewStylePlain];
- self.tableView.backgroundColor = RGBValueColor(0xf7f7f7, 1.0);
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- self.tableView.tableFooterView = [[UIView alloc] init];
- [self.view addSubview:self.tableView];
- }
- #pragma mark -- UITableViewDelegate, UITableViewDataSource
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return self.orderArr.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- static NSString *cellid = @"OrderCell";
- MyOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];
- if (!cell) {
- cell = [[MyOrderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid];
- }
- if (indexPath.row == 1) {
- cell.lineView.hidden = YES;
- }
- [cell setMyOrderCellValueWithDic:self.orderArr[indexPath.row] titleStr:@"myOrder"];
-
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 75;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-
- if ([[ModelUser user].modelpk isEqualToString:@"51"]) {
- SkillOrderController *videoVC = [[SkillOrderController alloc] init];
- [self.navigationController pushViewController:videoVC animated:YES];
- }else{
- if (indexPath.row == 0) {
- VideoOrderController *videoVC = [[VideoOrderController alloc] init];
- [self.navigationController pushViewController:videoVC animated:YES];
- } else {
- SkillOrderController *videoVC = [[SkillOrderController alloc] init];
- [self.navigationController pushViewController:videoVC animated:YES];
- }
- }
- }
- @end
|