소스 검색

1、mob 秒验的完成

2、mob 短信的完成
tags/0.0.2+8
PH2 4 년 전
부모
커밋
ca819b6228
3개의 변경된 파일43개의 추가작업 그리고 29개의 파일을 삭제
  1. +9
    -6
      lib/pages/login_page/account/bloc/login_account_repository.dart
  2. +31
    -23
      lib/pages/login_page/login_page.dart
  3. +3
    -0
      pubspec.yaml

+ 9
- 6
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<bool> 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<UserInfoModel> 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) {


+ 31
- 23
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<LoginPageContainer> {

/// 微信登陆
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<LoginPageContainer> {

/// 跳到用户协议
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<LoginPageContainer> {
Widget _getMainWidget(LoginModel model) {
return Column(
children: <Widget>[

/// 头部
_headWidget(model),
_sizedHeight50,
@@ -151,14 +152,13 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
size: 22,
color: HexColor.fromHex('#333333'),
),
onPressed: ()=> _openPop(),
onPressed: () => _openPop(),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[

/// logo
Container(
margin: EdgeInsets.only(bottom: 12, top: MediaQuery.of(context).padding.top),
@@ -175,8 +175,10 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
),

/// logo 名字
CachedNetworkImage( imageUrl: model?.main?.appNameImg ?? '', width: 90,),

CachedNetworkImage(
imageUrl: model?.main?.appNameImg ?? '',
width: 90,
),
],
),
],
@@ -199,7 +201,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
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<LoginPageContainer> {
/// 协议
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()),
);
}



+ 3
- 0
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



불러오는 중...
취소
저장