瀏覽代碼

1、修复快速登录的邀请码没有带手机号的问题

2、添加mob用户隐私协议
tags/0.0.2+12^0
PH2 4 年之前
父節點
當前提交
cfc5f239ed
共有 6 個文件被更改,包括 78 次插入48 次删除
  1. +6
    -5
      lib/pages/login_page/account/login_account_page.dart
  2. +8
    -7
      lib/pages/login_page/bind/login_bind_phone_page.dart
  3. +14
    -3
      lib/pages/login_page/invite/login_invite_page.dart
  4. +10
    -9
      lib/pages/login_page/login_page.dart
  5. +37
    -21
      lib/util/mob_util/mob_util.dart
  6. +3
    -3
      lib/util/mob_util/secverify/quick_login_util.dart

+ 6
- 5
lib/pages/login_page/account/login_account_page.dart 查看文件

@@ -57,14 +57,14 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> i
bool _isLogging = false;

/// 跳转到邀请码页面
void _openInvitePage() {
void _openInvitePage(String mobile) {
print('跳转到邀请码页面');
RouterUtil.hideKeyboard(context);
Navigator.push(
context,
CupertinoPageRoute(
// builder: (_) => PageFactory.create('login_invite', null)
builder: (_) => LoginInvitePage()));
builder: (_) => LoginInvitePage({'mobile': mobile})));
}

/// 登陆成功页面
@@ -276,9 +276,10 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> i
}
// 登陆成功
if (current is LoginAccountLoginSuccessState) {
/// 缓存登陆数据
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model);

if (current?.model?.registerInviteCodeEnable != '1') {
/// 缓存登陆数据
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model);
Fluttertoast.showToast(msg: '登录成功~');
_isLogging = true;

@@ -286,7 +287,7 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> i
_openLoginSuccessPage();
} else {
/// 打开邀请页面
_openInvitePage();
_openInvitePage(current?.model?.mobile);
}
return false;
}


+ 8
- 7
lib/pages/login_page/bind/login_bind_phone_page.dart 查看文件

@@ -60,10 +60,10 @@ class _LoginBindPhonePageContainerState extends State<_LoginBindPhonePageContain
bool _isLogging = false;

/// 跳转到邀请码页面
void _openInvitePage() {
void _openInvitePage(String mobile) {
print('跳转到邀请码页面');
RouterUtil.hideKeyboard(context);
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginInvitePage()));
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginInvitePage({'mobile': mobile})));
}

/// 登陆成功页面
@@ -225,17 +225,18 @@ class _LoginBindPhonePageContainerState extends State<_LoginBindPhonePageContain
}
// 登陆成功
if (current is LoginBindPhoneLoginSuccessState) {
/// 缓存登陆数据
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model);

if (current?.model?.registerInviteCodeEnable != '1') {
/// 缓存登陆数据
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model);
Fluttertoast.showToast(msg: '登录成功~');
_isLogging = true;

/// 打开也买
_isLogging = true;
/// 打开首页
_openLoginSuccessPage();
} else {
/// 打开邀请页面
_openInvitePage();
_openInvitePage(current?.model?.mobile);
}
return false;
}


+ 14
- 3
lib/pages/login_page/invite/login_invite_page.dart 查看文件

