JXProcuratorViewController.m 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. //
  2. // JXProcuratorViewController.m
  3. // shiku_im
  4. //
  5. // Created by qiudezheng on 2020/4/29.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXProcuratorViewController.h"
  9. #import "JXBigReelVc.h"
  10. #import "JXActiveDetailVc.h"
  11. @interface JXProcuratorViewController ()
  12. @property(strong,nonatomic)UIView * navigationView;
  13. @property(strong,nonatomic)UIButton * backButton;
  14. @property(strong,nonatomic)UILabel * coinLabel;
  15. @property(strong,nonatomic)NSString * coin;
  16. @property(strong,nonatomic)UIButton * awardButton;
  17. @property(strong,nonatomic)UIButton * applyButton;
  18. @property (nonatomic,strong) NSDictionary *dict;
  19. @end
  20. @implementation JXProcuratorViewController
  21. -(void)viewWillDisappear:(BOOL)animated
  22. {
  23. [SVProgressHUD dismiss];
  24. }
  25. - (void)viewDidLoad {
  26. [super viewDidLoad];
  27. [self initNavigationView];
  28. [self initComponents];
  29. _dict=[NSDictionary dictionary];
  30. long time = (long)[[NSDate date] timeIntervalSince1970];
  31. time = (time *1000 + g_server.timeDifference);
  32. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  33. //[SVProgressHUD show];
  34. [g_server getColoredCoin:salt andToView:self];
  35. [g_server get_act_userServeqqget:@"" salt:salt qq:@"" toView:self];
  36. }
  37. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  38. // [_wait hide];
  39. [SVProgressHUD dismiss];
  40. if([aDownload.action isEqualToString:act_userServeqqget])
  41. {
  42. _dict=dict;
  43. }
  44. if([aDownload.action isEqualToString:act_GetColoredCoin])
  45. {
  46. NSString * money = [NSString stringWithFormat:@"%@",[dict objectForKey:@"money"]];
  47. self.coin = money;
  48. if(money != nil && money.length != 0 && ![money isEqualToString:@"(null)"] && ![money isEqualToString:@"<null>"])
  49. {
  50. self.coinLabel.text = [NSString stringWithFormat:@"您当前可领取彩金币:%@",money];
  51. }
  52. }
  53. if([aDownload.action isEqualToString:act_withDrawColoredCoin])
  54. {
  55. [SVProgressHUD setMaximumDismissTimeInterval:2.5f];
  56. [SVProgressHUD showSuccessWithStatus:@"代理彩金提现成功"];
  57. }
  58. }
  59. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  60. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  61. if([errorCode isEqualToString:@"权限验证失败"])
  62. {
  63. if([aDownload.action isEqualToString:act_GetColoredCoin])
  64. {
  65. long time = (long)[[NSDate date] timeIntervalSince1970];
  66. time = (time *1000 + g_server.timeDifference);
  67. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  68. [g_server getColoredCoin:salt andToView:self];
  69. }
  70. if([aDownload.action isEqualToString:act_withDrawColoredCoin])
  71. {
  72. long time = (long)[[NSDate date] timeIntervalSince1970];
  73. time = (time *1000 + g_server.timeDifference);
  74. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  75. [g_server withDrawColoredCoin:salt andToView:self];
  76. }
  77. }
  78. else
  79. {
  80. [SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]];
  81. }
  82. if( [aDownload.action isEqualToString:act_UserLogout] ){
  83. [self performSelector:@selector(doSwitch) withObject:nil afterDelay:1];
  84. }
  85. return hide_error;
  86. }
  87. -(void)initComponents
  88. {
  89. UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.navigationView.frame.origin.y + self.navigationView.frame.size.height, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT - (self.navigationView.frame.origin.y + self.navigationView.frame.size.height))];
  90. scrollView.contentSize = CGSizeMake(JX_SCREEN_WIDTH, 1.77*JX_SCREEN_WIDTH);
  91. [self.view addSubview:scrollView];
  92. // return;
  93. // UIButton *lefImg= [[UIButton alloc]initWithFrame:CGRectMake(15,JX_SCREEN_HEIGHT-42-10, 140, 42)];
  94. // lefImg.layer.cornerRadius = 12;
  95. // lefImg.backgroundColor = [UIColor colorWithRed:125/255.0f green:24/255.0f blue:25/255.0f alpha:1.0f];
  96. // [lefImg setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  97. // [lefImg setTitle:@"活动详情" forState:UIControlStateNormal];
  98. // lefImg.tag=0;
  99. // [self.view addSubview:lefImg];
  100. // [lefImg addTarget:self action:@selector(lefIMGClick:) forControlEvents:UIControlEventTouchUpInside];
  101. //
  102. // UIButton *rightImg= [[UIButton alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH-140-15, JX_SCREEN_HEIGHT-42-10, 140, 42)];
  103. // rightImg.tag=1;
  104. // rightImg.layer.cornerRadius = 12;
  105. // rightImg.backgroundColor = [UIColor colorWithRed:125/255.0f green:24/255.0f blue:25/255.0f alpha:1.0f];
  106. // [rightImg setTitle:@"我要参与" forState:UIControlStateNormal];
  107. // [rightImg setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  108. // // [rightImg setBackgroundImage:[UIImage imageNamed:@"huodongxq"] forState:UIControlStateNormal];
  109. // [self.view addSubview:rightImg];
  110. // [rightImg addTarget:self action:@selector(lefIMGClick:) forControlEvents:UIControlEventTouchUpInside];
  111. UIImageView * compImage = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,JX_SCREEN_WIDTH,1.77*JX_SCREEN_WIDTH)];
  112. compImage.image = [UIImage imageNamed:@"proImage.jpeg"];
  113. [scrollView addSubview:compImage];
  114. compImage.userInteractionEnabled = YES;
  115. self.coinLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0.26 * compImage.frame.size.height, 200, 35)];
  116. self.coinLabel.text = @"";
  117. self.coinLabel.textColor = [UIColor colorWithRed:126/255.0f green:23/255.0f blue:21/255.0f alpha:1.0f];
  118. self.coinLabel.font = [UIFont systemFontOfSize:13.0f];
  119. [compImage addSubview:self.coinLabel];
  120. self.awardButton = [UIButton buttonWithType:UIButtonTypeCustom];
  121. self.awardButton.frame = CGRectMake(15, self.coinLabel.frame.origin.y + self.coinLabel.frame.size.height, 80, 30);
  122. [self.awardButton setBackgroundColor:[UIColor colorWithRed:195/255.0f green:47/255.0f blue:53/255.0f alpha:1.0f]];
  123. [self.awardButton setTitle:@"领取奖励" forState:UIControlStateNormal];
  124. [self.awardButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  125. [self.awardButton.titleLabel setFont:[UIFont boldSystemFontOfSize:14.0f]];
  126. [self.awardButton.layer setCornerRadius:15.0f];
  127. [self.awardButton.layer setMasksToBounds:YES];
  128. [self.awardButton addTarget:self action:@selector(awardButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
  129. [compImage addSubview:self.awardButton];
  130. self.applyButton = [UIButton buttonWithType:UIButtonTypeCustom];
  131. //self.applyButton.frame = CGRectMake(JX_SCREEN_WIDTH - 80 - 15, self.coinLabel.frame.origin.y + self.coinLabel.frame.size.height, 80, 30);
  132. [self.applyButton setBackgroundColor:[UIColor colorWithRed:245/255.0f green:224/255.0f blue:108/255.0f alpha:1.0f]];
  133. [self.applyButton setTitle:@"申请代理" forState:UIControlStateNormal];
  134. [self.applyButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  135. [self.applyButton.titleLabel setFont:[UIFont boldSystemFontOfSize:14.0f]];
  136. [self.applyButton.layer setCornerRadius:15.0f];
  137. [self.applyButton.layer setMasksToBounds:YES];
  138. [compImage addSubview:self.applyButton];
  139. }
  140. -(void)awardButtonClicked:(UIButton *)sender
  141. {
  142. NSDictionary *dict=_dict;
  143. NSString *url = [NSString stringWithFormat:@"mqqwpa://im/chat?chat_type=crm&uin=%@&version=1&src_type=web&web_src=http:://wpa.b.qq.com",dict[@"qq"]];
  144. NSURL *qqURL = [NSURL URLWithString:url];
  145. [[UIApplication sharedApplication] openURL:qqURL];
  146. return;
  147. if(self.coin.intValue == 0 || self.coin == nil || self.coin.length == 0 || [self.coin isEqualToString:@"(null)"] || [self.coin isEqualToString:@"<null>"])
  148. {
  149. [SVProgressHUD setMaximumDismissTimeInterval:2.0f];
  150. [SVProgressHUD showErrorWithStatus:@"当前彩金币不足"];
  151. }
  152. else
  153. {
  154. long time = (long)[[NSDate date] timeIntervalSince1970];
  155. time = (time *1000 + g_server.timeDifference);
  156. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  157. [SVProgressHUD show];
  158. [g_server withDrawColoredCoin:salt andToView:self];
  159. }
  160. }
  161. -(void)lefIMGClick:(UIButton *)sender{
  162. // [SVProgressHUD showWithStatus:@"暂未开发"];
  163. // [SVProgressHUD dismissWithDelay:1.0];
  164. // return;
  165. if (sender.tag==0) {
  166. JXActiveDetailVc *vc=[JXActiveDetailVc new];
  167. [g_navigation pushViewController:vc animated:YES];
  168. }else{
  169. JXBigReelVc *vc=[JXBigReelVc new];
  170. [g_navigation pushViewController:vc animated:YES];
  171. }
  172. }
  173. -(void)initNavigationView
  174. {
  175. self.navigationView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT>=812?88:64)];
  176. self.navigationView.backgroundColor = [UIColor whiteColor];
  177. [self.view addSubview:self.navigationView];
  178. UILabel * titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, JX_SCREEN_TOP - 40, JX_SCREEN_WIDTH, 40)];
  179. titleLabel.text = @"申请代理";
  180. titleLabel.textColor = [UIColor blackColor];
  181. titleLabel.font = [UIFont systemFontOfSize:18.0f];
  182. titleLabel.textAlignment = NSTextAlignmentCenter;
  183. [self.navigationView addSubview:titleLabel];
  184. self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
  185. self.backButton.frame = CGRectMake(15, 30, 30, 30);
  186. if(JX_SCREEN_HEIGHT >= 812)
  187. {
  188. self.backButton.frame = CGRectMake(15, 45, 30, 30);
  189. }
  190. [self.backButton setImage:[UIImage imageNamed:@"title_back_black"] forState:UIControlStateNormal];
  191. [self.backButton addTarget:self action:@selector(backButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
  192. [self.navigationView addSubview:self.backButton];
  193. }
  194. -(void)backButtonClicked:(UIButton *)sender
  195. {
  196. [g_navigation dismissViewController:self animated:YES];
  197. }
  198. @end