1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- //
- // ScanLoginViewController.m
- // GuanYueTeamTeacher
- //
- // Created by 王智 on 2024/3/12.
- //
- #import "ScanLoginViewController.h"
- #import "ScanLoginBodyView.h"
- #import "ScanFailViewController.h"
- @interface ScanLoginViewController ()
- @property (nonatomic, strong) ScanLoginBodyView *bodyView;
- @end
- @implementation ScanLoginViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self allocTitle:@"授权登录"];
- [self configUI];
- }
- - (void)configUI {
- [self.scrollView removeFromSuperview];
- [self.view addSubview:self.bodyView];
- [self.bodyView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.top.bottom.mas_equalTo(self.view);
- }];
- }
- - (ScanLoginBodyView *)bodyView {
- if (!_bodyView) {
- _bodyView = [ScanLoginBodyView shareInstance];
- MJWeakSelf;
- [_bodyView authActionCallback:^(BOOL isAuth) {
- [weakSelf authAction:isAuth];
- }];
- }
- return _bodyView;
- }
- - (void)authAction:(BOOL)isAuth {
- if (isAuth) {
- [LOADING_MANAGER showCustomLoading:@"登录中.."];
- [KSNetworkingManager verifyQrcode:KS_POST uuid:self.uuid success:^(NSDictionary * _Nonnull dic) {
- [LOADING_MANAGER removeCustomLoading];
- if ([dic ks_integerValueForKey:@"code"] == 200) {
- [LOADING_MANAGER KSShowMsg:@"授权成功" promptCompletion:^{
- [self.navigationController popToRootViewControllerAnimated:YES];
- }];
- }
- else {
- ScanFailViewController *ctrl = [[ScanFailViewController alloc] init];
- if ([dic ks_integerValueForKey:@"code"] == 5440) { // 过期
- ctrl.failType = SCANFAIL_EXPIRED;
- }
- else {
- ctrl.failType = SCANFAIL_AUTHFAILED;
- }
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- } faliure:^(NSError * _Nonnull error) {
- [LOADING_MANAGER removeCustomLoading];
-
- }];
- }
- else {
- [self.navigationController popToRootViewControllerAnimated:YES];
- }
- }
- - (void)backAction {
- [self.navigationController popToRootViewControllerAnimated:YES];
- }
- /*
- #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.
- }
- */
- @end
|