diff --git a/lib/models/base/base_setting_model.dart b/lib/models/base/base_setting_model.dart index 2fe3a3b..3586463 100644 --- a/lib/models/base/base_setting_model.dart +++ b/lib/models/base/base_setting_model.dart @@ -1,10 +1,14 @@ +import 'dart:io'; + import 'package:zhiying_comm/util/net_util.dart'; +import 'package:zhiying_comm/util/shared_prefe_util.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class BaseSettingModel { String fileProvider; String fileBucketHost; String fileBucketHostProtocol; + String isIosReview; Map tab; static BaseSettingModel _setting; @@ -23,6 +27,7 @@ class BaseSettingModel { fileProvider = json['file_provider']; fileBucketHost = json['file_bucket_host']; fileBucketHostProtocol = json['file_bucket_host_protocol']; + isIosReview = json['is_ios_review']?.toString(); tab = Map.from(json['bottom_nav']); } @@ -32,6 +37,7 @@ class BaseSettingModel { data['file_bucket_host'] = this.fileBucketHost; data['file_bucket_host_protocol'] = this.fileBucketHostProtocol; data['bottom_nav'] = this.tab; + data['is_ios_review'] = this.isIosReview; return data; } @@ -41,6 +47,13 @@ class BaseSettingModel { try { var data = result['data']; _setting = BaseSettingModel.fromJson(Map.from(data)); + if(Platform.isIOS) { + if (null != _setting && _setting.isIosReview == '1') { + SharedPreferencesUtil.setStringValue(GlobalConfig.IS_IOS_REVIEW, '1'); + } else { + SharedPreferencesUtil.setStringValue(GlobalConfig.IS_IOS_REVIEW, '0'); + } + } Logger.debug('基础设置初始化'); return _setting; } catch (err) { diff --git a/lib/pages/login_page/account/login_account_page.dart b/lib/pages/login_page/account/login_account_page.dart index 96bff8a..bd22eef 100644 --- a/lib/pages/login_page/account/login_account_page.dart +++ b/lib/pages/login_page/account/login_account_page.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -6,6 +8,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:provider/provider.dart'; import 'package:zhiying_comm/pages/login_page/invite/login_invite_page.dart'; import 'package:zhiying_comm/pages/login_page/model/login_style_model.dart'; +import 'package:zhiying_comm/util/shared_prefe_util.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; import 'bloc/bloc.dart'; import 'bloc/login_account_repository.dart'; @@ -53,9 +56,29 @@ class _LoginAccountPageContianerState extends State i FocusNode _passFN; FocusNode _vcodeFN; - // 是否登录中 + /// 是否使用验证码登陆 默认使用 + bool _useVcode = true; + + /// 是否可以登陆 + bool _canSubmit = false; + + /// 是否同意协议 + bool _acceptAgreement = true; + + /// 是否显示第三方验证码 + bool _showOtherVcode = false; + + /// 是否登录中 bool _isLogging = false; + /// 设置苹果审核UI + void _settingIosReviewUI() async{ + String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); + if(Platform.isIOS && is_ios_review == '1' ){ + _useVcode = false; + } + } + /// 跳转到邀请码页面 void _openInvitePage(String mobile) { print('跳转到邀请码页面'); @@ -74,13 +97,6 @@ class _LoginAccountPageContianerState extends State i // Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (BuildContext context) => PageFactory.create('homePage', null)), (Route route) => false,); } - /// 返回上一页 - void _openPop() { - if (Navigator.canPop(context)) { - Navigator.pop(context); - } - } - /// 登陆 void _submitOnClick() { print('登陆'); @@ -211,18 +227,6 @@ class _LoginAccountPageContianerState extends State i return true; } - /// 是否使用验证码登陆 默认使用 - bool _useVcode = true; - - /// 是否可以登陆 - bool _canSubmit = false; - - /// 是否同意协议 - bool _acceptAgreement = true; - - /// 是否显示第三方验证码 - bool _showOtherVcode = false; - @override void initState() { _phoneEdController = TextEditingController(); @@ -231,6 +235,8 @@ class _LoginAccountPageContianerState extends State i _vcodeFN = FocusNode(); _passFN = FocusNode(); _phoneFN = FocusNode(); + // 设置苹果审核UI + _settingIosReviewUI(); super.initState(); } @@ -369,7 +375,7 @@ class _LoginAccountPageContianerState extends State i size: 22, color: HexColor.fromHex('#333333'), ), - onPressed: () => _openPop(), + onPressed: () => Navigator.maybePop(context), ), ); } diff --git a/lib/util/global_config.dart b/lib/util/global_config.dart index 73089eb..840379e 100644 --- a/lib/util/global_config.dart +++ b/lib/util/global_config.dart @@ -41,4 +41,7 @@ class GlobalConfig { /// 货币类型 static final String MONEY_TYPE = "¥ "; + /// 苹果审核 + static final String IS_IOS_REVIEW = 'is_ios_review'; + } diff --git a/lib/util/router_util.dart b/lib/util/router_util.dart index 6b569a0..fd76f90 100644 --- a/lib/util/router_util.dart +++ b/lib/util/router_util.dart @@ -1,7 +1,11 @@ +import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:zhiying_comm/pages/login_page/account/login_account_page.dart'; import 'package:zhiying_comm/pages/login_page/login_page.dart'; +import 'package:zhiying_comm/util/shared_prefe_util.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class RouterUtil { @@ -45,9 +49,14 @@ class RouterUtil { } // 跳转登录 - static Future goLogin(BuildContext context) { + static Future goLogin(BuildContext context) async{ + String isIosReview = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); return Navigator.of(context) .push(CupertinoPageRoute(builder: (BuildContext context) { + // 苹果审核登录样式 + if(Platform.isIOS && isIosReview == '1'){ + return LoginAccountPage(null); + } return LoginPage(); })); }