75 lines
2.3 KiB
Objective-C
75 lines
2.3 KiB
Objective-C
//
|
|
// LMTixianQianyueViewController.m
|
|
// SweetParty
|
|
//
|
|
// Created by Xmac on 2024/9/12.
|
|
//
|
|
|
|
#import "LMTixianQianyueViewController.h"
|
|
#import <WebKit/WebKit.h>
|
|
|
|
@interface LMTixianQianyueViewController ()<WKNavigationDelegate,WKUIDelegate>
|
|
|
|
@property (strong, nonatomic) WKWebView *webView;
|
|
|
|
|
|
@property (weak, nonatomic) IBOutlet UIButton *confirmButton;
|
|
@property (weak, nonatomic) IBOutlet UIView *webCover;
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topLayout;
|
|
|
|
@end
|
|
|
|
@implementation LMTixianQianyueViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self setupUI];
|
|
}
|
|
|
|
- (void)setupUI
|
|
{
|
|
self.confirmButton.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(APPW-29*2, 48) direction:(FXGradientChangeDirectionHorizontal) startColor:mainLightColor endColor:mainDeepColor];
|
|
|
|
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;
|
|
|
|
_webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, APPW, APPH) configuration:configuration];
|
|
_webView.navigationDelegate = self;
|
|
_webView.UIDelegate = self;
|
|
_webView.backgroundColor = kClearColor;
|
|
_webView.scrollView.backgroundColor = kClearColor;
|
|
[self.webCover addSubview:_webView];
|
|
NSURL *url = [NSURL URLWithString:self.url];
|
|
[_webView loadRequest:[NSURLRequest requestWithURL:url]];
|
|
|
|
[_webView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(_webCover);
|
|
}];
|
|
}
|
|
|
|
|
|
- (IBAction)confirmButtonClick:(UIButton *)sender {
|
|
NSDictionary *params = @{};
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"api/yun/submit_sign" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|
NSInteger code = [responseDic safeIntForKey:@"code"];
|
|
if (code==200){
|
|
[HelpPageDefine showMessage:@"成功"];
|
|
}
|
|
|
|
} Failure:^(id _Nonnull errorData) {
|
|
|
|
}];
|
|
}
|
|
|
|
- (IBAction)backMethod:(UIButton *)sender {
|
|
[self dismissViewControllerAnimated:YES completion:^{
|
|
|
|
}];
|
|
}
|
|
|
|
@end
|