注册,设置UI调整

This commit is contained in:
linyudan
2023-11-23 14:43:42 -08:00
parent 0a2831586a
commit 197ebc6528
54 changed files with 2517 additions and 76 deletions

View File

@@ -35,6 +35,16 @@
8C4D535C2AFD4CF700238AE6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8C4D535B2AFD4CF700238AE6 /* Assets.xcassets */; };
8C4D535F2AFD4CF700238AE6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8C4D535D2AFD4CF700238AE6 /* LaunchScreen.storyboard */; };
8C4D53622AFD4CF700238AE6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C4D53612AFD4CF700238AE6 /* main.m */; };
8C92A8042B0EED72008F362C /* LoginBindPhoneResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A8032B0EED72008F362C /* LoginBindPhoneResultViewController.m */; };
8C92A8072B0EEDD0008F362C /* LoginVerifBindPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A8062B0EEDD0008F362C /* LoginVerifBindPhoneViewController.m */; };
8C92A80B2B0EEE73008F362C /* LoginVerifBindPhonePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A80A2B0EEE73008F362C /* LoginVerifBindPhonePresenter.m */; };
8C92A80E2B0EEF3A008F362C /* LoginBindPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A80D2B0EEF3A008F362C /* LoginBindPhoneViewController.m */; };
8C92A8112B0EEFAE008F362C /* LoginBindPhonePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A8102B0EEFAE008F362C /* LoginBindPhonePresent.m */; };
8C92A8142B0EF1D8008F362C /* MineLoginPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A8132B0EF1D8008F362C /* MineLoginPasswordViewController.m */; };
8C92A8182B0EF3E9008F362C /* MineModifPayPwdView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A8172B0EF3E9008F362C /* MineModifPayPwdView.m */; };
8C92A81C2B0EF449008F362C /* UIButton+EnlargeTouchArea.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A81B2B0EF449008F362C /* UIButton+EnlargeTouchArea.m */; };
8C92A81F2B0EF4D2008F362C /* MineLoginPasswordPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A81E2B0EF4D2008F362C /* MineLoginPasswordPresenter.m */; };
8C92A8232B0FE1DC008F362C /* MewHtmlUrl.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92A8222B0FE1DC008F362C /* MewHtmlUrl.m */; };
8C9C821F2B0C694900A601BC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C821D2B0C694900A601BC /* AppDelegate.m */; };
8C9C82202B0C694900A601BC /* AppDelegate+ThirdConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C821E2B0C694900A601BC /* AppDelegate+ThirdConfig.m */; };
8C9C82A62B0C695600A601BC /* UIImage+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C82252B0C695600A601BC /* UIImage+Utils.m */; };
@@ -251,6 +261,28 @@
8C4D535E2AFD4CF700238AE6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
8C4D53602AFD4CF700238AE6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8C4D53612AFD4CF700238AE6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8C92A8022B0EED72008F362C /* LoginBindPhoneResultViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginBindPhoneResultViewController.h; sourceTree = "<group>"; };
8C92A8032B0EED72008F362C /* LoginBindPhoneResultViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginBindPhoneResultViewController.m; sourceTree = "<group>"; };
8C92A8052B0EEDD0008F362C /* LoginVerifBindPhoneViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifBindPhoneViewController.h; sourceTree = "<group>"; };
8C92A8062B0EEDD0008F362C /* LoginVerifBindPhoneViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginVerifBindPhoneViewController.m; sourceTree = "<group>"; };
8C92A8082B0EEE3C008F362C /* LoginVerifBindPhoneProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifBindPhoneProtocol.h; sourceTree = "<group>"; };
8C92A8092B0EEE73008F362C /* LoginVerifBindPhonePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifBindPhonePresenter.h; sourceTree = "<group>"; };
8C92A80A2B0EEE73008F362C /* LoginVerifBindPhonePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginVerifBindPhonePresenter.m; sourceTree = "<group>"; };
8C92A80C2B0EEF3A008F362C /* LoginBindPhoneViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginBindPhoneViewController.h; sourceTree = "<group>"; };
8C92A80D2B0EEF3A008F362C /* LoginBindPhoneViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginBindPhoneViewController.m; sourceTree = "<group>"; };
8C92A80F2B0EEFAE008F362C /* LoginBindPhonePresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginBindPhonePresent.h; sourceTree = "<group>"; };
8C92A8102B0EEFAE008F362C /* LoginBindPhonePresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginBindPhonePresent.m; sourceTree = "<group>"; };
8C92A8122B0EF1D8008F362C /* MineLoginPasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MineLoginPasswordViewController.h; sourceTree = "<group>"; };
8C92A8132B0EF1D8008F362C /* MineLoginPasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MineLoginPasswordViewController.m; sourceTree = "<group>"; };
8C92A8162B0EF3E9008F362C /* MineModifPayPwdView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MineModifPayPwdView.h; sourceTree = "<group>"; };
8C92A8172B0EF3E9008F362C /* MineModifPayPwdView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MineModifPayPwdView.m; sourceTree = "<group>"; };
8C92A81A2B0EF449008F362C /* UIButton+EnlargeTouchArea.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIButton+EnlargeTouchArea.h"; sourceTree = "<group>"; };
8C92A81B2B0EF449008F362C /* UIButton+EnlargeTouchArea.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIButton+EnlargeTouchArea.m"; sourceTree = "<group>"; };
8C92A81D2B0EF4D2008F362C /* MineLoginPasswordPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MineLoginPasswordPresenter.h; sourceTree = "<group>"; };
8C92A81E2B0EF4D2008F362C /* MineLoginPasswordPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MineLoginPasswordPresenter.m; sourceTree = "<group>"; };
8C92A8202B0EF500008F362C /* MineLoginPasswordProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MineLoginPasswordProtocol.h; sourceTree = "<group>"; };
8C92A8212B0FE1DC008F362C /* MewHtmlUrl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MewHtmlUrl.h; sourceTree = "<group>"; };
8C92A8222B0FE1DC008F362C /* MewHtmlUrl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MewHtmlUrl.m; sourceTree = "<group>"; };
8C9C821B2B0C694900A601BC /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
8C9C821C2B0C694900A601BC /* AppDelegate+ThirdConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+ThirdConfig.h"; sourceTree = "<group>"; };
8C9C821D2B0C694900A601BC /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -793,6 +825,24 @@
path = "yinmeng-ios";
sourceTree = "<group>";
};
8C92A8152B0EF3CE008F362C /* SubView */ = {
isa = PBXGroup;
children = (
8C92A8162B0EF3E9008F362C /* MineModifPayPwdView.h */,
8C92A8172B0EF3E9008F362C /* MineModifPayPwdView.m */,
);
path = SubView;
sourceTree = "<group>";
};
8C92A8192B0EF42F008F362C /* UIButton */ = {
isa = PBXGroup;
children = (
8C92A81A2B0EF449008F362C /* UIButton+EnlargeTouchArea.h */,
8C92A81B2B0EF449008F362C /* UIButton+EnlargeTouchArea.m */,
);
path = UIButton;
sourceTree = "<group>";
};
8C9C821A2B0C694900A601BC /* AppDelegate */ = {
isa = PBXGroup;
children = (
@@ -807,6 +857,7 @@
8C9C82212B0C695600A601BC /* Base */ = {
isa = PBXGroup;
children = (
8C92A8192B0EF42F008F362C /* UIButton */,
8C9C82222B0C695600A601BC /* UI */,
8C9C82512B0C695600A601BC /* Net */,
8C9C82552B0C695600A601BC /* MVP */,
@@ -1162,6 +1213,8 @@
8C9C82D92B0C696900A601BC /* YMMacro.h */,
8C9C82DA2B0C696900A601BC /* YMEnum.h */,
8C9C82DB2B0C696900A601BC /* YMConstant.m */,
8C92A8212B0FE1DC008F362C /* MewHtmlUrl.h */,
8C92A8222B0FE1DC008F362C /* MewHtmlUrl.m */,
);
path = Global;
sourceTree = "<group>";
@@ -1518,6 +1571,7 @@
8C9C836E2B0C697A00A601BC /* View */ = {
isa = PBXGroup;
children = (
8C92A8152B0EF3CE008F362C /* SubView */,
8C9C836F2B0C697A00A601BC /* CollectRoom */,
8C9C83752B0C697A00A601BC /* Setting */,
);
@@ -1627,6 +1681,12 @@
8C9C83922B0C697A00A601BC /* LoginVerifCodePresent.m */,
8C9C83932B0C697A00A601BC /* LoginPresenter.h */,
8C9C83942B0C697A00A601BC /* LoginPasswordPresent.m */,
8C92A8092B0EEE73008F362C /* LoginVerifBindPhonePresenter.h */,
8C92A80A2B0EEE73008F362C /* LoginVerifBindPhonePresenter.m */,
8C92A80F2B0EEFAE008F362C /* LoginBindPhonePresent.h */,
8C92A8102B0EEFAE008F362C /* LoginBindPhonePresent.m */,
8C92A81D2B0EF4D2008F362C /* MineLoginPasswordPresenter.h */,
8C92A81E2B0EF4D2008F362C /* MineLoginPasswordPresenter.m */,
);
path = Presenter;
sourceTree = "<group>";
@@ -1639,6 +1699,8 @@
8C9C83982B0C697A00A601BC /* LoginPasswordProtocol.h */,
8C9C83992B0C697A00A601BC /* LoginFullInfoProtocol.h */,
8C9C839A2B0C697A00A601BC /* LoginVerifCodeProtocol.h */,
8C92A8082B0EEE3C008F362C /* LoginVerifBindPhoneProtocol.h */,
8C92A8202B0EF500008F362C /* MineLoginPasswordProtocol.h */,
);
path = Protocol;
sourceTree = "<group>";
@@ -1660,6 +1722,14 @@
8C9C83A12B0C697A00A601BC /* LoginForgetPasswordViewController.h */,
8C9C83A22B0C697A00A601BC /* CustomView */,
8C9C83A72B0C697A00A601BC /* LoginFullInfoViewController.m */,
8C92A8022B0EED72008F362C /* LoginBindPhoneResultViewController.h */,
8C92A8032B0EED72008F362C /* LoginBindPhoneResultViewController.m */,
8C92A8052B0EEDD0008F362C /* LoginVerifBindPhoneViewController.h */,
8C92A8062B0EEDD0008F362C /* LoginVerifBindPhoneViewController.m */,
8C92A80C2B0EEF3A008F362C /* LoginBindPhoneViewController.h */,
8C92A80D2B0EEF3A008F362C /* LoginBindPhoneViewController.m */,
8C92A8122B0EF1D8008F362C /* MineLoginPasswordViewController.h */,
8C92A8132B0EF1D8008F362C /* MineLoginPasswordViewController.m */,
);
path = View;
sourceTree = "<group>";
@@ -2291,6 +2361,7 @@
8C9C82C92B0C695600A601BC /* UploadFile.m in Sources */,
2337575C2B0CB577001D0B7F /* SessionMessageCell.m in Sources */,
8C9C821F2B0C694900A601BC /* AppDelegate.m in Sources */,
8C92A8182B0EF3E9008F362C /* MineModifPayPwdView.m in Sources */,
8C9C84462B0C697A00A601BC /* YMMineSettingViewController.m in Sources */,
8C9C843D2B0C697A00A601BC /* YMMineCollectRoomPresenter.m in Sources */,
8C9C82A92B0C695600A601BC /* BaseNavigationController.m in Sources */,
@@ -2307,6 +2378,8 @@
8C9C84662B0C697A00A601BC /* MewUserIntroductionView.m in Sources */,
8C9C82C42B0C695600A601BC /* YYUtility+Carrier.m in Sources */,
8C9C84172B0C697A00A601BC /* YMWebViewController.m in Sources */,
8C92A8232B0FE1DC008F362C /* MewHtmlUrl.m in Sources */,
8C92A80E2B0EEF3A008F362C /* LoginBindPhoneViewController.m in Sources */,
8C9C84432B0C697A00A601BC /* WalletInfoModel.m in Sources */,
8C9C84552B0C697A00A601BC /* LoginForgetEditView.m in Sources */,
8C9C82C02B0C695600A601BC /* MvpViewController.m in Sources */,
@@ -2396,6 +2469,7 @@
8C9C846E2B0C697A00A601BC /* MewRoomHeaderView.m in Sources */,
8C9C84492B0C697A00A601BC /* YMMineAboutUsViewController.m in Sources */,
8C9C84632B0C697A00A601BC /* MewPlayVoiceView.m in Sources */,
8C92A80B2B0EEE73008F362C /* LoginVerifBindPhonePresenter.m in Sources */,
8C9C84502B0C697A00A601BC /* LoginVerifCodePresent.m in Sources */,
8C9C844C2B0C697A00A601BC /* CustomAttachmentDecoder.m in Sources */,
8C9C845E2B0C697A00A601BC /* AudioPlayerManager.m in Sources */,
@@ -2422,6 +2496,8 @@
8C9C84202B0C697A00A601BC /* MicroView.m in Sources */,
8C9C84522B0C697A00A601BC /* ThirdUserInfo.m in Sources */,
8C9C82BD2B0C695600A601BC /* UserVipInfoVo.m in Sources */,
8C92A81F2B0EF4D2008F362C /* MineLoginPasswordPresenter.m in Sources */,
8C92A8042B0EED72008F362C /* LoginBindPhoneResultViewController.m in Sources */,
8C9C82CD2B0C695600A601BC /* Base64.m in Sources */,
8C9C84472B0C697A00A601BC /* MewMineCollectionTableViewCell.m in Sources */,
8C9C844E2B0C697A00A601BC /* LoginPresenter.m in Sources */,
@@ -2431,10 +2507,12 @@
8C9C84272B0C697A00A601BC /* YMNetImageYYLabel.m in Sources */,
8C9C842A2B0C697A00A601BC /* Api+Room.m in Sources */,
8C9C84902B0D439800A601BC /* YMRoomMessageFilter.m in Sources */,
8C92A8072B0EEDD0008F362C /* LoginVerifBindPhoneViewController.m in Sources */,
8C9C84412B0C697A00A601BC /* MineCollectRoomModel.m in Sources */,
8C9C82CC2B0C695600A601BC /* DESEncrypt.m in Sources */,
2337576B2B0CB630001D0B7F /* UIView+FilletCorner.m in Sources */,
8C9C82CA2B0C695600A601BC /* CountDownHelper.m in Sources */,
8C92A81C2B0EF449008F362C /* UIButton+EnlargeTouchArea.m in Sources */,
8C9C82B72B0C695600A601BC /* HttpRequestHelper.m in Sources */,
8C9C841B2B0C697A00A601BC /* YMRoomPresenter.m in Sources */,
8C9C82A72B0C695600A601BC /* YMCurrentVCStackManager.m in Sources */,
@@ -2452,9 +2530,11 @@
8C9C846B2B0C697A00A601BC /* MewSocialMicroView.m in Sources */,
233757572B0CB577001D0B7F /* MessageMenuModel.m in Sources */,
8C9C844B2B0C697A00A601BC /* AttachmentModel.m in Sources */,
8C92A8112B0EEFAE008F362C /* LoginBindPhonePresent.m in Sources */,
8C9C82C62B0C695600A601BC /* UIImage+RW.m in Sources */,
8C9C84562B0C697A00A601BC /* LoginFullInfoViewController.m in Sources */,
8C9C84262B0C697A00A601BC /* YMMessageRemoteExtModel.m in Sources */,
8C92A8142B0EF1D8008F362C /* MineLoginPasswordViewController.m in Sources */,
8C9C82AA2B0C695600A601BC /* UIImageConstant.m in Sources */,
8C9C82BB2B0C695600A601BC /* BaseModel.m in Sources */,
8C9C84942B0D65C300A601BC /* YMRoomAnimationHitView.m in Sources */,
@@ -2615,7 +2695,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -2655,7 +2735,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@@ -25,9 +25,9 @@
[self createTabbarController];
[self initThirdConfig];
[IQKeyboardManager sharedManager].enable = YES;
[[IQKeyboardManager sharedManager] setKeyboardDistanceFromTextField:50];
[IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
// [IQKeyboardManager sharedManager].enable = YES;
// [[IQKeyboardManager sharedManager] setKeyboardDistanceFromTextField:50];
// [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
return YES;
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mew_common_white_right@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mew_common_white_right@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mew_mine_aboutus_logo@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mew_mine_aboutus_logo@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@@ -0,0 +1,42 @@
//
// UIButton+EnlargeTouchArea.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIButton (EnlargeTouchArea)
@property (nonatomic, assign) NSTimeInterval yn_acceptEventInterval; // 重复点击的间隔
//图片frmae
@property (strong, nonatomic) NSValue *imageFrame;
//标题frmae
@property (strong, nonatomic) NSValue *titleFrame;
/**
通过 hitTest:withEvent: 扩大btn的点击范围
注:填写的都是 在button 原frame 上面 扩大的对应的值
@param top 顶部 扩大的值
@param right 右边 扩大的值
@param bottom 底部 扩大的值
@param left 左边 扩大的值
*/
- (void)setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left;
/**
扩大按钮点击范围
@discussion setEnlargeEdgeWithTop:right:bottom:left:方法的包装
*/
- (void)enlargeTouchArea:(UIEdgeInsets)insets;
+(UIButton *)buttonInitWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor image:(UIImage *)image bgImage:(UIImage *)bgImage;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,191 @@
//
// UIButton+EnlargeTouchArea.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "UIButton+EnlargeTouchArea.h"
#import <objc/runtime.h>
#define defaultInterval 0.0003 //,
@interface UIButton ()
/**
* bool YES NO
*/
@property (nonatomic, assign) BOOL isIgnoreEvent;
@end
@implementation UIButton (EnlargeTouchArea)
static const char *UIControl_acceptEventInterval = "UIControl_acceptEventInterval";
static const char *UIControl_enventIsIgnoreEvent = "UIControl_enventIsIgnoreEvent";
// C
static const char *imageFrameStr = "imageFrame";
static const char *titleFrameStr = "titleFrame";
+ (void)load{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Method newImageMethod = class_getInstanceMethod(self, @selector(new_imageRectForContentRect:));
Method oldImageMethod = class_getInstanceMethod(self, @selector(imageRectForContentRect:));
method_exchangeImplementations(newImageMethod, oldImageMethod);
Method newTitleMethod = class_getInstanceMethod(self, @selector(new_titleRectForContentRect:));
Method oldTitleMethod = class_getInstanceMethod(self, @selector(titleRectForContentRect:));
method_exchangeImplementations(newTitleMethod, oldTitleMethod);
//selectorMethod
SEL selA = @selector(sendAction:to:forEvent:);
SEL selB = @selector(new_sendAction:to:forEvent:);
Method methodA = class_getInstanceMethod(self,selA);
Method methodB = class_getInstanceMethod(self, selB);
//
BOOL isAdd = class_addMethod(self, selA, method_getImplementation(methodB), method_getTypeEncoding(methodB));
if (isAdd) {//->
class_replaceMethod(self, selB, method_getImplementation(methodA), method_getTypeEncoding(methodA));
}else{//->
// methodBmethodAmethodBIMP
method_exchangeImplementations(methodA, methodB);
}
});
}
- (void)new_sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event {
self.yn_acceptEventInterval = self.yn_acceptEventInterval == 0 ? defaultInterval : self.yn_acceptEventInterval;
if (self.isIgnoreEvent){//
return;
}
if (self.yn_acceptEventInterval > 0){//eventTimeInterval
[self performSelector:@selector(setNoIgnoreEvent) withObject:nil afterDelay:self.yn_acceptEventInterval];
}
self.isIgnoreEvent = YES;//
[self new_sendAction:action to:target forEvent:event];
}
// runtime
- (BOOL)isIgnoreEvent{
return [objc_getAssociatedObject(self, UIControl_enventIsIgnoreEvent) boolValue];
}
-(void)setNoIgnoreEvent{
self.isIgnoreEvent = NO;
}
- (void)setIsIgnoreEvent:(BOOL)isIgnoreEvent {
objc_setAssociatedObject(self, UIControl_enventIsIgnoreEvent, @(isIgnoreEvent), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
-(void)setYn_acceptEventInterval:(NSTimeInterval)yn_acceptEventInterval{
objc_setAssociatedObject(self, UIControl_acceptEventInterval, @(yn_acceptEventInterval), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
-(NSTimeInterval)yn_acceptEventInterval{
return [objc_getAssociatedObject(self, UIControl_acceptEventInterval) doubleValue];
}
- (void)setImageFrame:(NSValue *)imageFrame{
objc_setAssociatedObject(self, imageFrameStr, imageFrame, OBJC_ASSOCIATION_RETAIN);
}
- (NSValue *)imageFrame{
return objc_getAssociatedObject(self, imageFrameStr);
}
- (void)setTitleFrame:(NSValue *)titleFrame{
objc_setAssociatedObject(self, titleFrameStr, titleFrame, OBJC_ASSOCIATION_RETAIN);
}
- (NSValue *)titleFrame{
return objc_getAssociatedObject(self, titleFrameStr);
}
- (CGRect)new_imageRectForContentRect:(CGRect)contentRect{
if (CGRectEqualToRect(self.imageFrame.CGRectValue, CGRectZero)) {
return [self new_imageRectForContentRect:contentRect];
}
return self.imageFrame.CGRectValue;
}
- (CGRect)new_titleRectForContentRect:(CGRect)contentRect{
if (CGRectEqualToRect(self.titleFrame.CGRectValue, CGRectZero)) {
return [self new_titleRectForContentRect:contentRect];
}
return self.titleFrame.CGRectValue;
}
static char topNameKey;
static char rightNameKey;
static char bottomNameKey;
static char leftNameKey;
- (void)setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left
{
objc_setAssociatedObject(self, &topNameKey, [NSNumber numberWithFloat:top], OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(self, &rightNameKey, [NSNumber numberWithFloat:right], OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(self, &bottomNameKey, [NSNumber numberWithFloat:bottom], OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(self, &leftNameKey, [NSNumber numberWithFloat:left], OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (void)enlargeTouchArea:(UIEdgeInsets)insets
{
[self setEnlargeEdgeWithTop:insets.top
right:insets.right
bottom:insets.bottom
left:insets.left];
}
- (CGRect)enlargedRect
{
NSNumber* topEdge = objc_getAssociatedObject(self, &topNameKey);
NSNumber* rightEdge = objc_getAssociatedObject(self, &rightNameKey);
NSNumber* bottomEdge = objc_getAssociatedObject(self, &bottomNameKey);
NSNumber* leftEdge = objc_getAssociatedObject(self, &leftNameKey);
if (topEdge && rightEdge && bottomEdge && leftEdge)
{
return CGRectMake(self.bounds.origin.x - leftEdge.floatValue,
self.bounds.origin.y - topEdge.floatValue,
self.bounds.size.width + leftEdge.floatValue + rightEdge.floatValue,
self.bounds.size.height + topEdge.floatValue + bottomEdge.floatValue);
}
else
{
return self.bounds;
}
}
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent*)event
{
if(self.hidden) return nil;
CGRect rect = [self enlargedRect];
if (CGRectEqualToRect(rect, self.bounds))
{
return [super hitTest:point withEvent:event];
}
return CGRectContainsPoint(rect, point) ? self : nil;
}
+(UIButton *)buttonInitWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor image:(UIImage *)image bgImage:(UIImage *)bgImage{
UIButton *button = [[UIButton alloc]initWithFrame:CGRectZero];
if(text.length > 0){
[button setTitle:text forState:UIControlStateNormal];
}
if(font != nil){
button.titleLabel.font = font;
}
if(textColor != nil){
[button setTitleColor:textColor forState:UIControlStateNormal];
}
if (image != nil){
[button setImage:image forState:UIControlStateNormal];
}
if(bgImage != nil){
[button setBackgroundImage:bgImage forState:UIControlStateNormal];
}
return button;
}
@end

View File

@@ -0,0 +1,24 @@
//
// MewHtmlUrl.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/23.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface MewHtmlUrl : NSObject
typedef NS_ENUM(NSUInteger, URLType) {
kPrivacyURL,///隐私政策
kCancelAccout, /// 注销账号
kUserProtocalURL ///用户协议
};
NSString * const URLWithType(URLType type);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,23 @@
//
// MewHtmlUrl.m
// yinmeng-ios
//
// Created by on 2023/11/23.
//
#import "MewHtmlUrl.h"
@implementation MewHtmlUrl
NSString * const URLWithType(URLType type) {
NSString * prefix = @"mew";
NSDictionary * dic = @{
@(kPrivacyURL) : @"modules/rule/privacy-wap.html",//
@(kCancelAccout) : @"modules/rule/logout-agreement.html",//
@(kUserProtocalURL) : @"modules/rule/protocol.html",///
};
NSString * url = [dic objectForKey:@(type)];
return [NSString stringWithFormat:@"%@/%@",prefix, url];
}
@end

View File

@@ -24,6 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 上传七牛获取token
/// @param completion 完成
+ (void)qiniuUpLoadImage:(HttpRequestHelperCompletion)completion;
/// 音萌商店包的上传声音秀
+ (void)mewPublishVoiceShow:(HttpRequestHelperCompletion)completion dura:(NSString *)dura desc:(NSString *)desc gender:(NSString *)gender url:(NSString *)url;
@end
NS_ASSUME_NONNULL_END

View File

@@ -27,7 +27,13 @@
+ (void)qiniuUpLoadImage:(HttpRequestHelperCompletion)completion {
NSString *getUrl = [NewEncryptTool MEW_aesDecrypt:@"V5gbqkWkuc4Fvzj9mYj/hBeoD5CULsPTsiK8Z8GieqY="];///qiniu/upload/getUploadToken
[self makeRequest:getUrl method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
}
///
+ (void)mewPublishVoiceShow:(HttpRequestHelperCompletion)completion dura:(NSString *)dura desc:(NSString *)desc gender:(NSString *)gender url:(NSString *)url {
[self makeRequest:@"voiceShow/publish" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, dura, desc, gender, url, nil];
}
@end

View File

@@ -37,6 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @param page 当前的页数
/// @param pageSize 一页多少个
- (void)getUserAttentionList:(int)page pageSize:(int)pageSize state:(int)state;
/// 音萌商店包的上传声音秀
- (void)mewPublishVoiceShowDura:(NSString *)dura desc:(NSString *)desc gender:(NSString *)gender url:(NSString *)url;
@end
NS_ASSUME_NONNULL_END

View File

@@ -68,19 +68,20 @@
/// - state: yes no
- (void)attentionUser:(NSString *)targetUid state:(BOOL)state {
if (state) {
// if (state) {
[self initiateAttentionUser:targetUid state:state];
return;
}
// return;
// }
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.title = @"提示";
config.message = @"确定取消关注该用户吗?";
[TTPopup alertWithConfig:config confirmHandler:^{
[self initiateAttentionUser:targetUid state:state];
} cancelHandler:^{
}];
// self ini
// TTAlertConfig *config = [[TTAlertConfig alloc]init];
// config.title = @"提示";
// config.message = @"确定取消关注该用户吗?";
// [TTPopup alertWithConfig:config confirmHandler:^{
// [self initiateAttentionUser:targetUid state:state];
// } cancelHandler:^{
//
// }];
}
@@ -131,6 +132,17 @@
}
///
- (void)mewPublishVoiceShowDura:(NSString *)dura desc:(NSString *)desc gender:(NSString *)gender url:(NSString *)url {
[Api mewPublishVoiceShow:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] mewPublishVoiceShowSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
}] dura:dura desc:desc gender:gender url: url];
}
#pragma mark - Private Method
- (void)initiateAttentionUser:(NSString *)targetUid state:(BOOL)state {
NSString *uid = [[AccountInfoStorage instance] getUid];

View File

@@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getMewHomeFriendListSuccesss:(NSArray *)array selfMine:(UserInfoModel *)selfMineModel;
///获取用户关注列表
- (void)getUserAttentionListSuccess:(NSArray *)array state:(int)state;
- (void)mewPublishVoiceShowSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -31,6 +31,7 @@
#import "FansInfoModel.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
#import <NIMSDK/NIMSDK.h>
@interface MewHomeViewController ()<MewHeaderViewDelegate, MewShowVoiceViewDelegate,MewUserIntroductionViewDelegate,MewPushExclusiveVoiceViewDelegate, MewHomeProtocol>
@@ -65,6 +66,10 @@
///
@property (nonatomic, copy) NSString *filterString;
///
@property (nonatomic, copy) NSString *voiceString;
@property (nonatomic, assign) NSInteger duration;
///
///
@property (nonatomic,assign) int page;
@@ -138,7 +143,7 @@
// ||
- (void)attentionUserSuccess:(BOOL)status {
NSLog(@"关注 status: %d",status);
[YMHUDTool showSuccessWithMessage: status ? @"关注成功" : @"取消关注成功"];
[self.userIntroductionView updateAttentionState:status];
}
@@ -150,6 +155,17 @@
///
- (void)uploadVoiceFileToThirdSuccess:(NSString *)fileUrl {
if (self.voiceString.length == 0 || self.voiceString == nil || [self.voiceString isEqualToString:@""]) {
self.voiceString = @"这个人很懒还没有签名";
}
[self.presenter mewPublishVoiceShowDura:[NSString stringWithFormat:@"%ld",self.duration] desc:self.voiceString gender:self.selfMineModel.gender == GenderType_Male ? @"1" : @"2" url:fileUrl];
}
/// mew
- (void)mewPublishVoiceShowSuccess {
[YMHUDTool showSuccessWithMessage:@"上传音频成功"];
[MewPushExclusiveVoiceView removeExclusiveViewFromSuperView];
}
@@ -243,6 +259,7 @@
SessionViewController *vc = [[SessionViewController alloc] initWithSession:session];
[self.navigationController pushViewController:vc animated:YES];
} else {
[self.presenter attentionUser:self.targetUid state:optionType == 1];
}
}
@@ -269,9 +286,10 @@
#pragma mark - MewPushExclusiveVoiceViewDelegate
///
///
- (void)mewPushExclusiveVoice:(NSString *)filePath voiceIntroString:(nonnull NSString *)voiceIntroString {
- (void)mewPushExclusiveVoice:(NSString *)filePath voiceIntroString:(nonnull NSString *)voiceIntroString dura:(NSInteger)dura {
[YMHUDTool showLoadingWithMessage:@"正在上传音频中请稍等"];
self.voiceString = voiceIntroString;
self.duration = dura;
[self.presenter uploadVoice:filePath];
}

View File

@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 发布声音
/// - Parameter filePath: 声音的路径
/// - Parameter voiceIntroString: 介绍
- (void)mewPushExclusiveVoice:(NSString *)filePath voiceIntroString:(NSString *)voiceIntroString;
- (void)mewPushExclusiveVoice:(NSString *)filePath voiceIntroString:(NSString *)voiceIntroString dura:(NSInteger)dura;
@end

View File

@@ -221,8 +221,9 @@ static MewPushExclusiveVoiceView *_exclusiveVoiceView = nil;
return;
}
if (self.delegate) {
[self.delegate mewPushExclusiveVoice:self.totalFilePath voiceIntroString:self.textView.text];
[self.delegate mewPushExclusiveVoice:self.totalFilePath voiceIntroString:self.textView.text dura:self.duration];
}
NSLog(@"发布录制声音");

View File

@@ -133,7 +133,7 @@ static MewUserIntroductionView *_userIntroductionView = nil;
///
- (void)followFriendActionEvent:(UIButton *)sender {
sender.selected = !sender.selected;
if (_userIntroductionView.currentUserInfo == nil) {
NSLog(@"获取用户的信息失败,请重新获取");
return;

View File

@@ -177,7 +177,7 @@
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"common_back_white_left"] forState:UIControlStateNormal];
[_backButton setImage:[UIImage imageNamed:@"mew_common_back_white_left"] forState:UIControlStateNormal];
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;

View File

@@ -8,6 +8,7 @@
#import "MewLoginViewController.h"
#import "MewLoginNumberViewController.h"
#import "YMIButton.h"
#import "YMWebViewController.h"
//apple
#import <AuthenticationServices/ASAuthorizationAppleIDButton.h>
#import <AuthenticationServices/AuthenticationServices.h>
@@ -25,6 +26,7 @@
#import "Base.h"
#import "AccountInfoStorage.h"
#import "Api+Login.h"
#import "MewHtmlUrl.h"
///Present
#import "LoginPresenter.h"
#import "LoginProtocol.h"
@@ -484,13 +486,13 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
attString.yy_color = UIColorRGBAlpha(0xFFFFFF, 0.8);
NSString *userString = @"《用户服务协议》";
NSMutableAttributedString *userAttString = [[NSMutableAttributedString alloc] initWithString:userString attributes:@{NSForegroundColorAttributeName:UIColor.whiteColor}];
// @weakify(self)
__weak typeof(self) weakSelf = self;
[userAttString yy_setTextHighlightRange:NSMakeRange(0, userAttString.length) color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
// @strongify(self);
// //
// XPWebViewController * webVC = [[XPWebViewController alloc] init];
// webVC.url = URLWithType(kUserProtocalURL);
// [self.navigationController pushViewController:webVC animated:YES];
__strong typeof(self) strongSelf = weakSelf;
//
YMWebViewController * webVC = [[YMWebViewController alloc] init];
webVC.url = URLWithType(kUserProtocalURL);
[strongSelf.navigationController pushViewController:webVC animated:YES];
} longPressAction:nil];
NSMutableAttributedString *andString = [[NSMutableAttributedString alloc] initWithString:@"和"];
@@ -499,10 +501,11 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
NSMutableAttributedString *privateString = [[NSMutableAttributedString alloc] initWithString:protocolString attributes:@{NSForegroundColorAttributeName:UIColor.whiteColor}];
[privateString yy_setTextHighlightRange:NSMakeRange(0, privateString.length) color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
// @strongify(self);
__strong typeof(self) strongSelf = weakSelf;
//
// XPWebViewController * webVC = [[XPWebViewController alloc] init];
// webVC.url = URLWithType(kPrivacyURL);
// [self.navigationController pushViewController:webVC animated:YES];
YMWebViewController * webVC = [[YMWebViewController alloc] init];
webVC.url = URLWithType(kPrivacyURL);
[self.navigationController pushViewController:webVC animated:YES];
} longPressAction:nil];
[attString appendAttributedString:userAttString];
[attString appendAttributedString:andString];

View File

@@ -192,12 +192,12 @@
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NIMRecentSession *recentSession = self.recentSessions[indexPath.row];
SessionViewController *vc = [[SessionViewController alloc] initWithSession:recentSession.session];
[self.navigationController pushViewController:vc animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NIMRecentSession *recentSession = self.recentSessions[indexPath.row];
SessionViewController *vc = [[SessionViewController alloc] initWithSession:recentSession.session];
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - Action Event

View File

@@ -155,10 +155,10 @@ NSString * const kNetworkReachabilityKey = @"kNetworkReachabilityKey";
[self pushBindPhoneController];
}
// if (userInfo.nick == nil || userInfo.avatar == nil) {
// [self completeUserInfo];
// return;
// }
if (userInfo.nick == nil || userInfo.avatar == nil) {
[self completeUserInfo];
return;
}
[self initTabs:YES];
// [self setUserInfoToQYWithUserInfo:userInfo];

View File

@@ -6,11 +6,13 @@
//
#import "BaseViewController.h"
#import <WebKit/WebKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface YMWebViewController : BaseViewController
@property (strong, nonatomic,readonly) WKWebView *webview;
@property (copy, nonatomic) NSString *url;
@end

View File

@@ -6,13 +6,57 @@
//
#import "YMWebViewController.h"
/// Tool
#import "ApiHost.h"
#import "YYUtility.h"
#import "AccountInfoStorage.h"
#import "ThemeColor.h"
/// Third
#import <Masonry/Masonry.h>
@interface YMWebViewController ()
//<WKNavigationDelegate, WKScriptMessageHandler>
//@property (strong, nonatomic) WKWebView *webview;
//@property (strong, nonatomic) UIProgressView *progressView;
//@property (nonatomic, strong) WKUserContentController *userContentController;
#ifdef DEBUG
static const NSString *CompanyFirstDomainByWeChatRegister = @"api.uat.lecheng163.com";
#else
static const NSString *CompanyFirstDomainByWeChatRegister = @"api.lecheng163.com";
#endif
@interface WeakWebViewScriptMessageDelegate : NSObject<WKScriptMessageHandler>
//WKScriptMessageHandler JavaScriptOC
@property (nonatomic, weak) id<WKScriptMessageHandler> scriptDelegate;
- (instancetype)initWithDelegate:(id<WKScriptMessageHandler>)scriptDelegate;
@end
@implementation WeakWebViewScriptMessageDelegate
- (instancetype)initWithDelegate:(id<WKScriptMessageHandler>)scriptDelegate {
self = [super init];
if (self) {
_scriptDelegate = scriptDelegate;
}
return self;
}
//WKScriptMessageHandler
//JSname
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
if ([self.scriptDelegate respondsToSelector:@selector(userContentController:didReceiveScriptMessage:)]) {
[self.scriptDelegate userContentController:userContentController didReceiveScriptMessage:message];
}
}
@end
NSString * const kJSGetUid = @"getUid";
@interface YMWebViewController ()<WKNavigationDelegate, WKScriptMessageHandler>
@property (strong, nonatomic) WKWebView *webview;
@property (strong, nonatomic) UIProgressView *progressView;
@property (nonatomic, strong) WKUserContentController *userContentController;
@end
@@ -21,16 +65,236 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self initView];
}
/*
#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)backButtonClick {
BOOL canGoBack = YES;
if (self.webview.backForwardList.backList.count <= 1) {
canGoBack = NO;
}
if ([self.webview canGoBack]) {
[self.webview goBack];
} else {
[self.navigationController popViewControllerAnimated:YES];
// [self.userContentController removeAllUserScripts];
}
}
*/
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
[self.webview evaluateJavaScript:@"document.location.href" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
NSString *currentUrl = [NSString stringWithFormat:@"%@", response];
if (currentUrl != nil) {
if ([message.name isEqualToString:kJSGetUid]) {
NSString *uid = [[AccountInfoStorage instance] getUid];
NSString *js = [NSString stringWithFormat:@"getMessage(\"uid\",%@)", uid];
[self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) {
NSLog(@"%@",error);
}];
}
}
}];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
if ([keyPath isEqualToString:@"estimatedProgress"]) {
self.progressView.progress = self.webview.estimatedProgress;
if (self.progressView.progress == 1) {
__weak typeof (self)weakSelf = self;
[UIView animateWithDuration:0.25f delay:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
weakSelf.progressView.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
} completion:^(BOOL finished) {
weakSelf.progressView.hidden = YES;
}];
}
} else if ([keyPath isEqualToString:@"title"]) {
if (object == self.webview) {
self.navigationItem.title = self.webview.title;
// if (self.urlLoadCompleted) {//webview
// self.urlLoadCompleted(YES, nil);
// }
}else{
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
- (void)dealloc {
[self.webview removeObserver:self forKeyPath:@"estimatedProgress"];
[self.webview removeObserver:self forKeyPath:@"title"];
}
#pragma mark - InitView
- (void)initView {
if (@available(iOS 11.0, *)) {
self.webview.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}else{
self.automaticallyAdjustsScrollViewInsets = NO;
}
[self.view addSubview:self.webview];
[self.webview mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom.mas_equalTo(self.view);
}];
[self.view addSubview:self.progressView];
}
#pragma mark - Set
- (void)setUrl:(NSString *)urlString{
_url = urlString;
if (_url == nil) {
return;
}
if (![_url hasPrefix:@"http"] && ![_url hasPrefix:@"https"]){
_url = [NSString stringWithFormat:@"%@/%@", API_HOST_H5_URL, _url];
}
if (![_url containsString:@"alipayh5"]) {
if (![_url containsString:@"?"]) {
_url = [NSString stringWithFormat:@"%@?platform=%@", _url, [YYUtility appName]];
} else {
_url = [NSString stringWithFormat:@"%@&platform=%@", _url, [YYUtility appName]];
}
}
// urlString
NSString *noSpaceTextUrl = [_url stringByReplacingOccurrencesOfString:@" " withString:@""];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:noSpaceTextUrl]];
if ([_url containsString:@"wx.tenpay"]) {
[request setValue:[NSString stringWithFormat:@"xdx.%@://", CompanyFirstDomainByWeChatRegister] forHTTPHeaderField:@"Referer"];
}
[self.webview loadRequest:request];
}
#pragma mark - Get
- (UIProgressView *)progressView{
if (!_progressView) {
_progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 1)];
_progressView.progressTintColor = UIColor.blackColor;
_progressView.trackTintColor = [UIColor clearColor];
_progressView.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
}
return _progressView;
}
- (WKWebView *)webview {
if (_webview == nil) {
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc]init];
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];
WKUserScript *cookieScript = [[WKUserScript alloc] initWithSource: [NSString stringWithFormat:@"document.cookie = '%@';", realCookie] injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO];
[self.userContentController addUserScript:cookieScript];
///
NSString *scaleJs = @"$('meta[name=description]').remove(); $('head').append( '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1,user-scalable=no\">' );";
WKUserScript *scaleScript = [[WKUserScript alloc] initWithSource:scaleJs injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO];
[self.userContentController addUserScript:scaleScript];
//WKUserScriptWKWebViewConfiguration
configuration.preferences.javaScriptEnabled = YES;
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
configuration.preferences.minimumFontSize = 10;
configuration.selectionGranularity = WKSelectionGranularityCharacter;
configuration.userContentController = self.userContentController;
CGSize size = [UIScreen mainScreen].bounds.size;
_webview = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, size.width,size.height) configuration:configuration];
_webview.navigationDelegate = self;
//KVOWKWebViewestimatedProgress
[_webview addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
//KVOtitle
[_webview addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL];
UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(backButtonClick)];
[_webview addGestureRecognizer:swipeGesture];
[_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;
if (![userAgent containsString:@"tutuAppIos erbanAppIos"]){
NSString *newUserAgent = [userAgent stringByAppendingString:@" tutuAppIos 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;
}
- (WKUserContentController *)userContentController{
if (!_userContentController) {
//WKScriptMessageHandler
WeakWebViewScriptMessageDelegate *weakScriptMessageDelegate = [[WeakWebViewScriptMessageDelegate alloc] initWithDelegate:self];
_userContentController = [[WKUserContentController alloc] init];
// uid
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetUid];
//
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenSharePage];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenPurse];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenChargePage];
// // uid
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetUid];
// // id
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetDeviceId];
// // Ticket
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetTicket];
// // info
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetDeviceInfo];
// // :
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenFaceLiveness];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSInitNav];
// // uid
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetRoomUid];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kOpenPersonPage];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kInitShowNav];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kCloseWebView];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJumpAppointPage];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenRoom];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenRoomForGiftId];
// ///
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kProhibitRightSlip];
/////
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kSaveBase64Image];
// //
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kOpenDialogWebview];
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kCheckResultFinish];
// [_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kOpenNativeTarotPay];
}
return _userContentController;
}
@end

