YOUPAILPYoungSettingVC.m 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. //
  2. // YOUPAILPYoungSettingVC.m
  3. // livePro
  4. //
  5. // Created by leo on 2019/12/25.
  6. // Copyright © 2019 caiPro. All rights reserved.
  7. //
  8. #import "YOUPAILPYoungSettingVC.h"
  9. #import "YOUPAILPYoungPwdVC.h"
  10. #import "YOUPAILPYoungCloseWindow.h"
  11. #import "UIViewController+TFPresent.h"
  12. #import "YOUPAILCTabBarVC.h"
  13. #import "AppDelegate.h"
  14. @interface YOUPAILPYoungSettingVC ()<LPYoungPwdDelegate,LPYoungCloseDelegate>
  15. //@property(nonatomic,assign)CGFloat lefpadding,imgVHeight,imgVWidth;
  16. //@property(nonatomic,strong)UIImageView *imgV;
  17. @property(nonatomic,strong)UIButton *youpaipopenBtn;
  18. //@property(nonatomic,strong)UILabel *titleLab,*noticeLab;
  19. @end
  20. @implementation YOUPAILPYoungSettingVC
  21. -(void)viewWillAppear:(BOOL)animated
  22. {
  23. [super viewWillAppear:animated];
  24. }
  25. - (void)viewDidLoad {
  26. [super viewDidLoad];
  27. self.title = @"青少年模式";
  28. self.view.backgroundColor = [UIColor whiteColor];
  29. // UIView *whiteView = [[UIView alloc] initWithFrame:CGRectMake(35.5,80.5+NavBarHeight,KScreenWidth-71, (KScreenWidth-71)*(172/304.0)+248)];
  30. // [self.view addSubview:whiteView];
  31. // whiteView.backgroundColor = UIColor.whiteColor;
  32. // whiteView.layer.cornerRadius = 10;
  33. // whiteView.layer.masksToBounds = NO;
  34. // UIBezierPath *shadowPath = [UIBezierPath
  35. // bezierPathWithRect:whiteView.bounds];
  36. // whiteView.layer.shadowColor = HexColorFromRGB(0xA7A9FD).CGColor;
  37. // whiteView.layer.shadowOffset = CGSizeMake(0.0f, 5.0f);
  38. // whiteView.layer.shadowOpacity = 0.22f;
  39. // whiteView.layer.shadowPath = shadowPath.CGPath;
  40. //
  41. //
  42. // UIView *view = [[UIView alloc] initWithFrame:CGRectMake(31,0,KScreenWidth-71-64, (KScreenWidth-71)*(172/304.0)+248-31)];
  43. // view.backgroundColor = HexColorFromRGB(0xE9E9FF);
  44. // view.layer.cornerRadius = 8;
  45. // view.layer.masksToBounds = YES;
  46. // [whiteView addSubview:view];
  47. UIImageView *imgView = [[UIImageView alloc] init];
  48. [self.view addSubview:imgView];
  49. [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.top.mas_equalTo(85 + NavBarHeight);
  51. make.centerX.mas_equalTo(0);
  52. make.size.mas_equalTo(CGSizeMake(169, 168));
  53. }];
  54. imgView.image = [UIImage imageNamed:@"vqu_images_young_Mode_Bg"];
  55. UILabel *label1 = [[UILabel alloc] init];
  56. [self.view addSubview:label1];
  57. [label1 mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.top.mas_equalTo(imgView.mas_bottom).offset(24);
  59. make.centerX.mas_equalTo(0);
  60. }];
  61. label1.text = @"青少年保护模式";
  62. label1.textColor = LZ273145Color;
  63. label1.textAlignment = NSTextAlignmentCenter;
  64. label1.font = LCBoldFont(18);
  65. UILabel *label2 = [[UILabel alloc] init];
  66. [self.view addSubview:label2];
  67. [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.top.mas_equalTo(label1.mas_bottom).offset(2);
  69. make.centerX.mas_equalTo(0);
  70. }];
  71. label2.text = @"开启未成年模式,防止未成年使用";
  72. label2.textColor = LZA3AABEColor;
  73. label2.textAlignment = NSTextAlignmentCenter;
  74. label2.numberOfLines = 0;
  75. label2.font = LCFont(14);
  76. // _imgVWidth = 251.5;
  77. // _imgVHeight = 156.5;
  78. // _lefpadding = (KScreenWidth-_imgVWidth)/2.0;
  79. //
  80. // [self.view addSubview:self.imgV];
  81. // [self.view addSubview:self.titleLab];
  82. // [self.view addSubview:self.noticeLab];
  83. [self.view addSubview:self.youpaipopenBtn];
  84. // [_titleLab setText:@"未成年模式已关闭"];
  85. // [_noticeLab setText:@"开启未成年模式,防止未成年使用"];
  86. [_youpaipopenBtn setTitle:@"开启青少年模式" forState:UIControlStateNormal];
  87. //
  88. // [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  89. // make.left.equalTo(self.view).with.offset(0);
  90. // make.right.equalTo(self.view).with.offset(0);
  91. // make.top.equalTo(_imgV.mas_bottom).with.offset(40);
  92. // make.height.mas_equalTo(20);
  93. //
  94. // }];
  95. // [_noticeLab mas_makeConstraints:^(MASConstraintMaker *make) {
  96. // make.left.equalTo(self.view).with.offset(0);
  97. // make.right.equalTo(self.view).with.offset(0);
  98. // make.top.equalTo(_titleLab.mas_bottom).with.offset(20);
  99. // make.height.mas_equalTo(25);
  100. // }];
  101. //
  102. [_youpaipopenBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.left.equalTo(self.view).with.offset(40);
  104. make.right.equalTo(self.view).with.offset(-40);
  105. make.bottom.offset(-SafeHeight - 30);
  106. make.height.mas_equalTo(49);
  107. }];
  108. [_youpaipopenBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth - 80, 49) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:(GradientLeftToRight)] forState:(UIControlStateNormal)];
  109. }
  110. //
  111. //-(UIImageView *)imgV
  112. //{
  113. // if(!_imgV)
  114. // {
  115. // _imgV = [[UIImageView alloc]initWithFrame:CGRectMake(_lefpadding, NavBarHeight+60, _imgVWidth, _imgVHeight)];
  116. // [_imgV setImage:[UIImage imageNamed:@"vqu_images_juvenile_2"]];
  117. // }
  118. // return _imgV;
  119. //}
  120. //-(UILabel *)titleLab
  121. //{
  122. // if(!_titleLab)
  123. // {
  124. // _titleLab = [[UILabel alloc]init];
  125. // [_titleLab setTextColor:HexColorFromRGB(0x666666)];
  126. // [_titleLab setFont:[UIFont systemFontOfSize:18]];
  127. // [_titleLab setTextAlignment:NSTextAlignmentCenter];
  128. // }
  129. // return _titleLab;
  130. //}
  131. //-(UILabel *)noticeLab
  132. //{
  133. // if(!_noticeLab)
  134. // {
  135. // _noticeLab = [[UILabel alloc]init];
  136. // [_noticeLab setTextColor:HexColorFromRGB(0x666666)];
  137. // [_noticeLab setFont:[UIFont systemFontOfSize:14]];
  138. // [_noticeLab setTextAlignment:NSTextAlignmentCenter];
  139. // }
  140. // return _noticeLab;
  141. //}
  142. //
  143. -(UIButton *)youpaipopenBtn
  144. {
  145. if(!_youpaipopenBtn)
  146. {
  147. _youpaipopenBtn = [[UIButton alloc]init];
  148. [_youpaipopenBtn.titleLabel setFont:[UIFont systemFontOfSize:16]];
  149. _youpaipopenBtn.layer.cornerRadius = 49/2;
  150. _youpaipopenBtn.layer.masksToBounds = YES;
  151. [_youpaipopenBtn addTarget:self action:@selector(youpaifopenYound) forControlEvents:UIControlEventTouchUpInside];
  152. [_youpaipopenBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  153. }
  154. return _youpaipopenBtn;
  155. }
  156. -(void)youpaifopenYound
  157. {
  158. YOUPAILPYoungPwdVC *vc = [[YOUPAILPYoungPwdVC alloc]init];
  159. vc.youpaippwdStatus = TFPWDSETTING;
  160. vc.youpaipdelegate = self;
  161. [self.navigationController pushViewController:vc animated:YES];
  162. }
  163. -(void)youpaifswitchYounModel:(NSInteger)isopen
  164. {
  165. // NSLog(@"hello isopen is %d",isopen);
  166. if(isopen ==1)
  167. {
  168. //
  169. [LCSaveData saveYoungMode:YES];
  170. kAppDelegate.kadolescentStatus =1;
  171. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)1*NSEC_PER_SEC), dispatch_get_main_queue(), ^{
  172. YOUPAILCTabBarVC *tab = (YOUPAILCTabBarVC *)kAppDelegate.window.rootViewController;
  173. [tab setSelectedIndex:0];
  174. });
  175. }
  176. else
  177. {
  178. [LCSaveData saveYoungMode:NO];
  179. kAppDelegate.kadolescentStatus = 0;
  180. }
  181. }
  182. -(void)youpaifshowYoungCloseWindow
  183. {
  184. YOUPAILPYoungCloseWindow *VC= [[YOUPAILPYoungCloseWindow alloc]init];
  185. VC.vWidth = KScreenWidth - 47.5f * 2.0f;
  186. VC.vHeight = 342.0f;
  187. VC.youpaipdelegate = self;
  188. VC.isTouchDismiss = NO;
  189. [kAppDelegate.window.rootViewController TFPresentVC:VC completion:^{
  190. }];
  191. }
  192. #pragma mark LPYoungCloseDelegate
  193. //忘记密码
  194. -(void)youpaifyoungForgetPwd
  195. {
  196. //关闭或打开 发通知 或者回调
  197. /*
  198. YOUPAILPYoungPwdVC *vc = [[YOUPAILPYoungPwdVC alloc]init];
  199. vc.pwdStatus = TFPWDCLOSE;
  200. [self.navigationController pushViewController:vc animated:YES];
  201. */
  202. }
  203. -(void)youpaifyoungClose
  204. {
  205. YOUPAILPYoungPwdVC *vc = [[YOUPAILPYoungPwdVC alloc]init];
  206. vc.youpaippwdStatus = TFPWDCLOSE;
  207. vc.youpaipdelegate = self;
  208. [self.navigationController pushViewController:vc animated:YES];
  209. }
  210. /*
  211. #pragma mark - Navigation
  212. // In a storyboard-based application, you will often want to do a little preparation before navigation
  213. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  214. // Get the new view controller using [segue destinationViewController].
  215. // Pass the selected object to the new view controller.
  216. }
  217. */
  218. @end