@@ -57,14 +57,14 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> i | |||||
bool _isLogging = false; | bool _isLogging = false; | ||||
/// 跳转到邀请码页面 | /// 跳转到邀请码页面 | ||||
void _openInvitePage() { | |||||
void _openInvitePage(String mobile) { | |||||
print('跳转到邀请码页面'); | print('跳转到邀请码页面'); | ||||
RouterUtil.hideKeyboard(context); | RouterUtil.hideKeyboard(context); | ||||
Navigator.push( | Navigator.push( | ||||
context, | context, | ||||
CupertinoPageRoute( | CupertinoPageRoute( | ||||
// builder: (_) => PageFactory.create('login_invite', null) | // 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) { | if (current is LoginAccountLoginSuccessState) { | ||||
/// 缓存登陆数据 | |||||
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model); | |||||
if (current?.model?.registerInviteCodeEnable != '1') { | if (current?.model?.registerInviteCodeEnable != '1') { | ||||
/// 缓存登陆数据 | |||||
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model); | |||||
Fluttertoast.showToast(msg: '登录成功~'); | Fluttertoast.showToast(msg: '登录成功~'); | ||||
_isLogging = true; | _isLogging = true; | ||||
@@ -286,7 +287,7 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> i | |||||
_openLoginSuccessPage(); | _openLoginSuccessPage(); | ||||
} else { | } else { | ||||
/// 打开邀请页面 | /// 打开邀请页面 | ||||
_openInvitePage(); | |||||
_openInvitePage(current?.model?.mobile); | |||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
@@ -60,10 +60,10 @@ class _LoginBindPhonePageContainerState extends State<_LoginBindPhonePageContain | |||||
bool _isLogging = false; | bool _isLogging = false; | ||||
/// 跳转到邀请码页面 | /// 跳转到邀请码页面 | ||||
void _openInvitePage() { | |||||
void _openInvitePage(String mobile) { | |||||
print('跳转到邀请码页面'); | print('跳转到邀请码页面'); | ||||
RouterUtil.hideKeyboard(context); | 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) { | if (current is LoginBindPhoneLoginSuccessState) { | ||||
/// 缓存登陆数据 | |||||
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model); | |||||
if (current?.model?.registerInviteCodeEnable != '1') { | if (current?.model?.registerInviteCodeEnable != '1') { | ||||
/// 缓存登陆数据 | |||||
Provider.of<UserInfoNotifier>(context, listen: false)?.setUserInfo(current.model); | |||||
Fluttertoast.showToast(msg: '登录成功~'); | Fluttertoast.showToast(msg: '登录成功~'); | ||||
_isLogging = true; | |||||
/// 打开也买 | |||||
_isLogging = true; | |||||
/// 打开首页 | |||||
_openLoginSuccessPage(); | _openLoginSuccessPage(); | ||||
} else { | } else { | ||||
/// 打开邀请页面 | /// 打开邀请页面 | ||||
_openInvitePage(); | |||||
_openInvitePage(current?.model?.mobile); | |||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
@@ -1,6 +1,7 @@ | |||||
import 'package:cached_network_image/cached_network_image.dart'; | import 'package:cached_network_image/cached_network_image.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:flutter_bloc/flutter_bloc.dart'; | import 'package:flutter_bloc/flutter_bloc.dart'; | ||||
import 'package:fluttertoast/fluttertoast.dart'; | |||||
import 'package:provider/provider.dart'; | import 'package:provider/provider.dart'; | ||||
import 'package:zhiying_comm/pages/login_page/model/login_style_model.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/empty_util.dart'; | ||||
@@ -15,6 +16,10 @@ import 'model/login_invite_user.dart'; | |||||
/// 邀请页面 | /// 邀请页面 | ||||
/// | /// | ||||
class LoginInvitePage extends StatelessWidget { | class LoginInvitePage extends StatelessWidget { | ||||
final Map<String, dynamic> data; | |||||
LoginInvitePage(this.data); | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return Scaffold( | return Scaffold( | ||||
@@ -22,7 +27,7 @@ class LoginInvitePage extends StatelessWidget { | |||||
backgroundColor: HexColor.fromHex('#FFFFFF'), | backgroundColor: HexColor.fromHex('#FFFFFF'), | ||||
body: BlocProvider( | body: BlocProvider( | ||||
create: (_) => LoginInviteBloc(repostitory: LoginInviteRepository())..add(LoginInviteInitEvent()), | create: (_) => LoginInviteBloc(repostitory: LoginInviteRepository())..add(LoginInviteInitEvent()), | ||||
child: LoginInvitePageContainer(), | |||||
child: LoginInvitePageContainer(this.data), | |||||
), | ), | ||||
); | ); | ||||
} | } | ||||
@@ -31,6 +36,10 @@ class LoginInvitePage extends StatelessWidget { | |||||
/// | /// | ||||
/// 邀请 | /// 邀请 | ||||
class LoginInvitePageContainer extends StatefulWidget { | class LoginInvitePageContainer extends StatefulWidget { | ||||
final Map<String, dynamic> data; | |||||
LoginInvitePageContainer(this.data); | |||||
@override | @override | ||||
_LoginInvitePageContainerState createState() => _LoginInvitePageContainerState(); | _LoginInvitePageContainerState createState() => _LoginInvitePageContainerState(); | ||||
} | } | ||||
@@ -39,6 +48,7 @@ class _LoginInvitePageContainerState extends State<LoginInvitePageContainer> { | |||||
TextEditingController _editingController; | TextEditingController _editingController; | ||||
FocusNode _focusNode; | FocusNode _focusNode; | ||||
bool _showInviteInfo = false; | bool _showInviteInfo = false; | ||||
// 是否登录中 | // 是否登录中 | ||||
bool _isLogging = false; | bool _isLogging = false; | ||||
@@ -84,8 +94,9 @@ class _LoginInvitePageContainerState extends State<LoginInvitePageContainer> { | |||||
String inviteNum = inviteUser?.userId ?? ''; | 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)) { | if (!EmptyUtil.isEmpty(inviteNum) && !EmptyUtil.isEmpty(mobile)) { | ||||
setState(() { | setState(() { | ||||
_isLogging = true; | _isLogging = true; | ||||
@@ -49,13 +49,19 @@ class _LoginPageContainerState extends State<LoginPageContainer> { | |||||
void _loginClick(String type, LoginStyleModel model) { | void _loginClick(String type, LoginStyleModel model) { | ||||
print('登陆$type'); | print('登陆$type'); | ||||
RouterUtil.hideKeyboard(context); | RouterUtil.hideKeyboard(context); | ||||
if (type == 'mobile') { | |||||
if ('mobile' == type) { | |||||
if (model?.flashLoginEnable == '1') { | if (model?.flashLoginEnable == '1') { | ||||
// mob 一键登录 | // mob 一键登录 | ||||
MobUtil.openQuickLoginPage(context, model?.quick); | MobUtil.openQuickLoginPage(context, model?.quick); | ||||
} else { | } else { | ||||
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginAccountPage(null))); | 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, | openSid: _taoBao?.data?.openSid, | ||||
topAccessToken: _taoBao?.data?.topAccessToken, | topAccessToken: _taoBao?.data?.topAccessToken, | ||||
topAuthCode: _taoBao?.data?.topAuthCode)); | 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: '暂不支持~'); | Fluttertoast.showToast(msg: '暂不支持~'); | ||||
} | } | ||||
/// 微信登录 | |||||
if ('wechat' == model.type) { | |||||
Fluttertoast.showToast(msg: '暂不支持~'); | |||||
} | |||||
/// 苹果登录 | /// 苹果登录 | ||||
if ('apple' == model.type) { | if ('apple' == model.type) { | ||||
Fluttertoast.showToast(msg: '暂不支持~'); | Fluttertoast.showToast(msg: '暂不支持~'); | ||||
@@ -1,5 +1,6 @@ | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:mobsms/mobsms.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/pages/login_page/model/login_style_model.dart'; | ||||
import 'package:zhiying_comm/util/empty_util.dart'; | import 'package:zhiying_comm/util/empty_util.dart'; | ||||
import 'package:zhiying_comm/util/enum_util.dart'; | import 'package:zhiying_comm/util/enum_util.dart'; | ||||
@@ -63,27 +64,7 @@ class MobUtil { | |||||
return Future.value(result); | 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'); | 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验证码提交 | /// 统计MOB验证码提交 | ||||
// static void _countMobSMS(final String phone, final String code, {String zoneCode = '86'}) async { | // static void _countMobSMS(final String phone, final String code, {String zoneCode = '86'}) async { | ||||
// try { | // try { | ||||
@@ -125,6 +140,7 @@ class MobUtil { | |||||
// } | // } | ||||
// } | // } | ||||
} | } | ||||
enum SMSCodeType { | enum SMSCodeType { | ||||
@@ -78,9 +78,9 @@ class QuickLoginUtil { | |||||
} | } | ||||
/// 打开邀请码页面 | /// 打开邀请码页面 | ||||
void _openInvitePage(BuildContext context) { | |||||
void _openInvitePage(BuildContext context, String mobile) { | |||||
print('跳转到邀请码页面'); | 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 (!EmptyUtil.isEmpty(model)) { | ||||
if (model.registerInviteCodeEnable == '1') { | if (model.registerInviteCodeEnable == '1') { | ||||
/// 需要填写注册码再跳首页 | /// 需要填写注册码再跳首页 | ||||
_openInvitePage(context); | |||||
_openInvitePage(context, model?.username); | |||||
return; | return; | ||||
} else { | } else { | ||||