View File

@@ -0,0 +1,16 @@
//
// LoginBindPhonePresent.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface LoginBindPhonePresent : BaseMvpPresenter
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,15 @@
//
// LoginBindPhonePresent.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "LoginBindPhonePresent.h"
@implementation LoginBindPhonePresent
- (id<BaseMvpProtocol>)getView {
return ((id<BaseMvpProtocol>) [super getView]);
}
@end

View File

@@ -0,0 +1,31 @@
//
// LoginVerifBindPhonePresenter.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import "MainPresenter.h"
#import "YMEnum.h"
NS_ASSUME_NONNULL_BEGIN
@interface LoginVerifBindPhonePresenter : MainPresenter
/// 获取手机的验证码
/// @param phone 手机号
/// @param type 类型
- (void)phoneSmsCode:(NSString *)phone type:(GetSmsType)type;
/// 校验手机验证码接口
/// @param moblieNum 手机号码
/// @param code 验证码
- (void)checkMoblieCodeWithMoblie:(NSString *)moblieNum code:(NSString *)code;
/// 绑定手机验证码接口
/// @param moblieNum 手机号码
/// @param code 验证码
- (void)bindkMoblieCodeWithMoblie:(NSString *)moblieNum code:(NSString *)code;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,53 @@
//
// LoginVerifBindPhonePresenter.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "LoginVerifBindPhonePresenter.h"
#import "Api+Login.h"
///Tool
#import "AccountInfoStorage.h"
#import "DESEncrypt.h"
#import "YMConstant.h"
///P
#import "LoginVerifBindPhoneProtocol.h"
@implementation LoginVerifBindPhonePresenter
///
/// @param phone
/// @param type
- (void)phoneSmsCode:(NSString *)phone type:(GetSmsType)type {
NSString * typeStr = [NSString stringWithFormat:@"%lu", (unsigned long)type];
NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)];
[Api phoneSmsCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] phoneSmsCodeSuccess];
}] mobile:desPhone type:typeStr];
}
///
/// @param moblieNum
/// @param code
- (void)checkMoblieCodeWithMoblie:(NSString *)moblieNum code:(NSString *)code {
NSString * uid = [[AccountInfoStorage instance] getUid];
NSString * ticket = [[AccountInfoStorage instance] getTicket];
NSString * desPhone = [DESEncrypt encryptUseDES:moblieNum key:KeyWithType(KeyType_PasswordEncode)];
// [Api checkMoblieCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
// [[self getView] checkMoblieCodeWithMoblieSuccess];
// }] mobile:desPhone code:code uid:uid ticket:ticket];
}
///
/// @param moblieNum
/// @param code
- (void)bindkMoblieCodeWithMoblie:(NSString *)moblieNum code:(NSString *)code {
NSString * ticket = [[AccountInfoStorage instance] getTicket];
NSString * desPhone = [DESEncrypt encryptUseDES:moblieNum key:KeyWithType(KeyType_PasswordEncode)];
[Api bindMoblieCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] bindMoblieCodeWithMoblieSuccess];
}] phone:desPhone code:code ticket:ticket];
}
@end

