提交
This commit is contained in:
19
SweetParty/主类/旧项目依赖(以后调整)/BJPSWViw.h
Executable file
19
SweetParty/主类/旧项目依赖(以后调整)/BJPSWViw.h
Executable file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// BJPSWViw.h
|
||||
// miliao
|
||||
//
|
||||
// Created by Mac on 2021/3/3.
|
||||
// Copyright © 2021 miliao. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface BJPSWViw : UIView
|
||||
|
||||
@property (nonatomic,strong) UITextField *pswTF;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
83
SweetParty/主类/旧项目依赖(以后调整)/BJPSWViw.m
Executable file
83
SweetParty/主类/旧项目依赖(以后调整)/BJPSWViw.m
Executable file
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// BJPSWViw.m
|
||||
// miliao
|
||||
//
|
||||
// Created by Mac on 2021/3/3.
|
||||
// Copyright © 2021 miliao. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BJPSWViw.h"
|
||||
|
||||
@interface BJPSWViw ()
|
||||
|
||||
@property (nonatomic,strong) UILabel *pswLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation BJPSWViw
|
||||
|
||||
#pragma mark - init method
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self addSubview:self.pswTF];
|
||||
[self addSubview:self.pswLabel];
|
||||
WEAK_SELF;
|
||||
[self.pswTF mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(weakSelf.mas_left);
|
||||
make.right.mas_equalTo(weakSelf.mas_right);
|
||||
make.top.mas_equalTo(weakSelf.mas_top);
|
||||
make.bottom.mas_equalTo(weakSelf.mas_bottom);
|
||||
}];
|
||||
[self.pswLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(weakSelf.mas_left);
|
||||
make.right.mas_equalTo(weakSelf.mas_right);
|
||||
make.top.mas_equalTo(weakSelf.mas_top);
|
||||
make.bottom.mas_equalTo(weakSelf.mas_bottom);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - private method
|
||||
- (void)pswTFChangeAction:(id)sender
|
||||
{
|
||||
MYLog(@"%@", self.pswTF.text);
|
||||
if (self.pswTF.text.length > 0) {
|
||||
NSMutableString *textStr = [[NSMutableString alloc] init];
|
||||
for (int i = 0; i < self.pswTF.text.length; i++) {
|
||||
[textStr appendString:@"●"];
|
||||
}
|
||||
self.pswLabel.text = textStr;
|
||||
self.pswLabel.textColor = MHColorFromHexString(@"#333333");
|
||||
}else {
|
||||
self.pswLabel.text = @"请设置6-20位数字加字母密码";
|
||||
self.pswLabel.textColor = MHColorFromHexString(@"#999999");
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - getter
|
||||
- (UITextField *)pswTF
|
||||
{
|
||||
if (!_pswTF) {
|
||||
_pswTF = [[UITextField alloc] init];
|
||||
_pswTF.keyboardType = UIKeyboardTypeASCIICapable;
|
||||
_pswTF.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
||||
[_pswTF addTarget:self action:@selector(pswTFChangeAction:) forControlEvents:UIControlEventEditingChanged];
|
||||
}
|
||||
return _pswTF;
|
||||
}
|
||||
|
||||
- (UILabel *)pswLabel
|
||||
{
|
||||
if (!_pswLabel) {
|
||||
_pswLabel = [[UILabel alloc] init];
|
||||
_pswLabel.textColor = MHColorFromHexString(@"#999999");
|
||||
_pswLabel.font = Font(14);
|
||||
_pswLabel.text = @"请设置6-20位数字加字母密码";
|
||||
_pswLabel.backgroundColor = MHColorFromHexString(@"#ffffff");
|
||||
}
|
||||
return _pswLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
36
SweetParty/主类/旧项目依赖(以后调整)/BJWebVC.h
Executable file
36
SweetParty/主类/旧项目依赖(以后调整)/BJWebVC.h
Executable file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// BJWebVC.h
|
||||
// buymore
|
||||
//
|
||||
// Created by yuebin on 2020/12/28.
|
||||
// Copyright © 2020 JLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BaseController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@interface BJWebVC : BaseController
|
||||
|
||||
|
||||
///选填: 0使用原生导航栏 1使用h5导航栏,标题从H5中取 2使用h5导航栏,网页全屏上下不留间隙
|
||||
@property (nonatomic, assign) NSInteger useH5NavBar;
|
||||
|
||||
/// 选填:使用原生导航栏,需要赋值该属性
|
||||
@property (nonatomic, copy) NSString *webName;
|
||||
|
||||
/// 必填:网址url
|
||||
@property (nonatomic, copy) NSString *webUrl;
|
||||
|
||||
/// 强制使用传来的标题,不使用h5的
|
||||
@property (nonatomic, assign) BOOL useSelfTitle;
|
||||
|
||||
/// 可选,在请求头里加东西
|
||||
@property (strong, nonatomic) NSDictionary *httpHeadDict;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
501
SweetParty/主类/旧项目依赖(以后调整)/BJWebVC.m
Executable file
501
SweetParty/主类/旧项目依赖(以后调整)/BJWebVC.m
Executable file
@@ -0,0 +1,501 @@
|
||||
//
|
||||
// BJWebVC.m
|
||||
// buymore
|
||||
//
|
||||
// Created by yuebin on 2020/12/28.
|
||||
// Copyright © 2020 JLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BJWebVC.h"
|
||||
#import <WebKit/WebKit.h>
|
||||
//#import <JavaScriptCore/JavaScriptCore.h>
|
||||
//#import "WKWebViewJavascriptBridge.h"
|
||||
//#import <Contacts/Contacts.h>
|
||||
//#import <ContactsUI/ContactsUI.h>
|
||||
|
||||
@interface BJWebVC () <WKNavigationDelegate, WKScriptMessageHandler, WKUIDelegate>
|
||||
@property (strong, nonatomic) WKWebView *webView;
|
||||
@property (nonatomic, strong) UIView *progressView;
|
||||
@property (nonatomic,strong) UIActivityIndicatorView *indicatorView;
|
||||
@property (nonatomic, assign) BOOL havePushLogin;
|
||||
@property (nonatomic, assign) BOOL canAddJs;
|
||||
//@property (strong, nonatomic) WKWebViewJavascriptBridge *webViewBridge;
|
||||
|
||||
@property (copy, nonatomic) NSString *fixWebUrl; //拼接通用参数之后网址链接
|
||||
|
||||
@property (strong, nonatomic) NSDictionary *jsPassDict; //兼容旧网页使用,js传的参数
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation BJWebVC
|
||||
|
||||
#pragma mark - view
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
self.navigationController.navigationBar.hidden = YES;
|
||||
|
||||
BlackContentStatusBar
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
// self.isUseWebPageTitle = YES;
|
||||
[self addJsMethod];
|
||||
[self addObserver];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
|
||||
[self removeJsMethod];
|
||||
[self removeObserve];
|
||||
}
|
||||
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
_canAddJs = YES;
|
||||
|
||||
[self initNavBar];
|
||||
[self initSpecialNavBtn];
|
||||
[self initWebView];
|
||||
[self addProgressView];
|
||||
[self loadRequest];
|
||||
[self registerNativeFunctions];
|
||||
|
||||
// [self performSelector:@selector(callJsAfterUUpay) afterDelay:6];
|
||||
}
|
||||
|
||||
- (void)initNavBar {
|
||||
self.view.backgroundColor = UIColor.whiteColor;
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.bm_navView = [[CustomNavigationView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, yb_NavigationBar_H)];
|
||||
[self.bm_navView cus_setNavShow:0];
|
||||
[self.bm_navView cus_setNavTitle:C_string(_webName)];
|
||||
|
||||
UIButton *closeBtn = self.bm_navView.left1Btn;
|
||||
[closeBtn setTitle:@"" forState:UIControlStateNormal];
|
||||
[closeBtn setImage:ImageNamed(@"BM_host_nav_btn_close") forState:UIControlStateNormal];
|
||||
|
||||
self.bm_navView.handleGuanBiBlock = ^{
|
||||
[weakSelf closeWeb:nil];
|
||||
};
|
||||
self.bm_navView.handleBackBlock = ^{
|
||||
[weakSelf backWeb:nil];
|
||||
};
|
||||
|
||||
self.bm_navView.hidden = _useH5NavBar>0;
|
||||
}
|
||||
|
||||
// 使用自定义导航栏时顶部的
|
||||
- (void)initSpecialNavBtn {
|
||||
if (_useH5NavBar != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
if ([_webUrl containsString:@"/help_center"] || [_webUrl containsString:@"index/task/task_bank"]) {
|
||||
//帮助中心需要右上角的分享按钮
|
||||
UIButton *shareBtn = self.bm_navView.right0Btn;
|
||||
shareBtn.hidden = NO;
|
||||
[shareBtn setTitle:@"" forState:UIControlStateNormal];
|
||||
[shareBtn setImage:ImageNamed(@"BM_Tools_nav_btn_share") forState:UIControlStateNormal];
|
||||
self.bm_navView.handleRight0Block = ^{
|
||||
[weakSelf shareBtnClick];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initWebView {
|
||||
|
||||
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
|
||||
configuration.userContentController = [[WKUserContentController alloc] init];
|
||||
configuration.preferences = [[WKPreferences alloc] init];
|
||||
configuration.preferences.minimumFontSize = 10;
|
||||
configuration.preferences.javaScriptEnabled = YES;
|
||||
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
||||
configuration.allowsInlineMediaPlayback = YES; //允许在线播放
|
||||
configuration.selectionGranularity = YES; //允许可以与网页交互,选择视图
|
||||
configuration.suppressesIncrementalRendering = YES; //支持记忆读取
|
||||
|
||||
// if (GVUSER.isLogin) {
|
||||
// WKUserScript *cookieScript = [[WKUserScript alloc] initWithSource:[NSString stringWithFormat:@"document.cookie=\'%@=%@;domain=%@\';",@"uid", GVUSER.uid,@"http://www.eqidian.net"] injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO];
|
||||
// [configuration.userContentController addUserScript:cookieScript];
|
||||
//
|
||||
// WKUserScript *cookieScript1 = [[WKUserScript alloc] initWithSource:[NSString stringWithFormat:@"document.cookie=\'%@=%@;domain=%@\';",@"sign", GVUSER.sign,@"http://www.eqidian.net"] injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO];
|
||||
// [configuration.userContentController addUserScript:cookieScript1];
|
||||
// }
|
||||
CGRect rect = CGRectMake(15, yb_NavigationBar_H, APPW-15*2, APPH-yb_NavigationBar_H); //原生导航栏
|
||||
if (_useH5NavBar == 1) {
|
||||
rect = CGRectMake(15, yb_StatusBar_H, APPW-15*2, APPH-yb_StatusBar_H);
|
||||
}else if (_useH5NavBar == 2) {
|
||||
rect = CGRectMake(15, 0, APPW-15*2, APPH);
|
||||
}
|
||||
_webView = [[WKWebView alloc] initWithFrame:rect configuration:configuration];
|
||||
_webView.navigationDelegate = self;
|
||||
_webView.UIDelegate = self;
|
||||
[self.view addSubview:_webView];
|
||||
|
||||
//禁用苹果的自动适配
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
} else {
|
||||
self.edgesForExtendedLayout = UIRectEdgeNone;
|
||||
}
|
||||
|
||||
_webView.allowsBackForwardNavigationGestures = YES;
|
||||
_webView.opaque = NO;
|
||||
}
|
||||
|
||||
- (void)addProgressView {
|
||||
//progress
|
||||
_progressView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
|
||||
_progressView.backgroundColor = mainDeepColor;
|
||||
[_webView addSubview:self.progressView];
|
||||
|
||||
//fenghuolun
|
||||
_indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
||||
[self.view addSubview:self.indicatorView];
|
||||
self.indicatorView.center = self.view.center;
|
||||
}
|
||||
|
||||
- (void)loadRequest {
|
||||
if (_webUrl.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//链接拼上通用参数
|
||||
if ([_webUrl containsString:@"?"]) {
|
||||
_fixWebUrl = [_webUrl stringByAppendingString:@"&iosShow=2&platform=2"];
|
||||
}else {
|
||||
_fixWebUrl = [_webUrl stringByAppendingString:@"?iosShow=2&platform=2"];
|
||||
}
|
||||
//如果登录就拼上user_id
|
||||
// if (UserID.length>0 && ![_fixWebUrl containsString:@"user_id"]) {
|
||||
// _fixWebUrl = [_fixWebUrl stringByAppendingFormat:@"&user_id=%@", UserID];
|
||||
// }
|
||||
if ([_fixWebUrl containsString:@"??"]) {
|
||||
_fixWebUrl = [_fixWebUrl stringByReplacingOccurrencesOfString:@"??" withString:@"?"]; //容错
|
||||
}
|
||||
//url编码
|
||||
_fixWebUrl = [_fixWebUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
|
||||
//设置请求头和策略:从原始地址确认缓存数据的合法性后,缓存数据就可以使用,否则从原始地址加载
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:_fixWebUrl] cachePolicy:NSURLRequestReloadRevalidatingCacheData timeoutInterval:1];
|
||||
[request addValue:@"ios" forHTTPHeaderField:@"app-type"];
|
||||
[request addValue:@"2" forHTTPHeaderField:@"platform"];
|
||||
if (_httpHeadDict.allKeys.count > 0) {
|
||||
for (NSString *key in _httpHeadDict.allKeys) {
|
||||
[request addValue:_httpHeadDict[key] forHTTPHeaderField:key];
|
||||
}
|
||||
}
|
||||
|
||||
[_webView loadRequest:request];
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - WKNavigationDelegate
|
||||
//网页开始加载
|
||||
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
|
||||
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
|
||||
[self.indicatorView startAnimating];
|
||||
|
||||
_progressView.hidden = NO;
|
||||
_progressView.width = 1;
|
||||
}
|
||||
|
||||
//当内容开始返回时调用
|
||||
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
|
||||
|
||||
[self.indicatorView startAnimating];
|
||||
}
|
||||
|
||||
//网页加载完毕
|
||||
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
|
||||
|
||||
_progressView.hidden = YES;
|
||||
//注入不响应的JS方法即可
|
||||
// 禁用长按弹出框
|
||||
[webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none';" completionHandler:^(id _Nullable result, NSError * _Nullable error) {}];
|
||||
// 禁用用户选择
|
||||
[webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none';" completionHandler:^(id _Nullable result, NSError * _Nullable error) {}];
|
||||
|
||||
|
||||
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
|
||||
[self.indicatorView stopAnimating];
|
||||
|
||||
|
||||
if (!_useH5NavBar) {
|
||||
NSUInteger pageCount = self.webView.backForwardList.backList.count;
|
||||
self.bm_navView.left1Btn.hidden = pageCount==0;
|
||||
}
|
||||
|
||||
//使用原生导航栏 并且 使用h5标题
|
||||
if (!_useH5NavBar && (!_useSelfTitle)) {
|
||||
if (webView.title.length > 0) {
|
||||
self.bm_navView.titleLab.text = webView.title;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler {
|
||||
NSLog(@"%@====URL",navigationResponse.response.URL);
|
||||
|
||||
decisionHandler(WKNavigationResponsePolicyAllow);
|
||||
}
|
||||
/**
|
||||
API授权
|
||||
*/
|
||||
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler{
|
||||
|
||||
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
|
||||
CFDataRef exceptions = SecTrustCopyExceptions(serverTrust);
|
||||
SecTrustSetExceptions(serverTrust, exceptions);
|
||||
CFRelease(exceptions);
|
||||
|
||||
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:serverTrust]);
|
||||
}
|
||||
|
||||
//通过导航跳转失败的时候调用
|
||||
- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error {
|
||||
|
||||
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
|
||||
[self.indicatorView stopAnimating];
|
||||
|
||||
}
|
||||
|
||||
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
|
||||
|
||||
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
|
||||
[self.indicatorView stopAnimating];
|
||||
|
||||
//关掉特定网址的网络错误框
|
||||
if ([_webUrl containsString:@"yangkeduo"]) {
|
||||
NSLog(@"是拼多多网址报错,不显示框");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_useH5NavBar == 0) {
|
||||
//原生导航栏
|
||||
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
||||
}else {
|
||||
//没有原生导航栏时,显示弹框,避免不能返回的尴尬
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - js调用原生有返回值的方法
|
||||
|
||||
- (void)registerNativeFunctions {
|
||||
/*
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
_webViewBridge = [WKWebViewJavascriptBridge bridgeForWebView:_webView];
|
||||
[_webViewBridge setWebViewDelegate:self];
|
||||
[_webViewBridge registerHandler:@"jsGetNativeData" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||||
NSDictionary *passDict;
|
||||
if ([data isKindOfClass:NSString.class]) {
|
||||
passDict = ((NSString *)data).mj_JSONObject;
|
||||
}
|
||||
if ([data isKindOfClass:NSDictionary.class]) {
|
||||
passDict = data;
|
||||
}
|
||||
|
||||
if (passDict) {
|
||||
BaseJumpModel *model = [[BaseJumpModel alloc] init];
|
||||
model.md_event_type = [passDict safeStringForKey:@"md_event_type"];
|
||||
model.md_event_content = [passDict valueForKey:@"md_event_content"];
|
||||
model.md_event_need_login = [passDict safeBoolForKey:@"md_event_need_login"];
|
||||
|
||||
[model doModelEvent];
|
||||
id result = model.jsNeedThing.mj_JSONString;
|
||||
if (result) {
|
||||
NSLog(@"返回给js的值 %@", result);
|
||||
#if DEBUG
|
||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// [QMUITips showInfo:[NSString stringWithFormat:@"返回给js的值 %@", result]];
|
||||
// });
|
||||
#endif
|
||||
responseCallback(result);
|
||||
}
|
||||
}
|
||||
}];
|
||||
*/
|
||||
}
|
||||
|
||||
#pragma mark - WKScriptMessageHandler js调用原生方法,没有返回值
|
||||
|
||||
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
|
||||
NSLog(@"JS 调用了 %@ 方法",message.name);
|
||||
NSString *jsonString = message.body;
|
||||
NSString *methodName = message.name;
|
||||
if ([methodName isEqualToString:@"jsCallNative"]) {
|
||||
NSDictionary *info;
|
||||
if ([jsonString isKindOfClass:NSString.class]) {
|
||||
info = jsonString.mj_JSONObject;
|
||||
}
|
||||
if ([jsonString isKindOfClass:NSDictionary.class]) {
|
||||
info = (NSDictionary *)jsonString; //容错一下,万一H5变成字典了
|
||||
}
|
||||
if ([info isKindOfClass:NSDictionary.class]) {
|
||||
// BaseJumpModel *model = [[BaseJumpModel alloc] init];
|
||||
// model.md_event_type = [info safeStringForKey:@"md_event_type"];
|
||||
// model.md_event_content = [info valueForKey:@"md_event_content"];
|
||||
// model.md_event_need_login = [info safeBoolForKey:@"md_event_need_login"];
|
||||
// [model doModelEvent];
|
||||
|
||||
// if (model.md_event_type.integerValue != 1017) {
|
||||
// NSLog(@"JS 调用了 %@ 方法,传回参数 %@",message.name,message.body);
|
||||
// }
|
||||
}
|
||||
return;
|
||||
}
|
||||
NSLog(@"JS 调用了 %@ 方法,传回参数 %@",message.name,message.body);
|
||||
}
|
||||
|
||||
#pragma mark - WKUIDelegate
|
||||
|
||||
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler{
|
||||
NSLog(@"message - %@",message);
|
||||
completionHandler();
|
||||
}
|
||||
|
||||
//弹出一个输入框(与JS交互的)
|
||||
- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * __nullable result))completionHandler{
|
||||
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:prompt message:defaultText preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *a1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
||||
//这里必须执行不然页面会加载不出来
|
||||
completionHandler(@"");
|
||||
}];
|
||||
UIAlertAction *a2 = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
NSLog(@"%@", [alert.textFields firstObject].text);
|
||||
completionHandler([alert.textFields firstObject].text);
|
||||
}];
|
||||
[alert addAction:a1];
|
||||
[alert addAction:a2];
|
||||
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
|
||||
NSLog(@"%@",textField.text);
|
||||
}];
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
//显示一个确认框(JS的)
|
||||
- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler{
|
||||
|
||||
// [AlertShowTool showAlertWithTitle:message message:nil sureBlock:^{
|
||||
// completionHandler(YES);
|
||||
// } cancleBlock:^{
|
||||
// completionHandler(NO);
|
||||
// } fromViewController:self];
|
||||
}
|
||||
|
||||
#pragma mark - btn action
|
||||
|
||||
- (void)backWeb:(id)sender {
|
||||
NSInteger pageCount = self.webView.backForwardList.backList.count;
|
||||
if (pageCount > 0) {
|
||||
[self.webView goBack];
|
||||
}else {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)closeWeb:(id)sender {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)shareBtnClick {
|
||||
|
||||
}
|
||||
|
||||
- (void)reloadWebAfterLogin {
|
||||
//是否需要确定当前页面在显示中才调用
|
||||
|
||||
[self loadRequest];
|
||||
}
|
||||
|
||||
#pragma mark - 原生调用js方法
|
||||
|
||||
- (void)callJsAfterUUpay {
|
||||
NSDictionary *para = @{@"md_event_type":@"1400", @"md_event_content":@{}};
|
||||
NSString *jsString = [NSString stringWithFormat:@"nativeCallJs('%@')", para.mj_JSONString];
|
||||
// NSString *jsString = @"nativeCallJs(1400)";
|
||||
|
||||
[_webView evaluateJavaScript:jsString completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)callJsAfterGetPhone:(NSString *)phone withName:(NSString *)name {
|
||||
NSDictionary *para = @{@"md_event_type":@"1202", @"md_event_content":@{@"phone":C_string(phone), @"name":C_string(name)}};
|
||||
NSString *jsString = [NSString stringWithFormat:@"nativeCallJs('%@')", para.mj_JSONString];
|
||||
// NSString *jsString = @"nativeCallJs(1400)";
|
||||
|
||||
[_webView evaluateJavaScript:jsString completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)callJsAfterVideoShow {
|
||||
NSDictionary *para = @{@"md_event_type":@"1205", @"md_event_content":@{}};
|
||||
NSString *jsString = [NSString stringWithFormat:@"nativeCallJs('%@')", para.mj_JSONString];
|
||||
[_webView evaluateJavaScript:jsString completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - KVO监听
|
||||
|
||||
- (void)addJsMethod {
|
||||
if (_canAddJs) { //连续添加会崩溃
|
||||
[_webView.configuration.userContentController addScriptMessageHandler:self name:@"jsCallNative"];
|
||||
_canAddJs = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeJsMethod {
|
||||
//不然会循环引用,造成内存泄漏
|
||||
if (_canAddJs == NO) {
|
||||
[_webView.configuration.userContentController removeScriptMessageHandlerForName:@"jsCallNative"];
|
||||
_canAddJs = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addObserver {
|
||||
[_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
|
||||
}
|
||||
|
||||
- (void)removeObserve {
|
||||
@try {
|
||||
[_webView removeObserver:self forKeyPath:@"estimatedProgress"];
|
||||
} @catch (NSException *exception) {
|
||||
NSLog(@"移除观察者出错");
|
||||
} @finally {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
|
||||
if ([keyPath isEqualToString:@"estimatedProgress"]) {
|
||||
[UIView animateWithDuration:0.1 animations:^{
|
||||
_progressView.width = self.webView.estimatedProgress * APPW;
|
||||
}];
|
||||
_progressView.hidden = _webView.estimatedProgress >= 0.97;
|
||||
}else{
|
||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
NSLog(@"%@", [NSString stringWithFormat:@"销毁%@页面", NSStringFromClass(self.class)]);
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
72
SweetParty/主类/旧项目依赖(以后调整)/GDMineModel.h
Executable file
72
SweetParty/主类/旧项目依赖(以后调整)/GDMineModel.h
Executable file
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// GDMineModel.h
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by apple on 2020/9/16.
|
||||
// Copyright © 2020 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GDMineModel : NSObject
|
||||
|
||||
/*冻结金额*/
|
||||
@property(nonatomic, copy) NSString *frozen_money;
|
||||
/*巧鱼币*/
|
||||
@property(nonatomic, copy) NSString *integral;
|
||||
/*生日*/
|
||||
@property(nonatomic, copy) NSString *birthday;
|
||||
/*省*/
|
||||
@property(nonatomic, copy) NSString *province;
|
||||
/*余额*/
|
||||
@property(nonatomic, copy) NSString *money;
|
||||
/*签名*/
|
||||
@property(nonatomic, copy) NSString *autograph;
|
||||
/*国家*/
|
||||
@property(nonatomic, copy) NSString *country;
|
||||
/*性别*/
|
||||
@property(nonatomic, copy) NSString *sex;
|
||||
/*星座*/
|
||||
@property(nonatomic, copy) NSString *constellation;
|
||||
/*是否实名认证,1,实名;2,未实名*/
|
||||
@property(nonatomic, copy) NSString *is_real;
|
||||
/*城市*/
|
||||
@property(nonatomic, copy) NSString *city;
|
||||
/*粉丝数量*/
|
||||
@property(nonatomic, copy) NSString *fans_num;
|
||||
/*头像*/
|
||||
@property(nonatomic, copy) NSString *head_pic;
|
||||
/*token*/
|
||||
@property(nonatomic, copy) NSString *login_token;
|
||||
/*用户id*/
|
||||
@property(nonatomic, copy) NSString *uid;
|
||||
/*关注数量*/
|
||||
@property(nonatomic, copy) NSString *follow_num;
|
||||
/*是否关注*/
|
||||
@property(nonatomic, copy) NSString *is_follow;
|
||||
/*房间收益*/
|
||||
@property(nonatomic, copy) NSString *room_profit;
|
||||
/*靓号ID*/
|
||||
@property(nonatomic, copy) NSString *special_uid;
|
||||
/*昵称*/
|
||||
@property(nonatomic, copy) NSString *nick_name;
|
||||
/**/
|
||||
@property(nonatomic, copy) NSString *base64_nick_name;
|
||||
/*收藏的房间数量*/
|
||||
@property(nonatomic, copy) NSString *collect_room_num;
|
||||
/*是否有房间*/
|
||||
@property(nonatomic, copy) NSString *rid;
|
||||
/*手机号*/
|
||||
@property(nonatomic, copy) NSString *user_name;
|
||||
|
||||
//邀请好友
|
||||
@property(nonatomic, copy) NSString *reg_url;
|
||||
|
||||
//爱好
|
||||
@property(nonatomic, copy) NSString *hobby;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
14
SweetParty/主类/旧项目依赖(以后调整)/GDMineModel.m
Executable file
14
SweetParty/主类/旧项目依赖(以后调整)/GDMineModel.m
Executable file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// GDMineModel.m
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by apple on 2020/9/16.
|
||||
// Copyright © 2020 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GDMineModel.h"
|
||||
|
||||
@implementation GDMineModel
|
||||
|
||||
|
||||
@end
|
||||
18
SweetParty/主类/旧项目依赖(以后调整)/HLHorizontalPageLayout.h
Executable file
18
SweetParty/主类/旧项目依赖(以后调整)/HLHorizontalPageLayout.h
Executable file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// HLHorizontalPageLayout.h
|
||||
// HLHorizontalPageLayoutDemo
|
||||
//
|
||||
// Created by dhl613 on 2018/8/24.
|
||||
// Copyright © 2018年 dhl613. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface HLHorizontalPageLayout : UICollectionViewLayout
|
||||
|
||||
@property (nonatomic) CGFloat minimumLineSpacing;
|
||||
@property (nonatomic) CGFloat minimumInteritemSpacing;
|
||||
@property (nonatomic) CGSize itemSize;
|
||||
@property (nonatomic) UIEdgeInsets sectionInset;
|
||||
|
||||
@end
|
||||
116
SweetParty/主类/旧项目依赖(以后调整)/HLHorizontalPageLayout.m
Executable file
116
SweetParty/主类/旧项目依赖(以后调整)/HLHorizontalPageLayout.m
Executable file
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// HLHorizontalPageLayout.m
|
||||
// HLHorizontalPageLayoutDemo
|
||||
//
|
||||
// Created by dhl613 on 2018/8/24.
|
||||
// Copyright © 2018年 dhl613. All rights reserved.
|
||||
//
|
||||
|
||||
#import "HLHorizontalPageLayout.h"
|
||||
|
||||
@interface HLHorizontalPageLayout()
|
||||
|
||||
@property (strong, nonatomic) NSMutableArray<UICollectionViewLayoutAttributes *> *layoutAttributes;
|
||||
|
||||
/** 单页行数 */
|
||||
@property (assign, nonatomic) NSInteger rowCount;
|
||||
/** 单页列数 */
|
||||
@property (assign, nonatomic) NSInteger columnCount;
|
||||
|
||||
@end
|
||||
|
||||
@implementation HLHorizontalPageLayout
|
||||
|
||||
#pragma mark - Layout
|
||||
// 布局前准备
|
||||
- (void)prepareLayout {
|
||||
|
||||
[self.layoutAttributes removeAllObjects];
|
||||
|
||||
NSInteger itemCount = [self.collectionView numberOfItemsInSection:0];
|
||||
// 获取所有布局
|
||||
for (NSInteger i = 0; i < itemCount; i++) {
|
||||
NSIndexPath *indexpath = [NSIndexPath indexPathForItem:i inSection:0];
|
||||
UICollectionViewLayoutAttributes *attr = [self layoutAttributesForItemAtIndexPath:indexpath];
|
||||
[self.layoutAttributes addObject:attr];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
UICollectionViewLayoutAttributes *attri = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
|
||||
|
||||
NSInteger item = indexPath.item;
|
||||
// 总页数
|
||||
NSInteger pageNumber = item / (self.rowCount * self.columnCount);
|
||||
// 该页中item的序号
|
||||
NSInteger itemInPage = item % (self.rowCount * self.columnCount);
|
||||
// item的所在列、行
|
||||
NSInteger col = itemInPage % self.columnCount;
|
||||
NSInteger row = itemInPage / self.columnCount;
|
||||
|
||||
CGFloat x = self.sectionInset.left + (self.itemSize.width + self.minimumInteritemSpacing)*col + pageNumber * self.collectionView.bounds.size.width;
|
||||
CGFloat y = self.sectionInset.top + (self.itemSize.height + self.minimumLineSpacing)*row ;
|
||||
|
||||
attri.frame = CGRectMake(x, y, self.itemSize.width, self.itemSize.height);
|
||||
|
||||
|
||||
return attri;
|
||||
}
|
||||
|
||||
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
|
||||
return self.layoutAttributes;
|
||||
}
|
||||
|
||||
- (CGSize)collectionViewContentSize {
|
||||
NSInteger itemCount = [self.collectionView numberOfItemsInSection:0];
|
||||
NSInteger pageNumber = itemCount / (self.rowCount * self.columnCount);
|
||||
if (itemCount%(self.rowCount*self.columnCount)) {
|
||||
pageNumber += 1;
|
||||
}
|
||||
return CGSizeMake(pageNumber * self.collectionView.bounds.size.width, self.collectionView.bounds.size.height);
|
||||
}
|
||||
|
||||
#pragma mark - Getter
|
||||
- (NSMutableArray<UICollectionViewLayoutAttributes *> *)layoutAttributes {
|
||||
if (_layoutAttributes == nil) {
|
||||
_layoutAttributes = [NSMutableArray array];
|
||||
}
|
||||
return _layoutAttributes;
|
||||
}
|
||||
|
||||
// 根据itemSize lineSpacing sectionInsets collectionView frame计算取得
|
||||
- (NSInteger)rowCount {
|
||||
if (_rowCount == 0) {
|
||||
|
||||
NSInteger numerator = self.collectionView.bounds.size.height - self.sectionInset.top - self.sectionInset.bottom + self.minimumLineSpacing;
|
||||
NSInteger denominator = self.minimumLineSpacing + self.itemSize.height;
|
||||
NSInteger count = numerator/denominator;
|
||||
_rowCount = count;
|
||||
|
||||
// minimumLineSpacing itemSize.height不是刚好填满 将多出来的补给minimumLineSpacing
|
||||
if (numerator % denominator) {
|
||||
self.minimumLineSpacing = (self.collectionView.bounds.size.height - self.sectionInset.top-self.sectionInset.bottom - count * self.itemSize.height) / (CGFloat)(count - 1);
|
||||
}
|
||||
}
|
||||
return _rowCount;
|
||||
}
|
||||
// 根据itemSize minimumInteritemSpacing sectionInsets collectionView frame计算取得
|
||||
- (NSInteger)columnCount {
|
||||
if (_columnCount == 0) {
|
||||
|
||||
NSInteger numerator = self.collectionView.bounds.size.width - self.sectionInset.left - self.sectionInset.right + self.minimumInteritemSpacing;
|
||||
NSInteger denominator = self.minimumInteritemSpacing + self.itemSize.width;
|
||||
NSInteger count = numerator/denominator;
|
||||
_columnCount = count;
|
||||
|
||||
// minimumInteritemSpacing itemSize.width不是刚好填满 将多出来的补给minimumInteritemSpacing
|
||||
if (numerator % denominator) {
|
||||
self.minimumInteritemSpacing = (self.collectionView.bounds.size.width - self.sectionInset.left - self.sectionInset.right - count * self.itemSize.width) / (CGFloat)(count - 1);
|
||||
}
|
||||
}
|
||||
return _columnCount;
|
||||
}
|
||||
|
||||
@end
|
||||
18
SweetParty/主类/旧项目依赖(以后调整)/LiangView.h
Executable file
18
SweetParty/主类/旧项目依赖(以后调整)/LiangView.h
Executable file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// LiangView.h
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by 翟三美 on 2020/11/25.
|
||||
// Copyright © 2020 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface LiangView : UIView
|
||||
@property (strong, nonatomic) IBOutlet UILabel *uid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
21
SweetParty/主类/旧项目依赖(以后调整)/LiangView.m
Executable file
21
SweetParty/主类/旧项目依赖(以后调整)/LiangView.m
Executable file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// LiangView.m
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by 翟三美 on 2020/11/25.
|
||||
// Copyright © 2020 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "LiangView.h"
|
||||
|
||||
@implementation LiangView
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
58
SweetParty/主类/旧项目依赖(以后调整)/LiangView.xib
Executable file
58
SweetParty/主类/旧项目依赖(以后调整)/LiangView.xib
Executable file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" id="iN0-l3-epB" customClass="LiangView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="91" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ID_liang" translatesAutoresizingMaskIntoConstraints="NO" id="EN7-si-Snd">
|
||||
<rect key="frame" x="2" y="2" width="20" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="20" id="seY-7q-Tlv"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="6666" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oCD-DR-JFd">
|
||||
<rect key="frame" x="25" y="2.5" width="31" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.21568627450980393" green="0.19607843137254902" blue="0.13725490196078433" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="EN7-si-Snd" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="2" id="2tB-xu-XiB"/>
|
||||
<constraint firstItem="EN7-si-Snd" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="2" id="7eL-dO-3e6"/>
|
||||
<constraint firstItem="oCD-DR-JFd" firstAttribute="leading" secondItem="EN7-si-Snd" secondAttribute="trailing" constant="3" id="8yB-f1-7G2"/>
|
||||
<constraint firstAttribute="bottom" secondItem="EN7-si-Snd" secondAttribute="bottom" constant="2" id="FQn-SB-Du1"/>
|
||||
<constraint firstItem="oCD-DR-JFd" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="FaC-oU-oPL"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="10"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
|
||||
<real key="value" value="1.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
|
||||
<color key="value" red="0.94509803920000002" green="0.85490196080000003" blue="0.59215686270000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="uid" destination="oCD-DR-JFd" id="xGU-lT-5qJ"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-151.44927536231884" y="63.616071428571423"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ID_liang" width="15" height="15.5"/>
|
||||
</resources>
|
||||
</document>
|
||||
17
SweetParty/主类/旧项目依赖(以后调整)/MH_ZhuanZengView.h
Executable file
17
SweetParty/主类/旧项目依赖(以后调整)/MH_ZhuanZengView.h
Executable file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MH_ZhuanZengView.h
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by 马方圆 on 2021/5/18.
|
||||
// Copyright © 2021 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "BJOperationAlertUserModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MH_ZhuanZengView : UIView
|
||||
@property(nonatomic, strong) BJOperationAlertUserModel *userInfoModel;// 模型
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
107
SweetParty/主类/旧项目依赖(以后调整)/MH_ZhuanZengView.m
Executable file
107
SweetParty/主类/旧项目依赖(以后调整)/MH_ZhuanZengView.m
Executable file
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// MH_ZhuanZengView.m
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by 马方圆 on 2021/5/18.
|
||||
// Copyright © 2021 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MH_ZhuanZengView.h"
|
||||
#import "GDMineModel.h"
|
||||
#import "TXMicIMService.h"
|
||||
|
||||
@interface MH_ZhuanZengView ()
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *maskImg;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *userIcon;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nickName;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *userID;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UITextField *jineTF;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *moneyLab;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *liangImg;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *confirmBtn;
|
||||
@property(nonatomic, strong) GDMineModel *mineModel;// 模型
|
||||
@end
|
||||
|
||||
@implementation MH_ZhuanZengView
|
||||
|
||||
- (void)awakeFromNib{
|
||||
[super awakeFromNib];
|
||||
|
||||
//获取账户余额
|
||||
[self getUserInfoMethod];
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
[self.maskImg dg_Tapped:^{
|
||||
[weakSelf removeFromSuperview];
|
||||
}];
|
||||
|
||||
[self.confirmBtn setJianBianWithCGSize:CGSizeMake(ScreenWidth-27*2, 49)];
|
||||
|
||||
// self.jineTF.attributedPlaceholder = [[NSMutableAttributedString alloc] initWithString:@"请输入转赠金额" attributes:@{NSForegroundColorAttributeName:[kWhiteColor colorWithAlphaComponent:0.6]}];
|
||||
|
||||
}
|
||||
#pragma mark - network request
|
||||
/** 获取个人信息接口 */
|
||||
- (void)getUserInfoMethod
|
||||
{
|
||||
WEAK_SELF;
|
||||
[BJHttpTool BJ_get_user_infoWithParameters:@{} success:^(id response) {
|
||||
weakSelf.mineModel = [GDMineModel mj_objectWithKeyValues:response[@"data"]];
|
||||
weakSelf.moneyLab.text = NSStringFormat(@"%@",self.mineModel.integral);
|
||||
// [weakSelf refreshUI];
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
}];
|
||||
}
|
||||
- (void)setUserInfoModel:(BJOperationAlertUserModel *)userInfoModel{
|
||||
_userInfoModel = userInfoModel;
|
||||
[self.userIcon sd_setImageWithURL:[NSURL URLWithString:self.userInfoModel.head_pic] placeholderImage:kDefaultUserIcon];
|
||||
self.nickName.text = self.userInfoModel.nick_name;
|
||||
if ([self.userInfoModel.special_uid intValue]>0) {
|
||||
self.liangImg.image = userID_liang;
|
||||
self.userID.text = self.userInfoModel.special_uid;
|
||||
}else{
|
||||
self.liangImg.image = userID_simgple;
|
||||
self.userID.text = self.userInfoModel.uid;
|
||||
}
|
||||
}
|
||||
- (IBAction)completeMethod:(id)sender {
|
||||
|
||||
if (self.jineTF.text.length==0) {
|
||||
[SVProgressHUD showErrorWithStatus:@"请输入转赠金额"];
|
||||
return;
|
||||
}
|
||||
|
||||
[BJHttpTool BJ_user_give_integralParameters:@{@"reveive_uid":self.userInfoModel.uid,
|
||||
@"integral":self.jineTF.text,
|
||||
@"last_login_device":[XYUUID uuidForKeychain]}
|
||||
success:^(id response) {
|
||||
// NSString *str = [NSString stringWithFormat:@"给您发了%@金币", self.jineTF.text];
|
||||
// [self startSendCoinMsg:str targetId:C_string(self.userInfoModel.uid) reSendCount:3];
|
||||
|
||||
[self removeFromSuperview];
|
||||
[SVProgressHUD showSuccessWithStatus:response[@"msg"]];
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)startSendCoinMsg:(NSString *)str targetId:(NSString *)targetId reSendCount:(NSInteger)reSendCount {
|
||||
if (reSendCount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *businessID = BussinessID_Hongbao;
|
||||
NSString *text = str;
|
||||
NSDictionary *param = @{@"businessID":businessID, @"text":text};
|
||||
[[V2TIMManager sharedInstance] sendC2CCustomMessage:param.mj_JSONData to:targetId succ:^{
|
||||
NSLog(@"转赠消息发送成功");
|
||||
}fail:^(int code, NSString *msg) {
|
||||
NSLog(@"转赠消息发送失败");
|
||||
//发送失败重新发送
|
||||
[self startSendCoinMsg:str targetId:targetId reSendCount:reSendCount-1];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
167
SweetParty/主类/旧项目依赖(以后调整)/MH_ZhuanZengView.xib
Executable file
167
SweetParty/主类/旧项目依赖(以后调整)/MH_ZhuanZengView.xib
Executable file
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina5_9" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MH_ZhuanZengView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="asB-vB-XLR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</imageView>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VUL-fF-bih">
|
||||
<rect key="frame" x="0.0" y="484" width="375" height="328"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="common_alert_bg" translatesAutoresizingMaskIntoConstraints="NO" id="GaS-OD-Wvh">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="328"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GP1-cu-s7M">
|
||||
<rect key="frame" x="166.33333333333334" y="54" width="42.333333333333343" height="19.333333333333329"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cLg-to-3gJ">
|
||||
<rect key="frame" x="173" y="85.333333333333371" width="29.333333333333343" height="14.333333333333329"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NFT-Ps-7bL">
|
||||
<rect key="frame" x="27" y="123.66666666666663" width="321" height="44"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入转赠金额" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="A0f-eB-zR0">
|
||||
<rect key="frame" x="20" y="0.0" width="281" height="44"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="A0f-eB-zR0" firstAttribute="leading" secondItem="NFT-Ps-7bL" secondAttribute="leading" constant="20" id="6IT-61-ic2"/>
|
||||
<constraint firstAttribute="height" constant="44" id="VE5-LQ-OlK"/>
|
||||
<constraint firstItem="A0f-eB-zR0" firstAttribute="top" secondItem="NFT-Ps-7bL" secondAttribute="top" id="Zhp-n3-N0U"/>
|
||||
<constraint firstAttribute="trailing" secondItem="A0f-eB-zR0" secondAttribute="trailing" constant="20" id="iRX-1o-VKo"/>
|
||||
<constraint firstAttribute="bottom" secondItem="A0f-eB-zR0" secondAttribute="bottom" id="oo3-4S-2Oe"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="22"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="余额" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WVk-QJ-5PS">
|
||||
<rect key="frame" x="179.33333333333334" y="185.66666666666663" width="32.666666666666657" height="19.333333333333343"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ID_normal" translatesAutoresizingMaskIntoConstraints="NO" id="u1v-IS-6Ux">
|
||||
<rect key="frame" x="155" y="85" width="15" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="GSc-0G-Oyl"/>
|
||||
<constraint firstAttribute="width" constant="15" id="ceP-3B-bCW"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lDG-so-fMs">
|
||||
<rect key="frame" x="27" y="227" width="321" height="49"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="49" id="9wA-oF-tND"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
||||
<state key="normal" title="确定">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="24.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="completeMethod:" destination="iN0-l3-epB" eventType="touchUpInside" id="9Fd-zM-uoZ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wallet_jinbi" translatesAutoresizingMaskIntoConstraints="NO" id="q7j-Bh-nOQ">
|
||||
<rect key="frame" x="155.33333333333334" y="186" width="19" height="19"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="lDG-so-fMs" firstAttribute="leading" secondItem="NFT-Ps-7bL" secondAttribute="leading" id="2rv-Cw-yB8"/>
|
||||
<constraint firstAttribute="height" constant="328" id="77l-8T-NuU"/>
|
||||
<constraint firstItem="q7j-Bh-nOQ" firstAttribute="centerY" secondItem="WVk-QJ-5PS" secondAttribute="centerY" id="AHU-ju-gxP"/>
|
||||
<constraint firstItem="GP1-cu-s7M" firstAttribute="top" secondItem="VUL-fF-bih" secondAttribute="top" constant="54" id="FMy-fI-szC"/>
|
||||
<constraint firstItem="NFT-Ps-7bL" firstAttribute="leading" secondItem="VUL-fF-bih" secondAttribute="leading" constant="27" id="G4z-au-u3O"/>
|
||||
<constraint firstItem="NFT-Ps-7bL" firstAttribute="top" secondItem="cLg-to-3gJ" secondAttribute="bottom" constant="24" id="IEo-6J-JZD"/>
|
||||
<constraint firstItem="GaS-OD-Wvh" firstAttribute="leading" secondItem="VUL-fF-bih" secondAttribute="leading" id="Msp-85-mYe"/>
|
||||
<constraint firstItem="lDG-so-fMs" firstAttribute="trailing" secondItem="NFT-Ps-7bL" secondAttribute="trailing" id="N9e-Vl-OJc"/>
|
||||
<constraint firstItem="WVk-QJ-5PS" firstAttribute="leading" secondItem="q7j-Bh-nOQ" secondAttribute="trailing" constant="5" id="PiR-Tj-zgX"/>
|
||||
<constraint firstAttribute="bottom" secondItem="GaS-OD-Wvh" secondAttribute="bottom" id="S6U-V6-NDj"/>
|
||||
<constraint firstItem="cLg-to-3gJ" firstAttribute="leading" secondItem="u1v-IS-6Ux" secondAttribute="trailing" constant="3" id="UkU-Mn-PeJ"/>
|
||||
<constraint firstItem="cLg-to-3gJ" firstAttribute="centerY" secondItem="u1v-IS-6Ux" secondAttribute="centerY" id="VRk-Mp-ShR"/>
|
||||
<constraint firstItem="GaS-OD-Wvh" firstAttribute="top" secondItem="VUL-fF-bih" secondAttribute="top" id="WNe-DY-vno"/>
|
||||
<constraint firstAttribute="trailing" secondItem="GaS-OD-Wvh" secondAttribute="trailing" id="fWD-vj-63P"/>
|
||||
<constraint firstItem="WVk-QJ-5PS" firstAttribute="top" secondItem="NFT-Ps-7bL" secondAttribute="bottom" constant="18" id="jT9-oY-Qde"/>
|
||||
<constraint firstItem="cLg-to-3gJ" firstAttribute="centerX" secondItem="VUL-fF-bih" secondAttribute="centerX" id="okt-2q-5iS"/>
|
||||
<constraint firstItem="WVk-QJ-5PS" firstAttribute="centerX" secondItem="VUL-fF-bih" secondAttribute="centerX" constant="8" id="rFa-bF-EO6"/>
|
||||
<constraint firstItem="lDG-so-fMs" firstAttribute="top" secondItem="WVk-QJ-5PS" secondAttribute="bottom" constant="22" id="uB3-Dz-aSA"/>
|
||||
<constraint firstItem="cLg-to-3gJ" firstAttribute="top" secondItem="GP1-cu-s7M" secondAttribute="bottom" constant="12" id="up5-VC-CIG"/>
|
||||
<constraint firstItem="GP1-cu-s7M" firstAttribute="centerX" secondItem="VUL-fF-bih" secondAttribute="centerX" id="wgR-bi-IFj"/>
|
||||
<constraint firstAttribute="trailing" secondItem="NFT-Ps-7bL" secondAttribute="trailing" constant="27" id="yIr-uq-HBs"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="default_userIcon" translatesAutoresizingMaskIntoConstraints="NO" id="6Vn-iP-i7u">
|
||||
<rect key="frame" x="147.66666666666666" y="444" width="80" height="80"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="80" id="5IA-9s-9Wm"/>
|
||||
<constraint firstAttribute="width" constant="80" id="EFU-Ig-AUh"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="40"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="asB-vB-XLR" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="0JK-aV-PE4"/>
|
||||
<constraint firstItem="VUL-fF-bih" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="D7N-0T-qkM"/>
|
||||
<constraint firstAttribute="bottom" secondItem="asB-vB-XLR" secondAttribute="bottom" id="Exg-nU-htc"/>
|
||||
<constraint firstItem="6Vn-iP-i7u" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="PMI-5Z-xoC"/>
|
||||
<constraint firstItem="asB-vB-XLR" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="S3P-e3-jQP"/>
|
||||
<constraint firstAttribute="bottom" secondItem="VUL-fF-bih" secondAttribute="bottom" id="d6j-jc-dhc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="asB-vB-XLR" secondAttribute="trailing" id="hA4-Na-D1Z"/>
|
||||
<constraint firstItem="VUL-fF-bih" firstAttribute="top" secondItem="6Vn-iP-i7u" secondAttribute="top" constant="40" id="jZ7-Xl-zw5"/>
|
||||
<constraint firstAttribute="trailing" secondItem="VUL-fF-bih" secondAttribute="trailing" id="sNW-l3-16c"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="confirmBtn" destination="lDG-so-fMs" id="FK9-ul-nqB"/>
|
||||
<outlet property="jineTF" destination="A0f-eB-zR0" id="PYr-ob-dsk"/>
|
||||
<outlet property="liangImg" destination="u1v-IS-6Ux" id="uJG-Zy-gJq"/>
|
||||
<outlet property="maskImg" destination="asB-vB-XLR" id="WlQ-b5-js4"/>
|
||||
<outlet property="moneyLab" destination="WVk-QJ-5PS" id="8Xc-r6-4mH"/>
|
||||
<outlet property="nickName" destination="GP1-cu-s7M" id="cEr-7y-l0E"/>
|
||||
<outlet property="userID" destination="cLg-to-3gJ" id="5C7-Fo-82i"/>
|
||||
<outlet property="userIcon" destination="6Vn-iP-i7u" id="3ke-nH-Grm"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-44" y="79.802955665024641"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ID_normal" width="15.5" height="15.5"/>
|
||||
<image name="common_alert_bg" width="375" height="413"/>
|
||||
<image name="default_userIcon" width="90" height="90"/>
|
||||
<image name="wallet_jinbi" width="19" height="19"/>
|
||||
</resources>
|
||||
</document>
|
||||
20
SweetParty/主类/旧项目依赖(以后调整)/MLMaskView.h
Executable file
20
SweetParty/主类/旧项目依赖(以后调整)/MLMaskView.h
Executable file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// MLMaskView.h
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by aa on 2019/5/29.
|
||||
// Copyright © 2019 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BaseView.h"
|
||||
|
||||
@interface MLMaskView : BaseView
|
||||
|
||||
@property (nonatomic , copy) void(^determineClickBlock)(void);
|
||||
@property (nonatomic, copy) void(^leftButtonBlock)(void);
|
||||
@property (weak, nonatomic) IBOutlet UIView *bgView;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *leftButton;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *rightButton;
|
||||
|
||||
- (void)setLeftButtonString:(NSString *)left rightButton:(NSString *)right promptLB:(NSString *)title maskViewH:(CGFloat )maskViewH;
|
||||
@end
|
||||
45
SweetParty/主类/旧项目依赖(以后调整)/MLMaskView.m
Executable file
45
SweetParty/主类/旧项目依赖(以后调整)/MLMaskView.m
Executable file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// MLMaskView.m
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by aa on 2019/5/29.
|
||||
// Copyright © 2019 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MLMaskView.h"
|
||||
|
||||
@interface MLMaskView ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *promptLB;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *maskViewH;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MLMaskView
|
||||
|
||||
- (IBAction)cancelClick:(UIButton *)sender {
|
||||
!_leftButtonBlock ? : _leftButtonBlock();
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
- (IBAction)determineClick:(UIButton *)sender {
|
||||
|
||||
!_determineClickBlock ? : _determineClickBlock();
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
- (void)setLeftButtonString:(NSString *)left rightButton:(NSString *)right promptLB:(NSString *)title maskViewH:(CGFloat )maskViewH{
|
||||
[self.leftButton setTitle:left forState:UIControlStateNormal];
|
||||
[self.rightButton setTitle:right forState:UIControlStateNormal];
|
||||
NSMutableAttributedString *attrString =
|
||||
[[NSMutableAttributedString alloc] initWithString:title];
|
||||
self.promptLB.attributedText = attrString;
|
||||
self.promptLB.textAlignment = NSTextAlignmentCenter;
|
||||
self.maskViewH.constant = maskViewH;
|
||||
[self layoutIfNeeded];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
113
SweetParty/主类/旧项目依赖(以后调整)/MLMaskView.xib
Executable file
113
SweetParty/主类/旧项目依赖(以后调整)/MLMaskView.xib
Executable file
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MLMaskView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view alpha="0.69999999999999996" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gkm-j1-8W7">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5KK-4S-Ap3">
|
||||
<rect key="frame" x="38" y="241" width="299" height="185"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9es-4I-7BK">
|
||||
<rect key="frame" x="0.0" y="127.5" width="299" height="0.5"/>
|
||||
<color key="backgroundColor" red="0.93333333333333335" green="0.93333333333333335" blue="0.93333333333333335" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="0.5" id="RF8-gl-1hF"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Of1-k1-vgG">
|
||||
<rect key="frame" x="149.5" y="128" width="0.5" height="57"/>
|
||||
<color key="backgroundColor" red="0.93333333330000001" green="0.93333333330000001" blue="0.93333333330000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="57" id="gEc-A5-uEw"/>
|
||||
<constraint firstAttribute="width" constant="0.5" id="gM6-VB-9TT"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8oE-Ao-qIE">
|
||||
<rect key="frame" x="0.0" y="128" width="149.5" height="57"/>
|
||||
<state key="normal" title="我再想想">
|
||||
<color key="titleColor" red="0.17255416512489319" green="0.17655402421951294" blue="0.17254871129989624" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="cancelClick:" destination="iN0-l3-epB" eventType="touchUpInside" id="cfv-2j-oyx"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Hx-Iz-0TA">
|
||||
<rect key="frame" x="150" y="128" width="149" height="57"/>
|
||||
<state key="normal" title="确定">
|
||||
<color key="titleColor" red="0.17255398629999999" green="0.1725452542" blue="0.17254927749999999" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="determineClick:" destination="iN0-l3-epB" eventType="touchUpInside" id="52S-Bp-F8k"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="性别一经确认无法修改哦~" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8VY-7k-lo1">
|
||||
<rect key="frame" x="0.0" y="0.0" width="299" height="127.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="8oE-Ao-qIE" firstAttribute="top" secondItem="9es-4I-7BK" secondAttribute="bottom" id="0Zv-qq-rXT"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Of1-k1-vgG" secondAttribute="bottom" id="9Qq-yz-rr5"/>
|
||||
<constraint firstAttribute="bottom" secondItem="8oE-Ao-qIE" secondAttribute="bottom" id="G6G-Z9-zsT"/>
|
||||
<constraint firstAttribute="height" constant="185" id="GRl-Vh-wdQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9es-4I-7BK" secondAttribute="trailing" id="IP8-sI-47e"/>
|
||||
<constraint firstItem="9es-4I-7BK" firstAttribute="top" secondItem="8VY-7k-lo1" secondAttribute="bottom" id="IyK-5d-KZN"/>
|
||||
<constraint firstItem="8VY-7k-lo1" firstAttribute="leading" secondItem="5KK-4S-Ap3" secondAttribute="leading" id="KCh-DW-R7G"/>
|
||||
<constraint firstItem="Of1-k1-vgG" firstAttribute="leading" secondItem="8oE-Ao-qIE" secondAttribute="trailing" id="Kfe-fK-RnC"/>
|
||||
<constraint firstItem="8oE-Ao-qIE" firstAttribute="leading" secondItem="5KK-4S-Ap3" secondAttribute="leading" id="MSp-Oo-wy9"/>
|
||||
<constraint firstItem="Of1-k1-vgG" firstAttribute="top" secondItem="9es-4I-7BK" secondAttribute="bottom" id="Ugg-JZ-0Lw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="4Hx-Iz-0TA" secondAttribute="bottom" id="eVg-X9-Sli"/>
|
||||
<constraint firstItem="Of1-k1-vgG" firstAttribute="centerX" secondItem="8VY-7k-lo1" secondAttribute="centerX" id="g0c-0j-TY0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4Hx-Iz-0TA" secondAttribute="trailing" id="l8R-vN-whv"/>
|
||||
<constraint firstItem="9es-4I-7BK" firstAttribute="leading" secondItem="5KK-4S-Ap3" secondAttribute="leading" id="mAy-B3-6zZ"/>
|
||||
<constraint firstItem="8VY-7k-lo1" firstAttribute="top" secondItem="5KK-4S-Ap3" secondAttribute="top" id="oNW-AB-beF"/>
|
||||
<constraint firstItem="4Hx-Iz-0TA" firstAttribute="leading" secondItem="Of1-k1-vgG" secondAttribute="trailing" id="qN5-hM-wPQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="8VY-7k-lo1" secondAttribute="trailing" id="wTb-dD-7rf"/>
|
||||
<constraint firstItem="4Hx-Iz-0TA" firstAttribute="top" secondItem="9es-4I-7BK" secondAttribute="bottom" id="xgH-NJ-CZi"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="7"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="5KK-4S-Ap3" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="62Q-L6-HE1"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gkm-j1-8W7" secondAttribute="bottom" id="IYw-f9-lCN"/>
|
||||
<constraint firstItem="5KK-4S-Ap3" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="38" id="YLT-CC-fTF"/>
|
||||
<constraint firstItem="gkm-j1-8W7" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="aSe-YB-A81"/>
|
||||
<constraint firstItem="gkm-j1-8W7" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="brk-Gy-Ulj"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gkm-j1-8W7" secondAttribute="trailing" id="sMw-mS-Ben"/>
|
||||
<constraint firstAttribute="trailing" secondItem="5KK-4S-Ap3" secondAttribute="trailing" constant="38" id="zKu-WN-YQc"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="bgView" destination="gkm-j1-8W7" id="gqu-oG-6mQ"/>
|
||||
<outlet property="leftButton" destination="8oE-Ao-qIE" id="bAb-gN-XWm"/>
|
||||
<outlet property="maskViewH" destination="GRl-Vh-wdQ" id="Smq-tb-caK"/>
|
||||
<outlet property="promptLB" destination="8VY-7k-lo1" id="qCv-X7-hyR"/>
|
||||
<outlet property="rightButton" destination="4Hx-Iz-0TA" id="y3z-y1-GMn"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="24.5" y="51.5"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
19
SweetParty/主类/旧项目依赖(以后调整)/RoomSearchView.h
Executable file
19
SweetParty/主类/旧项目依赖(以后调整)/RoomSearchView.h
Executable file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// RoomSearchView.h
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by aa on 2019/7/4.
|
||||
// Copyright © 2019 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BaseView.h"
|
||||
|
||||
@interface RoomSearchView : BaseView
|
||||
|
||||
@property (nonatomic , copy) void(^quDingButtonClickBlock)(NSString *textTF);
|
||||
|
||||
|
||||
@property (nonatomic, strong) UITextField *searchTF;
|
||||
|
||||
|
||||
@end
|
||||
84
SweetParty/主类/旧项目依赖(以后调整)/RoomSearchView.m
Executable file
84
SweetParty/主类/旧项目依赖(以后调整)/RoomSearchView.m
Executable file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// RoomSearchView.m
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by aa on 2019/7/4.
|
||||
// Copyright © 2019 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RoomSearchView.h"
|
||||
|
||||
|
||||
@interface RoomSearchView ()<UITextFieldDelegate>
|
||||
|
||||
|
||||
@property (nonatomic, strong) UIButton *queDingButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomSearchView
|
||||
|
||||
#pragma mark - Intial
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
[self setUpUI];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)quDingButtonClick:(UIButton *)sender{
|
||||
if ([self.searchTF.text isEqualToString:@""]) {
|
||||
[SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"请输入ID"];
|
||||
}else{
|
||||
! self.quDingButtonClickBlock ?: self.quDingButtonClickBlock(self.searchTF.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)setUpUI{
|
||||
[self addSubview:self.searchTF];
|
||||
[self addSubview:self.queDingButton];
|
||||
|
||||
[self.queDingButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self).offset(-12);
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.height.mas_equalTo(30);
|
||||
make.width.mas_equalTo(60);
|
||||
}];
|
||||
|
||||
[self.searchTF mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self).offset(12);
|
||||
make.height.mas_equalTo(35);
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.right.mas_equalTo(self.queDingButton.mas_left).offset(-16);
|
||||
}];
|
||||
|
||||
}
|
||||
- (UITextField *)searchTF{
|
||||
if (!_searchTF) {
|
||||
_searchTF = [ControlCreator createTextField:nil rect:CGRectMake(0, 0, 0, 0) placeholder:@"输入用户ID" placeholderColor:nil text:@"" font:Font(12) color:mainViceColor backguoundColor:MHColorFromHexString(@"#F8F8F8")];
|
||||
_searchTF.delegate = self;
|
||||
_searchTF.layer.masksToBounds = YES;
|
||||
_searchTF.layer.cornerRadius = 17.5;
|
||||
_searchTF.keyboardType = UIKeyboardTypeNumberPad;
|
||||
UIView *leftTFView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 35)];
|
||||
leftTFView.backgroundColor = [UIColor clearColor];
|
||||
_searchTF.leftView = leftTFView;
|
||||
_searchTF.leftViewMode = UITextFieldViewModeAlways;
|
||||
}
|
||||
return _searchTF;
|
||||
}
|
||||
- (UIButton *)queDingButton{
|
||||
if (!_queDingButton) {
|
||||
_queDingButton = [ControlCreator createButton:nil rect:CGRectZero text:@"确定" font:Font(13) color:[UIColor whiteColor] backguoundColor:MLControlsColor imageName:nil target:self action:@selector(quDingButtonClick:)];
|
||||
_queDingButton.layer.masksToBounds = YES;
|
||||
_queDingButton.layer.cornerRadius = 7;
|
||||
}
|
||||
return _queDingButton;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user