MineController.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. //
  2. // MineController.m
  3. // model
  4. //
  5. // Created by zuxiukuan on 2018/7/15.
  6. // Copyright © 2018年 Mine. All rights reserved.
  7. // 我的
  8. #import "MineController.h"
  9. #import "MyWalletController.h"
  10. #import "ModelDataController.h"
  11. #import "MySkillsController.h"
  12. #import "MyOrderController.h"
  13. #import "PlatformActivityController.h"
  14. #import "RedEnvelopeController.h"
  15. #import "ModelCodeController.h"
  16. #import "UIViewController+YJPhoto.h"
  17. #import "LoginViewController.h"
  18. #import "AboutUsViewController.h"
  19. @interface MineController ()
  20. @property (nonatomic, strong) UIImageView *iconView; //  头像
  21. @property (nonatomic, strong) UILabel *nameLabel; //  名字
  22. @property (nonatomic, strong) UILabel *incomeLabel; //  收入
  23. @property (nonatomic, strong) UIView *notificationView; //  消息红点
  24. @property (nonatomic, strong) UIScrollView *bgScrollView; //  滚动背景
  25. @end
  26. @implementation MineController
  27. {
  28. UIView *outPutView;
  29. UILabel *outLabel;
  30. UIImageView *cancelBtn;
  31. UIImageView *sureBtn;
  32. UIImageView *mengBanView;
  33. }
  34. - (void)viewWillAppear:(BOOL)animated {
  35. [self changeLoginState:@"1"];
  36. [super viewWillAppear:animated];
  37. self.navigationController.navigationBar.hidden = YES;
  38. // 网络请求
  39. [self getDataFromNetworking];
  40. }
  41. - (void)viewWillDisappear:(BOOL)animated {
  42. [super viewWillDisappear:animated];
  43. self.navigationController.navigationBar.hidden = NO;
  44. }
  45. - (void)changeLoginState:(NSString *)state{
  46. NSString *str = [NSString stringWithFormat:@"%@modelInfo?action=doPutOnline&modelpk=%@&online=%@",imageURl,[ModelUser user].modelpk,state];
  47. [[AHHttpManager sharedManager]POST:str parameters:nil success:^(id responseObject) {
  48. NSLog(@"%@",responseObject);
  49. if ([[responseObject objectForKey:@"msg"]isEqualToString:@"success"]) {
  50. }else{
  51. }
  52. } failure:^(NSError *error) {
  53. NSLog(@"error = %@",error);
  54. }];
  55. }
  56. - (void)viewDidLoad {
  57. [super viewDidLoad];
  58. self.view.backgroundColor = [UIColor whiteColor];
  59. self.extendedLayoutIncludesOpaqueBars = YES;
  60. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orderNotification) name:@"orderMsg" object:nil];
  61. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideNavigationBar) name:@"hideNavigationBar" object:nil];
  62. //布局子视图
  63. [self createSubviews];
  64. mengBanView = [[UIImageView alloc]init];
  65. mengBanView.frame = self.view.bounds;
  66. [mengBanView setImage:[UIImage imageNamed:@"graymengban"]];
  67. outPutView = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenHeight-140, ScreenWidth, 140)];
  68. outPutView.backgroundColor = [UIColor whiteColor];
  69. outLabel = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth/2-50, 30, 140, 30)];
  70. outLabel.text = @"是否确定退出?";
  71. cancelBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 80, ScreenWidth/2, 60)];
  72. [cancelBtn setImage:[UIImage imageNamed:@"quxiao"]];
  73. sureBtn = [[UIImageView alloc]initWithFrame:CGRectMake(ScreenWidth/2, 80, ScreenWidth/2, 60)];
  74. [sureBtn setImage:[UIImage imageNamed:@"queding"]];
  75. [outPutView addSubview:cancelBtn];
  76. [outPutView addSubview:sureBtn];
  77. [outPutView addSubview:outLabel];
  78. [mengBanView addSubview:outPutView];
  79. UITapGestureRecognizer *cancelTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cancelAction:)];
  80. [cancelBtn addGestureRecognizer:cancelTap];
  81. UITapGestureRecognizer *sureTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sureAction:)];
  82. [sureBtn addGestureRecognizer:sureTap];
  83. cancelBtn.userInteractionEnabled = YES;
  84. sureBtn.userInteractionEnabled = YES;
  85. outPutView.userInteractionEnabled = YES;
  86. mengBanView.userInteractionEnabled = YES;
  87. [self.navigationController.view addSubview:mengBanView];
  88. [self hideOutPut];
  89. }
  90. -(void)hideNavigationBar{
  91. if ([[self getCurrentVC] isKindOfClass:[MineController class]]) {
  92. self.navigationController.navigationBar.hidden = YES;
  93. }
  94. }
  95. //获取当前屏幕显示的viewcontroller
  96. -(UIViewController *)getCurrentVC {
  97. UIViewController *result = nil;
  98. UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
  99. do {
  100. if ([rootVC isKindOfClass:[UINavigationController class]]) {
  101. UINavigationController *navi = (UINavigationController *)rootVC;
  102. UIViewController *vc = [navi.viewControllers lastObject];
  103. result = vc;
  104. rootVC = vc.presentedViewController;
  105. continue;
  106. } else if([rootVC isKindOfClass:[UITabBarController class]]) {
  107. UITabBarController *tab = (UITabBarController *)rootVC;
  108. result = tab;
  109. rootVC = [tab.viewControllers objectAtIndex:tab.selectedIndex];
  110. continue;
  111. } else if([rootVC isKindOfClass:[UIViewController class]]) {
  112. result = rootVC;
  113. rootVC = nil;
  114. }
  115. } while (rootVC != nil);
  116. return result;
  117. }
  118. - (void)hideOutPut{
  119. mengBanView.hidden = YES;
  120. outPutView.hidden = YES;
  121. outLabel.hidden = YES;
  122. cancelBtn.hidden = YES;
  123. sureBtn.hidden = YES;
  124. }
  125. - (void)showOutPut{
  126. mengBanView.hidden = NO;
  127. outPutView.hidden = NO;
  128. outLabel.hidden = NO;
  129. cancelBtn.hidden = NO;
  130. sureBtn.hidden = NO;
  131. }
  132. //隐藏tabbar
  133. - (void)hideTabBar {
  134. if (self.tabBarController.tabBar.hidden == YES) {
  135. return;
  136. }
  137. UIView *contentView;
  138. if ( [[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]]){
  139. contentView = [self.tabBarController.view.subviews objectAtIndex:1];
  140. }else{
  141. contentView = [self.tabBarController.view.subviews objectAtIndex:0];
  142. }
  143. contentView.frame = CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y, contentView.bounds.size.width, contentView.bounds.size.height + self.tabBarController.tabBar.frame.size.height);
  144. self.tabBarController.tabBar.hidden = YES;
  145. }
  146. //显示tabbar
  147. - (void)showTabBar
  148. {
  149. if (self.tabBarController.tabBar.hidden == NO)
  150. {
  151. return;
  152. }
  153. UIView *contentView;
  154. if ([[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]]){
  155. contentView = [self.tabBarController.view.subviews objectAtIndex:1];
  156. }else{
  157. contentView = [self.tabBarController.view.subviews objectAtIndex:0];
  158. }
  159. contentView.frame = CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y, contentView.bounds.size.width, contentView.bounds.size.height - self.tabBarController.tabBar.frame.size.height);
  160. self.tabBarController.tabBar.hidden = NO;
  161. }
  162. - (void)cancelAction:(UITapGestureRecognizer*)recognizer{
  163. [self showTabBar];
  164. [self hideOutPut];
  165. }
  166. - (void)sureAction:(UITapGestureRecognizer*)recognizer{
  167. [self changeLoginState];
  168. [self setupLoginViewController];
  169. [[[NIMSDK sharedSDK] loginManager] logout:^(NSError *error) {
  170. NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
  171. [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
  172. }];
  173. }
  174. - (void)setupLoginViewController
  175. {
  176. [self.view.window.rootViewController dismissViewControllerAnimated:YES completion:nil];
  177. LoginViewController *loginController = [[LoginViewController alloc] init];
  178. UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:loginController];
  179. self.view.window.rootViewController = nav;
  180. }
  181. - (void)didReceiveMemoryWarning {
  182. [super didReceiveMemoryWarning];
  183. }
  184. #pragma mark -- 网络请求
  185. - (void)getDataFromNetworking {
  186. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  187. NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:[ModelUser user].modelpk,@"modelpk", nil];
  188. [YanCNetWorkManager requestPostWithURLStr:Url_refreshLogin(PublicUrl) parameters:dic finish:^(id dataDic) {
  189. [MBProgressHUD hideHUDForView:self.view animated:YES];
  190. NSString *issuccess = dataDic[@"msg"];
  191. if ([issuccess isEqualToString:@"success"]) {
  192. ModelUser *user = [ModelUser modelUser];
  193. [user setValuesForKeysWithDictionary:dataDic[@"data"]];
  194. user.modelpk = dataDic[@"data"][@"modelpk"];
  195. user.coin_a = dataDic[@"data"][@"coin_a"];
  196. user.coin_ir = dataDic[@"data"][@"coin_ir"];
  197. user.pk = dataDic[@"data"][@"pk"];
  198. user.qrcode = dataDic[@"data"][@"qrcode"];
  199. [ModelUser save:user];
  200. self.nameLabel.text = [NSString stringWithFormat:@"%@", dataDic[@"data"][@"pet"]];
  201. [self.iconView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", PublicUrl, dataDic[@"data"][@"hphoto"]]] placeholderImage:[UIImage imageNamed:@"morentouxiang"]];
  202. if ([dataDic[@"data"][@"hasred"] isEqualToString:@"1"]) {
  203. self.notificationView.hidden = NO;
  204. }else{
  205. self.notificationView.hidden = YES;
  206. }
  207. [self getIncomeFromNetworking];
  208. } else {
  209. [MBProgressHUD showInfo:@"请求失败!"];
  210. }
  211. } enError:^(NSError *error) {
  212. [MBProgressHUD hideHUDForView:self.view animated:YES];
  213. }];
  214. }
  215. -(void)getIncomeFromNetworking{
  216. NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:[ModelUser modelUser].pk,@"memberpk", nil];
  217. [YanCNetWorkManager requestPostWithURLStr:Url_getIncomeToday(PublicUrl) parameters:dic finish:^(id dataDic) {
  218. NSString *issuccess = dataDic[@"msg"];
  219. if ([issuccess isEqualToString:@"success"]) {
  220. self.incomeLabel.text = [NSString stringWithFormat:@"%@元", dataDic[@"count"]];
  221. }else {
  222. [MBProgressHUD showInfo:@"请求失败!"];
  223. }
  224. }enError:^(NSError *error) {
  225. [MBProgressHUD hideHUDForView:self.view animated:YES];
  226. }];
  227. }
  228. #pragma mark -- 布局子视图
  229. - (void)createSubviews {
  230. self.bgScrollView = [[UIScrollView alloc]initWithFrame:self.view.bounds];
  231. self.bgScrollView.backgroundColor = [UIColor whiteColor];
  232. self.bgScrollView.contentSize = CGSizeMake(ScreenWidth, 600);
  233. self.bgScrollView.showsVerticalScrollIndicator = NO;
  234. [self.view addSubview:self.bgScrollView];
  235. //头像
  236. self.iconView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth/2 - 40, 40, 80, 80)];
  237. self.iconView.layer.masksToBounds = YES;
  238. self.iconView.layer.cornerRadius = 40;
  239. [self.bgScrollView addSubview:self.iconView];
  240. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickUploadHeadPhoto)];
  241. self.iconView.userInteractionEnabled = YES;
  242. [self.iconView addGestureRecognizer:tap];
  243. //姓名
  244. self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.iconView.frame) + 18, ScreenWidth, 16)];
  245. self.nameLabel.font = [UIFont systemFontOfSize:16.f];
  246. self.nameLabel.textColor = RGBValueColor(0x333333, 1.0);
  247. self.nameLabel.textAlignment = NSTextAlignmentCenter;
  248. [self.bgScrollView addSubview:self.nameLabel];
  249. //线
  250. UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.nameLabel.frame) + 20, ScreenWidth, 0.5)];
  251. lineLabel.backgroundColor = RGBValueColor(0xdfdfdf, 1.0);
  252. [self.bgScrollView addSubview:lineLabel];
  253. //收入金额
  254. self.incomeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(lineLabel.frame) + 10, ScreenWidth, 16)];
  255. self.incomeLabel.font = [UIFont systemFontOfSize:16.f];
  256. self.incomeLabel.textColor = RGBValueColor(0x333333, 1.0);
  257. self.incomeLabel.textAlignment = NSTextAlignmentCenter;
  258. [self.bgScrollView addSubview:self.incomeLabel];
  259. //今日收入
  260. UILabel *incomeTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.incomeLabel.frame) + 8, ScreenWidth, 13)];
  261. incomeTitleLabel.font = [UIFont systemFontOfSize:13.f];
  262. incomeTitleLabel.textColor = RGBValueColor(0x999999, 1.0);
  263. incomeTitleLabel.textAlignment = NSTextAlignmentCenter;
  264. incomeTitleLabel.text = @"今日收入";
  265. [self.bgScrollView addSubview:incomeTitleLabel];
  266. //粗线条
  267. UILabel *greyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(incomeTitleLabel.frame) + 10, ScreenWidth, 10)];
  268. greyLabel.backgroundColor = RGBValueColor(0xf7f7f7, 1.0);
  269. [self.bgScrollView addSubview:greyLabel];
  270. //  九宫格
  271. CGFloat btnWidth = ScreenWidth / 3;
  272. CGFloat btnHeight = 95 * AutoSizeSalseX;
  273. NSArray *imagesArr = @[@"qianbao",@"jineng",@"dingdan",@"mokaziliao",@"pingtaihuodong",@"erweima",@"aboutUs",@"tuichu"];
  274. NSArray *titlesArr = @[@"我的钱包",@"我的技能",@"我的订单",@"模卡资料",@"平台活动",@"邀请二维码",@"联系我们",@"退出账号"];
  275. for (int i = 0; i < 8; i++) {// 0 1 2 3 4 5 6 7
  276. int x = i % 3;
  277. int y = i / 3;
  278. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  279. btn.frame = CGRectMake(x * btnWidth, CGRectGetMaxY(greyLabel.frame) + y * btnHeight, btnWidth, btnHeight);
  280. [btn setImage:[UIImage imageNamed:imagesArr[i]] forState:UIControlStateNormal];
  281. btn.adjustsImageWhenHighlighted = NO;
  282. [btn setTitle:titlesArr[i] forState:UIControlStateNormal];
  283. [btn setTitleColor:RGBValueColor(0x333333, 1.0) forState:UIControlStateNormal];
  284. btn.titleLabel.font = [UIFont systemFontOfSize:13];
  285. // button标题的偏移量
  286. btn.titleEdgeInsets = UIEdgeInsetsMake(btn.imageView.frame.size.height+12, -btn.imageView.bounds.size.width, 0,0);
  287. // button图片的偏移量
  288. btn.imageEdgeInsets = UIEdgeInsetsMake(0, btn.titleLabel.frame.size.width/2, btn.titleLabel.frame.size.height+12, -btn.titleLabel.frame.size.width/2);
  289. btn.tag = i;
  290. [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
  291. [self.bgScrollView addSubview:btn];
  292. if (i == 2) {
  293. self.notificationView = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(btn.imageView.frame)-3, CGRectGetMinY(btn.imageView.frame)-5, 10, 10)];
  294. self.notificationView.backgroundColor = RGB(254, 64, 134);
  295. self.notificationView.layer.cornerRadius = 5;
  296. [btn addSubview:self.notificationView];
  297. self.notificationView.hidden = YES;
  298. }
  299. if (x == 1) {
  300. UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(btnWidth * x, CGRectGetMaxY(greyLabel.frame), 0.5, btnHeight * 3)];
  301. lineLabel.backgroundColor = RGBValueColor(0xefefef, 1.0);
  302. [self.bgScrollView addSubview:lineLabel];
  303. }
  304. if (x == 2) {
  305. UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(btnWidth * x, CGRectGetMaxY(greyLabel.frame), 0.5, btnHeight * 3)];
  306. lineLabel.backgroundColor = RGBValueColor(0xefefef, 1.0);
  307. [self.bgScrollView addSubview:lineLabel];
  308. }
  309. if (y == 0 || y == 1) {
  310. UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(greyLabel.frame) +btnHeight * (y + 1), ScreenWidth, 0.5)];
  311. lineLabel.backgroundColor = RGBValueColor(0xefefef, 1.0);
  312. [self.bgScrollView addSubview:lineLabel];
  313. }
  314. if (y == 2) {
  315. UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(greyLabel.frame) +btnHeight * 3, btnWidth * 2, 0.5)];
  316. lineLabel.backgroundColor = RGBValueColor(0xefefef, 1.0);
  317. [self.bgScrollView addSubview:lineLabel];
  318. }
  319. }
  320. }
  321. -(void)clickUploadHeadPhoto{
  322. [self showCanEdit:NO title:@"上传头像" wscale:0.7 hscale:0.7 photo:^(UIImage *photo) {
  323. NSData *photoData = UIImageJPEGRepresentation(photo, 0.2);
  324. NSInteger length = [photoData length] / 1000;
  325. NSLog(@"图片大小:%ld Kb",(long)length);
  326. UIImage *smallPhoto = [UIImage imageWithData:photoData];
  327. ModelUser *user = [ModelUser modelUser];
  328. AFHTTPSessionManager * manger =[AFHTTPSessionManager manager];
  329. manger.responseSerializer = [AFHTTPResponseSerializer serializer];
  330. manger.requestSerializer = [AFJSONRequestSerializer serializer];
  331. manger.securityPolicy.allowInvalidCertificates = YES;
  332. NSDictionary *dict =@{@"memberpk":user.pk,
  333. @"action":@"hp"
  334. };
  335. [manger POST:Url_uploadImage(PublicUrl) parameters:dict constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
  336. if (photoData==NULL) {
  337. }else{
  338. [formData appendPartWithFileData:photoData name:@"img" fileName:@"head.png" mimeType:@"image/png"];
  339. }
  340. } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
  341. self.iconView.image = smallPhoto;
  342. NSDictionary *dic =[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers| NSJSONReadingMutableLeaves error:nil];
  343. NSString * img = [dic objectForKey:@"img"];
  344. [[NIMSDK sharedSDK].userManager updateMyUserInfo:@{@(NIMUserInfoUpdateTagAvatar) : [NSString stringWithFormat:@"%@%@",imageURl,img]} completion:nil];
  345. } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
  346. }];
  347. }];
  348. }
  349. - (void)btnAction:(UIButton *)sender {
  350. NSLog(@"sender.tag = %ld", sender.tag);
  351. switch (sender.tag) {
  352. case 0: //   我的钱包
  353. {
  354. MyWalletController *myWalletVC = [[MyWalletController alloc] init];
  355. myWalletVC.hidesBottomBarWhenPushed = YES;
  356. myWalletVC.amount = [ModelUser modelUser].coin_a;
  357. [self.navigationController pushViewController:myWalletVC animated:YES];
  358. }
  359. break;
  360. case 1://   我的技能
  361. {
  362. MySkillsController *mySkillsVC = [[MySkillsController alloc] init];
  363. mySkillsVC.hidesBottomBarWhenPushed = YES;
  364. [self.navigationController pushViewController:mySkillsVC animated:YES];
  365. }
  366. break;
  367. case 2://   我的订单
  368. {
  369. [self doRemoveModelHasRed];
  370. MyOrderController *myOrderVC = [[MyOrderController alloc] init];
  371. myOrderVC.hidesBottomBarWhenPushed = YES;
  372. [self.navigationController pushViewController:myOrderVC animated:YES];
  373. }
  374. break;
  375. case 3://   模卡资料
  376. {
  377. ModelDataController *modelDataVC = [[ModelDataController alloc] init];
  378. modelDataVC.hidesBottomBarWhenPushed = YES;
  379. [self.navigationController pushViewController:modelDataVC animated:YES];
  380. }
  381. break;
  382. case 4://   平台活动
  383. {
  384. PlatformActivityController *activityVC = [[PlatformActivityController alloc] init];
  385. activityVC.hidesBottomBarWhenPushed = YES;
  386. [self.navigationController pushViewController:activityVC animated:YES];
  387. }
  388. break;
  389. case 5://   邀请二维码
  390. {
  391. ModelCodeController *modelCodeVC = [[ModelCodeController alloc] init];
  392. modelCodeVC.hidesBottomBarWhenPushed = YES;
  393. [self.navigationController pushViewController:modelCodeVC animated:YES];
  394. }
  395. break;
  396. case 6://   关于我们
  397. {
  398. AboutUsViewController *aboutUsVC = [[AboutUsViewController alloc] init];
  399. aboutUsVC.hidesBottomBarWhenPushed = YES;
  400. [self.navigationController pushViewController:aboutUsVC animated:YES];
  401. }
  402. break;
  403. case 7://   退出账号
  404. {
  405. // UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:nil message:@"是否确定退出" preferredStyle:UIAlertControllerStyleAlert];
  406. // UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
  407. // UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  408. // [self.navigationController pushViewController:[UIViewController new] animated:YES];
  409. // }];
  410. // [alertVc addAction:cancelAction];
  411. // [alertVc addAction:sureAction];
  412. // [self presentViewController:alertVc animated:YES completion:nil];
  413. [self hideTabBar];
  414. [self showOutPut];
  415. }
  416. break;
  417. default:
  418. break;
  419. }
  420. }
  421. - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
  422. if (![outPutView isExclusiveTouch]) {
  423. [self showTabBar];
  424. [self hideOutPut];
  425. }
  426. }
  427. - (void)changeLoginState{
  428. NSString *str = [NSString stringWithFormat:@"%@modelInfo?action=doPutOnline&modelpk=%@&online=0",imageURl,[ModelUser user].modelpk];
  429. [[AHHttpManager sharedManager]POST:str parameters:nil success:^(id responseObject) {
  430. NSLog(@"%@",responseObject);
  431. if ([[responseObject objectForKey:@"msg"]isEqualToString:@"success"]) {
  432. }else{
  433. }
  434. } failure:^(NSError *error) {
  435. NSLog(@"error = %@",error);
  436. }];
  437. }
  438. -(void)doRemoveModelHasRed{
  439. NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:[ModelUser modelUser].modelpk,@"modelpk", nil];
  440. [YanCNetWorkManager requestPostWithURLStr:Url_doRemoveModelHasRed(PublicUrl) parameters:dic finish:^(id dataDic) {
  441. NSString *issuccess = dataDic[@"msg"];
  442. if ([issuccess isEqualToString:@"success"]) {
  443. }else {
  444. }
  445. }enError:^(NSError *error) {
  446. }];
  447. }
  448. -(void)orderNotification{
  449. [self getDataFromNetworking];
  450. }
  451. @end