View File

@@ -0,0 +1,25 @@
//
// MineLoginPasswordPresenter.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface MineLoginPasswordPresenter : BaseMvpPresenter
/// 设置登录密码
/// @param phone 手机号
/// @param newPwd 密码
- (void)setLoginPassword:(NSString *)phone newPwd:(NSString *)newPwd;
/// 修改登录密码
/// @param phone 手机号
/// @param newPwd 新密码
/// @param pwd 旧密码
- (void)modifyLoginPassword:(NSString *)phone newPwd:(NSString *)newPwd pwd:(NSString *)pwd;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,43 @@
//
// MineLoginPasswordPresenter.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "MineLoginPasswordPresenter.h"
#import "Api+Mine.h"
#import "DESEncrypt.h"
#import "YMConstant.h"
#import "MineLoginPasswordProtocol.h"
@implementation MineLoginPasswordPresenter
///
/// @param phone
/// @param newPwd
- (void)setLoginPassword:(NSString *)phone newPwd:(NSString *)newPwd {
NSString * desNewPwd = [DESEncrypt encryptUseDES:newPwd key:KeyWithType(KeyType_PasswordEncode)];
NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)];
[Api setLoingPassword:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] setLoginPasswordSuccess];
} showLoading:YES] phone:desPhone newPwd:desNewPwd];
}
///
/// @param phone
/// @param newPwd
/// @param pwd
- (void)modifyLoginPassword:(NSString *)phone newPwd:(NSString *)newPwd pwd:(NSString *)pwd{
NSString * desNewPwd = [DESEncrypt encryptUseDES:newPwd key:KeyWithType(KeyType_PasswordEncode)];
NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)];
NSString * desPwd = [DESEncrypt encryptUseDES:pwd key:KeyWithType(KeyType_PasswordEncode)];
[Api modifyLoingPassword:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] modifyLoginPasswordSuccess];
}] phone:desPhone newPwd:desNewPwd pwd:desPwd];
}
@end

