|
|
@@ -52,6 +52,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
var _qqUserData; |
|
|
|
var _wxUserData; |
|
|
|
String _appleData; |
|
|
|
bool checkBool = false; |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
@@ -88,6 +89,10 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
|
|
|
|
/// 微信or手机登陆 |
|
|
|
void _loginClick(String type, LoginStyleModel model) { |
|
|
|
if(!checkBool){ |
|
|
|
Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); |
|
|
|
return; |
|
|
|
} |
|
|
|
print('登陆$type'); |
|
|
|
RouterUtil.hideKeyboard(context); |
|
|
|
if ('mobile' == type) { |
|
|
@@ -104,20 +109,27 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
Logger.log('state = ${state?.toString()}, userInfo = ${userdata?.toString()}'); |
|
|
|
if (state == SSDKResponseState.Success) { |
|
|
|
try { |
|
|
|
if(Platform.isIOS){ |
|
|
|
Map credentialDic=userdata['credential']; |
|
|
|
Map rawDatalDic=userdata['rawData']; |
|
|
|
var name=userdata['nickname']; |
|
|
|
var gender=userdata['gender']; |
|
|
|
var icon=userdata['icon']; |
|
|
|
var userID=userdata['uid']; |
|
|
|
var unionid=rawDatalDic['unionid']; |
|
|
|
var token=credentialDic['token']; |
|
|
|
Map dbInfoDic={'nickname':name,'gender':gender,'icon':icon,'userID':userID,'unionid':unionid,'token':token,}; |
|
|
|
Map tempUserData = {'dbInfo':jsonEncode(dbInfoDic)}; |
|
|
|
if (Platform.isIOS) { |
|
|
|
Map credentialDic = userdata['credential']; |
|
|
|
Map rawDatalDic = userdata['rawData']; |
|
|
|
var name = userdata['nickname']; |
|
|
|
var gender = userdata['gender']; |
|
|
|
var icon = userdata['icon']; |
|
|
|
var userID = userdata['uid']; |
|
|
|
var unionid = rawDatalDic['unionid']; |
|
|
|
var token = credentialDic['token']; |
|
|
|
Map dbInfoDic = { |
|
|
|
'nickname': name, |
|
|
|
'gender': gender, |
|
|
|
'icon': icon, |
|
|
|
'userID': userID, |
|
|
|
'unionid': unionid, |
|
|
|
'token': token, |
|
|
|
}; |
|
|
|
Map tempUserData = {'dbInfo': jsonEncode(dbInfoDic)}; |
|
|
|
_wxUserData = jsonDecode(tempUserData['dbInfo']); |
|
|
|
BlocProvider.of<LoginBloc>(context).add(LoginThirdWeChatEvent(model: tempUserData)); |
|
|
|
}else if(Platform.isAndroid){ |
|
|
|
} else if (Platform.isAndroid) { |
|
|
|
_wxUserData = jsonDecode(userdata['dbInfo']); |
|
|
|
BlocProvider.of<LoginBloc>(context).add(LoginThirdWeChatEvent(model: userdata)); |
|
|
|
} |
|
|
@@ -136,6 +148,10 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
|
|
|
|
/// 第三方登陆 |
|
|
|
void _otherLoginClick(BottomIcons model) async { |
|
|
|
if(!checkBool){ |
|
|
|
Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); |
|
|
|
return; |
|
|
|
} |
|
|
|
print('第三方登陆${model.type}'); |
|
|
|
if (EmptyUtil.isEmpty(model) || EmptyUtil.isEmpty(model.type)) { |
|
|
|
Fluttertoast.showToast(msg: '暂不支持~'); |
|
|
@@ -434,18 +450,39 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
|
|
|
|
/// 协议 |
|
|
|
Widget _protocolWidget(LoginStyleModel 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()), |
|
|
|
return Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: <Widget>[ |
|
|
|
InkWell( |
|
|
|
borderRadius: BorderRadius.circular(20), |
|
|
|
onTap: () { |
|
|
|
checkBool = !checkBool; |
|
|
|
setState(() {}); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
width: 32, |
|
|
|
height: 32, |
|
|
|
child: Icon( |
|
|
|
checkBool ? Icons.check_box : Icons.check_box_outline_blank, |
|
|
|
size: 16, |
|
|
|
color: checkBool?Colors.red:Colors.black12, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
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()), |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|