Browse Source

bug修改

吴彦祖 10 months ago
parent
commit
2d6ab59dd1

BIN
ADHTuanCan.xcworkspace/xcuserdata/aodeheng.xcuserdatad/UserInterfaceState.xcuserstate


+ 15 - 2
ADHTuanCan/Class/Config/LanguagesUtil.swift

@@ -17,11 +17,17 @@ class LanguagesUtil: NSObject {
         let languanges : [String] = UserDefaults.standard.object(forKey: "AppleLanguages") as! [String]
         let preferredLanguage = languanges.first
         
-        if preferredLanguage == "zh-Hans-CN" || preferredLanguage == "zh-Hant-CN" || preferredLanguage == "zh-Hant-HK" || preferredLanguage == "zh-Hant-MO" || preferredLanguage == "zh-Hant-TW" || preferredLanguage == "zh-Hans-US"{
+//        if preferredLanguage == "zh-Hans-CN" || preferredLanguage == "zh-Hant-CN" || preferredLanguage == "zh-Hant-HK" || preferredLanguage == "zh-Hant-MO" || preferredLanguage == "zh-Hant-TW" || preferredLanguage == "zh-Hans-US"{
+//            return Ctext ?? ""
+//        }else{
+//            return Etext ?? ""
+//        }
+        if preferredLanguage!.contains("zh"){
             return Ctext ?? ""
         }else{
             return Etext ?? ""
         }
+        
     }
     
     class func isEnLanguage() -> Bool{
@@ -29,10 +35,17 @@ class LanguagesUtil: NSObject {
         let languanges : [String] = UserDefaults.standard.object(forKey: "AppleLanguages") as! [String]
         let preferredLanguage = languanges.first
         
-        if preferredLanguage == "zh-Hans-CN" || preferredLanguage == "zh-Hant-CN" || preferredLanguage == "zh-Hant-HK" || preferredLanguage == "zh-Hant-MO" || preferredLanguage == "zh-Hant-TW" || preferredLanguage == "zh-Hans-US"{
+        
+        if preferredLanguage!.contains("zh"){
             return false
         }else{
             return true
         }
+        
+//        if preferredLanguage == "zh-Hans-CN" || preferredLanguage == "zh-Hant-CN" || preferredLanguage == "zh-Hant-HK" || preferredLanguage == "zh-Hant-MO" || preferredLanguage == "zh-Hant-TW" || preferredLanguage == "zh-Hans-US"{
+//            return false
+//        }else{
+//            return true
+//        }
     }
 }

+ 9 - 2
ADHTuanCan/Class/登录/注册/RegisteViewController.swift

@@ -8,6 +8,7 @@
 import UIKit
 import RxSwift
 import RxCocoa
+import SwiftyUserDefaults
 
 class RegisteViewController: ADHBaseVC {
     
@@ -63,7 +64,7 @@ class RegisteViewController: ADHBaseVC {
         }
         
         accountField.inputFigure(maxLength: 20) {
-            self.phone = "\(self.areaCode ?? "")\(self.accountField.text ?? "")"
+            self.phone = "\(self.accountField.text ?? "")"
         }
         
         inviteField.inputText(maxLength: 20) {
@@ -101,7 +102,7 @@ class RegisteViewController: ADHBaseVC {
         vc.backCountryCode = { [weak self] country, code in
             self?.areaBtn.setTitle("+\(code ?? "")", for: .normal)
             self?.areaCode = code
-            self?.phone = "\(self?.areaCode ?? "")\(self?.accountField.text ?? "")"
+            self?.phone = "\(self?.accountField.text ?? "")"
         }
         self.navigationController?.pushViewController(vc, animated: true)
     }
@@ -130,6 +131,11 @@ class RegisteViewController: ADHBaseVC {
         }
         
         
+        if areaCode?.count ?? 0 == 0{
+            self.hud.showWarning(LanguagesUtil.createTextBy(Ctext: "请选择地区", Etext: "Please select a Area"))
+            return
+        }
+        
         if phone?.count ?? 0 == 0{
             self.hud.showWarning(LanguagesUtil.createTextBy(Ctext: "请输入手机号", Etext: "Please input your phone number"))
             return
@@ -153,6 +159,7 @@ class RegisteViewController: ADHBaseVC {
             vc.password = self.pswStr
             vc.inviteCode = self.inviteNum
             vc.areaCode = self.areaCode
+            Defaults[\.areaCode] = self.areaCode
             self.navigationController?.pushViewController(vc, animated: true)
             return
         }