Browse Source

1、添加苹果审核登录样式

tags/0.0.2+18^0
PH2 3 years ago
parent
commit
a93244d991
4 changed files with 53 additions and 22 deletions
  1. +13
    -0
      lib/models/base/base_setting_model.dart
  2. +27
    -21
      lib/pages/login_page/account/login_account_page.dart
  3. +3
    -0
      lib/util/global_config.dart
  4. +10
    -1
      lib/util/router_util.dart

+ 13
- 0
lib/models/base/base_setting_model.dart View File

@@ -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<String, dynamic> 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<String, dynamic>.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<String, dynamic>.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) {


+ 27
- 21
lib/pages/login_page/account/login_account_page.dart View File

@@ -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<LoginAccountPageContianer> 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<LoginAccountPageContianer> i
// Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (BuildContext context) => PageFactory.create('homePage', null)), (Route<dynamic> route) => false,);
}

/// 返回上一页
void _openPop() {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}

/// 登陆
void _submitOnClick() {
print('登陆');
@@ -211,18 +227,6 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> 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<LoginAccountPageContianer> i
_vcodeFN = FocusNode();
_passFN = FocusNode();
_phoneFN = FocusNode();
// 设置苹果审核UI
_settingIosReviewUI();
super.initState();
}

@@ -369,7 +375,7 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> i
size: 22,
color: HexColor.fromHex('#333333'),
),
onPressed: () => _openPop(),
onPressed: () => Navigator.maybePop(context),
),
);
}


+ 3
- 0
lib/util/global_config.dart View File

@@ -41,4 +41,7 @@ class GlobalConfig {
/// 货币类型
static final String MONEY_TYPE = "¥ ";

/// 苹果审核
static final String IS_IOS_REVIEW = 'is_ios_review';

}

+ 10
- 1
lib/util/router_util.dart View File

@@ -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();
}));
}


Loading…
Cancel
Save