View File

@@ -0,0 +1,21 @@
//
// LoginVerifBindPhoneProtocol.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol LoginVerifBindPhoneProtocol <NSObject>
///请求手机号的验证码成功
- (void)phoneSmsCodeSuccess;
///绑定手机号成功
- (void)bindMoblieCodeWithMoblieSuccess;
///验证绑定手机成功
- (void)checkMoblieCodeWithMoblieSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// MineLoginPasswordProtocol.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol MineLoginPasswordProtocol <NSObject>
- (void)modifyLoginPasswordSuccess;
- (void)setLoginPasswordSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// LoginBindPhoneResultViewController.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import "BaseViewController.h"
@class UserInfoModel;
NS_ASSUME_NONNULL_BEGIN
@interface LoginBindPhoneResultViewController : BaseViewController
@property (nonatomic, strong) UserInfoModel *userInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,143 @@
//
// LoginBindPhoneResultViewController.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "LoginBindPhoneResultViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
///Tool
#import "ThemeColor.h"
#import "UIImage+Utils.h"
///Model
#import "UserInfoModel.h"
@interface LoginBindPhoneResultViewController ()
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *phoneLabel;
@property (nonatomic, strong) UIButton *changePhoneBtn;
@end
@implementation LoginBindPhoneResultViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initViews];
[self setUpConstraints];
[self setConfigs];
}
#pragma mark - Private Method
- (void)initViews {
[self.view addSubview:self.containerView];
[self.containerView addSubview:self.iconImageView];
[self.containerView addSubview:self.titleLabel];
[self.containerView addSubview:self.phoneLabel];
[self.containerView addSubview:self.changePhoneBtn];
}
- (void)setConfigs {
self.title = @"绑定手机";
self.phoneLabel.text = self.userInfo.phone;
}
- (void)setUpConstraints {
[self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(49);
make.left.right.bottom.mas_equalTo(0);
}];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(50);
make.centerX.mas_equalTo(0);
make.size.mas_equalTo(CGSizeMake(135, 130));
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(0);
make.top.mas_equalTo(self.iconImageView.mas_bottom).offset(39);
}];
[self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(0);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(11);
}];
[self.changePhoneBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.phoneLabel.mas_bottom).offset(41);
make.left.right.mas_equalTo(0).inset(32);
make.centerX.mas_equalTo(0);
make.height.mas_equalTo(45);
}];
}
#pragma mark - Event Response
- (void)changePhoneBtnAction:(UIButton *)sender {
// XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init];
// vc.userInfo = self.userInfo;
// vc.bindingPhoneNumType = XPBindingPhoneNumTypeConfirm;
// [self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - Getters And Setters
- (UIView *)containerView{
if (!_containerView) {
_containerView = [[UIView alloc] init];
_containerView.backgroundColor = [ThemeColor appBackgroundColor];
}
return _containerView;
}
- (UIImageView *)iconImageView{
if (!_iconImageView) {
_iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"login_bind_phone_bg"]];
}
return _iconImageView;
}
- (UILabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"您当前绑定的手机号为";
_titleLabel.textColor = [ThemeColor secondTextColor];
_titleLabel.font = [UIFont systemFontOfSize:14.f];
_titleLabel.adjustsFontSizeToFitWidth = YES;
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
return _titleLabel;
}
- (UILabel *)phoneLabel{
if (!_phoneLabel) {
_phoneLabel = [[UILabel alloc] init];
_phoneLabel.textColor = [ThemeColor mainTextColor];
_phoneLabel.font = [UIFont boldSystemFontOfSize:18.f];
_phoneLabel.adjustsFontSizeToFitWidth = YES;
_phoneLabel.textAlignment = NSTextAlignmentCenter;
}
return _phoneLabel;
}
- (UIButton *)changePhoneBtn {
if (!_changePhoneBtn) {
_changePhoneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_changePhoneBtn setTitle:@"更改手机号码" forState:UIControlStateNormal];
[_changePhoneBtn setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_changePhoneBtn.titleLabel setFont:[UIFont fontWithName:@"PingFang-SC-Medium" size:18]];
[_changePhoneBtn setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
_changePhoneBtn.layer.masksToBounds = YES;
_changePhoneBtn.layer.cornerRadius = 22.5;
[_changePhoneBtn addTarget:self action:@selector(changePhoneBtnAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _changePhoneBtn;
}
@end

View File

@@ -0,0 +1,16 @@
//
// LoginBindPhoneViewController.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface LoginBindPhoneViewController : MvpViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,222 @@
//
// LoginBindPhoneViewController.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "LoginBindPhoneViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
///Tool
#import "YMMacro.h"
#import "ThemeColor.h"
//#import "NSString+Utils.h"
///Tool
#import "LoginBindPhonePresent.h"
///VC
//#import "LoginVerifCodeViewController.h"
@interface LoginBindPhoneViewController ()
///Label
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic, strong) UIView *bgView;
///86 Label
@property (nonatomic, strong) UILabel *countryLabel;
///
@property (nonatomic, strong) UITextField *phoneTextField;
///
@property (nonatomic, strong) UIButton *loginBtn;
/// 退
@property (nonatomic,strong) UIButton *backButton;
@end
@implementation LoginBindPhoneViewController
- (BOOL)isHiddenNavBar {
return YES;
}
#pragma mark - life cycle
- (LoginBindPhonePresent *)createPresenter {
return [[LoginBindPhonePresent alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpUI];
[self setEvents];
}
- (void)viewDidAppear:(BOOL)animated {
[self showErrorToast:@"第三方登录需绑定手机号喔~"];
}
- (void)setUpUI {
[self.view addSubview:self.titleLabel];
[self.view addSubview:self.bgView];//
[self.bgView addSubview:self.countryLabel];
[self.bgView addSubview:self.phoneTextField];
[self.view addSubview:self.loginBtn]; //
[self.view addSubview:self.backButton];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.view).offset(150);
}];
//
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(50);
make.width.mas_equalTo(280);
make.height.mas_equalTo(45);
}];
[self.countryLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.top.mas_equalTo(self.bgView).offset(5);
make.width.mas_equalTo(60);
make.height.mas_equalTo(35);
}];
[self.phoneTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(70);
make.top.mas_equalTo(self.bgView).offset(5);
make.width.mas_equalTo(200);
make.height.mas_equalTo(35);
}];
//
[self.loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.bgView.mas_bottom).offset(50);
make.width.mas_equalTo(60);
make.height.mas_equalTo(60);
}];
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
make.left.mas_equalTo(self.view).offset(14);
make.top.mas_equalTo(self.view).offset(36 + kSafeAreaTopHeight);
}];
}
- (void)setEvents {
@weakify(self)
//
[[RACSignal combineLatest:@[self.phoneTextField.rac_textSignal]
reduce:^id(NSString *phone){
BOOL enable = phone.length == 11;
return @(enable);
}] subscribeNext:^(NSNumber *enable) {
@strongify(self)
self.loginBtn.enabled = [enable boolValue];
}];
// [[[[self.loginBtn rac_signalForControlEvents:UIControlEventTouchUpInside] doNext:^(id x) {
// @strongify(self)
// self.loginBtn.enabled = NO;
// }] flattenMap:^id (id value) {
// return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
// if (!self.phoneTextField.text.isPhoneNumber) {
// [self showErrorToast:@"手机格式不正确"];
// [subscriber sendNext:@(NO)];
// }else {
// [subscriber sendNext:@(YES)];
// }
// [subscriber sendCompleted];
// return nil;
// }];
// }] subscribeNext:^(NSNumber *signedIn) {
// @strongify(self)
// self.loginBtn.enabled = YES;
// BOOL success = [signedIn boolValue];
// if (success) {
// //
// LoginVerifCodeViewController *codeVC = [[LoginVerifCodeViewController alloc] init];
// codeVC.phone = self.phoneTextField.text;
// codeVC.type = VerifCodeType_BindPhone;
// [self.navigationController pushViewController:codeVC animated:YES];
// }
// }];
}
#pragma mark - Event Response
- (void)backButtonAction:(UIButton *)sender {
///退
[self dismissViewControllerAnimated:NO completion:^{
[self.presenter logout];
}];
}
#pragma mark - Getters And Setters
- (UILabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
_titleLabel.text = @"绑定手机号";
_titleLabel.textColor = [ThemeColor mainTextColor];
}
return _titleLabel;
}
- (UIView *)bgView {
if (!_bgView) {
_bgView = [[UIView alloc] init];
_bgView.backgroundColor = [ThemeColor appCellBackgroundColor];
_bgView.layer.cornerRadius = 45/2;
_bgView.layer.masksToBounds = YES;
}
return _bgView;
}
- (UILabel *)countryLabel{
if (!_countryLabel) {
_countryLabel = [[UILabel alloc] init];
_countryLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
_countryLabel.text = @"+86";
_countryLabel.textColor = [ThemeColor mainTextColor];
_countryLabel.backgroundColor = [UIColor clearColor];
_countryLabel.textAlignment = NSTextAlignmentCenter;
}
return _countryLabel;
}
- (UITextField *)phoneTextField {
if (!_phoneTextField) {
_phoneTextField = [[UITextField alloc] init];
_phoneTextField.keyboardType = UIKeyboardTypeNumberPad;
_phoneTextField.backgroundColor = [UIColor clearColor];
_phoneTextField.textColor = [ThemeColor mainTextColor];
// _phoneTextField.tintColor = [ThemeColor appMainColor];
_phoneTextField.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
_phoneTextField.textAlignment = NSTextAlignmentLeft;
}
return _phoneTextField;
}
- (UIButton *)loginBtn {
if (!_loginBtn) {
_loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_loginBtn.enabled = NO;
[_loginBtn setImage:[UIImage imageNamed:@"login_button"] forState:UIControlStateDisabled];
[_loginBtn setImage:[UIImage imageNamed:@"login_button_sel"] forState:UIControlStateNormal];
}
return _loginBtn;
}
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateNormal];
[_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateSelected];
// [_backButton setEnlargeEdgeWithTop:15 right:15 bottom:15 left:15];
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;
}
@end

