Browse Source

1.优化登录页

tags/0.0.8+1
“yanghuaxuan” 3 years ago
parent
commit
172ded1bb9
4 changed files with 44 additions and 15 deletions
  1. +28
    -15
      lib/pages/login_page/login_page.dart
  2. +2
    -0
      lib/pages/login_page/model/login_style_model.dart
  3. +12
    -0
      lib/util/net_util.dart
  4. +2
    -0
      lib/zhiying_comm.dart

+ 28
- 15
lib/pages/login_page/login_page.dart View File

@@ -89,7 +89,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> {


/// 微信or手机登陆 /// 微信or手机登陆
void _loginClick(String type, LoginStyleModel model) { void _loginClick(String type, LoginStyleModel model) {
if(!isCheck()){
if (!isCheck()) {
return; return;
} }
print('登陆$type'); print('登陆$type');
@@ -147,7 +147,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> {


/// 第三方登陆 /// 第三方登陆
void _otherLoginClick(BottomIcons model) async { void _otherLoginClick(BottomIcons model) async {
if(!isCheck()){
if (!isCheck()) {
return; return;
} }
print('第三方登陆${model.type}'); print('第三方登陆${model.type}');
@@ -357,9 +357,11 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
/// 按钮 /// 按钮
_buttonsWidget(model), _buttonsWidget(model),
_sizedHeight9, _sizedHeight9,

///账号密码登录 ///账号密码登录
_buildOrderLogin(),
_sizedHeight9,
_buildOrderLogin(),
_sizedHeight9,

/// 协议 /// 协议
_protocolWidget(model), _protocolWidget(model),


@@ -415,10 +417,18 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
), ),


/// logo 名字 /// logo 名字
CachedNetworkImage(
imageUrl: model?.main?.appNameImg ?? '',
width: 90,
),
// CachedNetworkImage(
// imageUrl: model?.main?.appNameImg ?? '',
// width: 90,
// ),
Container(
margin: EdgeInsets.only(top: 0, bottom: 6),
child: Center(
child: Text(
model?.main?.appName ?? "",
style: TextStyle(color: HexColor.fromHex("#FF333333"), fontSize: 20,fontWeight: FontWeight.bold),
)),
)
], ],
), ),
], ],
@@ -465,7 +475,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
child: Icon( child: Icon(
checkBool ? Icons.check_box : Icons.check_box_outline_blank, checkBool ? Icons.check_box : Icons.check_box_outline_blank,
size: 16, size: 16,
color: checkBool?Colors.red:Colors.black12,
color: checkBool ? Colors.red : Colors.black12,
), ),
), ),
), ),
@@ -571,21 +581,24 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
return Center( return Center(
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){
if(isCheck()){
onTap: () {
if (isCheck()) {
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginAccountPage(null))); Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginAccountPage(null)));
} }
}, },
child: Text("使用账号密码登录",style: TextStyle(color: HexColor.fromHex("#FFFF4242"),fontSize: 14),),
child: Text(
"使用账号密码登录",
style: TextStyle(color: HexColor.fromHex("#FFFF4242"), fontSize: 14),
),
), ),
); );
} }


bool isCheck(){
if(!checkBool){
bool isCheck() {
if (!checkBool) {
Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项");
return false; return false;
}else{
} else {
return true; return true;
} }
} }


+ 2
- 0
lib/pages/login_page/model/login_style_model.dart View File

@@ -65,6 +65,7 @@ class Main {
String appBarTitleColor; String appBarTitleColor;
String appBarBgColor; String appBarBgColor;
String appNameImg; String appNameImg;
String appName;
String backgroundImg; String backgroundImg;
List<Agreements> agreements; List<Agreements> agreements;
List<ImportanceLogin> importanceLogin; List<ImportanceLogin> importanceLogin;
@@ -92,6 +93,7 @@ class Main {
appBarBgColor = json['app_bar_bg_color']; appBarBgColor = json['app_bar_bg_color'];
appNameImg = json['app_name_img']; appNameImg = json['app_name_img'];
backgroundImg = json['background_img']; backgroundImg = json['background_img'];
appName=json['app_name_cn'];
if (json['agreements'] != null) { if (json['agreements'] != null) {
agreements = new List<Agreements>(); agreements = new List<Agreements>();
json['agreements'].forEach((v) { json['agreements'].forEach((v) {


+ 12
- 0
lib/util/net_util.dart View File

@@ -167,6 +167,18 @@ class NetUtil {
} }
} }


///非法用户
if (result[GlobalConfig.HTTP_RESPONSE_KEY_CODE]?.toString() == '401000') {
try {
Future.delayed(Duration(seconds: 0)).then((onValue) {
BuildContext context = navigatorKey.currentState.overlay.context;
Provider.of<UserInfoNotifier>(context, listen: false).unLogin();
});
} catch (e, s) {
Logger.error(e, s);
}
}

/// ///
/// 403028 账号被冻结 /// 403028 账号被冻结
/// 403029 账号被禁用 /// 403029 账号被禁用


+ 2
- 0
lib/zhiying_comm.dart View File

@@ -50,3 +50,5 @@ export 'package:path_provider/path_provider.dart';
export 'package:dio/dio.dart'; export 'package:dio/dio.dart';
export 'package:fluwx/fluwx.dart'; export 'package:fluwx/fluwx.dart';
export 'package:permission_handler/permission_handler.dart'; export 'package:permission_handler/permission_handler.dart';
export 'package:zhiying_comm/util/shared_prefe_util.dart';
export 'package:fluttertoast/fluttertoast.dart';

Loading…
Cancel
Save