Sfoglia il codice sorgente

【会员系统】补充"登录界面,邮箱可否记住上一次登录的账户邮箱"

wanjun 22 ore fa
parent
commit
201ca577e4

+ 6 - 0
PDF Office/PDF Master/MemberCenter/View/KMSignUpView.swift

@@ -166,6 +166,12 @@ class KMSignUpView: KMBaseXibView {
         passwordTextField.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
         passwordTextField1.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
         privacyCheckButton.toolTip = NSLocalizedString("Please agree and check the agreement first.", tableName: "MemberCenterLocalizable", comment: "")
+        let email = UserDefaults.standard.value(forKey: "MemberSystemAccount")
+        if email is String {
+            if (email as! String).count > 0 {
+                viewModel.email = email as! String
+            }
+        }
         emailTextField.stringValue = viewModel.email
         verifficationTextField.stringValue = viewModel.verificationCode
         passwordTextField.stringValue = viewModel.password

+ 2 - 2
PDF Office/PDF Master/MemberCenter/ViewModel/KMSignUpViewModel.swift

@@ -277,12 +277,12 @@ class KMSignUpViewModel: ObservableObject {
                 if self.stayState {
                     UserDefaults.standard.setValue(refresh_token, forKey: "MemberRefreshToken")
                     UserDefaults.standard.setValue(access_token, forKey: "MemberAccessToken")
-                    UserDefaults.standard.synchronize()
                 } else {
                     UserDefaults.standard.setValue("", forKey: "MemberRefreshToken")
                     UserDefaults.standard.setValue("", forKey: "MemberAccessToken")
-                    UserDefaults.standard.synchronize()
                 }
+                UserDefaults.standard.setValue(self.email, forKey: "MemberSystemAccount")
+                UserDefaults.standard.synchronize()
                 KMMemberInfo.shared.refresh_token = refresh_token!
                 KMMemberInfo.shared.access_token = access_token!
                 KMMemberInfo.shared.token_type = token_type!