@@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:provider/provider.dart';
import 'package:zhiying_comm/pages/login_page/model/login_style_model.dart';
import 'package:zhiying_comm/util/empty_util.dart';
@@ -15,6 +16,10 @@ import 'model/login_invite_user.dart';
/// 邀请页面
///
class LoginInvitePage extends StatelessWidget {
final Map<String, dynamic> data;

LoginInvitePage(this.data);

@override
Widget build(BuildContext context) {
return Scaffold(
@@ -22,7 +27,7 @@ class LoginInvitePage extends StatelessWidget {
backgroundColor: HexColor.fromHex('#FFFFFF'),
body: BlocProvider(
create: (_) => LoginInviteBloc(repostitory: LoginInviteRepository())..add(LoginInviteInitEvent()),
child: LoginInvitePageContainer(),
child: LoginInvitePageContainer(this.data),
),
);
}
@@ -31,6 +36,10 @@ class LoginInvitePage extends StatelessWidget {
///
/// 邀请
class LoginInvitePageContainer extends StatefulWidget {
final Map<String, dynamic> data;

LoginInvitePageContainer(this.data);

@override
_LoginInvitePageContainerState createState() => _LoginInvitePageContainerState();
}
@@ -39,6 +48,7 @@ class _LoginInvitePageContainerState extends State<LoginInvitePageContainer> {
TextEditingController _editingController;
FocusNode _focusNode;
bool _showInviteInfo = false;

// 是否登录中
bool _isLogging = false;

@@ -84,8 +94,9 @@ class _LoginInvitePageContainerState extends State<LoginInvitePageContainer> {
String inviteNum = inviteUser?.userId ?? '';

/// 手机号
UserInfoModel model = await Provider.of<UserInfoNotifier>(context, listen: false)?.getUserInfoModel();
String mobile = model?.mobile ?? '';
// UserInfoModel model = await Provider.of<UserInfoNotifier>(context, listen: false)?.getUserInfoModel();

String mobile = widget?.data['mobile'] ;//model?.mobile ?? '';
if (!EmptyUtil.isEmpty(inviteNum) && !EmptyUtil.isEmpty(mobile)) {
setState(() {
_isLogging = true;


+ 10
- 9
lib/pages/login_page/login_page.dart 查看文件

@@ -49,13 +49,19 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
void _loginClick(String type, LoginStyleModel model) {
print('登陆$type');
RouterUtil.hideKeyboard(context);
if (type == 'mobile') {
if ('mobile' == type) {
if (model?.flashLoginEnable == '1') {
// mob 一键登录
MobUtil.openQuickLoginPage(context, model?.quick);
} else {
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginAccountPage(null)));
}
} else if ('wechat' == type) {
/// 微信登录
// fluwx.sendWeChatAuth(scope: "snsapi_userinfo", state: "wechat_sdk_demo_test").then((data) {
// Logger.debug('返回数据: ${data?.toString()}');
// });
Fluttertoast.showToast(msg: '暂不支持~');
}
}

@@ -79,9 +85,9 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
openSid: _taoBao?.data?.openSid,
topAccessToken: _taoBao?.data?.topAccessToken,
topAuthCode: _taoBao?.data?.topAuthCode));
// Logger.warn(' tao login = ${taoBao?.errorCode} , msg = ${taoBao?.errorMessage}, nick = ${taoBao?.data?.nick}, '
// 'avatar = ${taoBao?.data?.avatarUrl}, openId = ${taoBao?.data?.openId}, openSid = ${taoBao?.data?.openSid}, '
// 'topAccessToken = ${taoBao?.data?.topAccessToken}, topAuthCode = ${taoBao?.data?.topAuthCode}');
// Logger.warn(' tao login = ${_taoBao?.errorCode} , msg = ${_taoBao?.errorMessage}, nick = ${_taoBao?.data?.nick}, '
// 'avatar = ${_taoBao?.data?.avatarUrl}, openId = ${_taoBao?.data?.openId}, openSid = ${_taoBao?.data?.openSid}, '
// 'topAccessToken = ${_taoBao?.data?.topAccessToken}, topAuthCode = ${_taoBao?.data?.topAuthCode}');
}
}

@@ -90,11 +96,6 @@ class _LoginPageContainerState extends State<LoginPageContainer> {
Fluttertoast.showToast(msg: '暂不支持~');
}

/// 微信登录
if ('wechat' == model.type) {
Fluttertoast.showToast(msg: '暂不支持~');
}

/// 苹果登录
if ('apple' == model.type) {
Fluttertoast.showToast(msg: '暂不支持~');


+ 37
- 21
lib/util/mob_util/mob_util.dart 查看文件

@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:mobsms/mobsms.dart';
import 'package:sharesdk_plugin/sharesdk_plugin.dart';
import 'package:zhiying_comm/pages/login_page/model/login_style_model.dart';
import 'package:zhiying_comm/util/empty_util.dart';
import 'package:zhiying_comm/util/enum_util.dart';
@@ -63,27 +64,7 @@ class MobUtil {
return Future.value(result);
}

///
/// 提交验证码
///
/// phone: 手机号码
/// code: 验证码
/// zoneCode: 区号
///
// static Future<bool> commitCode(final String phone, String code, {String zoneCode = '86'}) async {
// bool result = false;
// await Smssdk.commitCode(phone, zoneCode, code, (ret, err) {
// if (err != null) {
// // showAlert(err.toString(),context);
// result = false;
// } else {
// // showAlert('提交验证码成功!',context);
// result = true;
// // _countMobSMS(phone, code, zoneCode: zoneCode);
// }
// });
// return Future.value(result);
// }



/// 询问验证码是否可以下发
@@ -116,6 +97,40 @@ class MobUtil {
return SharedPreferencesUtil.getStringValue('mobInvitedCode');
}

/// 隐私协议授权
static void submitPrivacyGrantResult(bool permission) {
SharesdkPlugin.uploadPrivacyPermissionStatus(permission ? 1 : 0, (bool success) {
if(success == true) {
Logger.log('隐私协议授权提交结果: 成功');
} else {
Logger.log('隐私协议授权提交结果: 失败');
}
});
}


///
/// 提交验证码
///
/// phone: 手机号码
/// code: 验证码
/// zoneCode: 区号
///
// static Future<bool> commitCode(final String phone, String code, {String zoneCode = '86'}) async {
// bool result = false;
// await Smssdk.commitCode(phone, zoneCode, code, (ret, err) {
// if (err != null) {
// // showAlert(err.toString(),context);
// result = false;
// } else {
// // showAlert('提交验证码成功!',context);
// result = true;
// // _countMobSMS(phone, code, zoneCode: zoneCode);
// }
// });
// return Future.value(result);
// }

/// 统计MOB验证码提交
// static void _countMobSMS(final String phone, final String code, {String zoneCode = '86'}) async {
// try {
@@ -125,6 +140,7 @@ class MobUtil {
// }
// }


}

enum SMSCodeType {


+ 3
- 3
lib/util/mob_util/secverify/quick_login_util.dart 查看文件

@@ -78,9 +78,9 @@ class QuickLoginUtil {
}

/// 打开邀请码页面
void _openInvitePage(BuildContext context) {
void _openInvitePage(BuildContext context, String mobile) {
print('跳转到邀请码页面');
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginInvitePage()));
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginInvitePage({'mobile': mobile})));
}

/// 打开首页的方法
@@ -113,7 +113,7 @@ class QuickLoginUtil {
if (!EmptyUtil.isEmpty(model)) {
if (model.registerInviteCodeEnable == '1') {
/// 需要填写注册码再跳首页
_openInvitePage(context);
_openInvitePage(context, model?.username);

return;
} else {


Loading…
取消
儲存