View File

@@ -202,7 +202,7 @@
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"common_back_white_left"] forState:UIControlStateNormal];
[_backButton setImage:[UIImage imageNamed:@"mew_common_back_white_left"] forState:UIControlStateNormal];
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;

View File

@@ -0,0 +1,29 @@
//
// LoginVerifBindPhoneViewController.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import "MvpViewController.h"
@class UserInfoModel;
/**
手机号绑定的类型
- TTBindingPhoneNumTypeNormal: 普通状态,首次绑定
- TTBindingPhoneNumTypeConfirm : 验证状态:验证已绑定的手机
*/
typedef NS_ENUM(NSUInteger, TTBindingPhoneNumType) {
XPBindingPhoneNumTypeNormal = 0,
XPBindingPhoneNumTypeEdit = 1,
XPBindingPhoneNumTypeConfirm = 2,
};
NS_ASSUME_NONNULL_BEGIN
@interface LoginVerifBindPhoneViewController : MvpViewController
@property (nonatomic, assign) TTBindingPhoneNumType bindingPhoneNumType;
///用户信息
@property (nonatomic, strong) UserInfoModel *userInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,429 @@
//
// LoginVerifBindPhoneViewController.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "LoginVerifBindPhoneViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
///Tool
#import "ThemeColor.h"
#import "YMConstant.h"
#import "YMMacro.h"
#import "UIImage+Utils.h"
#import "YMHUDTool.h"
#import "CountDownHelper.h"
///Model
#import "UserInfoModel.h"
///P
#import "LoginVerifBindPhoneProtocol.h"
#import "LoginVerifBindPhonePresenter.h"
///VC
#import "LoginBindPhoneViewController.h"
//#import "MineSettingViewController.h"
@interface LoginVerifBindPhoneViewController ()<LoginVerifBindPhoneProtocol, CountDownHelperDelegate>
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) UIImageView *bgImageView;
///
@property (nonatomic, strong) UIButton *backButton;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIView *phoneBgView;
@property (nonatomic, strong) UILabel *areaCodeLabel;
@property (nonatomic, strong) UITextField *phoneNumTextField;
@property (nonatomic, strong) UIButton *authCodeBtn;
@property (nonatomic, strong) UIView *authCodeBgView;
@property (nonatomic, strong) UITextField *authCodeTextField;
@property (nonatomic, strong) UIButton *confirmBtn; //
//@property (nonatomic, strong) UILabel *tipsLabel; //
//@property (nonatomic, assign) BOOL isResetPhone; //
@end
@implementation LoginVerifBindPhoneViewController
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)dealloc {
[[CountDownHelper shareHelper] stopCountDown];
}
- (LoginVerifBindPhonePresenter *)createPresenter {
return [[LoginVerifBindPhonePresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
[self setConfigs];
[self setEvents];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[[CountDownHelper shareHelper] stopCountDown];
}
#pragma mark - Private Method
- (void)initSubViews {
[CountDownHelper shareHelper].delegate = self;
[self.view addSubview:self.containerView];
[self.containerView addSubview:self.bgImageView];
[self.containerView addSubview:self.backButton];
[self.containerView addSubview:self.titleLabel];
[self.containerView addSubview:self.phoneBgView];
[self.phoneBgView addSubview:self.areaCodeLabel];
[self.phoneBgView addSubview:self.phoneNumTextField];
[self.phoneBgView addSubview:self.authCodeBtn];
[self.containerView addSubview:self.authCodeBgView];
[self.authCodeBgView addSubview:self.authCodeTextField];
// [self.containerView addSubview:self.authLineView];
[self.containerView addSubview:self.confirmBtn];
// [self.containerView addSubview:self.tipsLabel];
}
- (void)initSubViewConstraints {
[self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.containerView);
}];
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view).mas_offset(10);
make.top.mas_equalTo(statusbarHeight);
make.height.width.mas_equalTo(44);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.backButton);
make.centerX.equalTo(self.view);
}];
// [self.areaLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(32);
// make.top.mas_equalTo(20);
// }];
//
// [self.countryBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.right.mas_equalTo(-32);
// make.centerY.mas_equalTo(self.areaLabel);
// }];
//
// [self.areaLineView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(20);
// make.left.right.mas_equalTo(0).inset(32);
// make.height.mas_equalTo(1);
// }];
[self.phoneBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(60);
make.left.mas_equalTo(32);
make.height.mas_equalTo(52);
make.width.mas_equalTo(KScreenWidth - 2 * 36);
}];
[self.areaCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.phoneBgView);
// make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(60);
make.left.mas_equalTo(self.phoneBgView).offset(10);
}];
[self.authCodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.phoneBgView).offset(-10);
make.centerY.mas_equalTo(self.areaCodeLabel);
}];
[self.phoneNumTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.areaCodeLabel.mas_right).offset(10);
make.centerY.mas_equalTo(self.areaCodeLabel);
make.right.mas_equalTo(self.authCodeBtn.mas_left).offset(-20);
}];
// [self.phoneLineView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.height.mas_equalTo(self.areaLineView);
// make.top.mas_equalTo(self.areaCodeLabel.mas_bottom).offset(18);
// }];
[self.authCodeBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.phoneBgView.mas_bottom).offset(20);
make.left.height.width.mas_equalTo(self.phoneBgView);
}];
[self.authCodeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.authCodeBgView);
make.right.mas_equalTo(self.authCodeBgView).offset(-10);
make.left.mas_equalTo(self.authCodeBgView).offset(10);
make.height.mas_equalTo(48);
}];
[self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.authCodeBgView);
make.top.mas_equalTo(self.authCodeBgView.mas_bottom).offset(20);
make.height.mas_equalTo(52);
}];
}
#pragma mark -
- (void)setConfigs {
switch (self.bindingPhoneNumType) {
case XPBindingPhoneNumTypeEdit:{
self.navigationItem.title = @"更改绑定手机";
}
break;
case XPBindingPhoneNumTypeNormal:{
self.navigationItem.title = @"绑定手机号";
}
break;
case XPBindingPhoneNumTypeConfirm:{
// self.tipsLabel.hidden = NO;
self.navigationItem.title = @"验证已绑定的手机号码";
[self.confirmBtn setTitle:@"验证" forState:UIControlStateNormal];
if (self.userInfo.isBindPhone) {
self.phoneNumTextField.enabled = NO;
self.phoneNumTextField.text = self.userInfo.phone;
}
}
break;
default:
break;
}
RAC(self.confirmBtn,enabled) = [RACSignal combineLatest:@[self.phoneNumTextField.rac_textSignal,self.authCodeTextField.rac_textSignal] reduce:^(NSString *phone,NSString *code){
return @(phone.length == 11 && code.length == 5);
}];
}
#pragma mark
- (void)setEvents {
@weakify(self)
//
[[[self.authCodeBtn rac_signalForControlEvents:UIControlEventTouchUpInside] filter:^BOOL(__kindof UIControl * _Nullable value) {
//
if (self.phoneNumTextField.text.length == 0) {
[self showErrorToast:@"手机号码不能为空"];
return NO;
}else if (self.phoneNumTextField.text.length < 11) {
[self showErrorToast:@"请输入正确手机号码"];
return NO;
}else {
return YES;
}
}] subscribeNext:^(id _Nullable x) {
@strongify(self);
[self.presenter phoneSmsCode:self.phoneNumTextField.text type:self.bindingPhoneNumType == XPBindingPhoneNumTypeConfirm ? GetSmsType_Unbind_Phone : GetSmsType_Bind_Phone];
}];
//
[[[self.confirmBtn rac_signalForControlEvents:UIControlEventTouchUpInside] filter:^BOOL(__kindof UIControl * _Nullable value) {
@strongify(self)
//
if (self.phoneNumTextField.text.length == 0) {
[self showErrorToast:@"手机号码不能为空"];
return NO;
}else if (self.authCodeTextField.text.length == 0) {
[self showErrorToast:@"验证码不能为空"];
return NO;
}else {
return YES;
}
}] subscribeNext:^(id _Nullable x) {
@strongify(self)
if (self.bindingPhoneNumType == XPBindingPhoneNumTypeConfirm) {
[self.presenter checkMoblieCodeWithMoblie:self.phoneNumTextField.text code:self.authCodeTextField.text];
} else {
[self.presenter bindkMoblieCodeWithMoblie:self.phoneNumTextField.text code:self.authCodeTextField.text];
}
} error:^(NSError * _Nullable error) {
}];
}
//
- (void)backButtonAction {
[self.navigationController popViewControllerAnimated:NO];
}
#pragma mark - LoginVerifBindPhoneProtocol
- (void)phoneSmsCodeSuccess {
self.authCodeBtn.enabled = NO;
[self showSuccessToast:@"验证码发送成功"];
[[CountDownHelper shareHelper] openCountdownWithTime:60];
}
- (void)checkMoblieCodeWithMoblieSuccess {
[self showSuccessToast:@"验证成功"];
[[CountDownHelper shareHelper] stopCountDown];
// LoginVerifBindPhoneViewController *vc = [[LoginVerifBindPhoneViewController alloc] init];
// vc.bindingPhoneNumType = XPBindingPhoneNumTypeEdit;
// vc.userInfo = self.userInfo;
// [self.navigationController pushViewController:vc animated:YES];
}
- (void)bindMoblieCodeWithMoblieSuccess {
[[CountDownHelper shareHelper] stopCountDown];
//
if (self.bindingPhoneNumType == XPBindingPhoneNumTypeEdit) {
} else if (self.bindingPhoneNumType == XPBindingPhoneNumTypeNormal) {
// @weakify(self);
[YMHUDTool showSuccessWithMessage:@"绑定成功"];
[self.navigationController popViewControllerAnimated:YES];
}
self.confirmBtn.enabled = YES; //
}
#pragma mark - CountDownHelperDelegate
///
- (void)onCountdownOpen:(int)time {
[self.authCodeBtn setTitle:[NSString stringWithFormat:@"%ds后重试", time] forState:UIControlStateDisabled];
}
///
- (void)onCountdownFinish {
self.authCodeBtn.enabled= YES;
[self.authCodeBtn setTitle:@"重新发送" forState:UIControlStateNormal];
}
#pragma mark - Getters And Setters
- (UIView *)containerView{
if (!_containerView) {
_containerView = [[UIView alloc] init];
_containerView.backgroundColor = [ThemeColor appBackgroundColor];
}
return _containerView;
}
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mew_home_bg"]];
}
return _bgImageView;
}
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"mew_common_back_white_left"] forState:UIControlStateNormal];
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"绑定手机号";
_titleLabel.font = kFontMedium(18);
_titleLabel.textColor = UIColor.whiteColor;
}
return _titleLabel;
}
- (UILabel *)areaCodeLabel{
if (!_areaCodeLabel) {
_areaCodeLabel = [[UILabel alloc] init];
_areaCodeLabel.text = @"+86";
_areaCodeLabel.textColor = [ThemeColor secondTextColor];
_areaCodeLabel.font = [UIFont systemFontOfSize:14.f];
_areaCodeLabel.adjustsFontSizeToFitWidth = YES;
}
return _areaCodeLabel;
}
- (UIButton *)confirmBtn {
if (!_confirmBtn) {
_confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_confirmBtn setTitle:@"绑定" forState:UIControlStateNormal];
[_confirmBtn.titleLabel setFont:[UIFont fontWithName:@"PingFang-SC-Medium" size:18]];
_confirmBtn.layer.cornerRadius = 52/2.f;
_confirmBtn.layer.masksToBounds = YES;
_confirmBtn.enabled = NO;
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FF60FD"], [ThemeColor colorWithHexString:@"#8974FF"],[ThemeColor colorWithHexString:@"#69EBFF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 2*36, 52)];
_confirmBtn.backgroundColor = [UIColor colorWithPatternImage:image];
}
return _confirmBtn;
}
- (UIButton *)authCodeBtn {
if (!_authCodeBtn) {
_authCodeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_authCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
[_authCodeBtn setTitleColor:[ThemeColor colorWithHexString:@"#9552FF"] forState:UIControlStateNormal];
// [_authCodeBtn setTitleColor:[ThemeColor appMainColor] forState:UIControlStateNormal];
[_authCodeBtn setTitleColor:[ThemeColor secondTextColor] forState:UIControlStateDisabled];
[_authCodeBtn.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
}
return _authCodeBtn;
}
- (UIView *)phoneBgView {
if (!_phoneBgView) {
_phoneBgView = [[UIView alloc] init];
_phoneBgView.backgroundColor = UIColor.whiteColor;
_phoneBgView.layer.cornerRadius = 52/2.f;
_phoneBgView.layer.masksToBounds = YES;
}
return _phoneBgView;
}
- (UITextField *)phoneNumTextField {
if (!_phoneNumTextField) {
_phoneNumTextField = [[UITextField alloc] init];
_phoneNumTextField.textColor = [ThemeColor mainTextColor];
_phoneNumTextField.font = [UIFont systemFontOfSize:14.f];
_phoneNumTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"输入手机号"attributes:@{NSForegroundColorAttributeName: [ThemeColor secondTextColor]}];
_phoneNumTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
_phoneNumTextField.borderStyle = UITextBorderStyleNone;
_phoneNumTextField.keyboardType = UIKeyboardTypeNumberPad;
_phoneNumTextField.tintColor = [ThemeColor mainTextColor];
}
return _phoneNumTextField;
}
- (UIView *)authCodeBgView {
if (!_authCodeBgView) {
_authCodeBgView = [[UIView alloc] init];
_authCodeBgView.backgroundColor = UIColor.whiteColor;
_authCodeBgView.layer.cornerRadius = 52/2.f;
_authCodeBgView.layer.masksToBounds = YES;
}
return _authCodeBgView;
}
- (UITextField *)authCodeTextField {
if (!_authCodeTextField) {
_authCodeTextField = [[UITextField alloc] init];
_authCodeTextField.textColor = [ThemeColor mainTextColor];
_authCodeTextField.font = [UIFont systemFontOfSize:14.f];
_authCodeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"输入验证码"attributes:@{NSForegroundColorAttributeName: [ThemeColor secondTextColor]}];
_authCodeTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
_authCodeTextField.borderStyle = UITextBorderStyleNone;
_authCodeTextField.keyboardType = UIKeyboardTypeNumberPad;
_authCodeTextField.tintColor = [ThemeColor mainTextColor];
}
return _authCodeTextField;
}
@end

