JXGoldMangVc.h 17 KB

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