Browse Source

Merge remote-tracking branch 'origin/v1.0.0' into v1.0.0

hezihao 7 months ago
parent
commit
34608d8999
30 changed files with 289 additions and 156 deletions
  1. BIN
      assets/images/bg_ticket.dialog.webp
  2. 5 0
      lib/data/bean/goods_info.dart
  3. 2 0
      lib/data/bean/goods_info.g.dart
  4. 2 2
      lib/data/consts/error_code.dart
  5. 1 1
      lib/data/repository/account_repository.dart
  6. 1 0
      lib/data/repository/keyboard_repository.dart
  7. 1 0
      lib/dialog/content/character_tab_group_content_view.dart
  8. 2 0
      lib/dialog/custom_character/custom_character_add_view.dart
  9. 3 3
      lib/dialog/custom_label_dialog.dart
  10. 1 1
      lib/dialog/loading_dialog.dart
  11. 38 0
      lib/handler/event_handler.dart
  12. 1 1
      lib/module/character/character_controller.dart
  13. 7 0
      lib/module/character/content/character_group_content_controller.dart
  14. 12 6
      lib/module/character_custom/detail/character_custom_detail_controller.dart
  15. 27 15
      lib/module/character_custom/list/character_custom_list_controller.dart
  16. 3 0
      lib/module/intimacy_scale/intimacy_scale_controller.dart
  17. 2 1
      lib/module/keyboard/keyboard_view.dart
  18. 45 34
      lib/module/keyboard_manage/keyboard_manage_controller.dart
  19. 2 2
      lib/module/keyboard_manage/keyboard_manage_page.dart
  20. 2 2
      lib/module/login/login_page.dart
  21. 9 4
      lib/module/main/main_controller.dart
  22. 12 11
      lib/module/new_user/new_user_controller.dart
  23. 64 52
      lib/module/new_user/new_user_page.dart
  24. 9 6
      lib/module/profile/profile_controller.dart
  25. 5 2
      lib/module/store/new_discount/new_discount_page.dart
  26. 8 8
      lib/module/store/store_controller.dart
  27. 20 2
      lib/module/store/suprise/goods_surprise_controller.dart
  28. 2 2
      lib/module/store/ticket/discount_ticket_dialog.dart
  29. 1 0
      lib/sdk/gravity/gravity_helper.dart
  30. 2 1
      lib/utils/payment_status_manager.dart

BIN
assets/images/bg_ticket.dialog.webp


+ 5 - 0
lib/data/bean/goods_info.dart

