| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- //
- // NewMineViewController.m
- // jitao
- //
- // Created by 罗云飞 on 2018/8/10.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "NewMineViewController.h"
- #import "BlankCell.h"
- #import "CategoryCell.h"
- #import "NewLoginViewController.h"
- #import "NewOrderManagementViewController.h"
- #import "SetupViewController.h"
- #import "NewMyfollowViewController.h"
- #import "NewMyneedsViewController.h"
- #import "NewAchievementsViewController.h"
- #import "NewMycollectionViewController.h"
- //#import "NewclassificationViewController.h"
- //#import "NewmoneyViewController.h"
- #import "NewFenLeiViewController.h"
- #import "NewKeFuViewController.h"
- #import "NewMessageViewController.h"
- #import "NewRegisterViewController.h"
- @interface NewMineViewController ()<UITableViewDelegate,UITableViewDataSource>{
- UITableView *newtableView;
- NSMutableArray *dataArray;
- NSArray *dingdanArray;
- }
- @end
- @implementation NewMineViewController
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self.navgationBar setHidden:YES];
- [newtableView reloadData];
- }
- - (void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- [self.navgationBar setHidden:NO];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.view.userInteractionEnabled = YES;
- [self dataInitialization];
- [self loadsView];
-
- // Do any additional setup after loading the view.
- }
- #pragma mark - 数据初始化
- - (void)dataInitialization{
- dataArray = NewMutableArrayInit;
- for (int i = 0; i<8; i++) {
- NSDictionary *dataDic = [NSDictionary dictionary];
- switch (i) {
- case 0:
- dataDic = @{@"nameKey":@"我的关注",@"imageKey":@"wdgz",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 1:
- dataDic = @{@"nameKey":@"我的收藏",@"imageKey":@"wdsc",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 2:
- dataDic = @{@"nameKey":@"我的成果",@"imageKey":@"wdcg",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 3:
- dataDic = @{@"nameKey":@"我的需求",@"imageKey":@"wdxq",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 4:
- dataDic = @{@"nameKey":@"",@"imageKey":@"",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 5:
- dataDic = @{@"nameKey":@"我的消息",@"imageKey":@"wdxx",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 6:
- dataDic = @{@"nameKey":@"我的设置",@"imageKey":@"wdsz",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 7:
- dataDic = @{@"nameKey":@"技淘客服",@"imageKey":@"kdkf",@"classKey":@""};
- [dataArray addObject:dataDic];
- break;
- default:
- break;
- }
- }
- dingdanArray = @[@"全部订单",@"赚钱订单",@"成果订单",@"需求订单",@"顾问订单",@"专家订单"];
-
- }
- #pragma mark ----加载界面
- - (void)loadsView{
- [self.view addSubview:newtableView = [NewControlPackage tableViewInitWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-TABBAR_HEIGHT) backgroundColor:NewNavigationColor style:UITableViewStyleGrouped delegate:self dataSource:self showsHorizontalScrollIndicator:NO showsVerticalScrollIndicator:NO hidden:NO tag:100 userInteractionEnabled:YES]];
- newtableView.separatorStyle = NO;
- }
- #pragma mark-------------------------UITableView------------------------------------
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- //返回每段行数
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return dataArray.count;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *Cell2 = @"Cell";
- static NSString *Cell1 = @"Cell1";
- if (indexPath.row == 4){
- BlankCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell1];
- if (cell == nil) {
- cell = [[BlankCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell1];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- return cell;
- }else{
- CategoryCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell2];
- if (cell == nil) {
- cell = [[CategoryCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell2];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
- cell.accessoryType = UITableViewCellAccessoryNone;
- [cell assignment:dataArray[indexPath.row]];
- if (indexPath.row == 3||indexPath.row == 7) {
- cell.line.hidden = YES;
- }
- // if (indexPath.row == 8) {
- cell.seedetails.hidden = YES;
- // cell.backimage.hidden = YES;
- // }
- return cell;
- }
- return [[UITableViewCell alloc] init];
-
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (indexPath.row == 4) {
- return 10;
- }
- return fitScreenHeight(44);
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"我的订单"]) {
- NewOrderManagementViewController *vc = [NewOrderManagementViewController new];
- NewPushViewController(vc);
- }else if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"我的设置"]){
- SetupViewController *vc = [SetupViewController new];
- [vc setTuichudenglu:^(NSString *string) {
- if ([string isEqualToString:@"退出登录"]) {
- [newtableView reloadData];
- }
- }];
- NewPushViewController(vc);
- }else if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"我的关注"]){
- if ([UserHelper isLogin]) {
- NSLog(@"%@",@"已登录");
- NewMyfollowViewController *vc = [NewMyfollowViewController new];
- NewPushViewController(vc);
- }else{
- NSLog(@"%@",@"未登录");
- NewLoginViewController *vc = [[NewLoginViewController alloc] init];
- [vc setLoginSuccess:^(NSString *string) {
- NewDismissNavigationController;
- }];
- NewPresentNavigationController(vc);
- }
- }else if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"我的需求"]){
- if ([UserHelper isLogin]) {
- NSLog(@"%@",@"已登录");
- NewMyneedsViewController *vc = [NewMyneedsViewController new];
- NewPushViewController(vc);
- }else{
- NSLog(@"%@",@"未登录");
- NewLoginViewController *vc = [[NewLoginViewController alloc] init];
- [vc setLoginSuccess:^(NSString *string) {
- NewDismissNavigationController;
- }];
- NewPresentNavigationController(vc);
- }
- }else if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"我的成果"]){
- if ([UserHelper isLogin]) {
- NSLog(@"%@",@"已登录");
- NewAchievementsViewController *vc = [NewAchievementsViewController new];
- NewPushViewController(vc);
- }else{
- NSLog(@"%@",@"未登录");
- NewLoginViewController *vc = [[NewLoginViewController alloc] init];
- [vc setLoginSuccess:^(NSString *string) {
- NewDismissNavigationController;
- }];
- NewPresentNavigationController(vc);
- }
- }else if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"我的收藏"]){
- if ([UserHelper isLogin]) {
- NSLog(@"%@",@"已登录");
- NewMycollectionViewController *vc = [NewMycollectionViewController new];
- NewPushViewController(vc);
- }else{
- NSLog(@"%@",@"未登录");
- NewLoginViewController *vc = [[NewLoginViewController alloc] init];
- [vc setLoginSuccess:^(NSString *string) {
- NewDismissNavigationController;
- }];
- NewPresentNavigationController(vc);
- }
- }else if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"技淘客服"]){
- NewKeFuViewController *vc = [NewKeFuViewController new];
- NewPushViewController(vc);
- }else if ([dataArray[indexPath.row][@"nameKey"] isEqualToString:@"我的消息"]){
- if ([UserHelper isLogin]) {
- NSLog(@"%@",@"已登录");
- NewMessageViewController *vc = [NewMessageViewController new];
- NewPushViewController(vc);
- }else{
- NSLog(@"%@",@"未登录");
- NewLoginViewController *vc = [[NewLoginViewController alloc] init];
- [vc setLoginSuccess:^(NSString *string) {
- NewDismissNavigationController;
- }];
- NewPresentNavigationController(vc);
- }
- }
- }
- // tableView 如果是Gruop类型的话,section之间的间距变宽,执行返回高度的同时还需要执行return UIView的代理
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- return 300;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- UIView *headview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 300)];
- headview.userInteractionEnabled = YES;
- headview.backgroundColor = NewNavigationColor;
-
- UIImageView *backview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 196)];
- [backview setImage:NewImageNamed(@"bj3")];
- backview.userInteractionEnabled = YES;
- [headview addSubview:backview];
-
- // UIButton *UserimageBT = [UIButton new];
- UIImageView *headimage = [UIImageView new];
- [headimage sd_setImageWithURL:NewURL([[UserEntity sharedInstance].headPortraitUrl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"txty")];
- // [UserimageBT setBackgroundImage:headimage.image forState:UIControlStateNormal];
- ViewRadius(headimage, fitScreenWidth(73/2));
- // UserimageBT.tag = 100;
- [backview addSubview:headimage];
-
- headimage.sd_layout
- .leftSpaceToView(backview, 15)
- .heightIs(fitScreenWidth(73))
- .widthIs(fitScreenWidth(73))
- .topSpaceToView(backview, 62);
-
- if ([UserHelper isLogin]) {
- UILabel *name = [UILabel new];
- name.text = [NSString stringWithFormat:@"%@,欢迎您",[UserEntity sharedInstance].name];
- name.font = NewFont(fitScreenWidth(17));
- [name setSingleLineAutoResizeWithMaxWidth:0];
- name.textColor = NewWhiteColor;
- [backview addSubview:name];
-
- name.sd_layout
- .heightIs(15)
- .topSpaceToView(backview, 80)
- .leftSpaceToView(headimage, 15);
-
- UILabel *userlvl = [UILabel new];
-
- CGFloat width = [NewUtils heightforString:[UserEntity sharedInstance].type andHeight:23 fontSize:fitScreenWidth(14)];
- userlvl.text = [UserEntity sharedInstance].type;
- userlvl.textColor = NewWhiteColor;
- userlvl.backgroundColor = [UIColor colorWithString:@"#0D79C5"];
- userlvl.font = NewFont(fitScreenWidth(14));
- ViewRadius(userlvl, 23/2);
- [userlvl setTextAlignment:NSTextAlignmentCenter];
- [backview addSubview:userlvl];
-
- userlvl.sd_layout
- .leftEqualToView(name)
- .heightIs(23)
- .topSpaceToView(name, 6)
- .widthIs(width+10);
-
- }else{
- UIButton *usernameBT = [UIButton new];
- [usernameBT setTitle:@"登 录" forState:UIControlStateNormal];
- [usernameBT setTitleColor:NewWhiteColor forState:UIControlStateNormal];
- usernameBT.titleLabel.font = NewFont(17);
- NewTouchUpInside(usernameBT, usernameBTclick:);
- [usernameBT setupAutoSizeWithHorizontalPadding:0 buttonHeight:34];
- usernameBT.tag = 100;
- [backview addSubview:usernameBT];
-
- usernameBT.sd_layout
- .leftSpaceToView(headimage, 15)
- .heightIs(34)
- .centerYEqualToView(headimage);
- // NewTouchUpInside(headimage, usernameBTclick:);
-
- UIButton *usernameBT1 = [UIButton new];
- [usernameBT1 setTitle:@"/注 册" forState:UIControlStateNormal];
- [usernameBT1 setTitleColor:NewWhiteColor forState:UIControlStateNormal];
- usernameBT1.titleLabel.font = NewFont(17);
- NewTouchUpInside(usernameBT1, usernameBTclick:);
- [usernameBT1 setupAutoSizeWithHorizontalPadding:0 buttonHeight:34];
- usernameBT1.tag = 101;
- [backview addSubview:usernameBT1];
-
- usernameBT1.sd_layout
- .leftSpaceToView(usernameBT, 0)
- .heightIs(34)
- .centerYEqualToView(headimage);
- // NewTouchUpInside(UserimageBT, usernameBTclick:);
-
- }
-
- UIView *dingdanView = [[UIView alloc] initWithFrame:CGRectMake(15, 179, SCREEN_WIDTH-30, 109)];
- ViewRadius(dingdanView, 5);
- dingdanView.backgroundColor = NewWhiteColor;
- dingdanView.userInteractionEnabled = YES;
- [backview addSubview:dingdanView];
-
- UILabel *myOrder = [UILabel new];
- myOrder.text = @"我的订单";
- myOrder.font = NewFont(15);
- myOrder.textColor = NewBlackColor;
- [myOrder setSingleLineAutoResizeWithMaxWidth:0];
- [dingdanView addSubview:myOrder];
-
- myOrder.sd_layout
- .leftSpaceToView(dingdanView, 10)
- .heightIs(15)
- .topSpaceToView(dingdanView, 10);
-
- UILabel *line = [UILabel new];
- line.backgroundColor = NewLineGrayColor;
- [dingdanView addSubview:line];
-
- line.sd_layout
- .leftEqualToView(dingdanView)
- .heightIs(0.8)
- .rightEqualToView(dingdanView)
- .topSpaceToView(dingdanView, 35);
- NSArray *arr = @[@"qbdd",@"zqdd",@"cgdd",@"xqdd",@"gwdd",@"zjdd"];
- for (int i = 0; i<6; i++) {
- UIButton *button111 = [UIButton buttonWithType:UIButtonTypeCustom];
- NewTouchUpInside(button111, afasaafsafasfsaf:);
- [button111 setBackgroundColor:NewClearColor];
- float btwidth = (SCREEN_WIDTH-30)/6;
- button111.frame = CGRectMake(15+i*btwidth, 179+37, btwidth, 74);
- button111.tag = 100+i;
- [headview addSubview:button111];
-
- UIImageView *image = [UIImageView new];
- [image setImage:[UIImage imageNamed:arr[i]]];
- float X = (btwidth-18)/2;
- image.frame = CGRectMake(X, 15, 18, 18);
- [button111 addSubview:image];
- UILabel *titlelabel = [UILabel new];
- titlelabel.text = dingdanArray[i];
- titlelabel.font = NewFont(13);
- titlelabel.textAlignment = NSTextAlignmentCenter;
- titlelabel.frame = CGRectMake(0, 25+18, btwidth, 15);
- [button111 addSubview:titlelabel];
- }
- return headview;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
- return [[UIView alloc] init];
- }
- - (void)usernameBTclick:(UIButton *)sender {
- if (sender.tag == 100) {
- NewLoginViewController *vc = [[NewLoginViewController alloc] init];
- [vc setLoginSuccess:^(NSString *string) {
- // [self Networkrequest];
- [newtableView reloadData];
- NewDismissNavigationController;
- }];
- NewPresentNavigationController(vc);
- }else{
- NewRegisterViewController *vc = [[NewRegisterViewController alloc] init];
- NewPresentNavigationController(vc);
- }
- }
- - (void)afasaafsafasfsaf:(UIButton *)sender{
-
- if ([UserHelper isLogin]) {
- NSLog(@"%@",@"已登录");
- NewOrderManagementViewController *vc = [NewOrderManagementViewController new];
- vc.dingdantype = dingdanArray[sender.tag-100];
- NewPushViewController(vc);
- }else{
- NSLog(@"%@",@"未登录");
- NewLoginViewController *vc = [[NewLoginViewController alloc] init];
- [vc setLoginSuccess:^(NSString *string) {
- NewDismissNavigationController;
- }];
- NewPresentNavigationController(vc);
- }
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #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
|