123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- //
- // MySetViewController.m
- // 双子星云手机
- //
- // Created by APPLE on 2023/8/17.
- //
- #import "MySetViewController.h"
- #import <SDWebImage.h>
- #import <Masonry.h>
- #import "UseAccountManage.h"
- #import "HelpDownScrollView.h"
- #import "MineViewCell.h"
- #import "ChangeLogoViewController.h"
- #import "HidenMaskSetViewController.h"
- #import "CustomerWebViewController.h"
- #import "AboutViewController.h"
- #import "iPhone.h"
- #import "CloudPhoneAPI.h"
- #import "UserDetailInfoModel.h"
- #import "BuyVIPViewController.h"
- #import "PayRecoderListViewController.h"
- #import "ComontAlretViewController.h"
- @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ComontAlretViewControllerDelegate>
- {
- UILabel *phoneLabel;
- UILabel *vipTypeTipsLabel;
- }
- @property (nonatomic, strong, nullable) UITableView *tableView;
- @end
- @implementation MySetViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- [self drawAnyView];
-
- NSString* bg_tableName = nil;
- NSDictionary *dictLogin = [[UseAccountManage shareInstance] getLoginInfo];
- if (dictLogin && [[dictLogin allKeys] containsObject:@"touristId"])
- {
- NSString* username = [dictLogin objectForKey:@"touristId"];
- bg_tableName = User_Info_tableName(username);
-
- NSArray* finfAlls = [UserDetailInfoModel bg_findAll:bg_tableName];
- if (finfAlls && finfAlls.count >0) {
- UserDetailInfoModel *model = finfAlls[0];
- /*更新用户名称*/
- [phoneLabel setText:model.userName];
- }
- }
-
- /*获取个人信息*/
- [[UseAccountManage shareInstance] CommonPostCallBackCode:PostUserDetailInfo
- Params:[NSDictionary new]
- success:^(id _Nonnull responseObject) {
- UserDetailInfoDataModel *model = [[UserDetailInfoDataModel alloc] initWithDictionary:responseObject error:nil];
- if (model.status.integerValue == 0){
- /*内容用数据库更新到本地*/
- if (bg_tableName){
- model.data.bg_tableName = bg_tableName;
- [model.data bg_cover];
-
- if (self.whetherPhoneStatus != 0){
- [self->vipTypeTipsLabel setText:[NSString stringWithFormat:@"%@%@",NSLocalizedString(@"my_set_no_time_top",nil),model.data.exceptTime]];
- }
- }
- }else{
- ;
- }
- }
- failure:^(NSError * _Nonnull error) {
- ;
- }];
- //http://testprivacy.phone.armclouding.com:11180/api/user/v1/user/getUserDetailInfo
- }
- - (void)drawAnyView{
- [self.view setBackgroundColor:HWF5F7FAColor];
-
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
-
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- make.top.mas_equalTo(0);
- }];
-
- [self.tableView setTableHeaderView:[self headViewForTable]];
- }
- - (UIView *)headViewForTable{
- /*236顶部视图, 44中间试图下部分, 126下方视图*/
- UIView *headView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, 236.f + 44.f + 126))];
- [headView setBackgroundColor:[UIColor clearColor]];
-
- UIImage *bgImage = [UIImage imageNamed:@"set_up_bg"];
- // bgImage = [bgImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 40, 80)];
-
- UIImageView *bgImView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 236.f)];
- [bgImView setImage:bgImage];
- [headView addSubview:bgImView];
-
- /*头像*/
- UIImageView *photoImage = [[UIImageView alloc] init];
- [photoImage setImage:[UIImage imageNamed:@"photo_normal"]];
- [bgImView addSubview:photoImage];
- [photoImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(16.f);
- make.top.mas_equalTo(99.f);
- make.width.mas_equalTo(62.f);
- make.height.mas_equalTo(62.f);
- }];
-
- NSDictionary *loginInfo = [[UseAccountManage shareInstance] getLoginInfo];
- /*用户名*/
- phoneLabel = [[UILabel alloc] init];
- [phoneLabel setFont:[UIFont boldSystemFontOfSize:18.f]];
- [phoneLabel setTextColor:[UIColor whiteColor]];
-
- if (loginInfo && [[loginInfo allKeys] containsObject:@"phone"]){
- [phoneLabel setText:[loginInfo objectForKey:@"phone"]];
- }
- [bgImView addSubview:phoneLabel];
- [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(photoImage.mas_right).offset(9);
- make.centerY.equalTo(photoImage.mas_centerY);
- make.right.mas_equalTo(-22.f);
- make.height.mas_equalTo(25.f);
- }];
-
- /*下方会员视图*/
- // vip_bg
- UIImageView *downBgView = [[UIImageView alloc] init];
- [downBgView setImage:[UIImage imageNamed:@"vip_bg"]];
- [headView addSubview:downBgView];
- [downBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15.f);
- make.right.mas_equalTo(-15.f);
- make.bottom.mas_equalTo(-126.f);
- make.height.mas_equalTo(96.f);
- }];
- [downBgView setUserInteractionEnabled:YES];
-
- /*VIP类型*/
- UILabel *vipType = [[UILabel alloc] init];
- [vipType setText:@"VIP"];
- [vipType setTextColor:[UIColor whiteColor]];
- [vipType setFont:[UIFont boldSystemFontOfSize:24.f]];
- [downBgView addSubview:vipType];
- [vipType mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(20.f);
- make.right.mas_equalTo(-100.f);
- make.top.mas_equalTo(18.f);
- make.height.mas_equalTo(33.f);
- }];
-
- /*VIP类型提示*/
- vipTypeTipsLabel = [[UILabel alloc] init];
- if (self.whetherPhoneStatus != 0){
- [vipTypeTipsLabel setText:@""];
- }else{
- [vipTypeTipsLabel setText:NSLocalizedString(@"my_set_no_vip_tips",nil)];
- }
-
- [vipTypeTipsLabel setTextColor:[UIColor whiteColor]];
- [vipTypeTipsLabel setFont:[UIFont systemFontOfSize:12.f]];
- [downBgView addSubview:vipTypeTipsLabel];
- [vipTypeTipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(20.f);
- make.right.mas_equalTo(-100.f);
- make.top.mas_equalTo(53.f);
- make.height.mas_equalTo(17.f);
- }];
-
- /*免费会员按钮*/
- UIButton *vipBtn = [[UIButton alloc] init];
- [vipBtn setBackgroundColor:[UIColor whiteColor]];
- if (self.whetherPhoneStatus != 0){
- [vipBtn setTitle:NSLocalizedString(@"no_enough_time_exchange",nil) forState:(UIControlStateNormal)];
- }else{
- [vipBtn setTitle:NSLocalizedString(@"my_set_no_vip_open_vip",nil) forState:(UIControlStateNormal)];
- }
-
- [vipBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
- [vipBtn.titleLabel setFont:[UIFont systemFontOfSize:13.f]];
- [vipBtn addTarget:self
- action:@selector(vipBtnPressed)
- forControlEvents:(UIControlEventTouchUpInside)];
- [vipBtn.layer setCornerRadius:31.f/2.f];
- [downBgView addSubview:vipBtn];
- [vipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(86.f);
- make.right.mas_equalTo(-20.f);
- make.centerY.equalTo(downBgView.mas_centerY);
- make.height.mas_equalTo(31.f);
- }];
- /*下方视图*/
- HelpDownScrollView *helpDownScrollView = [[HelpDownScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W - 30, 96.f) withImageAry:@[@"icon-tubiao",@"icon-jincheng"] tilteAry:@[NSLocalizedString(@"my_set_no_change_logo",nil),NSLocalizedString(@"my_set_no_hidden_app",nil)] numberOfLine:3];
- helpDownScrollView.presedDelegate = self;
- [headView addSubview:helpDownScrollView];
- [helpDownScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15.f);
- make.right.mas_equalTo(-15.f);
- make.bottom.mas_equalTo(-15.f);
- make.height.mas_equalTo(96.f);
- }];
- [helpDownScrollView setBackgroundColor:[UIColor whiteColor]];
- [helpDownScrollView.layer setCornerRadius:8.f];
-
- return headView;
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- - (void)helpDownScrollViewBePressed:(nonnull id)sender withIndex:(NSInteger)index {
- HLog(@"\n----点击了第个%ld按钮----",index);
- if (index == 0){
- ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }else if (index == 1){/**/
- HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- }
- #pragma mark - 懒加载
- - (UITableView *)tableView{
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStyleGrouped];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.showsVerticalScrollIndicator = NO;
- _tableView.showsHorizontalScrollIndicator = NO;
- _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
- [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
- [_tableView setSeparatorColor:[UIColor clearColor]];
- [_tableView setBackgroundColor:[UIColor clearColor]];
- [_tableView setTableFooterView:[UIView new]];
- [_tableView setBounces:YES];
- if (@available(iOS 15.0, *)) {
- _tableView.sectionHeaderTopPadding = 0;
- }
- }
-
- return _tableView;
- }
- #pragma mark - 列表委托
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-
- return 7;
- }
- - (MineViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSInteger row = indexPath.row;
- static NSString *identifier = @"MineViewCell";
-
- MineViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- if (!cell){
- cell = [[MineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
- [cell setBackgroundColor:[UIColor clearColor]];
- [cell setAccessoryType:(UITableViewCellAccessoryNone)];
- }
- [cell.bgViewLayer removeFromSuperlayer];
- [cell.titleLabel2 setHidden:YES];
- [cell.rightImage setHidden:NO];
- [cell.lineView setHidden:NO];
- [cell.maskSwitch setHidden:YES];
- if (row == 0){
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_invite_friend",nil)];
- [cell.titleLabel2 setText:NSLocalizedString(@"my_set_no_invite_friend_get_vip",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-yaoqing"]];
- [cell.titleLabel2 setHidden:NO];
- /*上圆角*/
- //设置部分圆角 贝塞尔曲线
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
- byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
- cornerRadii:CGSizeMake(8, 8)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = cell.cellBgView.bounds;
- maskLayer.path = maskPath.CGPath;
- cell.bgViewLayer = maskLayer;
- cell.cellBgView.layer.mask = cell.bgViewLayer;
- }else if (row == 1){
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_fanzhuan_exit",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"fanzhuan"]];
- [cell.rightImage setHidden:YES];
- [cell.maskSwitch setHidden:NO];
- }else if (row == 2){
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_check_update",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"app_update"]];
- }else if (row == 3){
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_connect_kefu",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-kefu"]];
- }else if (row == 4){
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_buy_recoder",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"buy_recoder_icon"]];
- }else if (row == 5){/*重启空间*/
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_restart_phone",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-gengxin"]];
- }else if (row == 6){
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_logout",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-tuichu"]];
- [cell.rightImage setHidden:YES];
- /*下圆角*/
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
- byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
- cornerRadii:CGSizeMake(8, 8)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = cell.cellBgView.bounds;
- maskLayer.path = maskPath.CGPath;
- cell.bgViewLayer = maskLayer;
- cell.cellBgView.layer.mask = cell.bgViewLayer;
-
- [cell.lineView setHidden:YES];
- }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 60;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
-
- NSInteger row = indexPath.row;
- if (0 == row){
- CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
- vc.needHidenNav = YES;
- NSDictionary *dictLogin = [[UseAccountManage shareInstance] getLoginInfo];
- if (dictLogin && [[dictLogin allKeys] containsObject:@"token"])
- {
- NSString *tokenStr = [dictLogin objectForKey:@"token"];
- NSString *url = [NSString stringWithFormat:@"http://192.168.11.32:11180/cloud/privacy/#/pages/invitation/index?token=%@&iosVersionNumber=%@", tokenStr,[iPhone appVersion]];
- vc.webUrl = url;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }else if (1 == row){
- /*翻转退出*/
- }else if (2 == row){
- AboutViewController *vc = [[AboutViewController alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
- }else if (3 == row){
- CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
- vc.titleStr = NSLocalizedString(@"my_set_no_app_kefu",nil);
- NSDictionary *dictLogin = [[UseAccountManage shareInstance] getLoginInfo];
- if (dictLogin && [[dictLogin allKeys] containsObject:@"token"])
- {
- NSString *tokenStr = [dictLogin objectForKey:@"token"];
- NSString *url = [NSString stringWithFormat:@"http://192.168.11.32:11180/cloud/privacy/#/pages/setup/online-customer-service?autoopen=true&token=%@", tokenStr];
- // if ([CloudService containsString:@"14.18.190.141:11180"]) { // 测试环境
- // url = [NSString stringWithFormat:@"http://testprivacy.phone.armclouding.com:11180/h5/customer-service?autoopen=true&token=%@", tokenStr];
- // }
- vc.webUrl = url;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- else if (4 == row){/*购买记录*/
- /*跳入订单界面*/
- PayRecoderListViewController *nextVC = [[PayRecoderListViewController alloc] init];
-
- [self.navigationController pushViewController:nextVC animated:YES];
- }else if (5 == row){/*重启空间*/
- NSArray *phoneList = [UseAccountManage shareInstance].cloudPhoneListModel.diskInfo;
-
- if (!phoneList || phoneList.count == 0){
- [[iToast makeText:NSLocalizedString(@"my_set_no_restart_phone_tips_no_vip",nil)] show];
- return;
- }
-
- /*弹窗提示重启*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
- msg:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil)];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- nextVC.delegate = self;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }else if (6 == row){/*退出登录*/
- [self.navigationController popToRootViewControllerAnimated:NO];
- [[UseAccountManage shareInstance] logout];
- }
- }
- - (void)okBtnClickPressed{
- /*重启云手机*/
- [self showNewIndicatorWithCanBack:YES canTouch:NO];
- CloudPhoneModel *model = [UseAccountManage shareInstance].cloudPhoneListModel.diskInfo.firstObject;
- [[UseAccountManage shareInstance] CommonGetWithCallBackCode:GetPhonereboot
- Parameters:@{@"userCardId":[NSNumber numberWithInteger:model.userCardId]}
- success:^(id _Nonnull responseObject) {
- HLog(@"%@", responseObject);
- [self removeNewIndicator];
- SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
- if (model.status && model.status.integerValue == 0) {
- if (model.msg.length > 0){
- [[iToast makeText:model.msg] show];
- }else{
- [[iToast makeText:NSLocalizedString(@"my_set_no_restart_phone_ok_tips",nil)] show];
- }
- }
- else
- {
- [[iToast makeText:model.msg] show];
- }
- } failure:^(NSError * _Nonnull error) {
- HLog(@"%@", error);
- [[iToast makeText:@"网络异常,请稍后重试!"] show];
- [self removeNewIndicator];
- }];
- }
- - (void)vipBtnPressed{
- /*跳转购买界面*/
- BuyVIPViewController *nextVC = [[BuyVIPViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- @end
|