Forráskód Böngészése

1、国家区号的选择与封装。
2、登录注册忘记密码修改密码相关页面的修改与接口的调试

liukai 2 hete
szülő
commit
b86dee65e8
37 módosított fájl, 542 hozzáadás és 150 törlés
  1. 32 11
      packages/cpt_auth/lib/modules/auth_login/auth_login_page.dart
  2. 5 2
      packages/cpt_auth/lib/modules/auth_login/auth_login_state.dart
  3. 8 2
      packages/cpt_auth/lib/modules/auth_login/auth_login_view_model.dart
  4. 18 16
      packages/cpt_auth/lib/modules/forgot_input/forgot_input_page.dart
  5. 20 16
      packages/cpt_auth/lib/modules/forgot_input/forgot_input_state.dart
  6. 8 2
      packages/cpt_auth/lib/modules/forgot_input/forgot_input_view_model.dart
  7. 1 1
      packages/cpt_auth/lib/modules/forgot_verify/forgot_verify_page.dart
  8. 4 4
      packages/cpt_auth/lib/modules/forgot_verify/forgot_verify_view_model.dart
  9. 18 17
      packages/cpt_auth/lib/modules/sign_up/sign_up_page.dart
  10. 5 1
      packages/cpt_auth/lib/modules/sign_up/sign_up_state.dart
  11. 8 1
      packages/cpt_auth/lib/modules/sign_up/sign_up_view_model.dart
  12. 6 6
      packages/cpt_auth/lib/modules/sing_up_verify/sign_up_verify_page.dart
  13. 8 9
      packages/cpt_auth/lib/modules/sing_up_verify/sign_up_verify_view_model.dart
  14. 1 1
      packages/cpt_auth/lib/router/page/auth_page_router.gr.dart
  15. 30 30
      packages/cpt_profile/lib/modules/change_mobile/change_mobile_page.dart
  16. 6 0
      packages/cpt_profile/lib/modules/change_mobile/change_mobile_state.dart
  17. 12 7
      packages/cpt_profile/lib/modules/change_mobile/change_mobile_view_model.dart
  18. 16 15
      packages/cpt_profile/lib/modules/reset_password/reset_password_page.dart
  19. 1 1
      packages/cpt_profile/lib/modules/reset_password/reset_password_view_model.dart
  20. 1 1
      packages/cpt_rewards/lib/modules/rewards_transaction/rewards_transaction_page.dart
  21. 12 4
      packages/cs_domain/lib/repository/auth_repository.dart
  22. 0 3
      packages/cs_plugin_basic/lib/constants/app_constant.dart
  23. 170 0
      packages/cs_plugin_basic/lib/dialog/country_code_selecter.dart
  24. 1 0
      packages/cs_plugin_platform/lib/engine/dialog/dialog_engine.dart
  25. BIN
      packages/cs_resources/assets/auth/aodaliya.webp
  26. BIN
      packages/cs_resources/assets/auth/feilvbing.webp
  27. BIN
      packages/cs_resources/assets/auth/malaixiya.webp
  28. BIN
      packages/cs_resources/assets/auth/meiguo.webp
  29. BIN
      packages/cs_resources/assets/auth/taiguo.webp
  30. BIN
      packages/cs_resources/assets/auth/xianggang.webp
  31. BIN
      packages/cs_resources/assets/auth/xinjiapo.webp
  32. BIN
      packages/cs_resources/assets/auth/yindunixiya.png
  33. BIN
      packages/cs_resources/assets/auth/yinguo.webp
  34. BIN
      packages/cs_resources/assets/auth/zhongguo.webp
  35. 10 0
      packages/cs_resources/lib/generated/assets.dart
  36. 140 0
      packages/cs_shared/lib/utils/util.dart
  37. 1 0
      packages/cs_widgets/pubspec.yaml

+ 32 - 11
packages/cpt_auth/lib/modules/auth_login/auth_login_page.dart

@@ -6,6 +6,7 @@ import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:plugin_basic/dialog/country_code_selecter.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_appbar.dart';
@@ -72,16 +73,35 @@ class AuthLoginPage extends HookConsumerWidget {
               ).marginOnly(top: 45, bottom: 45),
 
               // 登录表单 - 账号
