From f52af5d620a296d4bc1b511ad2f4500cbe3eb497 Mon Sep 17 00:00:00 2001 From: edwinQQQ Date: Fri, 27 Jun 2025 11:33:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20YUMIHtmlUrl.h=20=E5=92=8C?= =?UTF-8?q?=20YUMIHtmlUrl.m=EF=BC=8C=E6=96=B0=E5=A2=9E=E9=A6=96=E5=85=85?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=20URL=20=E7=B1=BB=E5=9E=8B=E5=92=8C?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=EF=BC=9B=E5=9C=A8=20FeedBackViewController.h?= =?UTF-8?q?=20=E5=92=8C=20FeedBackViewController.m=20=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=B1=9E=E6=80=A7=E7=B1=BB=E5=9E=8B=E4=B8=BA?= =?UTF-8?q?=E5=BC=BA=E5=BC=95=E7=94=A8=E4=BB=A5=E5=A2=9E=E5=BC=BA=E5=86=85?= =?UTF-8?q?=E5=AD=98=E7=AE=A1=E7=90=86=EF=BC=9B=E9=87=8D=E6=9E=84=20FeedBa?= =?UTF-8?q?ckViewController=20=E7=9A=84=E8=A7=86=E5=9B=BE=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AD=90?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E7=9A=84=E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=BB=A5=E6=8F=90=E9=AB=98=E4=BB=A3=E7=A0=81=E5=8F=AF?= =?UTF-8?q?=E8=AF=BB=E6=80=A7=EF=BC=9B=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=20FeedBackViewController.xib=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=9B=E5=9C=A8=20XPGiftBarView.h=20?= =?UTF-8?q?=E5=92=8C=20XPGiftBarView.m=20=E4=B8=AD=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E9=A6=96=E5=85=85=E6=8C=89=E9=92=AE=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=9B=BF=E6=8D=A2=E4=B8=BA=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E9=A6=96=E5=85=85=E8=A7=86=E5=9B=BE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=9B=E6=9B=B4=E6=96=B0=20XPWebViewController.h=20=E5=92=8C?= =?UTF-8?q?=20XPWebViewController.m=EF=BC=8C=E8=B0=83=E6=95=B4=20webview?= =?UTF-8?q?=20=E5=B1=9E=E6=80=A7=E4=B8=BA=E5=8F=AF=E5=86=99=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8A=A8=E6=80=81=E6=9B=B4=E6=96=B0=EF=BC=9B?= =?UTF-8?q?=E5=9C=A8=20FirstRechargeManager.m=20=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A6=96=E5=85=85=E7=8A=B6=E6=80=81=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D=E5=9C=A8?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=A8=A1=E5=BC=8F=E4=B8=8B=E5=A7=8B=E7=BB=88?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=A6=96=E5=85=85=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi.xcodeproj/project.pbxproj | 4 - YuMi/Global/YUMIHtmlUrl.h | 4 +- YuMi/Global/YUMIHtmlUrl.m | 4 +- .../YMLogin/View/FeedBackViewController.h | 32 +-- .../YMLogin/View/FeedBackViewController.m | 192 +++++++++++++---- .../YMLogin/View/FeedBackViewController.xib | 185 ---------------- .../YMLogin/View/LoginTypesViewController.m | 2 +- .../View/IncomeRecord/XPIncomeRecordVC.m | 5 +- .../YMMine/View/Medals/MedalsDetailView.m | 1 + .../View/Medals/MedalsLevelIndicatorView.h | 9 +- .../View/Medals/MedalsLevelIndicatorView.m | 197 +++++++++++++++--- .../YMMine/View/XPMineViewController.m | 10 +- .../YMNewHome/View/XPNewHomeViewController.m | 80 +++++-- .../View/SendGiftView/View/XPGiftBarView.h | 3 +- .../View/SendGiftView/View/XPGiftBarView.m | 72 ++++--- .../View/SendGiftView/View/XPSendGiftView.m | 1 - YuMi/Modules/YMWeb/XPWebViewController.h | 2 +- YuMi/Modules/YMWeb/XPWebViewController.m | 98 ++++----- YuMi/Tools/FirstCharge/FirstRechargeManager.m | 11 +- 19 files changed, 532 insertions(+), 380 deletions(-) delete mode 100644 YuMi/Modules/YMLogin/View/FeedBackViewController.xib diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index 9d4e8a76..c7c3744c 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -631,7 +631,6 @@ 547B30F92CB511700041E962 /* RoomBoomEntryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 547B30F82CB511700041E962 /* RoomBoomEntryView.m */; }; 5484E1FD2CA2897B008E8754 /* IAPManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5484E1FC2CA2897B008E8754 /* IAPManager.m */; }; 548D54202CC208FD0084A2FF /* AlbumResourcePickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 548D541F2CC208FD0084A2FF /* AlbumResourcePickerViewController.m */; }; - 548E01C52C3F78360071C83D /* FeedBackViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 548E01C22C3F78360071C83D /* FeedBackViewController.xib */; }; 548E01C62C3F78360071C83D /* FeedBackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C42C3F78360071C83D /* FeedBackViewController.m */; }; 548E01C92C3F78600071C83D /* FeedBackConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C82C3F78600071C83D /* FeedBackConfigModel.m */; }; 548E01CC2C3FB1C70071C83D /* i18nGiftNameMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01CB2C3FB1C70071C83D /* i18nGiftNameMap.m */; }; @@ -2907,7 +2906,6 @@ 5484E1FC2CA2897B008E8754 /* IAPManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IAPManager.m; sourceTree = ""; }; 548D541E2CC208FD0084A2FF /* AlbumResourcePickerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AlbumResourcePickerViewController.h; sourceTree = ""; }; 548D541F2CC208FD0084A2FF /* AlbumResourcePickerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AlbumResourcePickerViewController.m; sourceTree = ""; }; - 548E01C22C3F78360071C83D /* FeedBackViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FeedBackViewController.xib; sourceTree = ""; }; 548E01C32C3F78360071C83D /* FeedBackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeedBackViewController.h; sourceTree = ""; }; 548E01C42C3F78360071C83D /* FeedBackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedBackViewController.m; sourceTree = ""; }; 548E01C72C3F78600071C83D /* FeedBackConfigModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeedBackConfigModel.h; sourceTree = ""; }; @@ -5410,7 +5408,6 @@ children = ( 548E01C32C3F78360071C83D /* FeedBackViewController.h */, 548E01C42C3F78360071C83D /* FeedBackViewController.m */, - 548E01C22C3F78360071C83D /* FeedBackViewController.xib */, 14DCAD12299B9B0B00A7DD31 /* NewLogin */, E872308A26E89D5100B90D4F /* CustomView */, E8B825C926EA1231009E8E9F /* LoginVerifCodeViewController.h */, @@ -11827,7 +11824,6 @@ E80EC83228ACD84000D133C5 /* emoji_00@2x.png in Resources */, E80EC89C28ACD84000D133C5 /* emoji_50@2x.png in Resources */, E80EC87A28ACD84000D133C5 /* emoji_113@2x.png in Resources */, - 548E01C52C3F78360071C83D /* FeedBackViewController.xib in Resources */, 23FF25622ABAE6310064E904 /* pi_room_game_fine_love.svga in Resources */, 23FF42672AA5CFBB0055733C /* home_sound_wave.gif in Resources */, 4C1392A12D71675900A6DFB5 /* coincoin.mp4 in Resources */, diff --git a/YuMi/Global/YUMIHtmlUrl.h b/YuMi/Global/YUMIHtmlUrl.h index c4e3acb2..b183d579 100644 --- a/YuMi/Global/YUMIHtmlUrl.h +++ b/YuMi/Global/YUMIHtmlUrl.h @@ -117,7 +117,9 @@ typedef NS_ENUM(NSUInteger, URLType) { // 新排行榜 kRankV2, kVIP, - kTransfer + kTransfer, + kFirstChargeHomeIndex, + kFirstChargeBanner, }; NSString * const URLWithType(URLType type); diff --git a/YuMi/Global/YUMIHtmlUrl.m b/YuMi/Global/YUMIHtmlUrl.m index 13f85a24..d1b5fb07 100644 --- a/YuMi/Global/YUMIHtmlUrl.m +++ b/YuMi/Global/YUMIHtmlUrl.m @@ -32,7 +32,9 @@ NSString * const URLWithType(URLType type) { @(kEventDetailPath) : @"modules/eventDetails/index.html?eventId=", @(kRankV2) : @"modules/newRank/index.html", @(kVIP) : @"modules/vip_Center/index.html", - @(kTransfer) : @"modules/rechargeAgent/index.html#/myTransfer" + @(kTransfer) : @"modules/rechargeAgent/index.html#/myTransfer", + @(kFirstChargeBanner) : @"modules/firstRechargeBonus/First_Bonus.html", + @(kFirstChargeHomeIndex) : @"modules/firstRechargeBonus/index.html", }; NSString * newUrl = [newDic objectForKey:@(type)]; diff --git a/YuMi/Modules/YMLogin/View/FeedBackViewController.h b/YuMi/Modules/YMLogin/View/FeedBackViewController.h index 8f394882..f97c2b39 100644 --- a/YuMi/Modules/YMLogin/View/FeedBackViewController.h +++ b/YuMi/Modules/YMLogin/View/FeedBackViewController.h @@ -11,28 +11,28 @@ NS_ASSUME_NONNULL_BEGIN @interface FeedBackViewController : MvpViewController -@property (nonatomic, strong) IBOutlet UIScrollView *scrollView; -@property (nonatomic, strong) IBOutlet UIView *scrollContentView; +@property (nonatomic, strong) UIScrollView *scrollView; +@property (nonatomic, strong) UIView *scrollContentView; -@property (nonatomic, weak) IBOutlet UIButton *closeKeyboardButton; +@property (nonatomic, strong) UIButton *closeKeyboardButton; -@property (nonatomic, weak) IBOutlet UILabel *title_1; -@property (nonatomic, weak) IBOutlet UILabel *title_2; -@property (nonatomic, weak) IBOutlet UILabel *title_3; -@property (nonatomic, weak) IBOutlet UILabel *title_4; +@property (nonatomic, strong) UILabel *title_1; +@property (nonatomic, strong) UILabel *title_2; +@property (nonatomic, strong) UILabel *title_3; +@property (nonatomic, strong) UILabel *title_4; -@property (nonatomic, weak) IBOutlet UICollectionViewFlowLayout *typeCollectionLayout; -@property (nonatomic, weak) IBOutlet UICollectionView *typeCollectionView; +@property (nonatomic, strong) UICollectionViewFlowLayout *typeCollectionLayout; +@property (nonatomic, strong) UICollectionView *typeCollectionView; -@property (nonatomic, weak) IBOutlet UITextView *feedbackTextView; -@property (nonatomic, weak) IBOutlet UILabel *feedbackPlaceholderLabel; -@property (nonatomic, weak) IBOutlet UILabel *feedbackCharCountLabel; -@property (nonatomic, weak) IBOutlet UILabel *feedbackCharLimitLabel; +@property (nonatomic, strong) UITextView *feedbackTextView; +@property (nonatomic, strong) UILabel *feedbackPlaceholderLabel; +@property (nonatomic, strong) UILabel *feedbackCharCountLabel; +@property (nonatomic, strong) UILabel *feedbackCharLimitLabel; -@property (nonatomic, weak) IBOutlet UIButton *uploadImageButton; -@property (weak, nonatomic) IBOutlet UIImageView *uploadImageView; +@property (nonatomic, strong) UIButton *uploadImageButton; +@property (nonatomic, strong) UIImageView *uploadImageView; -@property (nonatomic, weak) IBOutlet UITextField *contactTextField; +@property (nonatomic, strong) UITextField *contactTextField; @end diff --git a/YuMi/Modules/YMLogin/View/FeedBackViewController.m b/YuMi/Modules/YMLogin/View/FeedBackViewController.m index 9dd90af7..8f469465 100644 --- a/YuMi/Modules/YMLogin/View/FeedBackViewController.m +++ b/YuMi/Modules/YMLogin/View/FeedBackViewController.m @@ -248,17 +248,10 @@ self.view.backgroundColor = [UIColor whiteColor]; [self setupFakeTopBar]; + [self setupSubviews]; [self.closeKeyboardButton setTitle:@"" forState:UIControlStateNormal]; - self.typeCollectionView.delegate = self; - self.typeCollectionView.dataSource = self; - self.typeCollectionView.allowsSelection = YES; - [self.typeCollectionView registerClass:[TypeCollectionCell class] forCellWithReuseIdentifier:@"cell"]; - - self.feedbackTextView.delegate = self; - self.feedbackTextView.textContainerInset = UIEdgeInsetsMake(8, 8, 20, 8); - self.title_1.textColor = [UIColor blackColor]; self.title_2.textColor = [UIColor blackColor]; self.title_3.textColor = [UIColor blackColor]; @@ -295,11 +288,9 @@ self.feedbackCharLimitLabel.text = @"/300"; } - [self.uploadImageButton setTitle:@"" forState:UIControlStateNormal]; + UIColor *placeholderColor = UIColorFromRGB(0xacb0b7); - self.contactTextField.layer.cornerRadius = 8; - self.contactTextField.layer.masksToBounds = YES; self.contactTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:YMLocalizedString(@"FeedBackViewController5") attributes:@{NSForegroundColorAttributeName: placeholderColor}]; @@ -320,6 +311,35 @@ self.submitButton.enabled = NO; } +- (void)setupSubviews { + // 添加主要的视图层次结构 + [self.view addSubview:self.scrollView]; + [self.scrollView addSubview:self.scrollContentView]; + [self.scrollContentView addSubview:self.closeKeyboardButton]; + + // 添加标题标签 + [self.scrollContentView addSubview:self.title_1]; + [self.scrollContentView addSubview:self.title_2]; + [self.scrollContentView addSubview:self.title_3]; + [self.scrollContentView addSubview:self.title_4]; + + // 添加类型选择集合视图 + [self.scrollContentView addSubview:self.typeCollectionView]; + + // 添加反馈文本视图和相关标签 + [self.scrollContentView addSubview:self.feedbackTextView]; + [self.scrollContentView addSubview:self.feedbackPlaceholderLabel]; + [self.scrollContentView addSubview:self.feedbackCharCountLabel]; + [self.scrollContentView addSubview:self.feedbackCharLimitLabel]; + + // 添加上传图片相关视图 + [self.scrollContentView addSubview:self.uploadImageButton]; + [self.scrollContentView addSubview:self.uploadImageView]; + + // 添加联系方式输入框 + [self.scrollContentView addSubview:self.contactTextField]; +} + - (void)setupFakeTopBar { UIView *fakeTopBar = [[UIView alloc] init]; fakeTopBar.backgroundColor = UIColorFromRGB(0xebecf3); @@ -540,14 +560,15 @@ [self.navigationController popViewControllerAnimated:YES]; } -- (IBAction)didTapUploadImageButton:(id)sender { +- (void)didTapUploadImageButton:(id)sender { [self showPhotoSelectionSheet]; } -- (IBAction)didTapSubmitButton:(id)sender { +- (void)didTapSubmitButton:(id)sender { [self uploadAvatar]; } -- (IBAction)didTapCloseKeyboardButton:(id)sender { + +- (void)didTapCloseKeyboardButton:(id)sender { [self.view endEditing:YES]; } @@ -623,7 +644,7 @@ }); } -- (IBAction)contactDidChange:(UITextField *)sender { +- (void)contactDidChange:(UITextField *)sender { [self updateSubmitButtonStatus]; } @@ -749,77 +770,170 @@ return YES; } -#pragma mark - -/* +#pragma mark - Lazy Loading + - (UIScrollView *)scrollView { - return nil; + if (!_scrollView) { + _scrollView = [[UIScrollView alloc] init]; + _scrollView.backgroundColor = [UIColor clearColor]; + _scrollView.showsVerticalScrollIndicator = NO; + _scrollView.showsHorizontalScrollIndicator = NO; + } + return _scrollView; } - (UIView *)scrollContentView { - return nil; + if (!_scrollContentView) { + _scrollContentView = [[UIView alloc] init]; + _scrollContentView.backgroundColor = [UIColor clearColor]; + } + return _scrollContentView; } - (UIButton *)closeKeyboardButton { - return nil; + if (!_closeKeyboardButton) { + _closeKeyboardButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _closeKeyboardButton.backgroundColor = [UIColor clearColor]; + [_closeKeyboardButton addTarget:self action:@selector(didTapCloseKeyboardButton:) forControlEvents:UIControlEventTouchUpInside]; + } + return _closeKeyboardButton; } - (UILabel *)title_1 { - return nil; + if (!_title_1) { + _title_1 = [UILabel labelInitWithText:@"" + font:[UIFont systemFontOfSize:16 weight:UIFontWeightBold] + textColor:[UIColor blackColor]]; + } + return _title_1; } - (UILabel *)title_2 { - return nil; + if (!_title_2) { + _title_2 = [UILabel labelInitWithText:@"" + font:[UIFont systemFontOfSize:16 weight:UIFontWeightBold] + textColor:[UIColor blackColor]]; + } + return _title_2; } - (UILabel *)title_3 { - return nil; + if (!_title_3) { + _title_3 = [UILabel labelInitWithText:@"" + font:[UIFont systemFontOfSize:16 weight:UIFontWeightBold] + textColor:[UIColor blackColor]]; + } + return _title_3; } - (UILabel *)title_4 { - return nil; + if (!_title_4) { + _title_4 = [UILabel labelInitWithText:@"" + font:[UIFont systemFontOfSize:16 weight:UIFontWeightBold] + textColor:[UIColor blackColor]]; + } + return _title_4; } - (UICollectionViewFlowLayout *)typeCollectionLayout { - return nil; + if (!_typeCollectionLayout) { + _typeCollectionLayout = [[UICollectionViewFlowLayout alloc] init]; + _typeCollectionLayout.scrollDirection = UICollectionViewScrollDirectionVertical; + } + return _typeCollectionLayout; } - (UICollectionView *)typeCollectionView { if (!_typeCollectionView) { - _typeCollectionView = [[UICollectionView alloc] init]; - self.typeCollectionView.delegate = self; - self.typeCollectionView.dataSource = self; - self.typeCollectionView.allowsSelection = YES; - [self.typeCollectionView registerClass:[TypeCollectionCell class] forCellWithReuseIdentifier:@"cell"]; + _typeCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:self.typeCollectionLayout]; + _typeCollectionView.backgroundColor = [UIColor clearColor]; + _typeCollectionView.delegate = self; + _typeCollectionView.dataSource = self; + _typeCollectionView.allowsSelection = YES; + [_typeCollectionView registerClass:[TypeCollectionCell class] forCellWithReuseIdentifier:@"cell"]; } - return nil; + return _typeCollectionView; } - (UITextView *)feedbackTextView { - return nil; + if (!_feedbackTextView) { + _feedbackTextView = [[UITextView alloc] init]; + _feedbackTextView.backgroundColor = UIColorFromRGB(0xf3f5fa); + _feedbackTextView.layer.cornerRadius = 8; + _feedbackTextView.layer.masksToBounds = YES; + _feedbackTextView.font = [UIFont systemFontOfSize:14]; + _feedbackTextView.textColor = UIColorFromRGB(0x333333); + _feedbackTextView.delegate = self; + _feedbackTextView.textContainerInset = UIEdgeInsetsMake(8, 8, 20, 8); + } + return _feedbackTextView; } - (UILabel *)feedbackPlaceholderLabel { - return nil; + if (!_feedbackPlaceholderLabel) { + _feedbackPlaceholderLabel = [UILabel labelInitWithText:@"" + font:[UIFont systemFontOfSize:14] + textColor:UIColorFromRGB(0xacb0b7)]; + _feedbackPlaceholderLabel.numberOfLines = 0; + } + return _feedbackPlaceholderLabel; } - (UILabel *)feedbackCharCountLabel { - return nil; + if (!_feedbackCharCountLabel) { + _feedbackCharCountLabel = [UILabel labelInitWithText:@"0" + font:[UIFont systemFontOfSize:12] + textColor:UIColorFromRGB(0xa7acb3)]; + } + return _feedbackCharCountLabel; } - (UILabel *)feedbackCharLimitLabel { - return nil; + if (!_feedbackCharLimitLabel) { + _feedbackCharLimitLabel = [UILabel labelInitWithText:@"/300" + font:[UIFont systemFontOfSize:12] + textColor:UIColorFromRGB(0xa7acb3)]; + } + return _feedbackCharLimitLabel; } - (UIButton *)uploadImageButton { - return nil; + if (!_uploadImageButton) { + _uploadImageButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _uploadImageButton.backgroundColor = UIColorFromRGB(0xf3f5fa); + _uploadImageButton.layer.cornerRadius = 8; + _uploadImageButton.layer.masksToBounds = YES; + [_uploadImageButton setImage:kImage(@"feedback_upload_image") forState:UIControlStateNormal]; + [_uploadImageButton addTarget:self action:@selector(didTapUploadImageButton:) forControlEvents:UIControlEventTouchUpInside]; + } + return _uploadImageButton; } - (UIImageView *)uploadImageView { - return nil; + if (!_uploadImageView) { + _uploadImageView = [[UIImageView alloc] init]; + _uploadImageView.contentMode = UIViewContentModeScaleAspectFill; + _uploadImageView.layer.cornerRadius = 8; + _uploadImageView.layer.masksToBounds = YES; + _uploadImageView.hidden = YES; + } + return _uploadImageView; } - (UITextField *)contactTextField { - return nil; + if (!_contactTextField) { + _contactTextField = [[UITextField alloc] init]; + _contactTextField.backgroundColor = UIColorFromRGB(0xf3f5fa); + _contactTextField.layer.cornerRadius = 8; + _contactTextField.layer.masksToBounds = YES; + _contactTextField.font = [UIFont systemFontOfSize:14]; + _contactTextField.textColor = UIColorFromRGB(0x333333); + _contactTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 16, 0)]; + _contactTextField.leftViewMode = UITextFieldViewModeAlways; + _contactTextField.rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 16, 0)]; + _contactTextField.rightViewMode = UITextFieldViewModeAlways; + [_contactTextField addTarget:self action:@selector(contactDidChange:) forControlEvents:UIControlEventEditingChanged]; + } + return _contactTextField; } -*/ @end diff --git a/YuMi/Modules/YMLogin/View/FeedBackViewController.xib b/YuMi/Modules/YMLogin/View/FeedBackViewController.xib deleted file mode 100644 index c4c9a43a..00000000 --- a/YuMi/Modules/YMLogin/View/FeedBackViewController.xib +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/YuMi/Modules/YMLogin/View/LoginTypesViewController.m b/YuMi/Modules/YMLogin/View/LoginTypesViewController.m index 50f184c4..a1eb9b04 100644 --- a/YuMi/Modules/YMLogin/View/LoginTypesViewController.m +++ b/YuMi/Modules/YMLogin/View/LoginTypesViewController.m @@ -523,7 +523,7 @@ _stackView = [[UIStackView alloc] init]; _stackView.axis = UILayoutConstraintAxisVertical; _stackView.spacing = 24; - _stackView.distribution = UIStackViewDistributionFillProportionally; + _stackView.distribution = UIStackViewDistributionFill; } return _stackView; } diff --git a/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m b/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m index c1d42d1e..7f59106f 100644 --- a/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m +++ b/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m @@ -74,7 +74,9 @@ } - (void)handleTapFirstCharge { - + XPWebViewController *webVC = [[XPWebViewController alloc] initWithRoomUID:@""]; + webVC.url = URLWithType(kFirstChargeBanner); + [self.navigationController pushViewController:webVC animated:YES]; } #pragma mark - Private Method @@ -91,6 +93,7 @@ FirstRechargeModel *model = [FirstRechargeManager.sharedManager loadCurrentModel]; if (![NSString isEmpty:model.chargeBanner]) { NetImageView *imageView = [[NetImageView alloc] init]; + imageView.contentMode = UIViewContentModeScaleAspectFill; [imageView setCornerRadius:12]; imageView.imageUrl = model.chargeBanner; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapFirstCharge)]; diff --git a/YuMi/Modules/YMMine/View/Medals/MedalsDetailView.m b/YuMi/Modules/YMMine/View/Medals/MedalsDetailView.m index 671179e9..83f7c504 100644 --- a/YuMi/Modules/YMMine/View/Medals/MedalsDetailView.m +++ b/YuMi/Modules/YMMine/View/Medals/MedalsDetailView.m @@ -125,6 +125,7 @@ [self.levelIndicatorView setupWithMaxLevel:self.currentSeriesItemVO.medalLevel]; [self.levelIndicatorView setSelectedLevel:1 animated:NO]; + [self.levelIndicatorView setSeriesItems:detailItemVo.medalSeries]; // 设置指示器类型为带图片 self.levelIndicatorView.indicatorType = MedalsLevelIndicatorTypeWithImage; diff --git a/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.h b/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.h index 22a679fc..eeae9eca 100644 --- a/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.h +++ b/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.h @@ -6,7 +6,7 @@ // #import - +@class MedalSeriesItemVo; NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, MedalsLevelIndicatorType) { @@ -18,6 +18,7 @@ typedef NS_ENUM(NSInteger, MedalsLevelIndicatorType) { @property (nonatomic, copy) void (^levelSelectedBlock)(NSInteger level); @property (nonatomic, assign) MedalsLevelIndicatorType indicatorType; +@property (nonatomic, copy) NSArray *seriesItems; - (void)setupWithMaxLevel:(NSInteger)maxLevel; - (void)setSelectedLevel:(NSInteger)level animated:(BOOL)animated; @@ -29,6 +30,12 @@ typedef NS_ENUM(NSInteger, MedalsLevelIndicatorType) { */ - (void)setImageUrl:(NSString *)imageUrl forLevel:(NSInteger)level; +/** + * 设置系列数据,用于处理 MP4 和 PNG 资源 + * @param seriesItems MedalSeriesItemVo 数组 + */ +- (void)setSeriesItems:(NSArray *)seriesItems; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.m b/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.m index 2e57f6c0..ba3af5d1 100644 --- a/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.m +++ b/YuMi/Modules/YMMine/View/Medals/MedalsLevelIndicatorView.m @@ -7,6 +7,9 @@ #import "MedalsLevelIndicatorView.h" #import "UIImage+Utils.h" +#import "MedalsModel.h" +#import +#import "XPRoomGiftAnimationParser.h" // 等级指示器视图 @interface LevelItemView : UIView @@ -14,17 +17,24 @@ @property (nonatomic, strong) UILabel *levelLabel; @property (nonatomic, strong) UIView *dotView; // 圆点视图 @property (nonatomic, strong) NetImageView *imageView; // 图片视图 +@property (nonatomic, strong) VAPView *mp4View; // MP4 视图 +@property (nonatomic, strong) XPRoomGiftAnimationParser *mp4Parser; // MP4 解析器 @property (nonatomic, assign) BOOL isSelected; @property (nonatomic, assign) NSInteger level; @property (nonatomic, assign) BOOL hasImage; +@property (nonatomic, assign) BOOL hasMP4; @property (nonatomic, strong) UIImage *originalImage; // 保存原始彩色图片 @property (nonatomic, strong) UIImage *grayImage; // 保存灰度图片 @property (nonatomic, copy) NSString *cachedImageUrl; // 缓存图片URL,用于延迟加载 +@property (nonatomic, copy) NSString *cachedMP4Url; // 缓存MP4 URL,用于延迟加载 - (instancetype)initWithLevel:(NSInteger)level; - (void)setSelected:(BOOL)selected animated:(BOOL)animated; - (void)setImageUrl:(NSString *)imageUrl; +- (void)setMP4Url:(NSString *)mp4Url; - (void)createImageViewIfNeeded; +- (void)createMP4ViewIfNeeded; +- (void)stopMP4Playback; @end @@ -36,6 +46,7 @@ _level = level; _isSelected = NO; _hasImage = NO; + _hasMP4 = NO; // 创建圆点视图 _dotView = [[UIView alloc] init]; @@ -98,24 +109,73 @@ } } -- (void)setImageUrl:(NSString *)imageUrl { - _hasImage = YES; - _cachedImageUrl = imageUrl; +- (void)createMP4ViewIfNeeded { + if (_mp4View) { + return; + } - // 如果已经创建了imageView,直接加载图片 + // 创建 MP4 视图 + _mp4View = [[VAPView alloc] init]; + _mp4View.contentMode = UIViewContentModeScaleAspectFill; + _mp4View.clipsToBounds = YES; + [self addSubview:_mp4View]; + + [_mp4View mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.bottom.mas_equalTo(_dotView.mas_top).offset(-4); + make.width.height.mas_equalTo(40); + }]; + + // 调整圆点位置 + [_dotView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(_mp4View.mas_bottom).offset(4); + make.width.height.mas_equalTo(6); + }]; + + // 如果有缓存的 MP4 URL,加载 MP4 + if (_cachedMP4Url) { + [self loadMP4WithUrl:_cachedMP4Url]; + _cachedMP4Url = nil; + } +} + +- (void)setImageUrl:(NSString *)imageUrl { + // 判断是 MP4 还是图片 + if ([imageUrl.lowercaseString hasSuffix:@"mp4"]) { + [self setMP4Url:imageUrl]; + } else { + _hasImage = YES; + _hasMP4 = NO; + _cachedImageUrl = imageUrl; + + // 停止 MP4 播放 + [self stopMP4Playback]; + + // 如果已经创建了imageView,直接加载图片 + if (_imageView) { + [self loadImageWithUrl:imageUrl]; + } + } +} + +- (void)setMP4Url:(NSString *)mp4Url { + _hasMP4 = YES; + _hasImage = NO; + _cachedMP4Url = mp4Url; + + // 隐藏图片视图 if (_imageView) { - [self loadImageWithUrl:imageUrl]; + _imageView.hidden = YES; + } + + // 如果已经创建了mp4View,直接加载MP4 + if (_mp4View) { + [self loadMP4WithUrl:mp4Url]; } } - (void)loadImageWithUrl:(NSString *)imageUrl { - // 调试时使用测试URL - #ifdef DEBUG - NSString *testUrl = @"https://img.toto.im/mw600/66b3de17ly1i2jopju47bj20xc1e0dx4.jpg.webp"; - imageUrl = testUrl; - NSLog(@"调试模式: 使用测试图片URL: %@", testUrl); - #endif - // 加载图片并处理灰度效果 @kWeakify(self); [_imageView loadImageWithUrl:imageUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) { @@ -129,18 +189,62 @@ }]; } -// 更新图片效果 -- (void)updateImageEffect { - if (!_hasImage || !_imageView) { - return; +- (void)loadMP4WithUrl:(NSString *)mp4Url { + if (!_mp4Parser) { + _mp4Parser = [[XPRoomGiftAnimationParser alloc] init]; } - if (_isSelected && _originalImage) { - // 选中状态:显示彩色图片 - self.imageView.image = _originalImage; - } else if (!_isSelected && _grayImage) { - // 非选中状态:显示灰度图片 - self.imageView.image = _grayImage; + @kWeakify(self); + [_mp4Parser parseWithURL:mp4Url + completionBlock:^(NSString * _Nullable videoUrl) { + @kStrongify(self); + if (![NSString isEmpty:videoUrl]) { + [self.mp4View setMute:YES]; + [self.mp4View playHWDMP4:videoUrl repeatCount:-1 delegate:nil]; + + // 显示 MP4 视图,隐藏图片视图 + self.mp4View.hidden = NO; + if (self.imageView) { + self.imageView.hidden = YES; + } + + // MP4 加载完成后,应用当前的选中状态效果 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self updateImageEffect]; + }); + } + } failureBlock:^(NSError * _Nullable error) { + // MP4 加载失败时的处理 + NSLog(@"MP4 加载失败: %@", error); + }]; +} + +- (void)stopMP4Playback { + if (_mp4View) { + [_mp4View stopHWDMP4]; + _mp4View.hidden = YES; + } +} + +// 更新图片效果 +- (void)updateImageEffect { + if (_hasImage && _imageView) { + if (_isSelected && _originalImage) { + // 选中状态:显示彩色图片 + self.imageView.image = _originalImage; + } else if (!_isSelected && _grayImage) { + // 非选中状态:显示灰度图片 + self.imageView.image = _grayImage; + } + } + + // MP4 的选中效果处理 - 使用简单的 alpha 透明度 + if (_hasMP4 && _mp4View) { + if (_isSelected) { + _mp4View.alpha = 1.0; // 选中状态:完全不透明 + } else { + _mp4View.alpha = 0.3; // 非选中状态:半透明 + } } } @@ -156,8 +260,8 @@ self.levelLabel.textColor = color; self.dotView.backgroundColor = color; - // 如果有图片,更新图片效果 - if (self.hasImage) { + // 如果有图片或MP4,更新效果 + if (self.hasImage || self.hasMP4) { [self updateImageEffect]; } }; @@ -385,10 +489,14 @@ // 如果已经创建了视图,需要根据类型进行调整 if (_levelItems.count > 0) { - // 如果是带图片类型,创建 imageView + // 如果是带图片类型,创建相应的视图 if (indicatorType == MedalsLevelIndicatorTypeWithImage) { for (LevelItemView *item in _levelItems) { - [item createImageViewIfNeeded]; + if (item.hasMP4) { + [item createMP4ViewIfNeeded]; + } else if (item.hasImage) { + [item createImageViewIfNeeded]; + } } } [self updateImageVisibility]; @@ -401,6 +509,9 @@ if (item.imageView) { item.imageView.hidden = (_indicatorType == MedalsLevelIndicatorTypeNormal); } + if (item.mp4View) { + item.mp4View.hidden = (_indicatorType == MedalsLevelIndicatorTypeNormal); + } } } @@ -411,16 +522,44 @@ LevelItemView *item = _levelItems[level - 1]; - // 根据指示器类型决定是否创建和加载图片 + // 根据指示器类型决定是否创建和加载图片/MP4 if (_indicatorType == MedalsLevelIndicatorTypeWithImage) { - [item createImageViewIfNeeded]; // 确保创建了 imageView + // 判断是 MP4 还是图片 + if ([imageUrl.lowercaseString hasSuffix:@"mp4"]) { + [item createMP4ViewIfNeeded]; // 确保创建了 mp4View + } else { + [item createImageViewIfNeeded]; // 确保创建了 imageView + } [item setImageUrl:imageUrl]; } else { - // 在普通模式下,只保存URL,不创建 imageView + // 在普通模式下,只保存URL,不创建视图 [item setImageUrl:imageUrl]; } } +- (void)setSeriesItems:(NSArray *)seriesItems { + _seriesItems = seriesItems; + + // 如果没有系列数据或者等级指示器还没有创建,直接返回 + if (!seriesItems || seriesItems.count == 0 || _levelItems.count == 0) { + return; + } + + // 获取第一个系列项 + MedalSeriesItemVo *firstSeriesItem = [seriesItems xpSafeObjectAtIndex:0]; + if (!firstSeriesItem || !firstSeriesItem.medalVos) { + return; + } + + // 为每个等级设置对应的图片/MP4 + for (NSInteger i = 0; i < firstSeriesItem.medalVos.count && i < _levelItems.count; i++) { + MedalVo *medalVo = [firstSeriesItem.medalVos xpSafeObjectAtIndex:i]; + if (medalVo && medalVo.picUrl) { + [self setImageUrl:medalVo.picUrl forLevel:i + 1]; + } + } +} + - (void)handleTap:(UITapGestureRecognizer *)gesture { CGPoint location = [gesture locationInView:self]; diff --git a/YuMi/Modules/YMMine/View/XPMineViewController.m b/YuMi/Modules/YMMine/View/XPMineViewController.m index 05004ddf..a4bbf6bd 100644 --- a/YuMi/Modules/YMMine/View/XPMineViewController.m +++ b/YuMi/Modules/YMMine/View/XPMineViewController.m @@ -518,11 +518,11 @@ UIKIT_EXTERN NSString *kRequestTicket; } ///转赠钻石 -(void)pushGiveDiamondVC{ - XPWebViewController * webVC =[[XPWebViewController alloc] initWithRoomUID:nil]; - webVC.url = URLWithType(kTransfer); - [self.navigationController pushViewController:webVC animated:YES]; -// XPMineGiveDiamondVC *giveDiamondVC = [[XPMineGiveDiamondVC alloc] initWithUserModel:self.userInfo]; -// [self.navigationController pushViewController:giveDiamondVC animated:YES]; +// XPWebViewController * webVC =[[XPWebViewController alloc] initWithRoomUID:nil]; +// webVC.url = URLWithType(kTransfer); +// [self.navigationController pushViewController:webVC animated:YES]; + XPMineGiveDiamondVC *giveDiamondVC = [[XPMineGiveDiamondVC alloc] initWithUserModel:self.userInfo]; + [self.navigationController pushViewController:giveDiamondVC animated:YES]; } ///点击充值 -(void)pushThirdPartyPayVC{ diff --git a/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m b/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m index 6b8fdbfd..2e532f76 100644 --- a/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m +++ b/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m @@ -13,7 +13,6 @@ #import #import #import "SDWebImageManager.h" -#import "FirstRechargeModel.h" #import "FirstRechargeManager.h" ///Tool #import "Api+Home.h" @@ -402,9 +401,9 @@ FirstRechargeManagerDelegate> // 注册首充管理器监听 [FirstRechargeManager sharedManager].delegate = self; - [[FirstRechargeManager sharedManager] startMonitoring]; - -// [self.presenter getUserFirstChargeStatus]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [[FirstRechargeManager sharedManager] startMonitoring]; + }); } } @@ -818,36 +817,86 @@ FirstRechargeManagerDelegate> // 如果已经有弹窗在显示,先移除它 [self removeFirstChargePopup]; - // 创建背景视图 - self.firstChargeBackgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; + // 获取 keyWindow 以确保盖在 tabbar 上 + UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; + if (!keyWindow) { + keyWindow = [UIApplication sharedApplication].windows.firstObject; + } + + // 创建背景视图,使用 keyWindow 的 bounds + self.firstChargeBackgroundView = [[UIView alloc] initWithFrame:keyWindow.bounds]; self.firstChargeBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; // 添加点击手势 UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleBackgroundTap:)]; [self.firstChargeBackgroundView addGestureRecognizer:tapGesture]; - // 添加背景视图 - [self.view addSubview:self.firstChargeBackgroundView]; + // 添加到 keyWindow 上,确保盖在 tabbar 上 + [keyWindow addSubview:self.firstChargeBackgroundView]; // 创建并配置 web 视图 self.firstChargeWebVC = [[XPWebViewController alloc] initWithRoomUID:@""]; self.firstChargeWebVC.isPush = NO; - self.firstChargeWebVC.url = @"https://jandan.net/pic"; - [self addChildViewController:self.firstChargeWebVC]; + self.firstChargeWebVC.url = URLWithType(kFirstChargeHomeIndex); + + // 获取当前的根视图控制器来添加子控制器 + UIViewController *rootViewController = keyWindow.rootViewController; + if ([rootViewController isKindOfClass:[UINavigationController class]]) { + rootViewController = [(UINavigationController *)rootViewController topViewController]; + } else if ([rootViewController isKindOfClass:[UITabBarController class]]) { + UITabBarController *tabBarController = (UITabBarController *)rootViewController; + rootViewController = tabBarController.selectedViewController; + if ([rootViewController isKindOfClass:[UINavigationController class]]) { + rootViewController = [(UINavigationController *)rootViewController topViewController]; + } + } + + [rootViewController addChildViewController:self.firstChargeWebVC]; [self.firstChargeBackgroundView addSubview:self.firstChargeWebVC.view]; - self.firstChargeWebVC.view.frame = CGRectMake(0, 0, KScreenWidth/2, KScreenHeight/2); + [self.firstChargeWebVC didMoveToParentViewController:rootViewController]; + + self.firstChargeWebVC.view.backgroundColor = [UIColor clearColor]; + self.firstChargeWebVC.webview.backgroundColor = [UIColor clearColor]; + self.firstChargeWebVC.webview.opaque = NO; + self.firstChargeWebVC.webview.scrollView.backgroundColor = [UIColor clearColor]; + self.firstChargeWebVC.view.frame = CGRectMake(0, 0, KScreenWidth - 40, KScreenHeight*2/3); self.firstChargeWebVC.view.center = self.firstChargeBackgroundView.center; + + // 添加关闭按钮 +// UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; +// [closeButton setTitle:@"✕" forState:UIControlStateNormal]; +// [closeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; +// closeButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold]; +// [closeButton addTarget:self action:@selector(removeFirstChargePopup) forControlEvents:UIControlEventTouchUpInside]; +// closeButton.frame = CGRectMake(0, 0, 30, 30); +// closeButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; +// closeButton.layer.cornerRadius = 15; +// [self.firstChargeBackgroundView addSubview:closeButton]; +// +// // 设置关闭按钮位置(webView 右上角) +// CGRect webViewFrame = self.firstChargeWebVC.view.frame; +// closeButton.center = CGPointMake(CGRectGetMaxX(webViewFrame) - 15, CGRectGetMinY(webViewFrame) + 15); // 3秒后自动移除 - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [self removeFirstChargePopup]; - }); +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// [self removeFirstChargePopup]; +// }); } // 处理背景点击事件 - (void)handleBackgroundTap:(UITapGestureRecognizer *)gesture { + // 获取点击位置 CGPoint location = [gesture locationInView:self.firstChargeBackgroundView]; - if (!CGRectContainsPoint(self.firstChargeWebVC.view.frame, location)) { + + // 检查是否点击在 webView 区域外 + if (self.firstChargeWebVC && self.firstChargeWebVC.view) { + CGRect webViewFrame = self.firstChargeWebVC.view.frame; + if (!CGRectContainsPoint(webViewFrame, location)) { + // 点击在 webView 外部,移除弹窗 + [self removeFirstChargePopup]; + } + } else { + // 如果 webView 不存在,直接移除弹窗 [self removeFirstChargePopup]; } } @@ -855,6 +904,7 @@ FirstRechargeManagerDelegate> // 修改移除弹窗的方法 - (void)removeFirstChargePopup { if (self.firstChargeWebVC) { + [self.firstChargeWebVC willMoveToParentViewController:nil]; [self.firstChargeWebVC.view removeFromSuperview]; [self.firstChargeWebVC removeFromParentViewController]; self.firstChargeWebVC = nil; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h index 8a09d81f..db2db311 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h @@ -32,8 +32,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong) XPGiftCountModel *giftCountModel; ///钱包信息 @property (nonatomic,strong) WalletInfoModel *walletInfoModel; -///是否展示首充 -@property (nonatomic,assign) BOOL isShowFirstRecharge; + ///是否可用 @property (nonatomic,assign) BOOL sendButtonIsEnable; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m index 517ee4bb..d4631d63 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m @@ -18,6 +18,10 @@ ///View #import "XPGiftCountCollectionViewCell.h" #import "XPGiftCountView.h" + +#import "MoliMoneyLabel.h" +#import "FirstRechargeManager.h" + @interface XPGiftBarView () ///余额 @@ -36,8 +40,7 @@ @property (nonatomic,strong) UIButton *arrowButton; ///赠送 @property (nonatomic,strong) UIButton *sendGiftButton; -///首充 -@property (nonatomic,strong) UIButton *firstRechargeButton; + ///自定义个数 @property (nonatomic,strong) UIView *customCountView; //输入框 @@ -47,6 +50,9 @@ ///送礼物的个数 @property (nonatomic,strong) XPGiftCountView *giftCountView; +@property (nonatomic, strong) UIView *firstChargeView; +@property (nonatomic, strong) MoliMoneyLabel *moneyLabel; + @end @implementation XPGiftBarView @@ -113,18 +119,13 @@ self.countLabel.text = countStr; } -- (void)firstRechargeButtonAction:(UIButton *)sender{ - if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftBarViewDidClickFirstRecharge:)]) { - [self.delegate xPGiftBarViewDidClickFirstRecharge:self]; - } -} #pragma mark - Private Method - (void)initSubViews { self.backgroundColor= [UIColor clearColor]; [self addSubview:self.balanceLabel]; [self addSubview:self.rechargeStackView]; - [self addSubview:self.firstRechargeButton]; + [self addSubview:self.firstChargeView]; [self addSubview:self.sendOperationView]; [self.rechargeStackView addArrangedSubview:self.rechargeLabel]; @@ -136,6 +137,14 @@ [self.customCountView addSubview:self.editTextFiled]; [self.customCountView addSubview:self.sureButton]; + + FirstRechargeModel *model = [[FirstRechargeManager sharedManager] loadCurrentModel]; + if (model && model.chargeStatus == NO) { + self.firstChargeView.hidden = NO; + [self.moneyLabel updateContent:@"Bonus >"]; + } else { + self.firstChargeView.hidden = YES; + } } - (void)initSubViewConstraints { @@ -154,9 +163,9 @@ make.leading.mas_equalTo(self.balanceLabel.mas_trailing).offset(12); }]; - [self.firstRechargeButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(17, 8)); - make.leading.mas_equalTo(self.rechargeStackView.mas_trailing).offset(4); + [self.firstChargeView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(68, 23)); + make.leading.mas_equalTo(self.rechargeStackView.mas_leading); make.centerY.mas_equalTo(self.rechargeStackView); }]; @@ -171,7 +180,6 @@ make.height.mas_equalTo(30); }]; - [self.arrowButton mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(30, 30)); }]; @@ -180,7 +188,6 @@ make.size.mas_equalTo(CGSizeMake(67, 30)); }]; - [self.editTextFiled mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(self.customCountView).offset(15); make.trailing.mas_equalTo(self.sureButton.mas_leading).offset(-10); @@ -306,11 +313,6 @@ }]; } -- (void)setIsShowFirstRecharge:(BOOL)isShowFirstRecharge { -// self.firstRechargeButton.hidden = !isShowFirstRecharge; - self.firstRechargeButton.hidden = YES; -} - - (void)setType:(GiftSegmentType)type { _type = type; if (!self.giftCountView.hidden) { @@ -532,14 +534,32 @@ return _giftCountView; } -- (UIButton *)firstRechargeButton { - if (!_firstRechargeButton) { - _firstRechargeButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_firstRechargeButton setImage:[UIImage imageNamed:@"pi_new_gift_first_recharge_bg"] forState:UIControlStateNormal]; - [_firstRechargeButton setImage:[UIImage imageNamed:@"pi_new_gift_first_recharge_bg"] forState:UIControlStateSelected]; - [_firstRechargeButton addTarget:self action:@selector(firstRechargeButtonAction:) forControlEvents:UIControlEventTouchUpInside]; - } - return _firstRechargeButton; +- (UIView *)firstChargeView { + if (!_firstChargeView) { + _firstChargeView = [[UIView alloc] init]; + _firstChargeView.userInteractionEnabled = YES; + [_firstChargeView addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xFFE347), + UIColorFromRGB(0xFF9a51), + ] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) cornerRadius:23/2]; + [_firstChargeView setCornerRadius:23/2]; + + [_firstChargeView addSubview:self.moneyLabel]; + [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(_firstChargeView).insets(UIEdgeInsetsMake(5, 5, 5, 5)); + }]; + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTagRecharge:)]; + [_firstChargeView addGestureRecognizer:tap]; + } + return _firstChargeView; +} + +- (MoliMoneyLabel *)moneyLabel { + if (!_moneyLabel) { + _moneyLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0x582B00) font:kFontSemibold(10) moneyPostion:1 moneySize:CGSizeMake(15, 15)]; + } + return _moneyLabel; } @end diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m index acbf9f66..eea45ea3 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m @@ -964,7 +964,6 @@ UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification; #pragma mark - XPGiftProtocol - (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo { self.headTypeView.isShowFirstRecharge = userInfo.isFirstCharge; - self.giftBarView.isShowFirstRecharge = userInfo.isFirstCharge; self.giftInfoView.curUserNobleLevel = userInfo.userVipInfoVO.vipLevel; } diff --git a/YuMi/Modules/YMWeb/XPWebViewController.h b/YuMi/Modules/YMWeb/XPWebViewController.h index bb223df4..2f3d2122 100644 --- a/YuMi/Modules/YMWeb/XPWebViewController.h +++ b/YuMi/Modules/YMWeb/XPWebViewController.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN @interface XPWebViewController : BaseViewController /// @property (nonatomic,weak) id delegate; -@property (strong, nonatomic,readonly) WKWebView *webview; +@property (strong, nonatomic) WKWebView *webview; ///跳转方式,如果push的直接pushViewController,不用dismissViewControllerAnimated后再pushViewController @property (nonatomic,assign) BOOL isPush; diff --git a/YuMi/Modules/YMWeb/XPWebViewController.m b/YuMi/Modules/YMWeb/XPWebViewController.m index 50948f16..99a155a5 100644 --- a/YuMi/Modules/YMWeb/XPWebViewController.m +++ b/YuMi/Modules/YMWeb/XPWebViewController.m @@ -81,7 +81,7 @@ typedef NS_ENUM(NSUInteger, RightNavigationPushType){ @interface XPWebViewController () @property (nonatomic,strong) WalletInfoModel *model ; -@property (strong, nonatomic) WKWebView *webview; +//@property (strong, nonatomic) WKWebView *webview; @property (strong, nonatomic) UIProgressView *progressView; @property (nonatomic, strong) WKUserContentController *pi_userContentController; ///分享的内容 @@ -881,65 +881,65 @@ NSString * const kJSShowShareCallBack = @"showShareAction"; } - (WKWebView *)webview { - if (_webview == nil) { - WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc]init]; + if (_webview == nil) { + WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc]init]; - if (@available(iOS 10.0, *)) { - configuration.mediaTypesRequiringUserActionForPlayback = NO; - } else { - // Fallback on earlier versions - } - configuration.allowsInlineMediaPlayback = YES; + if (@available(iOS 10.0, *)) { + configuration.mediaTypesRequiringUserActionForPlayback = NO; + } else { + // Fallback on earlier versions + } + configuration.allowsInlineMediaPlayback = YES; - NSString *uid = [[AccountInfoStorage instance] getUid]; - NSString *realCookie = [NSString stringWithFormat:@"%@=%@",@"uid",uid]; + NSString *uid = [[AccountInfoStorage instance] getUid]; + NSString *realCookie = [NSString stringWithFormat:@"%@=%@",@"uid",uid]; - WKUserScript *cookieScript = [[WKUserScript alloc] initWithSource: [NSString stringWithFormat:@"document.cookie = '%@';", realCookie] injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO]; - [self.pi_userContentController addUserScript:cookieScript]; - ///禁止缩放 - NSString *scaleJs = @"$('meta[name=description]').remove(); $('head').append( '' );"; - WKUserScript *scaleScript = [[WKUserScript alloc] initWithSource:scaleJs injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO]; - [self.pi_userContentController addUserScript:scaleScript]; + WKUserScript *cookieScript = [[WKUserScript alloc] initWithSource: [NSString stringWithFormat:@"document.cookie = '%@';", realCookie] injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO]; + [self.pi_userContentController addUserScript:cookieScript]; + ///禁止缩放 + NSString *scaleJs = @"$('meta[name=description]').remove(); $('head').append( '' );"; + WKUserScript *scaleScript = [[WKUserScript alloc] initWithSource:scaleJs injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO]; + [self.pi_userContentController addUserScript:scaleScript]; - //根据生成的WKUserScript对象,初始化WKWebViewConfiguration - configuration.preferences.javaScriptEnabled = YES; - configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES; - configuration.preferences.minimumFontSize = 10; - configuration.selectionGranularity = WKSelectionGranularityCharacter; - configuration.userContentController = self.pi_userContentController; + //根据生成的WKUserScript对象,初始化WKWebViewConfiguration + configuration.preferences.javaScriptEnabled = YES; + configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES; + configuration.preferences.minimumFontSize = 10; + configuration.selectionGranularity = WKSelectionGranularityCharacter; + configuration.userContentController = self.pi_userContentController; - CGSize size = [UIScreen mainScreen].bounds.size; - _webview = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, size.width,size.height) configuration:configuration]; + CGSize size = [UIScreen mainScreen].bounds.size; + _webview = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, size.width,size.height) configuration:configuration]; - _webview.navigationDelegate = self; - //添加KVO,WKWebView有一个属性estimatedProgress,就是当前网页加载的进度,所以监听这个属性 - [_webview addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil]; - //添加KVO,监听title属性 - [_webview addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL]; + _webview.navigationDelegate = self; + //添加KVO,WKWebView有一个属性estimatedProgress,就是当前网页加载的进度,所以监听这个属性 + [_webview addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil]; + //添加KVO,监听title属性 + [_webview addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL]; - UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(backButtonClick)]; - [_webview addGestureRecognizer:swipeGesture]; + UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(backButtonClick)]; + [_webview addGestureRecognizer:swipeGesture]; - [_webview.scrollView setShowsVerticalScrollIndicator:NO]; - [_webview.scrollView setShowsHorizontalScrollIndicator:NO]; + [_webview.scrollView setShowsVerticalScrollIndicator:NO]; + [_webview.scrollView setShowsHorizontalScrollIndicator:NO]; - //set useragent - __weak typeof(self) weakSelf = self; - [_webview evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id result, NSError *error) { - NSString *userAgent = result; + //set useragent + __weak typeof(self) weakSelf = self; + [_webview evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id result, NSError *error) { + NSString *userAgent = result; - if (![userAgent containsString:@"molistarAppIos erbanAppIos"]){ - NSString *newUserAgent = [userAgent stringByAppendingString:@" molistarAppIos erbanAppIos"]; - NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:newUserAgent, @"UserAgent", nil]; - [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; - [[NSUserDefaults standardUserDefaults] synchronize]; - [weakSelf.webview setCustomUserAgent:newUserAgent]; - } + if (![userAgent containsString:@"molistarAppIos erbanAppIos"]){ + NSString *newUserAgent = [userAgent stringByAppendingString:@" molistarAppIos erbanAppIos"]; + NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:newUserAgent, @"UserAgent", nil]; + [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; + [[NSUserDefaults standardUserDefaults] synchronize]; + [weakSelf.webview setCustomUserAgent:newUserAgent]; + } - }]; - _webview.scrollView.bounces = NO; - } - return _webview; + }]; + _webview.scrollView.bounces = NO; + } + return _webview; } - (UIProgressView *)progressView{ if (!_progressView) { diff --git a/YuMi/Tools/FirstCharge/FirstRechargeManager.m b/YuMi/Tools/FirstCharge/FirstRechargeManager.m index 37d9e7c1..f45e83db 100644 --- a/YuMi/Tools/FirstCharge/FirstRechargeManager.m +++ b/YuMi/Tools/FirstCharge/FirstRechargeManager.m @@ -161,7 +161,9 @@ static NSString * const kTodayShownKey = @"FirstRechargeTodayShown"; } // 调用API获取首充信息 + @kWeakify(self); [Api firstchargeInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); if (code == 200 && data.data) { FirstRechargeModel *model = [FirstRechargeModel modelWithJSON:data.data]; [self handleFirstRechargeResult:model]; @@ -191,13 +193,14 @@ static NSString * const kTodayShownKey = @"FirstRechargeTodayShown"; } - (BOOL)shouldShowFirstRecharge:(FirstRechargeModel *)model { +#if DEBUG + return YES; +#endif // 如果已经首充过,不展示 if (model.chargeStatus) { return NO; } -#if DEBUG - return YES; -#endif + // 检查今天是否已经展示过 NSString *shownDate = [[NSUserDefaults standardUserDefaults] objectForKey:kTodayShownKey]; NSString *today = [self getTodayString]; @@ -206,7 +209,9 @@ static NSString * const kTodayShownKey = @"FirstRechargeTodayShown"; } - (void)notifyDelegatesWithModel:(FirstRechargeModel *)model shouldShow:(BOOL)shouldShow { + @kWeakify(self); dispatch_async(dispatch_get_main_queue(), ^{ + @kStrongify(self); if (self.delegate && [self.delegate respondsToSelector:@selector(firstRechargeManager:didCheckFirstRecharge:shouldShow:)]) { [self.delegate firstRechargeManager:self didCheckFirstRecharge:model shouldShow:shouldShow]; }