View File

@@ -0,0 +1,19 @@
//
// MineLoginPasswordViewController.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import "MvpViewController.h"
@class UserInfoModel;
NS_ASSUME_NONNULL_BEGIN
@interface MineLoginPasswordViewController : MvpViewController
@property (nonatomic,strong) UserInfoModel *userInfo;
///是否是修改密码
@property (nonatomic,assign) BOOL isModifiPwd;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,301 @@
//
// MineLoginPasswordViewController.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "MineLoginPasswordViewController.h"
#import "MineModifPayPwdView.h"
#import "LoginForgetPasswordViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
///Tool
#import "ThemeColor.h"
#import "UIButton+EnlargeTouchArea.h"
#import "UIImage+Utils.h"
#import "YMMacro.h"
///Model
#import "UserInfoModel.h"
///P
#import "MineLoginPasswordPresenter.h"
#import "MineLoginPasswordProtocol.h"
@interface MineLoginPasswordViewController ()<MineLoginPasswordProtocol>
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic, strong) UIButton *backButton;
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) MineModifPayPwdView *currentPwdView;
///
@property (nonatomic,strong) MineModifPayPwdView *newsPwdView;
///
@property (nonatomic,strong) MineModifPayPwdView *checkPwdView;
///
@property (nonatomic, strong) UIButton *forgetButton;
///
@property (nonatomic, strong) UIButton *submitButton;
///
@property (nonatomic,strong) UILabel *limitLabel;
///
@property (nonatomic,copy) NSString *currentPwd;
///
@property (nonatomic,copy) NSString *newsPwd;
///
@property (nonatomic,copy) NSString *checkPwd;
@end
@implementation MineLoginPasswordViewController
- (BOOL)isHiddenNavBar {
return YES;
}
- (MineLoginPasswordPresenter *)createPresenter {
return [[MineLoginPasswordPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [ThemeColor colorWithHexString:@"#14171B"];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.backButton];
[self.view addSubview:self.titleLabel];
[self.view addSubview:self.stackView];
[self.view addSubview:self.limitLabel];
[self.view addSubview:self.forgetButton];
[self.view addSubview:self.submitButton];
[self.stackView addArrangedSubview:self.currentPwdView];
[self.stackView addArrangedSubview:self.newsPwdView];
[self.stackView addArrangedSubview:self.checkPwdView];
}
- (void)initSubViewConstraints {
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view).mas_offset(10);
make.top.mas_equalTo(statusbarHeight);
make.height.width.mas_equalTo(44);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.backButton);
make.centerX.equalTo(self.view);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.mas_equalTo(self.view);
make.width.mas_equalTo(KScreenWidth - 2 *36);
make.centerX.equalTo(self.view);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(60);
}];
[self.limitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(self.view).offset(15);
make.centerX.equalTo(self.stackView);
make.top.mas_equalTo(self.stackView.mas_bottom).offset(10);
}];
[self.forgetButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.view).offset(-15);
make.top.mas_equalTo(self.submitButton.mas_bottom).offset(15);
}];
[self.submitButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.limitLabel.mas_bottom).offset(20);
make.right.mas_equalTo(self.view).offset(-36);
make.left.mas_equalTo(self.view).offset(36);
make.height.mas_equalTo(52);
}];
}
#pragma mark - XPMineLoginPasswordProtocol
- (void)setLoginPasswordSuccess {
[self showSuccessToast:@"设置成功"];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)modifyLoginPasswordSuccess {
[self showSuccessToast:@"修改成功"];
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - Event Response
- (void)forgetButtonAction:(UIButton *)sender {
LoginForgetPasswordViewController *controller = [[LoginForgetPasswordViewController alloc] init];
[self.navigationController pushViewController:controller animated:YES];
// XPMineResetLoginPwdViewController * VC = [[XPMineResetLoginPwdViewController alloc] init];
// VC.userInfo = self.userInfo;
// [self.navigationController pushViewController:VC animated:YES];
}
- (void)submitButtonAction:(UIButton *)sender {
if (![self.newsPwdView.contentTextField.text isEqualToString:self.checkPwdView.contentTextField.text]) {
[self showErrorToast:@"两次输入的新密码不一致哦"];
return;
}
if (self.isModifiPwd) {
[self.presenter modifyLoginPassword:self.userInfo.phone newPwd:self.newsPwd pwd:self.currentPwd];
} else {
[self.presenter setLoginPassword:self.userInfo.phone newPwd:self.newsPwd];
}
}
- (void)textFieldDidChange:(UITextField *)textfield {
if (textfield == self.currentPwdView.contentTextField) {
self.currentPwd = textfield.text;
} else if (textfield == self.newsPwdView.contentTextField) {
self.newsPwd = textfield.text;
} else {
self.checkPwd = textfield.text;
}
if (self.isModifiPwd) {
if (self.currentPwd.length >= 6 && self.newsPwd.length >= 6 && self.checkPwd.length >= 6) {
self.submitButton.enabled = YES;
} else {
self.submitButton.enabled = NO;
}
} else {
if (self.newsPwd.length >= 6 && self.checkPwd.length >= 6) {
self.submitButton.enabled = YES;
} else {
self.submitButton.enabled = NO;
}
}
}
//
- (void)backButtonAction {
[self.navigationController popViewControllerAnimated:NO];
}
#pragma mark - Getters And Setters
- (void)setIsModifiPwd:(BOOL)isModifiPwd {
_isModifiPwd = isModifiPwd;
if (_isModifiPwd) {
self.currentPwdView.hidden = NO;
self.currentPwdView.placeholder = @"输入原密码";
self.newsPwdView.placeholder = @"输入新密码";
self.checkPwdView.placeholder = @"再次确认密码";
self.title = @"重置密码";
} else {
self.currentPwdView.hidden = YES;
self.newsPwdView.placeholder = @"输入密码";
self.checkPwdView.placeholder = @"再次确认密码";
self.forgetButton.hidden = YES;
self.title = @"设置密码";
}
self.currentPwdView.hidden = !_isModifiPwd;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 20;
}
return _stackView;
}
- (MineModifPayPwdView *)currentPwdView {
if (!_currentPwdView) {
_currentPwdView = [[MineModifPayPwdView alloc] init];
[_currentPwdView.contentTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
_currentPwdView.backgroundColor = UIColor.whiteColor;
_currentPwdView.hidden = YES;
_currentPwdView.layer.cornerRadius = 50/2.f;
_currentPwdView.layer.masksToBounds = YES;
}
return _currentPwdView;
}
- (MineModifPayPwdView *)newsPwdView {
if (!_newsPwdView) {
_newsPwdView = [[MineModifPayPwdView alloc] init];
_newsPwdView.backgroundColor = UIColor.whiteColor;
[_newsPwdView.contentTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
_newsPwdView.layer.cornerRadius = 50/2.f;
_newsPwdView.layer.masksToBounds = YES;
}
return _newsPwdView;
}
- (MineModifPayPwdView *)checkPwdView {
if (!_checkPwdView) {
_checkPwdView = [[MineModifPayPwdView alloc] init];
_checkPwdView.backgroundColor = UIColor.whiteColor;
[_checkPwdView.contentTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
_checkPwdView.layer.cornerRadius = 50/2.f;
_checkPwdView.layer.masksToBounds = YES;
}
return _checkPwdView;
}
- (UIButton *)submitButton {
if (!_submitButton) {
_submitButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_submitButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
[_submitButton setTitle:@"确定" forState:UIControlStateNormal];
_submitButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
_submitButton.layer.masksToBounds = YES;
_submitButton.layer.cornerRadius = 52/2;
_submitButton.enabled = YES;
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FF60FD"], [ThemeColor colorWithHexString:@"#8974FF"],[ThemeColor colorWithHexString:@"#69EBFF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 2*36, 52)];
_submitButton.backgroundColor = [UIColor colorWithPatternImage:image];
[_submitButton addTarget:self action:@selector(submitButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _submitButton;
}
- (UIButton *)forgetButton {
if (!_forgetButton) {
_forgetButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_forgetButton setEnlargeEdgeWithTop:5 right:5 bottom:5 left:5];
[_forgetButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
[_forgetButton setTitle:@"忘记密码?" forState:UIControlStateNormal];
_forgetButton.titleLabel.font = [UIFont systemFontOfSize:13];
[_forgetButton addTarget:self action:@selector(forgetButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _forgetButton;
}
- (UILabel *)limitLabel {
if (!_limitLabel) {
_limitLabel = [[UILabel alloc] init];
_limitLabel.font = [UIFont systemFontOfSize:13];
_limitLabel.textColor = UIColor.whiteColor;
_limitLabel.text = @"密码必须使用6-16个字符内的数字和英文字母组合哦";
}
return _limitLabel;
}
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"mew_common_back_white_left"] forState:UIControlStateNormal];
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"重置密码";
_titleLabel.font = kFontMedium(18);
_titleLabel.textColor = UIColor.whiteColor;
}
return _titleLabel;
}
@end

View File

@@ -162,6 +162,7 @@
[_reportButton setImage:[UIImage imageNamed:@"mew_message_session_nav_report"] forState:UIControlStateNormal];
[_reportButton setImage:[UIImage imageNamed:@"mew_message_session_nav_report"] forState:UIControlStateSelected];
[_reportButton addTarget:self action:@selector(reportButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_reportButton.hidden = YES;
}
return _reportButton;
}

View File

@@ -20,6 +20,7 @@
#import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h>
#import <MJRefresh/MJRefresh.h>
#import <IQKeyboardManager/IQKeyboardManager.h>
/// Presenter
#import "MessagePresenter.h"
#import "MessageProtocol.h"
@@ -69,10 +70,12 @@
[[NIMSDK sharedSDK].chatManager addDelegate:self];
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
[self initHeaderAndFooterRefresh];
[IQKeyboardManager sharedManager].enable = NO;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.presenter getFansLike:self.session.sessionId];
self.sessionNavView.userId = self.session.sessionId;

View File

@@ -88,6 +88,7 @@ NS_ASSUME_NONNULL_BEGIN
transcationId:(NSString *)transcationId
uid:(NSString *)uid
ticket:(NSString *)ticket;
/// 验证凭据
/// @param completion 完成
/// @param chooseEnv @"true"
@@ -96,6 +97,21 @@ NS_ASSUME_NONNULL_BEGIN
/// @param uid 用户uid
/// @param ticket ticket
+ (void)checkReceipt:(HttpRequestHelperCompletion)completion chooseEnv:(NSString *)chooseEnv chargeRecordId:(NSString *)chargeRecordId transcationId:(NSString *)transcationId uid:(NSString *)uid ticket:(NSString *)ticket;
/// 设置登录密码
/// @param completion 完成
/// @param phone 手机号
/// @param newPwd 新的密码
+ (void)setLoingPassword:(HttpRequestHelperCompletion)completion phone:(NSString *)phone newPwd:(NSString *)newPwd;
/// 修改 登录密码
/// @param completion 完成
/// @param phone 手机号
/// @param newPwd 新的密码
/// @param pwd 旧密码
+ (void)modifyLoingPassword:(HttpRequestHelperCompletion)completion phone:(NSString *)phone newPwd:(NSString *)newPwd pwd:(NSString *)pwd;
@end
NS_ASSUME_NONNULL_END

View File

@@ -116,4 +116,22 @@
NSString *getUrl = [NewEncryptTool MEW_aesDecrypt:@"10iACYRNJ/Q7R019Q4DRNFPf0nODacTzggh6x9bvmOw="];//storeKitV2/verifyOrder
[self makeRequest:getUrl method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, chooseEnv, chargeRecordId, transcationId, uid, ticket, nil];
}
///
/// @param completion
/// @param phone
/// @param newPwd
+ (void)setLoingPassword:(HttpRequestHelperCompletion)completion phone:(NSString *)phone newPwd:(NSString *)newPwd {
[self makeRequest:@"acc/pwd/set" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, phone, newPwd, nil];
}
///
/// @param completion
/// @param phone
/// @param newPwd
/// @param pwd
+ (void)modifyLoingPassword:(HttpRequestHelperCompletion)completion phone:(NSString *)phone newPwd:(NSString *)newPwd pwd:(NSString *)pwd {
[self makeRequest:@"acc/pwd/modify" method:HttpRequestHelperMethodPOST completion:completion,__FUNCTION__, phone, newPwd, pwd, nil];
}
@end

View File

@@ -12,6 +12,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "YMMacro.h"
@interface YMMineSettingTableViewCell()
///
@@ -38,7 +39,7 @@
#pragma mark - Private Method
- (void)initSubViews {
self.contentView.backgroundColor = [ThemeColor appCellBackgroundColor];
self.backgroundColor = UIColor.clearColor;
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.stackView];
@@ -65,6 +66,7 @@
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.backgroundColor = UIColor.clearColor;
_stackView.axis = UILayoutConstraintAxisHorizontal;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentCenter;
@@ -76,8 +78,8 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:16];
_titleLabel.textColor = [ThemeColor secondTextColor];
_titleLabel.font = kFontMedium(16);
_titleLabel.textColor = UIColor.whiteColor;
[_titleLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _titleLabel;
@@ -86,7 +88,7 @@
if (!_subTitleLabel) {
_subTitleLabel = [[UILabel alloc] init];
_subTitleLabel.font = [UIFont systemFontOfSize:12];
_subTitleLabel.textColor = UIColor.grayColor;
_subTitleLabel.textColor = UIColorRGBAlpha(0xFFFFFF, 0.8);
_subTitleLabel.textAlignment = NSTextAlignmentRight;
}
return _subTitleLabel;
@@ -96,7 +98,7 @@
if (!_arrowImageView) {
_arrowImageView = [[UIImageView alloc] init];
_arrowImageView.userInteractionEnabled = YES;
_arrowImageView.image = [UIImage imageNamed:@"mine_item_arrow"];
_arrowImageView.image = [UIImage imageNamed:@"mew_common_white_right"];
[_arrowImageView setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[_arrowImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}

View File

@@ -6,6 +6,7 @@
//
#import "YMMineAboutUsViewController.h"
#import "YMWebViewController.h"
///Third
#import <Masonry/Masonry.h>
/// Tool
@@ -13,8 +14,12 @@
#import "ThemeColor.h"
#import "Base.h"
#import "YYUtility.h"
#import "MewHtmlUrl.h"
@interface YMMineAboutUsViewController ()
@property (nonatomic, strong) UIButton *backButton;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *iconImageView;//
@property (strong, nonatomic) UILabel *versionLabel;//
@property (strong , nonatomic) UILabel *nameLabel;
@@ -26,10 +31,15 @@
@implementation YMMineAboutUsViewController
- (BOOL)isHiddenNavBar {
return YES;
}
#pragma mark - Life Cycle
- (void)viewDidLoad {
[super viewDidLoad];
self.title = [NSString stringWithFormat:@"关于%@",@"我们"];
self.view.backgroundColor = [ThemeColor colorWithHexString:@"#14171B"];
[self initSubViews];
[self makeConstriants];
}
@@ -37,12 +47,22 @@
#pragma mark - Action Event
///
- (void)pushPrivacyView:(UITapGestureRecognizer *)tap {
YMWebViewController *controller = [[YMWebViewController alloc] init];
controller.url = URLWithType(kPrivacyURL);
[self.navigationController pushViewController:controller animated:NO];
}
//
- (void)backButtonAction {
[self.navigationController popViewControllerAnimated:NO];
}
#pragma mark - Init View
- (void)initSubViews {
[self.view addSubview:self.backButton];
[self.view addSubview:self.titleLabel];
[self.view addSubview:self.versionLabel];
[self.view addSubview:self.iconImageView];
[self.view addSubview:self.nameLabel];
@@ -53,6 +73,17 @@
}
- (void)makeConstriants {
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view).mas_offset(10);
make.top.mas_equalTo(statusbarHeight);
make.height.width.mas_equalTo(44);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.backButton);
make.centerX.equalTo(self.view);
}];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(kNavigationHeight+60);
@@ -79,7 +110,7 @@
[self.privacyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.privacyView).offset(-24);
make.centerY.equalTo(self.privacyView);
make.width.height.mas_equalTo(24);
// make.width.height.mas_equalTo(24);
}];
}
@@ -88,7 +119,7 @@
- (UIImageView *)iconImageView {
if (!_iconImageView) {
_iconImageView = [[UIImageView alloc] init];
_iconImageView.image = [UIImage imageNamed:@"ming_setting_about_us"];
_iconImageView.image = [UIImage imageNamed:@"mew_mine_aboutus_logo"];
_iconImageView.layer.cornerRadius = 12;
_iconImageView.layer.masksToBounds = YES;
@@ -101,7 +132,7 @@
if (!_versionLabel) {
_versionLabel = [[UILabel alloc] init];
_versionLabel.font = [UIFont systemFontOfSize:12];
_versionLabel.textColor = [ThemeColor mainTextColor];
_versionLabel.textColor = UIColorRGBAlpha(0xFFFFFF, 0.8);
_versionLabel.text = [NSString stringWithFormat:@"V%@",[YYUtility appVersion]];
}
return _versionLabel;
@@ -110,9 +141,9 @@
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] init];
_nameLabel.text = AppName;
_nameLabel.textColor = [ThemeColor secondTextColor];
_nameLabel.font = [UIFont systemFontOfSize:17];
_nameLabel.text = @"Mew";
_nameLabel.textColor = UIColor.whiteColor;
_nameLabel.font = kFontHeavy(24);
}
return _nameLabel;
}
@@ -120,7 +151,7 @@
- (UIView *)privacyView {
if(!_privacyView) {
_privacyView = [[UIView alloc] init];
_privacyView.backgroundColor = UIColor.whiteColor;
_privacyView.backgroundColor = [ThemeColor colorWithHexString:@"#5E6175"];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushPrivacyView:)];
[_privacyView addGestureRecognizer:tap];
}
@@ -140,10 +171,27 @@
- (UIImageView *)privacyImageView {
if (!_privacyImageView) {
_privacyImageView = [[UIImageView alloc] init];
_privacyImageView.image = [UIImage imageNamed:@""];
_privacyImageView.backgroundColor = UIColor.blueColor;
_privacyImageView.image = [UIImage imageNamed:@"mew_common_white_right"];
}
return _privacyImageView;
}
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"mew_common_back_white_left"] forState:UIControlStateNormal];
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"关于我们";
_titleLabel.font = kFontMedium(18);
_titleLabel.textColor = UIColor.whiteColor;
}
return _titleLabel;
}
@end