-              _buildInputLayout(
-                context,
-                state,
-                "account",
-                textInputAction: TextInputAction.next,
-                errorText: state.accountErrorText,
-                onSubmit: (formKey, value) {
-                  state.formData[formKey]!['focusNode'].unfocus();
-                  FocusScope.of(context).requestFocus(state.formData['password']!['focusNode']);
-                },
+              Row(
+                mainAxisSize: MainAxisSize.max,
+                crossAxisAlignment: CrossAxisAlignment.center,
+                children: [
+                  //封装的国家选择控件
+                  CountryCodeSelector(
+                    onChanged: (countryCode) {
+                      viewModel.saveCountryCode(countryCode);
+                    },
+                  ).marginOnly(left: 15),
+
+                  //电话输入框
+                  _buildInputLayout(
+                    context,
+                    state,
+                    "account",
+                    fillBGColor: Colors.transparent,
+                    textInputType: TextInputType.number,
+                    textInputAction: TextInputAction.done,
+                    errorText: state.accountErrorText,
+                    onSubmit: (formKey, value) {
+                      state.formData[formKey]!['focusNode'].unfocus();
+                      FocusScope.of(context).requestFocus(state.formData['password']!['focusNode']);
+                    },
+                  ).expanded(),
+                ],
+              ).decorated(
+                color: context.appColors.authFiledBG,
+                borderRadius: BorderRadius.circular(5.0),
               ),
 
               // 登录表单 - 密码
@@ -201,6 +221,7 @@ class AuthLoginPage extends HookConsumerWidget {
     Widget? rightWidget, //右侧的布局
     TextInputType textInputType = TextInputType.text,
     String? errorText,
+    Color? fillBGColor,
     bool obscureText = false,
     TextInputAction textInputAction = TextInputAction.done,
     Function? onSubmit,
@@ -208,7 +229,7 @@ class AuthLoginPage extends HookConsumerWidget {
     return IgnoreKeyboardDismiss(
       child: MyTextField(
         key,
-        fillBackgroundColor: context.appColors.authFiledBG,
+        fillBackgroundColor: fillBGColor ?? context.appColors.authFiledBG,
         state.formData[key]!['value'],
         hintText: state.formData[key]!['hintText'],
         hintStyle: TextStyle(

+ 5 - 2
packages/cpt_auth/lib/modules/auth_login/auth_login_state.dart

@@ -12,6 +12,8 @@ class LoginState {
   String? accountErrorText;
   String? passwordErrorText;
 
+  String? countryCode;
+
   //是否明文展示密码
   bool pwdVisibility;
 
@@ -29,6 +31,7 @@ class LoginState {
     this.pwdVisibility = false,
     this.isLoginBtnEnable = false,
     this.isAgreeTerms = false,
+    this.countryCode,
   }) : formData = formData ??
             {
               'account': {
@@ -55,6 +58,7 @@ class LoginState {
     bool? pwdVisibility,
     bool? isLoginBtnEnable,
     bool? isAgreeTerms,
+    String? countryCode,
   }) {
     return LoginState(
       formData: this.formData,
@@ -63,8 +67,7 @@ class LoginState {
       pwdVisibility: pwdVisibility ?? this.pwdVisibility,
       isLoginBtnEnable: isLoginBtnEnable ?? this.isLoginBtnEnable,
       isAgreeTerms: isAgreeTerms ?? this.isLoginBtnEnable,
+      countryCode: countryCode ?? this.countryCode,
     );
   }
-
-
 }

+ 8 - 2
packages/cpt_auth/lib/modules/auth_login/auth_login_view_model.dart

@@ -53,7 +53,7 @@ class AuthLoginViewModel extends _$AuthLoginViewModel {
     Log.d('当前待提交的 账号:$account password:$password');
 
     if (Utils.isEmpty(account)) {
-      state = state.copyWith(accountErrorText: "Phone/Email cannot be empty!");
+      state = state.copyWith(accountErrorText: "Phone cannot be empty!");
       return;
     }
 
@@ -62,7 +62,7 @@ class AuthLoginViewModel extends _$AuthLoginViewModel {
       return;
     }
 
-    final result = await authRepository.authLogin(AppConstant.countryCode + account, password);
+    final result = await authRepository.authLogin("${state.countryCode}$account", password);
 
     //请求成功去首页
     if (result.isSuccess) {
@@ -141,4 +141,10 @@ class AuthLoginViewModel extends _$AuthLoginViewModel {
     passwordController.dispose();
     Log.d("LoginViewModel 销毁 onDispose");
   }
+
+  //保存当前选择的国家区号
+  void saveCountryCode(String? countryCode) {
+    state = state.copyWith(countryCode: countryCode);
+    Log.d("saveCountryCode:${state.countryCode}");
+  }
 }

+ 18 - 16
packages/cpt_auth/lib/modules/forgot_input/forgot_input_page.dart

@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_appbar.dart';
 import 'package:widgets/my_button.dart';
@@ -13,7 +14,7 @@ import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_field.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
-
+import 'package:plugin_basic/dialog/country_code_selecter.dart';
 import '../../router/page/auth_page_router.dart';
 import 'forgot_input_state.dart';
 import 'forgot_input_view_model.dart';
@@ -84,24 +85,19 @@ class ForgotInputPage extends HookConsumerWidget {
                 mainAxisSize: MainAxisSize.max,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: [
-                  const MyAssetImage(
-                    Assets.authCountrySg,
-                    width: 45,
-                    height: 30,
-                  ),
-                  MyTextView(
-                    "+65",
-                    textColor: context.appColors.textBlack,
-                    fontSize: 18.5,
-                    marginLeft: 15,
-                    marginRight: 12,
-                    isFontMedium: true,
-                  ),
+                  //封装的国家选择控件
+                  CountryCodeSelector(
+                    onChanged: (countryCode) {
+                     viewModel.saveCountryCode(countryCode);
+                    },
+                  ).marginOnly(left: 15),
+
                   //电话输入框
                   _buildInputLayout(
                     context,
                     state,
                     "phone",
+                    fillBGColor: Colors.transparent,
                     textInputType: TextInputType.number,
                     textInputAction: TextInputAction.done,
                     errorText: state.phoneErrorText,
@@ -111,7 +107,12 @@ class ForgotInputPage extends HookConsumerWidget {
                     },
                   ).expanded(),
                 ],
-              ).marginOnly(top: 15),
+              )
+                  .decorated(
+                    color: context.appColors.authFiledBG,
+                    borderRadius: BorderRadius.circular(5.0),
+                  )
+                  .marginOnly(top: 15),
 
               MyButton(
                 onPressed: viewModel.submitInput,
@@ -142,13 +143,14 @@ class ForgotInputPage extends HookConsumerWidget {
     TextInputType textInputType = TextInputType.text,
     String? errorText,
     bool obscureText = false,
+    Color? fillBGColor,
     TextInputAction textInputAction = TextInputAction.done,
     Function? onSubmit,
   }) {
     return IgnoreKeyboardDismiss(
       child: MyTextField(
         key,
-        fillBackgroundColor: context.appColors.authFiledBG,
+        fillBackgroundColor: fillBGColor ?? context.appColors.authFiledBG,
         state.formData[key]!['value'],
         hintText: state.formData[key]!['hintText'],
         hintStyle: TextStyle(

+ 20 - 16
packages/cpt_auth/lib/modules/forgot_input/forgot_input_state.dart

@@ -12,6 +12,7 @@ class ForgotInputState {
   String? emailErrorText;
   String? phoneErrorText;
 
+  String? countryCode; //用户选择的区号
 
   // ===================================  Begin  ↓  ===================================
 
@@ -19,32 +20,35 @@ class ForgotInputState {
     Map<String, Map<String, dynamic>>? formData,
     this.emailErrorText,
     this.phoneErrorText,
+    this.countryCode,
   }) : formData = formData ??
-      {
-        'email': {
-          'value': '',
-          'controller': TextEditingController(),
-          'hintText': S.current.email,
-          'focusNode': FocusNode(),
-          'obsecure': false,
-        },
-        'phone': {
-          'value': '',
-          'controller': TextEditingController(),
-          'hintText': S.current.mobile_phone,
-          'focusNode': FocusNode(),
-          'obsecure': false,
-        },
-      };
+            {
+              'email': {
+                'value': '',
+                'controller': TextEditingController(),
+                'hintText': S.current.email,
+                'focusNode': FocusNode(),
+                'obsecure': false,
+              },
+              'phone': {
+                'value': '',
+                'controller': TextEditingController(),
+                'hintText': S.current.mobile_phone,
+                'focusNode': FocusNode(),
+                'obsecure': false,
+              },
+            };
 
   ForgotInputState copyWith({
     String? emailErrorText,
     String? phoneErrorText,
+    String? countryCode,
   }) {
     return ForgotInputState(
       formData: this.formData,
       emailErrorText: emailErrorText,
       phoneErrorText: phoneErrorText,
+      countryCode: countryCode ?? this.countryCode,
     );
   }
 }

+ 8 - 2
packages/cpt_auth/lib/modules/forgot_input/forgot_input_view_model.dart

@@ -36,14 +36,14 @@ class ForgotInputViewModel extends _$ForgotInputViewModel {
     final email = emailController.text;
     final phone = phoneController.text;
 
-    Log.d('当前待提交的 邮箱:${email} 电话:${phone}');
+    Log.d('当前待提交的 邮箱:${email} 电话:${phone} 最终的电话:${state.countryCode}$phone');
 
     if (Utils.isEmpty(phone)) {
       state = state.copyWith(phoneErrorText: "Phone cannot be empty!");
       return;
     }
 
-    ForgotVerifyPage.startInstance(phone: phone);
+    ForgotVerifyPage.startInstance(phone: "${state.countryCode}$phone");
   }
 
   //初始化监听
@@ -75,4 +75,10 @@ class ForgotInputViewModel extends _$ForgotInputViewModel {
     Log.d("ForgotInputViewModel 销毁 onDispose");
   }
 
+  //保存当前选择的国家区号
+  void saveCountryCode(String? countryCode) {
+    state = state.copyWith(countryCode: countryCode);
+    Log.d("saveCountryCode:${state.countryCode}");
+  }
+
 }

+ 1 - 1
packages/cpt_auth/lib/modules/forgot_verify/forgot_verify_page.dart

@@ -68,7 +68,7 @@ class ForgotVerifyPage extends HookConsumerWidget {
               ),
 
               MyTextView(
-                "+${AppConstant.countryCode} ${phone ?? "-"}",
+                phone ?? "-",
                 fontSize: 23,
                 marginBottom: 23,
                 isFontMedium: true,

+ 4 - 4
packages/cpt_auth/lib/modules/forgot_verify/forgot_verify_view_model.dart

@@ -86,8 +86,8 @@ class ForgotVerifyViewModel extends _$ForgotVerifyViewModel with DioCancelableMi
     //执行密码登录
     final result = await _authRepository.forgotPassword(
       smsCode: code,
-      countryCode: AppConstant.countryCode,
-      phone: phone,
+      countryCode: Utils.getMobileCode(phone ?? ""),
+      phone: Utils.getRealMobile(phone ?? ""),
       password: password,
       confirmPassword: confirmPassword,
       cancelToken: cancelToken,
@@ -136,8 +136,8 @@ class ForgotVerifyViewModel extends _$ForgotVerifyViewModel with DioCancelableMi
   /// 调用接口发送短信验证码
   void sendSMS(String phone, String? key, String? code) async {
     final result = await _authRepository.sendSMS(
-      countryCode: AppConstant.countryCode,
-      phone: phone,
+      countryCode: Utils.getMobileCode(phone ?? ""),
+      phone: Utils.getRealMobile(phone ?? ""),
       captchaKey: key,
       captchaValue: code,
       cancelToken: cancelToken,

+ 18 - 17
packages/cpt_auth/lib/modules/sign_up/sign_up_page.dart

@@ -6,13 +6,13 @@ import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:plugin_basic/dialog/country_code_selecter.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_appbar.dart';
 import 'package:widgets/my_button.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_field.dart';
-import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
 
 import '../../router/page/auth_page_router.dart';
@@ -105,26 +105,21 @@ class SignUpPage extends HookConsumerWidget {
                 mainAxisSize: MainAxisSize.max,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: [
-                  const MyAssetImage(
-                    Assets.authCountrySg,
-                    width: 45,
-                    height: 30,
-                  ),
-                  MyTextView(
-                    "+65",
-                    textColor: context.appColors.textBlack,
-                    fontSize: 18.5,
-                    marginLeft: 15,
-                    marginRight: 12,
-                    isFontMedium: true,
-                  ),
+                  //封装的国家选择控件
+                  CountryCodeSelector(
+                    onChanged: (countryCode) {
+                      viewModel.saveCountryCode(countryCode);
+                    },
+                  ).marginOnly(left: 15),
+
                   //电话输入框
                   _buildInputLayout(
                     context,
                     state,
                     "phone",
+                    fillBGColor: Colors.transparent,
                     textInputType: TextInputType.number,
-                    textInputAction: TextInputAction.next,
+                    textInputAction: TextInputAction.done,
                     errorText: state.phoneErrorText,
                     onSubmit: (formKey, value) {
                       state.formData[formKey]!['focusNode'].unfocus();
@@ -132,7 +127,12 @@ class SignUpPage extends HookConsumerWidget {
                     },
                   ).expanded(),
                 ],
-              ).marginOnly(top: 15),
+              )
+                  .decorated(
+                color: context.appColors.authFiledBG,
+                borderRadius: BorderRadius.circular(5.0),
+              )
+                  .marginOnly(top: 15),
 
               // 表单 - 重置密码
               _buildInputLayout(
@@ -259,6 +259,7 @@ class SignUpPage extends HookConsumerWidget {
     Widget? rightWidget, //右侧的布局
     TextInputType textInputType = TextInputType.text,
     String? errorText,
+    Color? fillBGColor,
     bool obscureText = false,
     TextInputAction textInputAction = TextInputAction.done,
     Function? onSubmit,
@@ -266,7 +267,7 @@ class SignUpPage extends HookConsumerWidget {
     return IgnoreKeyboardDismiss(
       child: MyTextField(
         key,
-        fillBackgroundColor: context.appColors.authFiledBG,
+        fillBackgroundColor: fillBGColor ?? context.appColors.authFiledBG,
         state.formData[key]!['value'],
         hintText: state.formData[key]!['hintText'],
         hintStyle: TextStyle(

+ 5 - 1
packages/cpt_auth/lib/modules/sign_up/sign_up_state.dart

@@ -13,6 +13,8 @@ class SignUpState {
   String? passwordErrorText;
   String? confirmPasswordErrorText;
 
+  String? countryCode;
+
   //是否明文展示密码
   bool pwdVisibility;
 
@@ -33,6 +35,7 @@ class SignUpState {
     this.phoneErrorText,
     this.passwordErrorText,
     this.confirmPasswordErrorText,
+    this.countryCode,
   }) : formData = formData ??
             {
               'first_name': {
@@ -86,6 +89,7 @@ class SignUpState {
     String? phoneErrorText,
     String? passwordErrorText,
     String? confirmPasswordErrorText,
+    String? countryCode,
     bool? pwdVisibility,
     bool? confirmPwdVisibility,
     bool? isAgreeTerms,
@@ -101,7 +105,7 @@ class SignUpState {
       phoneErrorText: phoneErrorText,
       passwordErrorText: passwordErrorText,
       confirmPasswordErrorText: confirmPasswordErrorText,
+      countryCode: countryCode ?? this.countryCode,
     );
   }
-
 }

+ 8 - 1
packages/cpt_auth/lib/modules/sign_up/sign_up_view_model.dart

@@ -110,7 +110,7 @@ class SignUpViewModel extends _$SignUpViewModel {
             firstName: firstName,
             lastName: lastName,
             email: email,
-            phone: phone,
+            phone: "${state.countryCode}$phone}",
             password: password,
             confirmPassword: confirmPassword,
             verifyKey: key,
@@ -209,4 +209,11 @@ class SignUpViewModel extends _$SignUpViewModel {
 
     Log.d("SignUpViewModel 销毁 onDispose");
   }
+
+  //保存当前选择的国家区号
+  void saveCountryCode(String? countryCode) {
+    state = state.copyWith(countryCode: countryCode);
+    Log.d("saveCountryCode:${state.countryCode}");
+  }
+
 }

+ 6 - 6
packages/cpt_auth/lib/modules/sing_up_verify/sign_up_verify_page.dart

@@ -21,7 +21,7 @@ class SignUpVerifyPage extends HookConsumerWidget {
   final String firstName;
   final String lastName;
   final String email;
-  final String phone;
+  final String fullPhone;
   final String password;
   final String confirmPassword;
   final String? verifyKey;
@@ -32,7 +32,7 @@ class SignUpVerifyPage extends HookConsumerWidget {
     required this.firstName,
     required this.lastName,
     required this.email,
-    required this.phone,
+    required this.fullPhone,
     required this.password,
     required this.confirmPassword,
     required this.verifyKey,
@@ -70,7 +70,7 @@ class SignUpVerifyPage extends HookConsumerWidget {
     useEffect(() {
       Future.microtask(() {
         //默认进来就发短信
-        viewModel.sendSMS(phone, verifyKey, verifyCode);
+        viewModel.sendSMS(fullPhone, verifyKey, verifyCode);
       });
       return () {
       };
@@ -134,7 +134,7 @@ class SignUpVerifyPage extends HookConsumerWidget {
                       firstName: firstName,
                       lastName: lastName,
                       email: email,
-                      phone: phone,
+                      fullPhone: fullPhone,
                       password: password,
                       confirmPassword: confirmPassword,
                       smsCode: pin,
@@ -169,7 +169,7 @@ class SignUpVerifyPage extends HookConsumerWidget {
               MyButton(
                 onPressed: () {
                   if (!state.isCounting) {
-                    viewModel.showVerifyCodedDialog(phone);
+                    viewModel.showVerifyCodedDialog(fullPhone);
                   }
                 },
                 text: state.isCounting ? "${state.countdownTime} s" : S.current.resend_code,
@@ -212,7 +212,7 @@ class SignUpVerifyPage extends HookConsumerWidget {
                     firstName: firstName,
                     lastName: lastName,
                     email: email,
-                    phone: phone,
+                    fullPhone: fullPhone,
                     password: password,
                     confirmPassword: confirmPassword,
                     smsCode: smsCode,

+ 8 - 9
packages/cpt_auth/lib/modules/sing_up_verify/sign_up_verify_view_model.dart

@@ -3,7 +3,6 @@ import 'dart:async';
 import 'package:cpt_auth/modules/sing_up_success/sign_up_success_page.dart';
 import 'package:cs_resources/generated/l10n.dart';
 import 'package:domain/repository/auth_repository.dart';
-import 'package:plugin_basic/constants/app_constant.dart';
 import 'package:plugin_basic/dialog/verify_code_dialog.dart';
 import 'package:plugin_basic/provider/user_config/user_config_service.dart';
 import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
@@ -37,7 +36,7 @@ class SignUpVerifyViewModel extends _$SignUpVerifyViewModel {
     required String firstName,
     required String lastName,
     required String email,
-    required String phone,
+    required String fullPhone,
     required String password,
     required String confirmPassword,
     required String? smsCode,
@@ -51,8 +50,8 @@ class SignUpVerifyViewModel extends _$SignUpVerifyViewModel {
       firstName: firstName,
       lastName: lastName,
       email: email,
-      countryCode: AppConstant.countryCode,
-      phone: phone,
+      countryCode: Utils.getMobileCode(fullPhone),
+      phone: Utils.getRealMobile(fullPhone),
       password: password,
       confirmPassword: confirmPassword,
       smsCode: smsCode,
@@ -77,23 +76,23 @@ class SignUpVerifyViewModel extends _$SignUpVerifyViewModel {
   }
 
   //展示验证码的弹窗
-  showVerifyCodedDialog(String phone) {
+  showVerifyCodedDialog(String fullPhone) {
     DialogEngine.show(
       onDismiss: () {},
       widget: VerifyCodeDialog(
         confirmAction: (key, code) {
           //发送短信验证码
-          sendSMS(phone, key, code);
+          sendSMS(fullPhone, key, code);
         },
       ),
     );
   }
 
   /// 调用接口发送短信验证码
-  void sendSMS(String phone, String? key, String? code) async {
+  void sendSMS(String fullPhone, String? key, String? code) async {
     final result = await authRepository.sendSMS(
-      countryCode: AppConstant.countryCode,
-      phone: phone,
+      countryCode: Utils.getMobileCode(fullPhone),
+      phone: Utils.getRealMobile(fullPhone),
       captchaKey: key,
       captchaValue: code,
     );

+ 1 - 1
packages/cpt_auth/lib/router/page/auth_page_router.gr.dart

@@ -84,7 +84,7 @@ abstract class _$AuthPageRouter extends RootStackRouter {
           firstName: args.firstName,
           lastName: args.lastName,
           email: args.email,
-          phone: args.phone,
+          fullPhone: args.phone,
           password: args.password,
           confirmPassword: args.confirmPassword,
           verifyKey: args.verifyKey,

+ 30 - 30
packages/cpt_profile/lib/modules/change_mobile/change_mobile_page.dart

@@ -5,6 +5,8 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:plugin_basic/dialog/country_code_selecter.dart';
+import 'package:plugin_basic/provider/user_config/user_config_service.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_appbar.dart';
@@ -62,33 +64,31 @@ class ChangeMobilePage extends HookConsumerWidget {
                 mainAxisSize: MainAxisSize.max,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: [
-                  const MyAssetImage(
-                    Assets.authCountrySg,
-                    width: 45,
-                    height: 30,
-                  ),
-                  MyTextView(
-                    "+65",
-                    textColor: context.appColors.textBlack,
-                    fontSize: 18.5,
-                    marginLeft: 15,
-                    marginRight: 12,
-                    isFontMedium: true,
-                  ),
+                  //封装的国家选择控件
+                  CountryCodeSelector(
+                    countryCode: UserConfigService.getState().user?.information?.countryCode ?? "+65",
+                    isEnable: false,
+                    onChanged: (countryCode) {},
+                  ).marginOnly(left: 15),
+
                   //电话输入框
                   _buildInputLayout(
                     context,
                     state,
                     "old",
                     enable: false,
+                    fillBGColor: Colors.transparent,
                     textInputType: TextInputType.number,
-                    textInputAction: TextInputAction.next,
+                    textInputAction: TextInputAction.done,
                     onSubmit: (formKey, value) {
                       state.formData[formKey]!['focusNode'].unfocus();
-                      FocusScope.of(context).requestFocus(state.formData['old_code']!['focusNode']);
+                      FocusScope.of(context).requestFocus(state.formData['new']!['focusNode']);
                     },
                   ).expanded(),
                 ],
+              ).decorated(
+                color: context.appColors.authFiledBG,
+                borderRadius: BorderRadius.circular(5.0),
               ),
 
               //新电话
@@ -106,32 +106,31 @@ class ChangeMobilePage extends HookConsumerWidget {
                 mainAxisSize: MainAxisSize.max,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: [
-                  const MyAssetImage(
-                    Assets.authCountrySg,
-                    width: 45,
-                    height: 30,
-                  ),
-                  MyTextView(
-                    "+65",
-                    textColor: context.appColors.textBlack,
-                    fontSize: 18.5,
-                    marginLeft: 15,
-                    marginRight: 12,
-                    isFontMedium: true,
-                  ),
+                  //封装的国家选择控件
+                  CountryCodeSelector(
+                    margin: const EdgeInsets.only(left: 0, right: 0, top: 5),
+                    onChanged: (countryCode) {
+                      viewModel.saveNewCountryCode(countryCode);
+                    },
+                  ).marginOnly(left: 15),
+
                   //电话输入框
                   _buildInputLayout(
                     context,
                     state,
                     "new",
+                    fillBGColor: Colors.transparent,
                     textInputType: TextInputType.number,
-                    textInputAction: TextInputAction.next,
+                    textInputAction: TextInputAction.done,
                     onSubmit: (formKey, value) {
                       state.formData[formKey]!['focusNode'].unfocus();
                       FocusScope.of(context).requestFocus(state.formData['new_code']!['focusNode']);
                     },
                   ).expanded(),
                 ],
+              ).decorated(
+                color: context.appColors.authFiledBG,
+                borderRadius: BorderRadius.circular(5.0),
               ),
 
               //新手机的验证码
@@ -199,13 +198,14 @@ class ChangeMobilePage extends HookConsumerWidget {
     String? errorText,
     bool obscureText = false,
     bool enable = true,
+    Color? fillBGColor,
     TextInputAction textInputAction = TextInputAction.done,
     Function? onSubmit,
   }) {
     return IgnoreKeyboardDismiss(
       child: MyTextField(
         key,
-        fillBackgroundColor: context.appColors.authFiledBG,
+        fillBackgroundColor: fillBGColor ?? context.appColors.authFiledBG,
         state.formData[key]!['value'],
         hintText: state.formData[key]!['hintText'],
         hintStyle: TextStyle(

+ 6 - 0
packages/cpt_profile/lib/modules/change_mobile/change_mobile_state.dart

@@ -16,6 +16,8 @@ class ChangeMobileState {
   String? oldCodeErrorText;
   String? newCodeErrorText;
 
+  String? newCountryCode;
+
   // ===================================  Begin  ↓  ===================================
 
   ChangeMobileState({
@@ -26,6 +28,7 @@ class ChangeMobileState {
     this.newCountdownTime = 0,
     this.oldCodeErrorText,
     this.newCodeErrorText,
+    this.newCountryCode,
   }) : formData = formData ??
             {
               'old': {
@@ -58,6 +61,8 @@ class ChangeMobileState {
     int? newCountdownTime,
     String? oldCodeErrorText,
     String? newCodeErrorText,
+
+    String? newCountryCode,
   }) {
     return ChangeMobileState(
       formData: this.formData,
@@ -67,6 +72,7 @@ class ChangeMobileState {
       newCountdownTime: newCountdownTime ?? this.newCountdownTime,
       oldCodeErrorText: oldCodeErrorText,
       newCodeErrorText: newCodeErrorText,
+      newCountryCode: newCountryCode ?? this.newCountryCode,
     );
   }
 }

+ 12 - 7
packages/cpt_profile/lib/modules/change_mobile/change_mobile_view_model.dart

@@ -1,6 +1,5 @@
 import 'dart:async';
 
-import 'package:cpt_profile/modules/setting/setting_page.dart';
 import 'package:cs_resources/generated/l10n.dart';
 import 'package:domain/repository/auth_repository.dart';
 import 'package:domain/repository/profile_repository.dart';
@@ -16,7 +15,6 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
 import 'package:router/componentRouter/component_service_manager.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/util.dart';
-import 'package:widgets/widget_export.dart';
 
 import 'change_mobile_state.dart';
 
@@ -73,7 +71,7 @@ class ChangeMobileViewModel extends _$ChangeMobileViewModel with DioCancelableMi
     //执行密码登录
     final result = await _profileRepository.changeMobilePhone(
       smsCode: newCode,
-      countryCode: AppConstant.countryCode,
+      countryCode: state.newCountryCode,
       phone: newMobile,
       cancelToken: cancelToken,
     );
@@ -105,17 +103,17 @@ class ChangeMobileViewModel extends _$ChangeMobileViewModel with DioCancelableMi
       widget: VerifyCodeDialog(
         confirmAction: (key, code) {
           //发送短信验证码
-          _sendSMS(phone, key, code);
+          _sendSMS("${state.newCountryCode}$phone", key, code);
         },
       ),
     );
   }
 
   /// 调用接口发送短信验证码
-  void _sendSMS(String phone, String? key, String? code) async {
+  void _sendSMS(String fullPhone, String? key, String? code) async {
     final result = await _authRepository.sendSMS(
-      countryCode: AppConstant.countryCode,
-      phone: phone,
+      countryCode: Utils.getMobileCode(fullPhone ?? ""),
+      phone: Utils.getRealMobile(fullPhone ?? ""),
       captchaKey: key,
       captchaValue: code,
       cancelToken: cancelToken,
@@ -175,4 +173,11 @@ class ChangeMobileViewModel extends _$ChangeMobileViewModel with DioCancelableMi
 
     Log.d("ChangeMobileViewModel 销毁 onDispose");
   }
+
+  //保存当前选择的国家区号
+  void saveNewCountryCode(String? countryCode) {
+    state = state.copyWith(newCountryCode: countryCode);
+    Log.d("saveCountryCode:${state.newCountryCode}");
+  }
+
 }

+ 16 - 15
packages/cpt_profile/lib/modules/reset_password/reset_password_page.dart

@@ -6,6 +6,8 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:plugin_basic/dialog/country_code_selecter.dart';
+import 'package:plugin_basic/provider/user_config/user_config_service.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_appbar.dart';
@@ -64,33 +66,31 @@ class ResetPasswordPage extends HookConsumerWidget {
                 mainAxisSize: MainAxisSize.max,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: [
-                  const MyAssetImage(
-                    Assets.authCountrySg,
-                    width: 45,
-                    height: 30,
-                  ),
-                  MyTextView(
-                    "+65",
-                    textColor: context.appColors.textBlack,
-                    fontSize: 18.5,
-                    marginLeft: 15,
-                    marginRight: 12,
-                    isFontMedium: true,
-                  ),
+                  //封装的国家选择控件
+                  CountryCodeSelector(
+                    countryCode: UserConfigService.getState().user?.information?.countryCode ?? "+65",
+                    isEnable: false,
+                    onChanged: (countryCode) {},
+                  ).marginOnly(left: 15),
+
                   //电话输入框
                   _buildInputLayout(
                     context,
                     state,
                     "phone",
                     enable: false,
+                    fillBGColor: Colors.transparent,
                     textInputType: TextInputType.number,
-                    textInputAction: TextInputAction.next,
+                    textInputAction: TextInputAction.done,
                     onSubmit: (formKey, value) {
                       state.formData[formKey]!['focusNode'].unfocus();
                       FocusScope.of(context).requestFocus(state.formData['code']!['focusNode']);
                     },
                   ).expanded(),
                 ],
+              ).decorated(
+                color: context.appColors.authFiledBG,
+                borderRadius: BorderRadius.circular(5.0),
               ),
 
               //手机的验证码
@@ -243,13 +243,14 @@ class ResetPasswordPage extends HookConsumerWidget {
         String? errorText,
         bool obscureText = false,
         bool enable = true,
+        Color? fillBGColor,
         TextInputAction textInputAction = TextInputAction.done,
         Function? onSubmit,
       }) {
     return IgnoreKeyboardDismiss(
       child: MyTextField(
         key,
-        fillBackgroundColor: context.appColors.authFiledBG,
+        fillBackgroundColor: fillBGColor ?? context.appColors.authFiledBG,
         state.formData[key]!['value'],
         hintText: state.formData[key]!['hintText'],
         hintStyle: TextStyle(

+ 1 - 1
packages/cpt_profile/lib/modules/reset_password/reset_password_view_model.dart

@@ -132,7 +132,7 @@ class ResetPasswordViewModel extends _$ResetPasswordViewModel {
   /// 调用接口发送短信验证码
   void _sendSMS(String phone, String? key, String? code) async {
     final result = await authRepository.sendSMS(
-      countryCode: AppConstant.countryCode,
+      countryCode: UserConfigService.getState().user?.information?.countryCode ?? "+65",
       phone: phone,
       captchaKey: key,
       captchaValue: code,

+ 1 - 1
packages/cpt_rewards/lib/modules/rewards_transaction/rewards_transaction_page.dart

@@ -205,7 +205,7 @@ class RewardsTransactionPage extends HookConsumerWidget {
   }
 
   Widget _buildNotice(BuildContext context, WidgetRef ref, _vm, types, detailInfo) {
-    int phone = detailInfo.account.phone ?? 0;
+    int phone = detailInfo.account.fullPhone ?? 0;
     String createdAt = detailInfo.createdAt ?? "";
     String usedAt = detailInfo.usedAt ?? "";
     int point = detailInfo.reward.point ?? 0;

+ 12 - 4
packages/cs_domain/lib/repository/auth_repository.dart

@@ -34,7 +34,9 @@ class AuthRepository {
     CancelToken? cancelToken,
   }) async {
     Map<String, String> params = {};
-
+    if (userName != null && userName.startsWith('+')) {
+      userName = userName.substring(1); // 去掉开头的 "+"
+    }
     params['username'] = userName!;
     params['password'] = password!;
 
@@ -84,7 +86,9 @@ class AuthRepository {
     CancelToken? cancelToken,
   }) async {
     Map<String, String> params = {};
-
+    if (countryCode != null && countryCode.startsWith('+')) {
+      countryCode = countryCode.substring(1); // 去掉开头的 "+"
+    }
     params['country_code'] = countryCode!;
     params['phone'] = phone!;
     params['captcha_key'] = captchaKey!;
@@ -118,7 +122,9 @@ class AuthRepository {
     CancelToken? cancelToken,
   }) async {
     Map<String, String> params = {};
-
+    if (countryCode.startsWith('+')) {
+      countryCode = countryCode.substring(1); // 去掉开头的 "+"
+    }
     params['first_name'] = firstName;
     params['last_name'] = lastName;
     params['email'] = email;
@@ -183,7 +189,9 @@ class AuthRepository {
     CancelToken? cancelToken,
   }) async {
     Map<String, String> params = {};
-
+    if (countryCode != null && countryCode.startsWith('+')) {
+      countryCode = countryCode.substring(1); // 去掉开头的 "+"
+    }
     params['sms_code'] = smsCode!;
     params['country_code'] = countryCode!;
     params['phone'] = phone!;

+ 0 - 3
packages/cs_plugin_basic/lib/constants/app_constant.dart

@@ -26,7 +26,4 @@ class AppConstant {
   static const eventEstateRefresh = 'event_estate_refresh'; //通知用户的房产信息需要刷新
   static const eventServiceOrderRefresh = 'event_service_order_refresh'; //通知用户的服务订单
 
-  //手机短信的国家区号
-  static const countryCode = ApiConstants.isServerRelease ? "65" : "86"; //(测试环境为+86,正式环境为+65)
-
 }

+ 170 - 0
packages/cs_plugin_basic/lib/dialog/country_code_selecter.dart

@@ -0,0 +1,170 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+/*
+ * 国家选择控件,用于电话号码区号的选择
+ */
+class CountryCodeSelector extends StatefulWidget {
+  String countryCode; //默认选中新加坡
+  bool isEnable = true; //是否可用
+  EdgeInsetsGeometry margin;
+  void Function(String? countryCode) onChanged; //选中的回调
+
+  CountryCodeSelector(
+      {Key? key, this.countryCode = "+65", this.isEnable = true, this.margin = const EdgeInsets.only(left: 35, right: 35, top: 5), required this.onChanged})
+      : super(key: key);
+
+  @override
+  State<CountryCodeSelector> createState() {
+    return _CountryCodePickerSelector();
+  }
+}
+
+class _CountryCodePickerSelector extends State<CountryCodeSelector> {
+  String? selectedCountryCode;
+  Map<String, String>? selectedCountryEntity;
+
+  final List<Map<String, String>> countries = [
+    {'code': '+1', 'icon': Assets.authMeiguo},
+    {'code': '+44', 'icon': Assets.authYinguo},
+    {'code': '+60', 'icon': Assets.authMalaixiya},
+    {'code': '+61', 'icon': Assets.authAodaliya},
+    {'code': '+62', 'icon': Assets.authYindunixiya},
+    {'code': '+63', 'icon': Assets.authFeilvbing},
+    {'code': '+65', 'icon': Assets.authXinjiapo},
+    {'code': '+66', 'icon': Assets.authTaiguo},
+    {'code': '+86', 'icon': Assets.authZhongguo},
+    {'code': '+852', 'icon': Assets.authXianggang},
+  ];
+
+  @override
+  void initState() {
+    super.initState();
+    selectedCountryCode = widget.countryCode.startsWith("+") ? widget.countryCode : "+${widget.countryCode}";
+    selectedCountryEntity = countries.firstWhere((element) => element['code'] == selectedCountryCode);
+
+    // 在布局完成之后调用回调
+    WidgetsBinding.instance.addPostFrameCallback((_) {
+      widget.onChanged.call(selectedCountryCode);
+    });
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Row(
+      mainAxisSize: MainAxisSize.min,
+      crossAxisAlignment: CrossAxisAlignment.center,
+      children: [
+        MyAssetImage(selectedCountryEntity?['icon'] ?? Assets.authXinjiapo, width: 28, height: 20),
+        MyTextView(
+          selectedCountryEntity?['code'] ?? '+65',
+          marginLeft: 8,
+          marginRight: 10,
+          textColor: context.appColors.authFiledHint,
+          isFontMedium: true,
+          fontSize: 16,
+        ),
+        Opacity(
+          opacity: widget.isEnable ? 1.0 : 0.0,
+          child: MyAssetImage(
+            Assets.baseServiceTriangleDropDown,
+            width: 7,
+            height: 4,
+            color: context.appColors.textBlack,
+          ),
+        ),
+      ],
+    ).onTap(() {
+      if (widget.isEnable) {
+        _showCountryPicker(context);
+      }
+    });
+  }
+
+  void _showCountryPicker(BuildContext targetContext) {
+    DialogEngine.showAttach(
+      tag: "CountryCode",
+      targetContext: targetContext,
+      position: DialogPosition.bottom,
+      widget: _AttachCountryDialog(
+        margin: widget.margin,
+        list: countries,
+        onSelected: (item) {
+          setState(() {
+            selectedCountryCode = item['code'];
+            selectedCountryEntity = item;
+            widget.onChanged.call(selectedCountryCode);
+          });
+        },
+      ),
+    );
+  }
+}
+
+//下拉选的弹窗布局
+class _AttachCountryDialog extends StatelessWidget {
+  final Function(Map<String, String>) onSelected;
+  final List<Map<String, String>> list;
+  EdgeInsetsGeometry margin;
+
+  // 创建一个构造函数接收 onSelected 回调
+  _AttachCountryDialog({required this.onSelected, required this.list, required this.margin});
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      margin: margin,
+      decoration: BoxDecoration(
+        color: context.appColors.whiteBG,
+        borderRadius: BorderRadius.circular(5.0), // 5个圆角
+        boxShadow: [
+          BoxShadow(
+            color: const Color(0xFF656565).withOpacity(0.1), // 阴影颜色,并且设置透明度
+            offset: const Offset(0, 1.5), // 阴影的偏移量
+            blurRadius: 2.5, // 模糊半径
+            spreadRadius: 1.5, // 扩散半径
+          ),
+        ],
+      ),
+      constraints: const BoxConstraints(
+        maxHeight: 250, // 设置最大高度
+        maxWidth: 100,
+      ),
+      child: ListView.builder(
+        padding: EdgeInsets.zero,
+        itemCount: list.length,
+        itemBuilder: (context, index) {
+          final item = list[index];
+          return GestureDetector(
+            onTap: () {
+              onSelected(item); // 点击后调用回调
+              SmartDialog.dismiss(tag: 'CountryCode');
+            },
+            child: Row(
+              mainAxisSize: MainAxisSize.max,
+              crossAxisAlignment: CrossAxisAlignment.center,
+              children: [
+                const SizedBox(width: 15),
+                MyAssetImage(item['icon']!, width: 28, height: 20),
+                MyTextView(
+                  item['code']!,
+                  marginLeft: 8,
+                  marginRight: 10,
+                  textColor: Colors.black,
+                  isFontMedium: true,
+                  fontSize: 16,
+                ).expanded(),
+              ],
+            ).marginOnly(top: 7.5, bottom: 7.5),
+          );
+        },
+      ),
+    );
+  }
+}

+ 1 - 0
packages/cs_plugin_platform/lib/engine/dialog/dialog_engine.dart

@@ -58,6 +58,7 @@ class DialogEngine {
 
     return SmartDialog.showAttach(
       targetContext: targetContext,
+      bindWidget: targetContext,
       builder: (context) => widget,
       usePenetrate: usePenetrate,
       debounce: true,

BIN
packages/cs_resources/assets/auth/aodaliya.webp


BIN
packages/cs_resources/assets/auth/feilvbing.webp


BIN
packages/cs_resources/assets/auth/malaixiya.webp


BIN
packages/cs_resources/assets/auth/meiguo.webp


BIN
packages/cs_resources/assets/auth/taiguo.webp


BIN
packages/cs_resources/assets/auth/xianggang.webp


BIN
packages/cs_resources/assets/auth/xinjiapo.webp


BIN
packages/cs_resources/assets/auth/yindunixiya.png


BIN
packages/cs_resources/assets/auth/yinguo.webp


BIN
packages/cs_resources/assets/auth/zhongguo.webp


+ 10 - 0
packages/cs_resources/lib/generated/assets.dart

@@ -4,17 +4,27 @@ class Assets {
 
   static const String assetsYyHomeLogo = 'assets/yy_home_logo.webp';
   static const String assetsYyHomeSplash = 'assets/yy_home_splash.png';
+  static const String authAodaliya = 'assets/auth/aodaliya.webp';
   static const String authChooseEstateBuilding = 'assets/auth/choose_estate_building.webp';
   static const String authCountrySg = 'assets/auth/country_sg.webp';
+  static const String authFeilvbing = 'assets/auth/feilvbing.webp';
   static const String authForgotInputEmailPhoneImg = 'assets/auth/forgot_input_email_phone_img.webp';
   static const String authForgotResetPasswordImg = 'assets/auth/forgot_reset_password_img.webp';
+  static const String authMalaixiya = 'assets/auth/malaixiya.webp';
+  static const String authMeiguo = 'assets/auth/meiguo.webp';
   static const String authPasswordHide = 'assets/auth/password_hide.webp';
   static const String authPasswordShow = 'assets/auth/password_show.webp';
   static const String authSignUpInputImg = 'assets/auth/sign_up_input_img.webp';
   static const String authSignUpSuccessImg = 'assets/auth/sign_up_success_img.webp';
   static const String authSignUpUnitImg = 'assets/auth/sign_up_unit_img.webp';
   static const String authSmsVerifyImg = 'assets/auth/sms_verify_img.webp';
+  static const String authTaiguo = 'assets/auth/taiguo.webp';
+  static const String authXianggang = 'assets/auth/xianggang.webp';
+  static const String authXinjiapo = 'assets/auth/xinjiapo.webp';
+  static const String authYindunixiya = 'assets/auth/yindunixiya.png';
+  static const String authYinguo = 'assets/auth/yinguo.webp';
   static const String authYyHomeSuccess = 'assets/auth/yy_home_success.webp';
+  static const String authZhongguo = 'assets/auth/zhongguo.webp';
   static const String baseLibBlackBack = 'assets/base_lib/black_back.webp';
   static const String baseLibCalendarLeftIcon = 'assets/base_lib/calendar_left_icon.webp';
   static const String baseLibCalendarRightIcon = 'assets/base_lib/calendar_right_icon.webp';

+ 140 - 0
packages/cs_shared/lib/utils/util.dart

@@ -201,4 +201,144 @@ class Utils {
     return '$start$asterisks$end';
   }
 
+  /// 获取实际手机号码
+  static String getRealMobile(String mobile) {
+    mobile = mobile.trim();
+
+    // 判断属于哪一个国家区号
+    if (mobile.startsWith("+1-")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+1")) {
+      return mobile.substring(2);
+    } else if (mobile.startsWith("+31-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+31")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+33-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+33")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+34-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+34")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+39-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+39")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+44-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+44")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+49-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+49")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+60-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+60")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+61-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+61")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+62-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+62")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+63-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+63")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+65-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+65")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+66-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+66")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+81-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+81")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+82-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+82")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+84-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+84")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+86-")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+86")) {
+      return mobile.substring(3);
+    } else if (mobile.startsWith("+852-")) {
+      return mobile.substring(5);
+    } else if (mobile.startsWith("+852")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+855-")) {
+      return mobile.substring(5);
+    } else if (mobile.startsWith("+855")) {
+      return mobile.substring(4);
+    } else if (mobile.startsWith("+971-")) {
+      return mobile.substring(5);
+    } else if (mobile.startsWith("+971")) {
+      return mobile.substring(4);
+    } else {
+      return mobile; // 返回原始手机号
+    }
+  }
+
+  /// 获取国家区号
+  static String getMobileCode(String mobile) {
+    mobile = mobile.trim();
+
+    // 判断属于哪一个国家区号
+    if (mobile.startsWith("1") || mobile.startsWith("+1") || mobile.startsWith("1-") || mobile.startsWith("+1-")) {
+      return "+1";
+    } else if (mobile.startsWith("31") || mobile.startsWith("+31") || mobile.startsWith("31-") || mobile.startsWith("+31-")) {
+      return "+31";
+    } else if (mobile.startsWith("33") || mobile.startsWith("+33") || mobile.startsWith("33-") || mobile.startsWith("+33-")) {
+      return "+33";
+    } else if (mobile.startsWith("34") || mobile.startsWith("+34") || mobile.startsWith("34-") || mobile.startsWith("+34-")) {
+      return "+34";
+    } else if (mobile.startsWith("39") || mobile.startsWith("+39") || mobile.startsWith("39-") || mobile.startsWith("+39-")) {
+      return "+39";
+    } else if (mobile.startsWith("44") || mobile.startsWith("+44") || mobile.startsWith("44-") || mobile.startsWith("+44-")) {
+      return "+44";
+    } else if (mobile.startsWith("49") || mobile.startsWith("+49") || mobile.startsWith("49-") || mobile.startsWith("+49-")) {
+      return "+49";
+    } else if (mobile.startsWith("60") || mobile.startsWith("+60") || mobile.startsWith("60-") || mobile.startsWith("+60-")) {
+      return "+60";
+    } else if (mobile.startsWith("61") || mobile.startsWith("+61") || mobile.startsWith("61-") || mobile.startsWith("+61-")) {
+      return "+61";
+    } else if (mobile.startsWith("62") || mobile.startsWith("+62") || mobile.startsWith("62-") || mobile.startsWith("+62-")) {
+      return "+62";
+    } else if (mobile.startsWith("63") || mobile.startsWith("+63") || mobile.startsWith("63-") || mobile.startsWith("+63-")) {
+      return "+63";
+    } else if (mobile.startsWith("65") || mobile.startsWith("+65") || mobile.startsWith("65-") || mobile.startsWith("+65-")) {
+      return "+65";
+    } else if (mobile.startsWith("66") || mobile.startsWith("+66") || mobile.startsWith("66-") || mobile.startsWith("+66-")) {
+      return "+66";
+    } else if (mobile.startsWith("81") || mobile.startsWith("+81") || mobile.startsWith("81-") || mobile.startsWith("+81-")) {
+      return "+81";
+    } else if (mobile.startsWith("82") || mobile.startsWith("+82") || mobile.startsWith("82-") || mobile.startsWith("+82-")) {
+      return "+82";
+    } else if (mobile.startsWith("84") || mobile.startsWith("+84") || mobile.startsWith("84-") || mobile.startsWith("+84-")) {
+      return "+84";
+    } else if (mobile.startsWith("86") || mobile.startsWith("+86") || mobile.startsWith("86-") || mobile.startsWith("+86-")) {
+      return "+86";
+    } else if (mobile.startsWith("852") || mobile.startsWith("+852") || mobile.startsWith("852-") || mobile.startsWith("+852-")) {
+      return "+852";
+    } else if (mobile.startsWith("855") || mobile.startsWith("+855") || mobile.startsWith("855-") || mobile.startsWith("+855-")) {
+      return "+855";
+    } else if (mobile.startsWith("971") || mobile.startsWith("+971") || mobile.startsWith("971-") || mobile.startsWith("+971-")) {
+      return "+971";
+    } else {
+      return ""; // 如果没有匹配的区号,返回空字符串
+    }
+  }
+
 }

+ 1 - 0
packages/cs_widgets/pubspec.yaml

@@ -24,6 +24,7 @@ dependencies:
   shared:
     path: ../cs_shared
 
+ # 路由
   router:
     path: ../cs_router