Explorar el Código

非机构老师扫码错误提示

Steven hace 6 meses
padre
commit
2256dccf0e

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/xcshareddata/xcschemes/KulexiuForTeacher.xcscheme

@@ -52,7 +52,7 @@
       </Testables>
       </Testables>
    </TestAction>
    </TestAction>
    <LaunchAction
    <LaunchAction
-      buildConfiguration = "TEST"
+      buildConfiguration = "DEV"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"
       launchStyle = "0"
@@ -93,7 +93,7 @@
       buildConfiguration = "Debug">
       buildConfiguration = "Debug">
    </AnalyzeAction>
    </AnalyzeAction>
    <ArchiveAction
    <ArchiveAction
-      buildConfiguration = "Release"
+      buildConfiguration = "DEV"
       revealArchiveInOrganizer = "YES">
       revealArchiveInOrganizer = "YES">
    </ArchiveAction>
    </ArchiveAction>
 </Scheme>
 </Scheme>

+ 16 - 12
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.m

@@ -148,19 +148,23 @@
         } successBlock:^(id response) {
         } successBlock:^(id response) {
             
             
             dic = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves error:nil];
             dic = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves error:nil];
-            
-            if ([dic ks_integerValueForKey:@"code"] == 403) { // token验证失败
-                [self logOutWithType:YES];
-                [dic setValue:@"" forKey:@"msg"];
-                success(dic);
-                return;
-            }
-            else if ([dic ks_integerValueForKey:@"code"] == 401) {
-                [self logOutWithType:NO];
-                [dic setValue:@"" forKey:@"msg"];
-                success(dic);
-                return;
+            // open  不需要校验失效
+            BOOL isOpenUrl = [myUrl hasPrefix:OPEN_URL];
+            if (isOpenUrl == NO) {
+                if ([dic ks_integerValueForKey:@"code"] == 403) { // token验证失败
+                    [self logOutWithType:YES];
+                    [dic setValue:@"" forKey:@"msg"];
+                    success(dic);
+                    return;
+                }
+                else if ([dic ks_integerValueForKey:@"code"] == 401) {
+                    [self logOutWithType:NO];
+                    [dic setValue:@"" forKey:@"msg"];
+                    success(dic);
+                    return;
+                }
             }
             }
+            
             success(dic);
             success(dic);
             return ;
             return ;
             
             

+ 5 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/ScanView/Controller/KSScanViewController.m

@@ -164,6 +164,11 @@
             ctrl.failType = SCANFAIL_EXPIRED;
             ctrl.failType = SCANFAIL_EXPIRED;
             [self.navigationController pushViewController:ctrl animated:YES];
             [self.navigationController pushViewController:ctrl animated:YES];
         }
         }
