diff --git a/lib/pages/login_page/account/bloc/login_account_repository.dart b/lib/pages/login_page/account/bloc/login_account_repository.dart index 672578c..6063446 100644 --- a/lib/pages/login_page/account/bloc/login_account_repository.dart +++ b/lib/pages/login_page/account/bloc/login_account_repository.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:zhiying_comm/pages/login_page/model/login_model.dart'; import 'package:zhiying_comm/util/empty_util.dart'; import 'package:zhiying_comm/util/global_config.dart'; +import 'package:zhiying_comm/util/mob_util/mob_util.dart'; import 'package:zhiying_comm/util/net_util.dart'; import 'package:zhiying_comm/models/user/user_info_model.dart'; @@ -25,11 +26,13 @@ class LoginAccountRepository { /// 获取验证码 Future fetchGetVcode(LoginAccountGetVcodeEvent event) async { print('mobile = ${event.mobile}'); - var result = await NetUtil.post('/api/v1/sign/sms/fast/in', params: {'mobile': event.mobile}); - if (NetUtil.isSuccess(result)) { - return true; - } - return false; + // var result = await NetUtil.post('/api/v1/sign/sms/fast/in', params: {'mobile': event.mobile}); + // if (NetUtil.isSuccess(result)) { + // return true; + // } + // return false; + var result = await MobUtil.getTextCode(event?.mobile, smsCodeType: SMSCodeType.AUTO); + return result; } /// 密码登陆 @@ -48,7 +51,7 @@ class LoginAccountRepository { /// 验证码登陆 Future loginTypeVcode(LoginAccountTypeVcodeEvent event) async { - var result = await NetUtil.post('/api/v1/sign/fast/in', params: {'mobile': event.mobile, 'captcha': event.captcha}); + var result = await NetUtil.post('/api/v1/sign/fast/in', params: {'mobile': event.mobile, 'captcha': event.captcha, 'zone': '86'}); if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { UserInfoModel loginUser = UserInfoModel.fromJson(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); if (null != loginUser) { diff --git a/lib/pages/login_page/login_page.dart b/lib/pages/login_page/login_page.dart index ed67e28..cd1c674 100644 --- a/lib/pages/login_page/login_page.dart +++ b/lib/pages/login_page/login_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:zhiying_comm/pages/login_page/account/login_account_page.dart'; import 'package:zhiying_comm/util/empty_util.dart'; +import 'package:zhiying_comm/util/mob_util/mob_util.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; import 'bloc/bloc.dart'; @@ -16,7 +17,6 @@ import 'model/login_model.dart'; /// 登陆页面 /// class LoginPage extends StatelessWidget { - const LoginPage({Key key}) : super(key: key); @override @@ -37,21 +37,23 @@ class LoginPageContainer extends StatefulWidget { } class _LoginPageContainerState extends State { - - /// 微信登陆 - void _loginClick(String type) { + /// 微信or手机登陆 + void _loginClick(String type, LoginModel model) { print('登陆$type'); - if(type == 'mobile'){ - RouterUtil.hideKeyboard(context); - Navigator.push(context, CupertinoPageRoute( - builder: (_) => LoginAccountPage(null) - )); + RouterUtil.hideKeyboard(context); + if (type == 'mobile') { + if (model?.flashLoginEnable == '1') { + // QuickLoginUtil.getInstance().openQuickLogin(context, model?.quick); + MobUtil.openQuickLoginPage(context, model?.quick); + } else { + Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginAccountPage(null))); + } } } /// 返回上一页 - void _openPop(){ - if(Navigator.canPop(context)){ + void _openPop() { + if (Navigator.canPop(context)) { Navigator.pop(context); } } @@ -63,7 +65,7 @@ class _LoginPageContainerState extends State { /// 跳到用户协议 void _jumpUserAgreement(String url) { - if(!EmptyUtil.isEmpty(url)) { + if (!EmptyUtil.isEmpty(url)) { print('协议'); RouterUtil.openWebview(url, context); } @@ -110,7 +112,6 @@ class _LoginPageContainerState extends State { Widget _getMainWidget(LoginModel model) { return Column( children: [ - /// 头部 _headWidget(model), _sizedHeight50, @@ -151,14 +152,13 @@ class _LoginPageContainerState extends State { size: 22, color: HexColor.fromHex('#333333'), ), - onPressed: ()=> _openPop(), + onPressed: () => _openPop(), ), ), Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ - /// logo Container( margin: EdgeInsets.only(bottom: 12, top: MediaQuery.of(context).padding.top), @@ -175,8 +175,10 @@ class _LoginPageContainerState extends State { ), /// logo 名字 - CachedNetworkImage( imageUrl: model?.main?.appNameImg ?? '', width: 90,), - + CachedNetworkImage( + imageUrl: model?.main?.appNameImg ?? '', + width: 90, + ), ], ), ], @@ -199,7 +201,7 @@ class _LoginPageContainerState extends State { textColor: item?.btnTextColor, bgColor: item?.btnBgColor, borderColor: item?.btnBorderColor, - onTap: () => _loginClick(item?.type)), + onTap: () => _loginClick(item?.type, model)), ); }).toList(), ), @@ -209,11 +211,17 @@ class _LoginPageContainerState extends State { /// 协议 Widget _protocolWidget(LoginModel model) { return RichText( - text: TextSpan(text: '', children: model.main.agreements.map((item){ - return TextSpan(text: item?.text, style: TextStyle(color: HexColor.fromHex(item?.textColor), fontSize: 10),recognizer: TapGestureRecognizer()..onTap = (){ - _jumpUserAgreement(item?.url); - }); - }).toList()), + text: TextSpan( + text: '', + children: model.main.agreements.map((item) { + return TextSpan( + text: item?.text, + style: TextStyle(color: HexColor.fromHex(item?.textColor), fontSize: 10), + recognizer: TapGestureRecognizer() + ..onTap = () { + _jumpUserAgreement(item?.url); + }); + }).toList()), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 60ef6d1..d3b949b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,7 +49,10 @@ dependencies: imei_plugin: 1.2.0 # mob 分享sdk sharesdk_plugin: ^1.2.8 + # 秒验 secverify: ^1.0.2 + # 短信 + mobsms: ^1.1.0 loading_indicator: ^1.2.0