@@ -33,6 +33,8 @@ class GoodsInfo {
   String? selectDesc;
   @JsonKey(name: 'timeLimitDesc')
   String? timeLimitDesc;
+  @JsonKey(name: 'code')
+  late String code;
 
   GoodsInfo({
     required this.id,
@@ -44,6 +46,7 @@ class GoodsInfo {
     required this.auth,
     required this.subscriptionMillis,
     required this.priceDesc,
+    required this.code,
     this.payOptionIds,
     this.description,
     this.mostDesc,
@@ -79,6 +82,8 @@ class GoodsInfo {
       description: description,
       mostDesc: mostDesc,
       selectDesc: selectDesc,
+      timeLimitDesc: timeLimitDesc,
+      code: code,
     );
   }
 }

+ 2 - 0
lib/data/bean/goods_info.g.dart

@@ -16,6 +16,7 @@ GoodsInfo _$GoodsInfoFromJson(Map<String, dynamic> json) => GoodsInfo(
   auth: json['auth'] as String,
   subscriptionMillis: (json['subscriptionMillis'] as num).toInt(),
   priceDesc: json['priceDesc'] as String,
+  code: json['code'] as String,
   payOptionIds:
       (json['payOptionIds'] as List<dynamic>?)
           ?.map((e) => (e as num).toInt())
@@ -41,4 +42,5 @@ Map<String, dynamic> _$GoodsInfoToJson(GoodsInfo instance) => <String, dynamic>{
   'mostDesc': instance.mostDesc,
   'selectDesc': instance.selectDesc,
   'timeLimitDesc': instance.timeLimitDesc,
+  'code': instance.code,
 };

+ 2 - 2
lib/data/consts/error_code.dart

@@ -2,9 +2,9 @@ import '../../resource/string.gen.dart';
 
 class ErrorCode {
   /// 登录相关错误码
-  static const int verificationCodeError = 1005; //验证码错误
+  static const int verificationCodeError = 2002; //验证码错误
   static const int noLoginError = 1006; //未登录
-  static const int noMember = 1007; //没有会员
+  static const int noMember = 1005; //没有会员
   static const int sensitive = 1023; //敏感内容
 
   /// 会员服务相关错误码

+ 1 - 1
lib/data/repository/account_repository.dart

@@ -35,7 +35,7 @@ class AccountRepository {
   Rxn<UserInfoResponse> get userInfo => _userInfo;
 
   RxnString loginPhoneNum = RxnString();
- final RxBool isLogin = false.obs;
+  final RxBool isLogin = false.obs;
 
   Rxn<MemberInfo> memberStatusInfo = Rxn<MemberInfo>();
 

+ 1 - 0
lib/data/repository/keyboard_repository.dart

@@ -72,6 +72,7 @@ class KeyboardRepository {
     getKeyboardLoveIndex();
   }
 
+
   void refreshUserInfo() async {
     homeInfoFuture?.cancel();
     homeInfoFuture = AsyncUtil.retryWithExponentialBackoff(

+ 1 - 0
lib/dialog/content/character_tab_group_content_view.dart

@@ -64,6 +64,7 @@ class CharacterTabGroupContentView
               // onRefresh: controller.refreshData,
               onLoad: controller.loadMoreData,
               child: ListView.separated(
+                padding: EdgeInsets.zero,
                 itemCount: controller.characterList.length,
                 itemBuilder: (context, index) {
                   return _buildListItem(

+ 2 - 0
lib/dialog/custom_character/custom_character_add_view.dart

@@ -39,6 +39,7 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
         tag: tag);
     return Column(
       children: [
+
         Expanded(
           child: Obx(() {
             return EasyRefresh(
@@ -55,6 +56,7 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
               // onRefresh: controller.refreshData,
               onLoad: controller.loadMoreData,
               child: ListView.separated(
+                padding: EdgeInsets.zero,
                 itemCount: controller.characterList.length,
                 itemBuilder: (context, index) {
                   return _buildListItem(

+ 3 - 3
lib/dialog/custom_label_dialog.dart

@@ -65,7 +65,6 @@ class CustomLabelDialog {
                           SizedBox(height: 16.h),
                           Container(
                             height: 48.h,
-
                             alignment: Alignment.center,
                             decoration: ShapeDecoration(
                               color: const Color(0xFFF5F4F9),
@@ -75,12 +74,13 @@ class CustomLabelDialog {
                             ),
                             child: TextField(
                               controller: textController,
-                              // maxLength: maxLength,
-                              maxLines: 1,
 
+                              maxLines: 1,
+                              scrollPhysics: const BouncingScrollPhysics(),
                               textAlign: TextAlign.center,
                               textAlignVertical: TextAlignVertical.center,
                               decoration: InputDecoration(
+                                isDense: true,
                                 counterText: "",
                                 hintText: hintText,
                                 hintStyle: TextStyle(

+ 1 - 1
lib/dialog/loading_dialog.dart

@@ -21,7 +21,7 @@ class CustomLoadingDialog {
   static void show({String? loadingTxt, bool backDismiss = false}) {
     SmartDialog.show(
         tag: tag,
-        backDismiss: backDismiss,
+       backType: SmartBackType.block,
         clickMaskDismiss: false,
         builder: (_) {
           return Container(

+ 38 - 0
lib/handler/event_handler.dart

@@ -0,0 +1,38 @@
+import '../data/consts/payment_type.dart';
+import '../sdk/gravity/gravity_helper.dart';
+import '../utils/toast_util.dart';
+
+class EventHandler {
+  static const bool isShowToast = false;
+
+  EventHandler._();
+
+  static void report(String eventId, {Map<String, dynamic>? params}) {
+    if (isShowToast) {
+      if (params == null) {
+        ToastUtil.show(eventId);
+      } else {
+        ToastUtil.show('$eventId ${params.toString()}');
+      }
+    }
+    GravityHelper.report(eventId, params: params);
+  }
+
+  static void reportPay(
+      int priceFen, String orderId, String itemName, int payWay) {
+    if (isShowToast) {
+      String? payWayStr;
+      switch (payWay) {
+        case PayMethod.alipay:
+          payWayStr = '支付宝';
+          break;
+        case PayMethod.wechat:
+          payWayStr = '微信';
+          break;
+      }
+      ToastUtil.show(
+          'PAY: 金额:$priceFen 订单号:$orderId 商品名:$itemName 支付方式:$payWayStr');
+    }
+    GravityHelper.reportPay(priceFen, orderId, itemName, payWay);
+  }
+}

+ 1 - 1
lib/module/character/character_controller.dart

@@ -59,7 +59,7 @@ class CharacterController extends BaseController
     }
     if (keyboardInfoList.isNotEmpty) {
       currentKeyboardInfo.value = keyboardInfoList.firstWhere(
-        (element) => element.type == KeyboardType.system.name,
+        (element) => element.isChoose == true,
         orElse: () => keyboardInfoList.first,
       );
     }

+ 7 - 0
lib/module/character/content/character_group_content_controller.dart

@@ -17,6 +17,7 @@ import 'package:keyboard/utils/toast_util.dart';
 import '../../../data/bean/character_group_info.dart';
 import '../../../data/bean/character_info.dart';
 import '../../../data/bean/keyboard_info.dart';
+import '../../../data/bean/member_info.dart';
 import '../../../utils/error_handler.dart';
 
 @injectable
@@ -34,6 +35,12 @@ class CharacterGroupContentController extends BaseController {
 
   bool get isLogin => accountRepository.isLogin.value;
 
+  bool get isVip =>
+      memberStatusInfo != null && memberStatusInfo!.isMember && isLogin;
+
+  MemberInfo? get memberStatusInfo => accountRepository.memberStatusInfo.value;
+
+
   UserInfoResponse? get userInfo =>
       accountRepository.userInfo.value;
 

+ 12 - 6
lib/module/character_custom/detail/character_custom_detail_controller.dart

@@ -10,8 +10,10 @@ import 'package:keyboard/module/store/store_page.dart';
 import 'package:keyboard/resource/string.gen.dart';
 import 'package:keyboard/utils/atmob_log.dart';
 
+import '../../../data/consts/error_code.dart';
 import '../../../di/get_it.dart';
 import '../../../dialog/keyboard_generating_dialog.dart';
+import '../../../dialog/login/login_dialog.dart';
 import '../../../resource/assets.gen.dart';
 import '../../../router/app_pages.dart';
 import '../../../utils/age_zodiac_sign_util.dart';
@@ -316,15 +318,19 @@ class CharacterCustomDetailController extends BaseController {
 
       ToastUtil.show("生成成功");
     } catch (error) {
-      if (error is ServerErrorException && error.code == 1005) {
-        ToastUtil.show('请开通会员解锁权益~');
-        StorePage.start();
-      }
       if (error is ServerErrorException) {
-        ToastUtil.show(error.message);
+        if (error.code == 1005) {
+          StorePage.start();
+          ToastUtil.show(error.message);
+        } else if (error.code == ErrorCode.noLoginError) {
+          LoginDialog.show();
+        } else {
+          ErrorHandler.toastError(error);
+        }
+      } else {
+        ToastUtil.show(error.toString());
       }
       KeyboardGeneratingDialog.hide();
-
     }
   }
 

+ 27 - 15
lib/module/character_custom/list/character_custom_list_controller.dart

@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
 import 'package:get/get.dart';
 import 'package:keyboard/data/repository/characters_repository.dart';
 import 'package:keyboard/data/repository/keyboard_repository.dart';
+import 'package:keyboard/dialog/login/login_dialog.dart';
 import 'package:keyboard/utils/toast_util.dart';
 
 import '../../../data/bean/character_info.dart';
@@ -14,6 +15,7 @@ import '../../../dialog/character_details_dialog.dart';
 import '../../../dialog/custom_character/custom_character_another_add_dialog.dart';
 import '../../../resource/string.gen.dart';
 import '../../../utils/atmob_log.dart';
+import '../../../utils/error_handler.dart';
 import '../../../utils/http_handler.dart';
 import '../detail/character_custom_detail_page.dart';
 
@@ -59,7 +61,6 @@ class CharacterCustomListController extends BaseController {
 
   // 下拉刷新
   Future<void> refreshData() async {
-
     _currentPage.value = 1;
     isLoading.value = true;
     await getCurrentCharacterListInfo(isRefresh: true);
@@ -83,27 +84,38 @@ class CharacterCustomListController extends BaseController {
 
   // 获取角色列表
   Future<void> getCurrentCharacterListInfo({bool isRefresh = false}) async {
-    var response = await charactersRepository.getCustomCharactersPage(
-      pageSize: 10,
-      page: _currentPage.value,
-      keyboardId: _currentKeyboardInfo.value.id.toString(),
-    );
-    if (response.characterInfos != null) {
-      if (isRefresh) {
-        _characterList.value = response.characterInfos!;
-      } else {
-        _characterList.addAll(response.characterInfos!);
+    try {
+      var response = await charactersRepository.getCustomCharactersPage(
+        pageSize: 10,
+        page: _currentPage.value,
+        keyboardId: _currentKeyboardInfo.value.id.toString(),
+      );
+      if (response.characterInfos != null) {
+        if (isRefresh) {
+          _characterList.value = response.characterInfos!;
+        } else {
+          _characterList.addAll(response.characterInfos!);
+        }
+        if (response.count != null) {
+          _currentListCount.value = response.count!;
+        }
       }
-      if (response.count != null) {
-        _currentListCount.value = response.count!;
+    } catch (error) {
+      AtmobLog.e(tag, "getCurrentCharacterListInfo error: $error");
+      if (error is ServerErrorException) {
+        if (error.code == ErrorCode.noLoginError) {
+          ErrorHandler.toastError(error);
+          LoginDialog.show();
+        } else {
+          ToastUtil.show(error.message);
+        }
       }
     }
   }
 
   void itemAddButtonClick(CharacterInfo characterInfo) async {
     AtmobLog.d(tag, 'characterInfo ${characterInfo.toJson()} ');
-    CustomCharacterAnotherAddDialog.show(customCharacterId:characterInfo.id!);
-
+    CustomCharacterAnotherAddDialog.show(customCharacterId: characterInfo.id!);
 
     // try {
     //   if (characterInfo.id != null) {

+ 3 - 0
lib/module/intimacy_scale/intimacy_scale_controller.dart

@@ -2,6 +2,7 @@ import 'package:injectable/injectable.dart';
 import 'package:keyboard/base/base_controller.dart';
 import 'package:get/get.dart';
 import 'package:keyboard/data/repository/keyboard_repository.dart';
+import 'package:keyboard/module/profile/profile_page.dart';
 import 'package:keyboard/utils/toast_util.dart';
 import '../../data/bean/keyboard_info.dart';
 import '../../data/consts/error_code.dart';
@@ -65,6 +66,7 @@ class IntimacyScaleController extends BaseController {
     if (currentKeyboardInfo.value == null &&
         currentKeyboardInfo.value?.id == null) {
       ToastUtil.show("请选择ta的键盘");
+      ProfilePage.start();
       return;
     }
 
@@ -78,6 +80,7 @@ class IntimacyScaleController extends BaseController {
       keyboardInfo.intimacy = currentCustomIntimacy.value;
       KeyboardAndroidPlatform.updateKeyboardInfo(keyboardInfo);
       await keyboardRepository.refreshData();
+
       Get.back();
     } catch (error) {
       if (error is ServerErrorException) {

+ 2 - 1
lib/module/keyboard/keyboard_view.dart

@@ -583,6 +583,7 @@ class KeyBoardView extends BaseView<KeyBoardController> {
   // 当前键盘人设信息
   Widget _buildKeyboardSettings() {
     return GestureDetector(
+      onTap: controller.clickGoKeyboardManage,
       child: Container(
         margin: EdgeInsets.symmetric(horizontal: 16.w),
         padding: EdgeInsets.only(
@@ -615,7 +616,7 @@ class KeyBoardView extends BaseView<KeyBoardController> {
                   fit: BoxFit.cover,
                 ),
                 GestureDetector(
-                  onTap: controller.clickGoKeyboardManage,
+                  // onTap: controller.clickGoKeyboardManage,
                   child: Row(
                     children: [
                       Text(

+ 45 - 34
lib/module/keyboard_manage/keyboard_manage_controller.dart

@@ -8,12 +8,14 @@ import 'package:keyboard/data/repository/account_repository.dart';
 import 'package:keyboard/data/repository/keyboard_repository.dart';
 import 'package:keyboard/dialog/character_add_dialog.dart';
 import 'package:keyboard/dialog/custom_character/custom_character_add_dialog.dart';
+import 'package:keyboard/dialog/login/login_dialog.dart';
 import 'package:keyboard/module/character/content/character_group_content_controller.dart';
 import 'package:keyboard/resource/string.gen.dart';
 import 'package:keyboard/utils/atmob_log.dart';
 import 'package:keyboard/utils/toast_util.dart';
 
 import '../../data/bean/keyboard_info.dart';
+import '../../data/consts/error_code.dart';
 import '../../utils/error_handler.dart';
 import '../../utils/http_handler.dart';
 
@@ -64,7 +66,7 @@ class KeyboardManageController extends BaseController
       _customKeyboardCharacterListChanged.value;
 
   // 存储排序前的定制人设列表,用于比较是否有变化
-   List<CharacterInfo> _oldCustomCharacterList = [];
+  List<CharacterInfo> _oldCustomCharacterList = [];
 
   // 通用键盘列表
   final RxList<KeyboardInfo> _generalKeyboardInfoList = RxList();
@@ -118,10 +120,13 @@ class KeyboardManageController extends BaseController
   // 键盘管理页面的pageController,用于控制通用键盘和自定义键盘的切换
   late PageController pageController;
 
+  // 首次加载数据标志
+  final isFirstLoad = true.obs;
+
   KeyboardManageController(this.keyboardRepository, this.accountRepository);
 
   @override
-  void onInit() {
+  void onInit() async {
     super.onInit();
 
     final args = Get.arguments;
@@ -129,10 +134,10 @@ class KeyboardManageController extends BaseController
       _currentCustomKeyboardInfo.value = args["customKeyboardInfo"];
     }
 
-    _dataLoad();
+   await _dataLoad();
   }
 
-  _dataLoad() {
+  _dataLoad() async {
     tabController = TabController(
       length: keyboardManageType.length,
       vsync: this,
@@ -146,7 +151,16 @@ class KeyboardManageController extends BaseController
 
     pageController = PageController();
 
-    getCustomKeyboard();
+    await getCustomKeyboard();
+    if (isFirstLoad.value) {
+      if (_customKeyboardInfoList.isEmpty) {
+        //   去另一个tab
+        pageController.jumpToPage(1);
+      }
+
+      isFirstLoad.value = false;
+    }
+
     getGeneralKeyboard();
   }
 
@@ -155,10 +169,15 @@ class KeyboardManageController extends BaseController
     Get.back();
   }
 
+  @override
+  void onReady() {
+    super.onReady();
+  }
+
   //   获取定制键盘
-  void getCustomKeyboard() {
+  Future<void> getCustomKeyboard() async {
     AtmobLog.i(tag, 'getCustomKeyboard');
-    keyboardRepository.getKeyboardList(type: KeyboardType.custom.name).then((
+   await keyboardRepository.getKeyboardList(type: KeyboardType.custom.name).then((
       keyboardListResponse,
     ) {
       AtmobLog.i(
@@ -171,11 +190,10 @@ class KeyboardManageController extends BaseController
       if (_customKeyboardInfoList.isNotEmpty) {
         if (_currentCustomKeyboardInfo.value.id == null) {
           _currentCustomKeyboardInfo.value = _customKeyboardInfoList.firstWhere(
-                (element) => element.isChoose == true,
+            (element) => element.isChoose == true,
             orElse: () => _customKeyboardInfoList.first,
           );
         }
-
         _currentCustomIntimacy.value =
             _currentCustomKeyboardInfo.value.intimacy ?? 0;
         _currentCustomIntimacy.listen((intimacy) {
@@ -294,20 +312,6 @@ class KeyboardManageController extends BaseController
     }
   }
 
-  //   切换当前通用键盘
-  void switchGeneralKeyboard(String? keyboardName) {
-    _currentGeneralKeyboardInfo.value = _generalKeyboardInfoList.firstWhere(
-      (element) => element.name == keyboardName,
-      orElse: () => _generalKeyboardInfoList.first,
-    );
-    String? keyboardId = _currentGeneralKeyboardInfo.value.id;
-    _currentGeneralIntimacy.value =
-        _currentGeneralKeyboardInfo.value.intimacy ?? 0;
-    if (keyboardId != null) {
-      getKeyboardCharacterList(keyboardId: keyboardId, isCustom: false);
-    }
-  }
-
   // tab切换
   void switchTabKeyboardType(int index) {
     // AtmobLog.i(tag, 'onTabChanged: $index');
@@ -335,7 +339,7 @@ class KeyboardManageController extends BaseController
       _currentCustomIntimacy.value =
           _currentCustomKeyboardInfo.value.intimacy ?? 0;
 
-      if(_oldCustomCharacterList.isNotEmpty){
+      if (_oldCustomCharacterList.isNotEmpty) {
         _currentCustomKeyboardCharacterList.value = _oldCustomCharacterList;
       }
 
@@ -374,8 +378,6 @@ class KeyboardManageController extends BaseController
     isCustom
         ? saveCustomKeyboardCharacterList()
         : saveGeneralKeyboardCharacterList();
-
-
   }
 
   void saveCustomKeyboardCharacterList() {
@@ -426,14 +428,18 @@ class KeyboardManageController extends BaseController
       keyboardRepository
           .updateKeyboardInfo(keyboardId: keyboardId, intimacy: currentIntimacy)
           .then((_) async {
-             ToastUtil.show(StringName.keyboardSaveSuccess);
-             await keyboardRepository.refreshData();
+            ToastUtil.show(StringName.keyboardSaveSuccess);
+            await keyboardRepository.refreshData();
           })
           .catchError((error) {
             if (error is ServerErrorException) {
               ErrorHandler.toastError(error);
+              if (error.code == ErrorCode.noLoginError) {
+                LoginDialog.show();
+              }
+            } else {
+              ToastUtil.show(StringName.keyboardSaveFailed);
             }
-            ToastUtil.show(StringName.keyboardSaveFailed);
           })
           .whenComplete(() => intimacyChanged.value = false);
     }
@@ -455,8 +461,12 @@ class KeyboardManageController extends BaseController
           .catchError((error) {
             if (error is ServerErrorException) {
               ErrorHandler.toastError(error);
+              if (error.code == ErrorCode.noLoginError) {
+                LoginDialog.show();
+              }
+            } else {
+              ToastUtil.show(StringName.keyboardSaveFailed);
             }
-            ToastUtil.show(StringName.keyboardSaveFailed);
           })
           .whenComplete(() => characterListChanged.value = false);
     }
@@ -484,6 +494,7 @@ class KeyboardManageController extends BaseController
   clickAddCharacter({required bool isCustom}) {
     if (!isLogin) {
       ToastUtil.show("请先登录");
+      LoginDialog.show();
       return;
     }
     if (isCustom) {
@@ -509,6 +520,7 @@ class KeyboardManageController extends BaseController
   clickCustomCharacter() {
     if (!isLogin) {
       ToastUtil.show("请先登录");
+      LoginDialog.show();
       return;
     }
     AtmobLog.i(tag, 'clickCustomCharacter');
@@ -530,8 +542,7 @@ class KeyboardManageController extends BaseController
     super.onClose();
   }
 
- void saveSuccessGetBack(){
-
-   Get.back(result: _currentCustomKeyboardCharacterList);
- }
+  void saveSuccessGetBack() {
+    Get.back(result: _currentCustomKeyboardCharacterList);
+  }
 }

+ 2 - 2
lib/module/keyboard_manage/keyboard_manage_page.dart

@@ -340,7 +340,7 @@ class KeyboardManagePage extends BasePage<KeyboardManageController> {
 
         Obx(() {
           return ReorderableWrap(
-            runSpacing: 16.h,
+            runSpacing: 16.w,
             spacing: 4.w,
             runAlignment: WrapAlignment.start,
             alignment: WrapAlignment.start,
@@ -404,7 +404,7 @@ class KeyboardManagePage extends BasePage<KeyboardManageController> {
     required bool isCustom,
   }) {
     return SizedBox(
-      width: (Get.width - 40.w) / 3,
+      width: (Get.width - 50.w) / 3,
       child: Stack(
         children: [
           Container(

+ 2 - 2
lib/module/login/login_page.dart

@@ -51,8 +51,9 @@ class LoginPage extends BasePage<LoginController> {
               buildLoginButton(),
               SizedBox(height: 25.w),
               _buildPrivacy(),
-              SizedBox(height: 100.w),
+              Spacer(),
               buildOtherLogin(),
+              SizedBox(height: 20.w),
             ],
           ),
         ),
@@ -361,7 +362,6 @@ class LoginPage extends BasePage<LoginController> {
             style: TextStyle(
               color: Colors.black.withValues(alpha: 0.5),
               fontSize: 12.sp,
-
               height: 0,
             ),
           ),

+ 9 - 4
lib/module/main/main_controller.dart

@@ -102,19 +102,24 @@ class MainController extends BaseController {
   @override
   void onInit() {
     super.onInit();
-    // 第一次显示首页,显示键盘引导页
-    KeyboardTutorialUtil.firstMainPageShowTutorial();
+
 
 
   }
 
   @override
-  void onReady() {
+  Future<void> onReady() async {
     super.onReady();
     if (memberStatusInfo != null && memberStatusInfo!.isMember&&isLogin) {
       return;
     }
-    NewDiscountPage.start();
+   await NewDiscountPage.start();
+    // 第一次显示首页,显示键盘引导页
+    KeyboardTutorialUtil.firstMainPageShowTutorial();
+
+
+
+
   }
 
   /// 处理跳转参数

+ 12 - 11
lib/module/new_user/new_user_controller.dart

@@ -85,7 +85,7 @@ class NewUserController extends BaseController
     }
   }
 
-  void clickNextButton() {
+  Future<void> clickNextButton() async {
     if (!isCurrentStepValid) {
       ToastUtil.show(currentStepValidationError ?? "请完成当前步骤");
       return;
@@ -94,13 +94,9 @@ class NewUserController extends BaseController
     if (currentStep == totalSteps) {
       _generateKeyboard();
     } else {
-      pageController.nextPage(
-        duration: const Duration(milliseconds: 300),
-        curve: Curves.easeIn,
-      );
-      _settingUseInfo();
 
-      _currentStep.value++;
+     await _settingUseInfo();
+
     }
   }
 
@@ -162,15 +158,20 @@ class NewUserController extends BaseController
 
   Future<void> _settingUseInfo() async {
     try {
-      accountRepository.setUserInfo(
+      await  accountRepository.setUserInfo(
         name: nickname.value,
         birthday:
-            currentBirthday != null
-                ? DateFormat('yyyy-MM-dd').format(currentBirthday!)
-                : null,
+        currentBirthday != null
+            ? DateFormat('yyyy-MM-dd').format(currentBirthday!)
+            : null,
         gender: currentGender,
         imageUrl: null,
       );
+      pageController.nextPage(
+        duration: const Duration(milliseconds: 300),
+        curve: Curves.easeIn,
+      );
+      _currentStep.value++;
       accountRepository.refreshUserInfo();
     } catch (error) {
       if (error is ServerErrorException) {

+ 64 - 52
lib/module/new_user/new_user_page.dart

@@ -36,63 +36,76 @@ class NewUserPage extends BasePage<NewUserController> {
 
   @override
   Widget buildBody(BuildContext context) {
-    return Stack(
-      children: [
-        IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)),
-        SafeArea(
-          child: Stack(
-            children: [
-              Column(
-                crossAxisAlignment: CrossAxisAlignment.start,
-                children: [
-                  _buildTitle(),
-                  Container(
-                    margin: EdgeInsets.only(top: 22.w, left: 32.w, right: 32.w),
+    return PopScope(
+      canPop: false,
+      onPopInvokedWithResult: (didPop, result) {
+        if (didPop) {
+          return;
+        }
+        controller.clickBack();
+      },
+      child: Stack(
+        children: [
+          IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)),
+          SafeArea(
+            child: Stack(
+              children: [
+                Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  children: [
+                    _buildTitle(),
+                    Container(
+                      margin: EdgeInsets.only(
+                        top: 22.w,
+                        left: 32.w,
+                        right: 32.w,
+                      ),
+                      child: Obx(() {
+                        return StepProgressBar(
+                          currentStep: controller.currentStep,
+                          totalSteps: controller.totalSteps,
+                        );
+                      }),
+                    ),
+                    SizedBox(height: 17.w),
+                    Expanded(
+                      child: PageView(
+                        controller: controller.pageController,
+                        physics: const NeverScrollableScrollPhysics(),
+                        children: const [
+                          StepGenderView(),
+                          StepBirthdayView(),
+                          StepNicknameView(),
+                          StepIntimacyStagesView(),
+                          StepPartnerView(),
+                        ],
+                      ),
+                    ),
+                  ],
+                ),
+                Align(
+                  alignment: Alignment.bottomCenter,
+                  child: Container(
+                    margin: EdgeInsets.only(
+                      bottom: 50.w,
+                      left: 50.w,
+                      right: 50.w,
+                    ),
                     child: Obx(() {
-                      return StepProgressBar(
-                        currentStep: controller.currentStep,
-                        totalSteps: controller.totalSteps,
+                      return _buildNextButton(
+                        onTap: () {
+                          controller.clickNextButton();
+                        },
+                        isEnable: controller.isCurrentStepValid,
                       );
                     }),
                   ),
-                  SizedBox(height: 17.w),
-                  Expanded(
-                    child: PageView(
-                      controller: controller.pageController,
-                      physics: const NeverScrollableScrollPhysics(),
-                      children: const [
-                        StepGenderView(),
-                        StepBirthdayView(),
-                        StepNicknameView(),
-                        StepIntimacyStagesView(),
-                        StepPartnerView(),
-                      ],
-                    ),
-                  ),
-                ],
-              ),
-              Align(
-                alignment: Alignment.bottomCenter,
-                child: Container(
-                  margin: EdgeInsets.only(
-                    bottom: 50.w,
-                    left: 50.w,
-                    right: 50.w,
-                  ),
-                  child: Obx(() {
-                    return _buildNextButton(
-                      onTap: () {
-                        controller.clickNextButton();
-                      },
-                      isEnable: controller.isCurrentStepValid,
-                    );
-                  }),
                 ),
-              ),
-            ],
+              ],
+            ),
           ),
-        ),
-      ],
+        ],
+      ),
     );
   }
 
@@ -167,7 +180,6 @@ class NewUserPage extends BasePage<NewUserController> {
                     style: TextStyle(
                       color: Colors.black.withAlpha(87),
                       fontSize: 14.sp,
-
                     ),
                   ),
                 ),

+ 9 - 6
lib/module/profile/profile_controller.dart

@@ -2,6 +2,7 @@ import 'package:get/get_rx/src/rx_types/rx_types.dart';
 import 'package:injectable/injectable.dart';
 import 'package:keyboard/base/base_controller.dart';
 import 'package:keyboard/data/repository/account_repository.dart';
+import 'package:keyboard/dialog/login/login_dialog.dart';
 import 'package:keyboard/module/profile/edit/profile_edit_page.dart';
 import 'package:keyboard/module/user_info/user_info_page.dart';
 import 'package:keyboard/module/user_profile/user_profile_page.dart';
@@ -9,6 +10,7 @@ import 'package:keyboard/utils/atmob_log.dart';
 import 'package:get/get.dart';
 import '../../data/api/response/user_info_response.dart';
 import '../../data/bean/keyboard_info.dart';
+import '../../data/consts/error_code.dart';
 import '../../data/repository/keyboard_repository.dart';
 import '../../utils/error_handler.dart';
 import '../../utils/http_handler.dart';
@@ -34,8 +36,6 @@ class ProfileController extends BaseController {
   RxList<KeyboardInfo> get customKeyboardInfoList =>
       keyboardRepository.customKeyboardInfoList;
 
-
-
   ProfileController(this.keyboardRepository, this.accountRepository) {
     AtmobLog.d(tag, '....init');
   }
@@ -43,10 +43,10 @@ class ProfileController extends BaseController {
   @override
   void onInit() {
     super.onInit();
-
   }
-@override
-void onReady() {
+
+  @override
+  void onReady() {
     super.onReady();
 
     getCustomKeyboard();
@@ -97,6 +97,9 @@ void onReady() {
       } catch (error) {
         if (error is ServerErrorException) {
           ErrorHandler.toastError(error);
+          if (error.code == ErrorCode.noLoginError) {
+            LoginDialog.show();
+          }
         } else {
           AtmobLog.d(tag, " $error");
         }
@@ -111,7 +114,7 @@ void onReady() {
       if (result == true) {
         await getCustomKeyboard();
       }
-    }else{
+    } else {
       UserProfilePage.start();
     }
   }

+ 5 - 2
lib/module/store/new_discount/new_discount_page.dart

@@ -22,8 +22,8 @@ class NewDiscountPage extends BasePage<NewDiscountController> {
   const NewDiscountPage({super.key});
 
   /// 跳转
-  static void start() {
-    Get.toNamed(RoutePath.newDiscount);
+  static Future<void> start() async {
+    await Get.toNamed(RoutePath.newDiscount);
   }
 
   @override
@@ -326,6 +326,9 @@ class NewDiscountPage extends BasePage<NewDiscountController> {
         children: [
           Obx(() {
             final goodsList = controller.filteredGoodsList;
+            if (goodsList.isEmpty) {
+              return CircularProgressIndicator();
+            }
             return Column(
               children: List.generate(goodsList.length, (index) {
                 final item = goodsList[index];

+ 8 - 8
lib/module/store/store_controller.dart

@@ -98,22 +98,22 @@ class StoreController extends BaseController implements PaymentStatusCallback {
     StoreUserReviewsBean(
       avatar: Assets.images.iconStoreUserReview1,
       userName: "执****念",
-      userReviews: "恋爱键盘超绝!多样人设主题,快捷情话输入,敲出专属浪漫,爱意满屏。1",
+      userReviews: "用了3天,crush居然主动约我吃饭!AI比我还会撩!",
     ),
     StoreUserReviewsBean(
       avatar: Assets.images.iconStoreUserReview2,
       userName: "过****人",
-      userReviews: "恋爱键盘超绝!多样人设主题,快捷情话输入,敲出专属浪漫,爱意满屏。2",
+      userReviews: "之前总把天聊死,现在TA说我‘突然变会说话’了😂",
     ),
     StoreUserReviewsBean(
       avatar: Assets.images.iconStoreUserReview3,
       userName: "不当****solo",
-      userReviews: "恋爱键盘超绝!多样人设主题,快捷情话输入,敲出专属浪漫,爱意满屏。3",
+      userReviews: "星座分析超准!按攻略撩天蝎座,他真的一步步上钩了!",
     ),
     StoreUserReviewsBean(
       avatar: Assets.images.iconStoreUserReview4,
-      userName: "用户*****1234",
-      userReviews: "很好,很满意",
+      userName: "用户****5476",
+      userReviews: "社恐救星!键盘帮我回的消息比我自己发可爱100倍🥰",
     ),
   ];
 
@@ -458,15 +458,15 @@ class StoreController extends BaseController implements PaymentStatusCallback {
   @override
   void onInit() async {
     super.onInit();
-    await AssetLottie(Assets.anim.animSurpriseDialogData).load();
+
   }
 
   @override
-  void onClose() {
+  void onClose() async{
     super.onClose();
     _storeDataFuture?.cancel();
     paymentStatusManager.unregisterPaymentSuccessCallback(this);
-
+    await AssetLottie(Assets.anim.animSurpriseDialogData).load();
     if (memberStatusInfo != null && memberStatusInfo!.isMember&&isLogin) {
       return;
     }

+ 20 - 2
lib/module/store/suprise/goods_surprise_controller.dart

@@ -10,7 +10,7 @@ import '../../../data/repository/store_repository.dart';
 import '../../../utils/async_util.dart';
 import '../../../utils/error_handler.dart';
 import 'package:keyboard/utils/atmob_log.dart';
-
+// 这里控制两个弹窗的数据
 @injectable
 class GoodsSurpriseController extends BaseController {
   final tag = 'GoodsSurpriseController';
@@ -40,8 +40,26 @@ class GoodsSurpriseController extends BaseController {
     if (goodsInfoList.isEmpty) {
       return;
     }
+    if (goodsInfoList.length < 2) {
+
+      AtmobLog.e(tag,"商品列表少于2个,无法处理");
+      return;
+    }
+    // 第一个直接拿第一个
     _firstAmount.value = goodsInfoList.first;
-    _secondAmount.value = goodsInfoList.last;
+    // 第二个找一个 code 不一样的
+    _secondAmount.value = goodsInfoList.firstWhereOrNull(
+          (item) => item.code != _firstAmount.value?.code,
+    );
+
+    // 打印
+    print('qqq firstAmount: ${_firstAmount.value?.toJson()}');
+    print('qqq secondAmount: ${_secondAmount.value?.toJson()}');
+    if (_secondAmount.value == null) {
+      // 如果没有找到不同的 code,默认取第二个
+      _secondAmount.value = goodsInfoList[1];
+    }
+
 
     super.onInit();
   }

+ 2 - 2
lib/module/store/ticket/discount_ticket_dialog.dart

@@ -59,7 +59,7 @@ class DiscountTicketDialog {
                             decoration: BoxDecoration(
                               image: DecorationImage(
                                 image: Assets.images.bgTicketDialog.provider(),
-                                fit: BoxFit.cover,
+                                fit: BoxFit.contain,
                               ),
                               boxShadow: [
                                 BoxShadow(
@@ -173,7 +173,7 @@ class DiscountTicketDialog {
                                                   .images
                                                   .bgTicketDialogPrices2
                                                   .provider(),
-                                          fit: BoxFit.cover,
+                                          fit: BoxFit.contain,
                                         ),
                                       ),
                                     ),

+ 1 - 0
lib/sdk/gravity/gravity_helper.dart

@@ -49,6 +49,7 @@ class GravityHelper {
     if (currentSSID == null || refreshSSID) {
       UserInfoResponse response =
           await AccountRepository.getInstance().getUserInfo();
+      // 要用的是deviceID
       KVUtil.putString(_keyCurrentSsid, response.deviceId);
       return response.deviceId;
     }

+ 2 - 1
lib/utils/payment_status_manager.dart

@@ -7,6 +7,7 @@ import 'package:keyboard/data/repository/store_repository.dart';
 import 'package:synchronized/synchronized.dart';
 
 
+import '../handler/event_handler.dart';
 import 'async_util.dart';
 
 class PaymentStatus {
@@ -82,7 +83,7 @@ class PaymentStatusManager {
 
   void reportPaySuccess(
       int price, String orderId, String itemName, int paymentWay) {
-    // EventHandler.reportPay(price, orderId, itemName, paymentWay);
+    EventHandler.reportPay(price, orderId, itemName, paymentWay);
   }
 
   void checkPaymentStatus(