Преглед на файлове

[fit]修改冷启动会员还弹出活动页

云天逵 преди 7 месеца
родител
ревизия
4395239ca9
променени са 2 файла, в които са добавени 22 реда и са изтрити 8 реда
  1. 6 0
      lib/data/repository/account_repository.dart
  2. 16 8
      lib/module/main/main_controller.dart

+ 6 - 0
lib/data/repository/account_repository.dart

@@ -41,6 +41,8 @@ class AccountRepository {
   RxnString loginPhoneNum = RxnString();
   final RxBool isLogin = false.obs;
 
+  final RxBool isRequest =false.obs;
+
   Rxn<MemberInfo> memberStatusInfo = Rxn<MemberInfo>();
 
   bool get isVipUser =>
@@ -158,6 +160,7 @@ class AccountRepository {
         .then(HttpHandler.handle(true))
         .then((response) {
           _userInfo.value = response;
+
           if (response.loginStatus != null) {
             if (response.loginStatus == 1) {
               print("loginStatus == 1");
@@ -167,8 +170,10 @@ class AccountRepository {
             if (response.loginStatus == 0) {
               print("loginStatus == 0");
               isLogin.value = false;
+
             }
           }
+
           memberStatusInfo.value = response.memberInfo;
           if (response.memberInfo != null) {
             KVUtil.putBool(
@@ -176,6 +181,7 @@ class AccountRepository {
               response.memberInfo!.isMember,
             );
           }
+          isRequest.value = true;
           if (isLogin.value) {
             isVipUser
                 ? JpushHelper.getInstance().setTags(tag: ["vipUser",getChannelName()])

+ 16 - 8
lib/module/main/main_controller.dart

@@ -38,6 +38,8 @@ class MainController extends BaseController {
 
   bool get isLogin => accountRepository.isLogin.value;
 
+  RxBool get isRequest => accountRepository.isRequest;
+
   MemberInfo? get memberStatusInfo => accountRepository.memberStatusInfo.value;
 
   MainController(
@@ -99,7 +101,6 @@ class MainController extends BaseController {
         EventHandler.report(EventId.event_11000);
       }
     }
-
   }
 
   @override
@@ -110,12 +111,19 @@ class MainController extends BaseController {
   @override
   Future<void> onReady() async {
     super.onReady();
-    if (memberStatusInfo != null && memberStatusInfo!.isMember && isLogin) {
-      return;
-    }
-    if(!accountRepository.isVipUser){
-      await NewDiscountPage.start();
-    }
+
+    once(isRequest, (value) async {
+      if (value) {
+        if (memberStatusInfo != null && memberStatusInfo!.isMember && isLogin) {
+          return;
+        }
+        AtmobLog.i(_tag, "memberStatusInfo ${memberStatusInfo?.isMember}");
+        if (!accountRepository.isVipUser) {
+
+          await NewDiscountPage.start();
+        }
+      }
+    });
 
     // 第一次显示首页,显示键盘引导页
     KeyboardTutorialUtil.firstMainPageShowTutorial();
@@ -153,4 +161,4 @@ class TabBean {
   const TabBean(this.title, this.normalIcon, this.selectedIcon, this.page);
 }
 
-typedef WidgetFunction = Widget Function();
+typedef WidgetFunction = Widget Function();