JXGoldMangVc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. //
  2. // JXGoldMangVc.h
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/6/14.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "XMGMyBaseVC.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. @interface JXGoldMangVc : XMGMyBaseVC
  12. @property (nonatomic,copy) NSString *nameStr;
  13. @end
  14. NS_ASSUME_NONNULL_END
  15. /**
  16. - (void)foundSwipe2:(UISwipeGestureRecognizer *)sender {
  17. if (JX_SCREEN_WIDTH<414){
  18. UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc]
  19. initWithTarget:self
  20. action:@selector(foundSwipe:)];
  21. //设置识别滑动方向
  22. recognizer.direction =UISwipeGestureRecognizerDirectionUp;
  23. //Swipe手势识别器关联到View
  24. [self.view addGestureRecognizer:recognizer];
  25. UISwipeGestureRecognizer *recognizer2 = [[UISwipeGestureRecognizer alloc]
  26. initWithTarget:self
  27. action:@selector(foundSwipe2:)];
  28. //设置识别滑动方向
  29. recognizer2.direction =UISwipeGestureRecognizerDirectionDown;
  30. //Swipe手势识别器关联到View
  31. [self.view addGestureRecognizer:recognizer2];
  32. }
  33. CGRect bounds=self.view.bounds;
  34. bounds.origin.y=0;
  35. self.view.bounds=bounds;
  36. }
  37. - (void)foundSwipe:(UISwipeGestureRecognizer *)sender {
  38. CGRect bounds=self.view.bounds;
  39. bounds.origin.y=110;
  40. self.view.bounds=bounds;
  41. }
  42. #import "JXGoldMangVc.h"
  43. @interface JXGoldMangVc ()
  44. @property (nonatomic,weak) UIImageView *titleIMG;
  45. @property (nonatomic,weak) UIImageView *headIMG;
  46. @property (nonatomic,weak) UILabel *titleName;
  47. @property (nonatomic,weak) UILabel *accountL;
  48. @property (nonatomic,weak) UILabel *weekMoney;
  49. @property (nonatomic,weak) UILabel *monthMoney;
  50. @property (nonatomic,weak) UILabel *levelLeft;
  51. @property (nonatomic,weak) UILabel *levelright;
  52. //还差多少大妈
  53. @property (nonatomic,weak) UILabel *chaRightL;
  54. @property (nonatomic,weak) UILabel *touzhuL;
  55. @property (nonatomic,weak) UILabel *lv2kelinQu;
  56. @property (nonatomic,weak) UIView *pressView;
  57. @property (nonatomic,strong) UIImageView *pressIMG;
  58. @property (nonatomic,weak) UIButton *lingBtn;
  59. @property (nonatomic,weak) UIView *scrolView;
  60. @end
  61. @implementation JXGoldMangVc
  62. - (void)viewDidLoad {
  63. [super viewDidLoad];
  64. // self.topViewHHH.constant=JX_SCREEN_TOP;
  65. //
  66. // self.pressView.layer.cornerRadius=2.5;
  67. // self.pressView.layer.masksToBounds=YES;
  68. [self CreateUIUI];
  69. [self defineNavBar:@"金管家" andRinghtBtnImg:@""];
  70. }
  71. - (void)CreateUIUI{
  72. UIView *scrollView=[[UIView alloc]init];
  73. scrollView.backgroundColor=[UIColor whiteColor];
  74. scrollView.userInteractionEnabled=YES;
  75. [self.view addSubview:scrollView];
  76. self.scrolView=scrollView;
  77. [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.top.mas_equalTo(JX_SCREEN_TOP);
  79. make.left.right.mas_equalTo(0);
  80. make.bottom.mas_equalTo(0);
  81. }];
  82. UIImageView *topIMG=[[UIImageView alloc]init];
  83. topIMG.backgroundColor=[UIColor greenColor];
  84. topIMG.contentMode=UIViewContentModeScaleAspectFill;
  85. [scrollView addSubview:topIMG];
  86. topIMG.image=[UIImage imageNamed:@"上半边"];
  87. [topIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  88. make.top.mas_equalTo(0);
  89. make.left.mas_equalTo(0);
  90. make.right.mas_equalTo(0);
  91. }];
  92. UIImageView *topLeftIMG=[[UIImageView alloc]init];
  93. topLeftIMG.image=[UIImage imageNamed:@"上半边文字"];
  94. [topIMG addSubview:topLeftIMG];
  95. [topLeftIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.left.mas_equalTo(30);
  97. make.centerY.mas_equalTo(topIMG.mas_centerY);
  98. }];
  99. UIImageView *headIMG=[[UIImageView alloc]init];
  100. headIMG.contentMode=UIViewContentModeScaleToFill;
  101. headIMG.image=[UIImage imageNamed:@"ALOGO_1200"];
  102. headIMG.layer.cornerRadius=25;
  103. headIMG.layer.masksToBounds=YES;
  104. [scrollView addSubview:headIMG];
  105. self.headIMG=headIMG;
  106. [g_server delHeadImage:g_server.myself.userId];
  107. [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:headIMG];
  108. [headIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.left.mas_equalTo(20);
  110. make.top.mas_equalTo(topIMG.mas_bottom).mas_offset(JX_SCREEN_WIDTH>=414?44:30);
  111. make.width.mas_equalTo(50);
  112. make.height.mas_equalTo(50);
  113. }];
  114. UILabel *titleName=[[UILabel alloc]init];
  115. titleName.font=[UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
  116. titleName.text=@"小明";
  117. [scrollView addSubview:titleName];
  118. self.titleName=titleName;
  119. [titleName mas_makeConstraints:^(MASConstraintMaker *make) {
  120. make.left.mas_equalTo(headIMG.mas_right).mas_offset(10);
  121. make.top.mas_equalTo(headIMG.mas_top).mas_offset(0);
  122. }];
  123. UILabel *accountL=[[UILabel alloc]init];
  124. accountL.font=[UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
  125. accountL.textColor=[UIColor grayColor];
  126. accountL.text=@"账号:jixin111";
  127. accountL.text=[NSString stringWithFormat:@"账号:%@",membershipAccount];
  128. [scrollView addSubview:accountL];
  129. [accountL mas_makeConstraints:^(MASConstraintMaker *make) {
  130. make.left.mas_equalTo(headIMG.mas_right).mas_offset(10);
  131. make.top.mas_equalTo(titleName.mas_bottom).mas_offset(10);
  132. }];
  133. UILabel *weekMoneyL=[[UILabel alloc]init];
  134. weekMoneyL.font=[UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
  135. weekMoneyL.textColor=[UIColor grayColor];
  136. weekMoneyL.text=@"周彩金:0";
  137. [scrollView addSubview:weekMoneyL];
  138. self.weekMoney=weekMoneyL;
  139. [weekMoneyL mas_makeConstraints:^(MASConstraintMaker *make) {
  140. make.right.mas_equalTo(-20);
  141. make.centerY.mas_equalTo(titleName.mas_centerY);
  142. }];
  143. UILabel *monthMoneyL=[[UILabel alloc]init];
  144. monthMoneyL.font=[UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
  145. monthMoneyL.textColor=[UIColor grayColor];
  146. monthMoneyL.text=@"月彩金:5元";
  147. [scrollView addSubview:monthMoneyL];
  148. self.monthMoney=monthMoneyL;
  149. [monthMoneyL mas_makeConstraints:^(MASConstraintMaker *make) {
  150. make.right.mas_equalTo(-20);
  151. make.centerY.mas_equalTo(accountL.mas_centerY);
  152. }];
  153. UILabel *myLevel=[[UILabel alloc]init];
  154. myLevel.font=[UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
  155. myLevel.textColor=[UIColor grayColor];
  156. myLevel.text=@"我的等级";
  157. [scrollView addSubview:myLevel];
  158. [myLevel mas_makeConstraints:^(MASConstraintMaker *make) {
  159. make.left.mas_equalTo(30);
  160. make.top.mas_equalTo(headIMG.mas_bottom).mas_offset(30);
  161. }];
  162. UILabel *leftLevel=[[UILabel alloc]init];
  163. leftLevel.font=[UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
  164. leftLevel.textColor=[UIColor grayColor];
  165. leftLevel.text=@"LV1";
  166. [scrollView addSubview:leftLevel];
  167. self.levelLeft=leftLevel;
  168. [leftLevel mas_makeConstraints:^(MASConstraintMaker *make) {
  169. make.left.mas_equalTo(30);
  170. make.top.mas_equalTo(myLevel.mas_bottom).mas_offset(20);
  171. }];
  172. UILabel *rightLevel=[[UILabel alloc]init];
  173. rightLevel.font=[UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
  174. rightLevel.textColor=[UIColor grayColor];
  175. rightLevel.text=@"还差10K打码到达LV2 ";
  176. [scrollView addSubview:rightLevel];
  177. self.levelright=rightLevel;
  178. [rightLevel mas_makeConstraints:^(MASConstraintMaker *make) {
  179. make.right.mas_equalTo(-20);
  180. make.centerY.mas_equalTo(leftLevel.mas_centerY);
  181. }];
  182. UIView *pressView=[[UIView alloc]init];
  183. pressView.backgroundColor=[UIColor grayColor];
  184. pressView.layer.cornerRadius=2.5;
  185. pressView.layer.masksToBounds=YES;
  186. [scrollView addSubview:pressView];
  187. self.pressView=pressView;
  188. [pressView mas_makeConstraints:^(MASConstraintMaker *make) {
  189. make.top.mas_equalTo(leftLevel.mas_bottom).mas_offset(8);
  190. make.left.mas_equalTo(30);
  191. make.right.mas_equalTo(-20);
  192. make.height.mas_equalTo(5);
  193. }];
  194. _pressIMG=[[UIImageView alloc]init];
  195. _pressIMG.image=[UIImage imageNamed:@"进度条"];
  196. [pressView addSubview:_pressIMG];
  197. _pressIMG.hidden=YES;
  198. [_pressIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  199. make.top.mas_equalTo(0);
  200. make.left.mas_equalTo(0);
  201. make.height.mas_equalTo(5);
  202. }];
  203. UILabel *touzhuL=[[UILabel alloc]init];
  204. touzhuL.font=[UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
  205. touzhuL.textColor=[UIColor grayColor];
  206. touzhuL.text=@"有效投注:30000 ";
  207. [scrollView addSubview:touzhuL];
  208. self.touzhuL=touzhuL;
  209. [touzhuL mas_makeConstraints:^(MASConstraintMaker *make) {
  210. make.left.mas_equalTo(30);
  211. make.top.mas_equalTo(pressView.mas_bottom).mas_offset(8);
  212. }];
  213. UILabel *linQuL=[[UILabel alloc]init];
  214. linQuL.font=[UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
  215. linQuL.textColor=[UIColor grayColor];
  216. linQuL.text=@"LV2可领取30元 ";
  217. [scrollView addSubview:linQuL];
  218. self.lv2kelinQu=linQuL;
  219. [linQuL mas_makeConstraints:^(MASConstraintMaker *make) {
  220. make.right.mas_equalTo(-20);
  221. make.top.mas_equalTo(pressView.mas_bottom).mas_offset(8);
  222. }];
  223. UIButton *nowBtn=[[UIButton alloc]init];
  224. [nowBtn setTitle:@"立即领取彩金" forState:UIControlStateNormal];
  225. [nowBtn setBackgroundImage:[UIImage imageNamed:@"领取按钮"] forState:UIControlStateNormal];
  226. [self.view addSubview:nowBtn];
  227. self.lingBtn=nowBtn;
  228. [nowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  229. make.bottom.mas_equalTo(0);
  230. make.right.left.mas_equalTo(0);
  231. make.height.mas_equalTo(JX_SCREEN_BOTTOM);
  232. }];
  233. [nowBtn addTarget:self action:@selector(nowBtn) forControlEvents:UIControlEventTouchUpInside];
  234. [SVProgressHUD show];
  235. long time = (long)[[NSDate date] timeIntervalSince1970];
  236. time = (time *1000 + g_server.timeDifference);
  237. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  238. [g_server Useract_act_VipConfigGoldMag:salt andToView:self];
  239. //[g_server getUserVipact_GainUserGoldMang:salt andToView:self];
  240. [g_server getUserVipInformation:salt andToView:self];
  241. if (JX_SCREEN_WIDTH<414){
  242. UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc]
  243. initWithTarget:self
  244. action:@selector(foundSwipe:)];
  245. //设置识别滑动方向
  246. recognizer.direction =UISwipeGestureRecognizerDirectionUp;
  247. //Swipe手势识别器关联到View
  248. [scrollView addGestureRecognizer:recognizer];
  249. UISwipeGestureRecognizer *recognizer2 = [[UISwipeGestureRecognizer alloc]
  250. initWithTarget:self
  251. action:@selector(foundSwipe2:)];
  252. //设置识别滑动方向
  253. recognizer2.direction =UISwipeGestureRecognizerDirectionDown;
  254. //Swipe手势识别器关联到View
  255. [scrollView addGestureRecognizer:recognizer2];
  256. }
  257. }
  258. - (void)foundSwipe2:(UISwipeGestureRecognizer *)sender {
  259. CGRect bounds=self.scrolView.bounds;
  260. bounds.origin.y=0;
  261. self.scrolView.bounds=bounds;
  262. }
  263. - (void)foundSwipe:(UISwipeGestureRecognizer *)sender {
  264. CGRect bounds=self.scrolView.bounds;
  265. bounds.origin.y=110;
  266. self.scrolView.bounds=bounds;
  267. }
  268. - (void)nowBtn {
  269. long time = (long)[[NSDate date] timeIntervalSince1970];
  270. time = (time *1000 + g_server.timeDifference);
  271. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  272. [g_server vipGainCoin:salt andToView:self];
  273. // _pressIMG.hidden=NO;
  274. // [_pressIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  275. // make.width.mas_equalTo(120);
  276. // }];
  277. }
  278. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  279. [SVProgressHUD dismiss];
  280. if([aDownload.action isEqualToString:act_GetUserVipInformation])
  281. {
  282. NSDictionary * currentDictionary = [dict objectForKey:@"current"];
  283. NSString * currentLevel = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"name"]];
  284. self.levelLeft.text=[NSString stringWithFormat:@"LV%@",currentLevel];
  285. self.titleName.text=@"sss";
  286. self.accountL.text= [NSString stringWithFormat:@"账号:%@", dict[@"membershipAccount"]];
  287. NSDictionary * weekAwardDictionary = [dict objectForKey:@"weekAward"];
  288. if ([weekAwardDictionary[@"isAllow"] intValue]==0) {
  289. self.lingBtn.userInteractionEnabled=NO; //控件不能点
  290. self.lingBtn.alpha=0.5;
  291. }
  292. NSDictionary * curretDictionary = [dict objectForKey:@"current"];
  293. NSDictionary * nextDictionary = [dict objectForKey:@"next"];
  294. self.levelLeft.text = [NSString stringWithFormat:@"LV:%@",[curretDictionary objectForKey:@"level"]];
  295. self.lv2kelinQu.text=[NSString stringWithFormat:@"LV%@可领取:%@", [nextDictionary objectForKey:@"level"],nextDictionary[@"upgradeCoin"]];
  296. CGFloat aaaaMoney= [dict[@"totalRecharge"] intValue]*1.0;
  297. self.touzhuL.text=[NSString stringWithFormat:@"有效投注:%@",dict[@"totalRecharge"]];
  298. //当前用户的等级
  299. int aaaa= ([curretDictionary[@"money"] intValue])*1.0;
  300. int nextaaa= [nextDictionary[@"money"] intValue];
  301. CGFloat baifenbi=aaaaMoney/(nextaaa-aaaa)*1.0;
  302. _pressIMG.hidden=NO;
  303. if (baifenbi>1) {
  304. baifenbi=1;
  305. [_pressIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  306. make.right.mas_equalTo(0);
  307. }];
  308. }else{
  309. [_pressIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  310. make.width.mas_equalTo((JX_SCREEN_WIDTH-50)*baifenbi);
  311. }];
  312. }
  313. CGFloat nextMoney=[nextDictionary[@"money"] floatValue];
  314. self.levelright.text = [NSString stringWithFormat:@"还差%.f打码到达LV:%@",nextMoney-aaaaMoney,[nextDictionary objectForKey:@"level"]];
  315. NSString * nextweekRedPackageCoin = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"weekRedPackageCoin"]];
  316. self.weekMoney.text = [NSString stringWithFormat:@"周俸禄:%@",nextweekRedPackageCoin];
  317. NSString * nextMonth = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"monthRedPackageCoin"]];
  318. self.monthMoney.text = [NSString stringWithFormat:@"月俸禄:%@",nextMonth];
  319. }
  320. else if([aDownload.action isEqualToString:act_GainUserCoin])
  321. {
  322. [SVProgressHUD dismiss];
  323. UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"领取成功" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
  324. [alert show];
  325. long time = (long)[[NSDate date] timeIntervalSince1970];
  326. time = (time *1000 + g_server.timeDifference);
  327. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  328. [g_server getUserVipInformation:salt andToView:self];
  329. }
  330. }
  331. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  332. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  333. if([errorCode isEqualToString:@"权限验证失败"])
  334. {
  335. if([aDownload.action isEqualToString:act_GetUserVipInformation])
  336. {
  337. long time = (long)[[NSDate date] timeIntervalSince1970];
  338. time = (time *1000 + g_server.timeDifference);
  339. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  340. [g_server getUserVipInformation:salt andToView:self];
  341. }
  342. else if([aDownload.action isEqualToString:act_GainUserCoin])
  343. {
  344. long time = (long)[[NSDate date] timeIntervalSince1970];
  345. time = (time *1000 + g_server.timeDifference);
  346. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  347. [g_server vipGainCoin:salt andToView:self];
  348. }
  349. }
  350. else
  351. {
  352. [SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]];
  353. }
  354. if( [aDownload.action isEqualToString:act_UserLogout] ){
  355. [self performSelector:@selector(doSwitch) withObject:nil afterDelay:1];
  356. }
  357. return hide_error;
  358. }
  359. @end
  360. */