From 172ded1bb9f778554b7211837ab33142fc34086e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Fri, 19 Mar 2021 13:55:35 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/login_page/login_page.dart | 43 ++++++++++++------- .../login_page/model/login_style_model.dart | 2 + lib/util/net_util.dart | 12 ++++++ lib/zhiying_comm.dart | 2 + 4 files changed, 44 insertions(+), 15 deletions(-) diff --git a/lib/pages/login_page/login_page.dart b/lib/pages/login_page/login_page.dart index 4084d0b..d8445e1 100644 --- a/lib/pages/login_page/login_page.dart +++ b/lib/pages/login_page/login_page.dart @@ -89,7 +89,7 @@ class _LoginPageContainerState extends State { /// 微信or手机登陆 void _loginClick(String type, LoginStyleModel model) { - if(!isCheck()){ + if (!isCheck()) { return; } print('登陆$type'); @@ -147,7 +147,7 @@ class _LoginPageContainerState extends State { /// 第三方登陆 void _otherLoginClick(BottomIcons model) async { - if(!isCheck()){ + if (!isCheck()) { return; } print('第三方登陆${model.type}'); @@ -357,9 +357,11 @@ class _LoginPageContainerState extends State { /// 按钮 _buttonsWidget(model), _sizedHeight9, + ///账号密码登录 - _buildOrderLogin(), - _sizedHeight9, + _buildOrderLogin(), + _sizedHeight9, + /// 协议 _protocolWidget(model), @@ -415,10 +417,18 @@ class _LoginPageContainerState extends State { ), /// 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 { child: Icon( checkBool ? Icons.check_box : Icons.check_box_outline_blank, size: 16, - color: checkBool?Colors.red:Colors.black12, + color: checkBool ? Colors.red : Colors.black12, ), ), ), @@ -571,21 +581,24 @@ class _LoginPageContainerState extends State { return Center( child: GestureDetector( behavior: HitTestBehavior.opaque, - onTap: (){ - if(isCheck()){ + onTap: () { + if (isCheck()) { 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: "请阅读并勾选同意用户协议选项"); return false; - }else{ + } else { return true; } } diff --git a/lib/pages/login_page/model/login_style_model.dart b/lib/pages/login_page/model/login_style_model.dart index 4926ec0..18d3c5d 100644 --- a/lib/pages/login_page/model/login_style_model.dart +++ b/lib/pages/login_page/model/login_style_model.dart @@ -65,6 +65,7 @@ class Main { String appBarTitleColor; String appBarBgColor; String appNameImg; + String appName; String backgroundImg; List agreements; List importanceLogin; @@ -92,6 +93,7 @@ class Main { appBarBgColor = json['app_bar_bg_color']; appNameImg = json['app_name_img']; backgroundImg = json['background_img']; + appName=json['app_name_cn']; if (json['agreements'] != null) { agreements = new List(); json['agreements'].forEach((v) { diff --git a/lib/util/net_util.dart b/lib/util/net_util.dart index d5b7a57..642fc60 100644 --- a/lib/util/net_util.dart +++ b/lib/util/net_util.dart @@ -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(context, listen: false).unLogin(); + }); + } catch (e, s) { + Logger.error(e, s); + } + } + /// /// 403028 账号被冻结 /// 403029 账号被禁用 diff --git a/lib/zhiying_comm.dart b/lib/zhiying_comm.dart index fd1a100..2868067 100644 --- a/lib/zhiying_comm.dart +++ b/lib/zhiying_comm.dart @@ -50,3 +50,5 @@ export 'package:path_provider/path_provider.dart'; export 'package:dio/dio.dart'; export 'package:fluwx/fluwx.dart'; export 'package:permission_handler/permission_handler.dart'; +export 'package:zhiying_comm/util/shared_prefe_util.dart'; +export 'package:fluttertoast/fluttertoast.dart';