+        else if ([dic ks_integerValueForKey:@"code"] == 5445) { // 不支持授权
+            ScanFailViewController *ctrl = [[ScanFailViewController alloc] init];
+            ctrl.failType = SCANFAIL_UNSUPPORAUTH;
+            [self.navigationController pushViewController:ctrl animated:YES];
+        }
         else {
         else {
             [LOADING_MANAGER KSShowMsg:MESSAGEKEY promptCompletion:^{
             [LOADING_MANAGER KSShowMsg:MESSAGEKEY promptCompletion:^{
                 [self startScan];
                 [self startScan];

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/ScanView/Controller/ScanFailViewController.h

@@ -11,6 +11,7 @@ typedef NS_ENUM(NSInteger, SCANFAIL) {
     SCANFAIL_EXPIRED,     // 过期
     SCANFAIL_EXPIRED,     // 过期
     SCANFAIL_AUTHFAILED,  // 授权失败
     SCANFAIL_AUTHFAILED,  // 授权失败
     SCANFAIL_UNRECOGNIZE, // 无法识别
     SCANFAIL_UNRECOGNIZE, // 无法识别
+    SCANFAIL_UNSUPPORAUTH, // 不支持授权
 };
 };
 NS_ASSUME_NONNULL_BEGIN
 NS_ASSUME_NONNULL_BEGIN
 
 

+ 14 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/ScanView/Controller/ScanFailViewController.m

@@ -50,6 +50,13 @@
         desc = @"授权失败,请重新扫码授权";
         desc = @"授权失败,请重新扫码授权";
         headTitle = @"授权登录";
         headTitle = @"授权登录";
     }
     }
+    else if (self.failType == SCANFAIL_UNSUPPORAUTH) { // 不支持授权
+        imageName = @"scan_authError";
+        title = @"授权失败";
+        desc = @"";
+        headTitle = @"授权登录";
+        [self addNoSupportAttrDesc];
+    }
     else if (self.failType == SCANFAIL_UNRECOGNIZE) { // 无法识别
     else if (self.failType == SCANFAIL_UNRECOGNIZE) { // 无法识别
         imageName = @"scan_codeExpired";
         imageName = @"scan_codeExpired";
         title = @"无法识别";
         title = @"无法识别";
@@ -62,6 +69,13 @@
     [self.bodyView configWithImageName:imageName title:title desc:desc];
     [self.bodyView configWithImageName:imageName title:title desc:desc];
 }
 }
 
 
+- (void)addNoSupportAttrDesc {
+    NSString *tipsMsg = @"您的账号暂不支持登录「乐教通」";
+    NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:tipsMsg attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16.0f], NSForegroundColorAttributeName:HexRGB(0x777777)}];
+    [attrs addAttributes:@{NSForegroundColorAttributeName:THEMECOLOR} range:[tipsMsg rangeOfString:@"「乐教通」"]];
+    [self.bodyView configAttrDesc:attrs];
+}
+
 - (void)backAction {
 - (void)backAction {
     [self.navigationController popToRootViewControllerAnimated:YES];
     [self.navigationController popToRootViewControllerAnimated:YES];
 }
 }

+ 3 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/ScanView/Controller/ScanLoginViewController.m

@@ -61,6 +61,9 @@
                 if ([dic ks_integerValueForKey:@"code"] == 5440) { // 过期
                 if ([dic ks_integerValueForKey:@"code"] == 5440) { // 过期
                     ctrl.failType = SCANFAIL_EXPIRED;
                     ctrl.failType = SCANFAIL_EXPIRED;
                 }
                 }
+                else if ([dic ks_integerValueForKey:@"code"] == 5445) { // 不支持授权
+                    ctrl.failType = SCANFAIL_UNSUPPORAUTH;
+                }
                 else {
                 else {
                     ctrl.failType = SCANFAIL_AUTHFAILED;
                     ctrl.failType = SCANFAIL_AUTHFAILED;
                 }
                 }

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/ScanView/View/ScanFailBodyView.h

@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 
 - (void)configWithImageName:(NSString *)imgName title:(NSString *)title desc:(NSString *)desc;
 - (void)configWithImageName:(NSString *)imgName title:(NSString *)title desc:(NSString *)desc;
 
 
+- (void)configAttrDesc:(NSMutableAttributedString *)descAttr;
+
 @end
 @end
 
 
 NS_ASSUME_NONNULL_END
 NS_ASSUME_NONNULL_END

+ 11 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Home/ScanView/View/ScanFailBodyView.m

@@ -43,8 +43,17 @@
 
 
 - (void)configWithImageName:(NSString *)imgName title:(NSString *)title desc:(NSString *)desc {
 - (void)configWithImageName:(NSString *)imgName title:(NSString *)title desc:(NSString *)desc {
     [self.imageView setImage:[UIImage imageNamed:imgName]];
     [self.imageView setImage:[UIImage imageNamed:imgName]];
-    self.errorTitle.text = title;
-    self.descLabel.text = desc;
+    if (![NSString isEmptyString:title]) {
+        self.errorTitle.text = title;
+    }
+    if (![NSString isEmptyString:desc]) {
+        self.descLabel.text = desc;
+
+    }
+}
+
+- (void)configAttrDesc:(NSMutableAttributedString *)descAttr {
+    self.descLabel.attributedText = descAttr;
 }
 }
 
 
 - (IBAction)backScan:(id)sender {
 - (IBAction)backScan:(id)sender {