View File

@@ -8,6 +8,8 @@
#import "YMMineSettingViewController.h"
#import "YMWebViewController.h"
#import "YMMineAboutUsViewController.h"
#import "LoginVerifBindPhoneViewController.h"
#import "MineLoginPasswordViewController.h"
// Presenter
#import "YMMineSettingProtocol.h"
#import "YMMineSettingPresenter.h"
@@ -21,9 +23,16 @@
#import "NSArray+Safe.h"
#import "ThemeColor.h"
#import "YMMacro.h"
#import "UIImage+Utils.h"
#import "YMHUDTool.h"
#import "MewHtmlUrl.h"
@interface YMMineSettingViewController ()<YMMineSettingProtocol, UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UIButton *backButton;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic, strong) NSArray<YMMineSettingItemModel *> *models;
///退
@@ -35,6 +44,10 @@
@implementation YMMineSettingViewController
- (BOOL)isHiddenNavBar {
return YES;
}
- (YMMineSettingPresenter *)createPresenter {
return [[YMMineSettingPresenter alloc] init];
}
@@ -43,6 +56,7 @@
#pragma mark - Life Cycle
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [ThemeColor colorWithHexString:@"#14171B"];
[self initSubViews];
[self.presenter getMineSettingDataSourceWith:self.userInfo];
}
@@ -92,11 +106,31 @@
switch (type) {
//
case YMMineSettingItemType_Phone:
{
if (!self.userInfo.isBindPhone) { //
LoginVerifBindPhoneViewController *controller = [[LoginVerifBindPhoneViewController alloc] init];
[self.navigationController pushViewController:controller animated:NO];
} else {
[YMHUDTool showErrorWithMessage:@"您已绑定手机号码"];
}
}
break;
//
case YMMineSettingItemType_Login_Password:
{
if (!self.userInfo.isBindPhone) {
LoginVerifBindPhoneViewController *controller = [[LoginVerifBindPhoneViewController alloc] init];
controller.bindingPhoneNumType = XPBindingPhoneNumTypeNormal;
controller.userInfo = _userInfo;
[self.navigationController pushViewController:controller animated:NO];
return;
}
MineLoginPasswordViewController *vc = [[MineLoginPasswordViewController alloc] init];
vc.userInfo = self.userInfo;
vc.isModifiPwd = self.userInfo.isBindPhone;
[self.navigationController pushViewController:vc animated:YES];
}
break;
//
case YMMineSettingItemType_About_Us:
@@ -108,6 +142,12 @@
break;
//
case YMMineSettingItemType_Cancel_Account:
{
YMWebViewController *controller = [[YMWebViewController alloc] init];
controller.url = URLWithType(kCancelAccout);
[self.navigationController pushViewController:controller animated:NO];
}
break;
}
}
@@ -123,24 +163,53 @@
[self.presenter logoutCurrentAccount];
}
//
- (void)backButtonAction {
[self.navigationController popViewControllerAnimated:NO];
}
#pragma mark - Init View
- (void)initSubViews {
self.title = @"设置";
// self.title = @"设置";
[self.view addSubview:self.backButton];
[self.view addSubview:self.titleLabel];
[self.view addSubview:self.tableView];
[self.footerView addSubview:self.logoutButton];
self.tableView.tableFooterView = self.footerView;
[self initLayout];
}
- (void)initLayout {
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view).mas_offset(10);
make.top.mas_equalTo(statusbarHeight);
make.height.width.mas_equalTo(44);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.backButton);
make.centerX.equalTo(self.view);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom);
make.width.bottom.equalTo(self.view);
}];
}
#pragma mark - Get
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:self.view.frame];
_tableView = [[UITableView alloc] init];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.rowHeight = 45;
_tableView.rowHeight = 60;
[_tableView registerClass:[YMMineSettingTableViewCell class] forCellReuseIdentifier:NSStringFromClass([YMMineSettingTableViewCell class])];
}
return _tableView;
@@ -156,17 +225,39 @@
- (UIButton *)logoutButton {
if (!_logoutButton) {
_logoutButton = [UIButton buttonWithType:UIButtonTypeCustom];
_logoutButton.frame = CGRectMake(32, 40, KScreenWidth - 32* 2, 50);
_logoutButton.frame = CGRectMake(40, 40, KScreenWidth - 40 * 2, 50);
_logoutButton.backgroundColor = [ThemeColor appCellBackgroundColor];
_logoutButton.layer.masksToBounds = YES;
_logoutButton.layer.cornerRadius = 50/2;
_logoutButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_logoutButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
[_logoutButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FF60FD"], [ThemeColor colorWithHexString:@"#8974FF"], [ThemeColor colorWithHexString:@"#69EBFF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 2 * 40, 48)];
_logoutButton.backgroundColor = [UIColor colorWithPatternImage:image];
[_logoutButton setTitle:@"退出账号" forState:UIControlStateNormal];
[_logoutButton addTarget:self action:@selector(logoutButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _logoutButton;
}
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"mew_common_back_white_left"] forState:UIControlStateNormal];
[_backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"设置";
_titleLabel.font = kFontMedium(18);
_titleLabel.textColor = UIColor.whiteColor;
}
return _titleLabel;
}
@end

View File

@@ -0,0 +1,21 @@
//
// MineModifPayPwdView.h
// yinmeng-ios
//
// Created by 触海 on 2023/11/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface MineModifPayPwdView : UIView
///输入框
@property (nonatomic,strong, readonly) UITextField *contentTextField;
///占位
@property (nonatomic,copy) NSString *placeholder;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,119 @@
//
// MineModifPayPwdView.m
// yinmeng-ios
//
// Created by on 2023/11/22.
//
#import "MineModifPayPwdView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "UIButton+EnlargeTouchArea.h"
@interface MineModifPayPwdView()
///
@property (nonatomic,strong) UITextField *contentTextField;
///
@property (nonatomic,strong) UIButton *commandButton;
///线
@property (nonatomic,strong) UIView * partLineView;
@end
@implementation MineModifPayPwdView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Response
- (void)onClickHiddenBtn:(UIButton *)btn {
btn.selected = !btn.selected;
self.contentTextField.secureTextEntry = !self.contentTextField.secureTextEntry;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [ThemeColor appCellBackgroundColor];
[self addSubview:self.contentTextField];
[self addSubview:self.commandButton];
[self addSubview:self.partLineView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(50);
}];
[self.contentTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(15);
make.top.bottom.mas_equalTo(self);
}];
[self.commandButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self).offset(-32);
make.centerY.mas_equalTo(self.contentTextField);
make.left.mas_equalTo(self.contentTextField.mas_right).offset(10);
}];
[self.partLineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(5);
make.right.mas_equalTo(self).offset(-5);
make.bottom.mas_equalTo(self);
make.height.mas_equalTo(0.5);
}];
}
#pragma mark - Getters And Setters
- (void)setPlaceholder:(NSString *)placeholder {
_placeholder = placeholder;
self.contentTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSFontAttributeName : self.contentTextField.font, NSForegroundColorAttributeName : [ThemeColor secondTextColor]}];
}
- (UIView *)partLineView {
if (!_partLineView) {
_partLineView = [[UIView alloc] init];
_partLineView.backgroundColor = [ThemeColor dividerColor];
_partLineView.hidden = YES;
}
return _partLineView;
}
- (UITextField *)contentTextField {
if (!_contentTextField) {
_contentTextField = [[UITextField alloc] init];
_contentTextField.secureTextEntry = YES;
_contentTextField.font = [UIFont systemFontOfSize:13];
_contentTextField.textColor = [ThemeColor mainTextColor];
// _contentTextField.tintColor = [ThemeColor appMainColor];
}
return _contentTextField;
}
- (UIButton *)commandButton {
if (!_commandButton) {
_commandButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_commandButton setEnlargeEdgeWithTop:20 right:20 bottom:20 left:20];
[_commandButton addTarget:self action:@selector(onClickHiddenBtn:) forControlEvents:UIControlEventTouchUpInside];
[_commandButton setImage:[UIImage imageNamed:@"mine_setting_modif_pay_pwd_hidden"] forState:UIControlStateNormal];
[_commandButton setImage:[UIImage imageNamed:@"mine_setting_modif_pay_pwd_show"] forState:UIControlStateSelected];
_commandButton.titleLabel.font = [UIFont systemFontOfSize:12];
[_commandButton setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _commandButton;
}
@end