|
|
|
@ -12,7 +12,6 @@ import 'package:huixiang/data/channels.dart';
|
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/data/examine_instance.dart'; |
|
|
|
|
import 'package:huixiang/data/login_info.dart'; |
|
|
|
|
import 'package:huixiang/data/user_entity.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/event_type.dart'; |
|
|
|
@ -65,15 +64,16 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
isLogin(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryChannels() async{ |
|
|
|
|
BaseData<Channels>? baseData = await apiService?.appChannels().catchError((error) { |
|
|
|
|
queryChannels() async { |
|
|
|
|
BaseData<Channels>? baseData = |
|
|
|
|
await apiService?.appChannels().catchError((error) { |
|
|
|
|
print(error.message); |
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
}); |
|
|
|
|
if (baseData?.isSuccess ?? false) { |
|
|
|
|
channelsList = baseData!.data; |
|
|
|
|
setState((){}); |
|
|
|
|
setState(() {}); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast("${baseData?.msg}", alignment: Alignment.center); |
|
|
|
|
} |
|
|
|
@ -216,9 +216,11 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
"mobile": mobile, |
|
|
|
|
"invite": invite, |
|
|
|
|
"areaCode": area, |
|
|
|
|
"regChannel":channelName ?? "" |
|
|
|
|
"regChannel": channelName ?? "" |
|
|
|
|
}; |
|
|
|
|
EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); |
|
|
|
|
EasyLoading.show( |
|
|
|
|
status: S.of(context).zhengzaijiazai, |
|
|
|
|
maskType: EasyLoadingMaskType.black); |
|
|
|
|
BaseData? value = await apiService?.memberLogin(param).catchError((error) { |
|
|
|
|
print(error.message); |
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), |
|
|
|
@ -227,7 +229,8 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
// EasyLoading.show(status: S.of(context).zhengzaijiazai); |
|
|
|
|
if (value?.isSuccess ?? false) { |
|
|
|
|
var userInfo = value!.data; |
|
|
|
|
ExamineInstance.instance.isExamine = userInfo.authInfo?.account == "13800138000"; |
|
|
|
|
ExamineInstance.instance.isExamine = |
|
|
|
|
userInfo.authInfo?.account == "13800138000"; |
|
|
|
|
saveUserJson(userInfo.authInfo?.toJson()); |
|
|
|
|
eventBus.fire(EventType(3)); |
|
|
|
|
|
|
|
|
@ -265,7 +268,8 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
if (sharedPreferences.containsKey('token') && |
|
|
|
|
sharedPreferences.getString("token") != null && |
|
|
|
|
sharedPreferences.getString("token") != "") { |
|
|
|
|
ExamineInstance.instance.isExamine = sharedPreferences.getString("mobile") == "13800138000"; |
|
|
|
|
ExamineInstance.instance.isExamine = |
|
|
|
|
sharedPreferences.getString("mobile") == "13800138000"; |
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/main_page'); |
|
|
|
|
} else { |
|
|
|
|
apiService = ApiService(Dio(), context: context); |
|
|
|
@ -275,7 +279,6 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void dispose() { |
|
|
|
|
if (_timer?.isActive ?? true) { |
|
|
|
@ -287,51 +290,52 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Scaffold( |
|
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
|
body: GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.translucent, |
|
|
|
|
onTap: () { |
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); |
|
|
|
|
}, |
|
|
|
|
child: AnimatedCrossFade( |
|
|
|
|
firstChild: Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/ic_splash_bg.webp", |
|
|
|
|
fit: BoxFit.fill, |
|
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
|
body: GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.translucent, |
|
|
|
|
onTap: () { |
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); |
|
|
|
|
}, |
|
|
|
|
child: AnimatedCrossFade( |
|
|
|
|
firstChild: Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/ic_splash_bg.webp", |
|
|
|
|
fit: BoxFit.fill, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
layoutBuilder: (widgetFirst, keyFirst, widgetSecond, keySecond) { |
|
|
|
|
return Stack( |
|
|
|
|
clipBehavior: Clip.none, |
|
|
|
|
children: <Widget>[ |
|
|
|
|
Positioned( |
|
|
|
|
key: keySecond, |
|
|
|
|
left: 0.0, |
|
|
|
|
top: 0.0, |
|
|
|
|
right: 0.0, |
|
|
|
|
bottom: 0.0, |
|
|
|
|
child: widgetSecond, |
|
|
|
|
), |
|
|
|
|
Positioned( |
|
|
|
|
key: keyFirst, |
|
|
|
|
left: 0.0, |
|
|
|
|
top: 0.0, |
|
|
|
|
right: 0.0, |
|
|
|
|
bottom: 0.0, |
|
|
|
|
child: widgetFirst, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
secondChild: substance(), |
|
|
|
|
firstCurve: Curves.easeInQuart, |
|
|
|
|
secondCurve: Curves.easeInQuart, |
|
|
|
|
crossFadeState: isShowLogin |
|
|
|
|
? CrossFadeState.showSecond |
|
|
|
|
: CrossFadeState.showFirst, |
|
|
|
|
duration: Duration(milliseconds: Platform.isIOS ? 1000 : 1000), |
|
|
|
|
), |
|
|
|
|
layoutBuilder: (widgetFirst, keyFirst, widgetSecond, keySecond) { |
|
|
|
|
return Stack( |
|
|
|
|
clipBehavior: Clip.none, |
|
|
|
|
children: <Widget>[ |
|
|
|
|
Positioned( |
|
|
|
|
key: keySecond, |
|
|
|
|
left: 0.0, |
|
|
|
|
top: 0.0, |
|
|
|
|
right: 0.0, |
|
|
|
|
bottom: 0.0, |
|
|
|
|
child: widgetSecond, |
|
|
|
|
), |
|
|
|
|
Positioned( |
|
|
|
|
key: keyFirst, |
|
|
|
|
left: 0.0, |
|
|
|
|
top: 0.0, |
|
|
|
|
right: 0.0, |
|
|
|
|
bottom: 0.0, |
|
|
|
|
child: widgetFirst, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
secondChild: substance(), |
|
|
|
|
firstCurve: Curves.easeInQuart, |
|
|
|
|
secondCurve: Curves.easeInQuart, |
|
|
|
|
crossFadeState: |
|
|
|
|
isShowLogin ? CrossFadeState.showSecond : CrossFadeState.showFirst, |
|
|
|
|
duration: Duration(milliseconds: Platform.isIOS ? 1000 : 1000), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -353,9 +357,10 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 16.w, |
|
|
|
|
top: 45.h + MediaQuery.of(context).padding.top, |
|
|
|
|
right: 12.w), |
|
|
|
|
left: 16.w, |
|
|
|
|
top: 45.h + MediaQuery.of(context).padding.top, |
|
|
|
|
right: 12.w, |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -395,24 +400,25 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.pushNamed('/router/phone_address_page') |
|
|
|
|
.then((value) { |
|
|
|
|
if (value != null) |
|
|
|
|
setState(() { |
|
|
|
|
area = value as String; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Text( |
|
|
|
|
area, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
color: Color(0xFF1A1A1A), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.pushNamed('/router/phone_address_page') |
|
|
|
|
.then((value) { |
|
|
|
|
if (value != null) |
|
|
|
|
setState(() { |
|
|
|
|
area = value as String; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Text( |
|
|
|
|
area, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
color: Color(0xFF1A1A1A), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Icon( |
|
|
|
|
Icons.keyboard_arrow_right, |
|
|
|
|
size: 18, |
|
|
|
@ -421,7 +427,9 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
Container( |
|
|
|
|
height: 30.h, |
|
|
|
|
width: MediaQuery.of(context).size.width - 100.w, |
|
|
|
|
margin: EdgeInsets.only(bottom:Platform.isIOS ? 10.h:5.h), |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
bottom: Platform.isIOS ? 10.h : 5.h, |
|
|
|
|
), |
|
|
|
|
child: TextField( |
|
|
|
|
style: TextStyle( |
|
|
|
|
height: 1.h, |
|
|
|
@ -598,50 +606,59 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
height: 30.h, |
|
|
|
|
), |
|
|
|
|
if (channelsList?.isOpen ?? false) |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/login_store_select',arguments: { |
|
|
|
|
"channelsList":channelsList, |
|
|
|
|
}, |
|
|
|
|
).then((value) => { |
|
|
|
|
setState(() { |
|
|
|
|
if (value != null) { |
|
|
|
|
channelName = value as String; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child:Container( |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 12.w, right: 12.w, top: 16.h, bottom: 16.h |
|
|
|
|
), |
|
|
|
|
margin: EdgeInsets.only(bottom:30.h), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFFF1F1F1), |
|
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|
|
), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
SizedBox(width: 3.w,), |
|
|
|
|
Expanded( |
|
|
|
|
child:Text( |
|
|
|
|
channelName ?? "邀请来源(选填)", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
fontSize: channelName == null ? 12.sp : 13.sp, |
|
|
|
|
color:channelName == null ? Color(0xFF868686) : Color(0xFF1A1A1A), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/login_store_select', |
|
|
|
|
arguments: { |
|
|
|
|
"channelsList": channelsList, |
|
|
|
|
}, |
|
|
|
|
).then((value) => { |
|
|
|
|
setState(() { |
|
|
|
|
if (value != null) { |
|
|
|
|
channelName = value as String; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 12.w, |
|
|
|
|
right: 12.w, |
|
|
|
|
top: 16.h, |
|
|
|
|
bottom: 16.h, |
|
|
|
|
), |
|
|
|
|
margin: EdgeInsets.only(bottom: 30.h), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFFF1F1F1), |
|
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|
|
), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
SizedBox( |
|
|
|
|
width: 3.w, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Icon( |
|
|
|
|
Icons.arrow_forward_ios, |
|
|
|
|
size: 16, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
channelName ?? "邀请来源(选填)", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
fontSize: |
|
|
|
|
channelName == null ? 12.sp : 13.sp, |
|
|
|
|
color: channelName == null |
|
|
|
|
? Color(0xFF868686) |
|
|
|
|
: Color(0xFF1A1A1A), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Icon( |
|
|
|
|
Icons.arrow_forward_ios, |
|
|
|
|
size: 16, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
@ -654,58 +671,63 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
checkColor: Color(0xFFFFFFFF), |
|
|
|
|
fillColor: MaterialStateProperty.all(Color(0xFF32A060)), |
|
|
|
|
hoverColor: Colors.white, |
|
|
|
|
activeColor: Color(0xFF32A060), |
|
|
|
|
focusColor: Colors.white, |
|
|
|
|
overlayColor: |
|
|
|
|
MaterialStateProperty.all(Colors.white), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Text.rich( |
|
|
|
|
TextSpan(children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: S.of(context).privacy_policy1, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Color(0xFF010101), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
// text: S.of(context).privacy_policy2, |
|
|
|
|
text: "《海峡姐妹用户协议》", |
|
|
|
|
recognizer: TapGestureRecognizer() |
|
|
|
|
..onTap = () { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/user_service_page'); |
|
|
|
|
}, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "、", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Colors.black, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: S.of(context).privacy_policy3, |
|
|
|
|
recognizer: tapGestureRecognizer, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: S.of(context).privacy_policy4, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
height: 1.2, |
|
|
|
|
color: Color(0xFF010101), |
|
|
|
|
), |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: S.of(context).privacy_policy1, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Color(0xFF010101), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
// text: S.of(context).privacy_policy2, |
|
|
|
|
text: "《海峡姐妹用户协议》", |
|
|
|
|
recognizer: TapGestureRecognizer() |
|
|
|
|
..onTap = () { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/user_service_page'); |
|
|
|
|
}, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "、", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Colors.black, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: S.of(context).privacy_policy3, |
|
|
|
|
recognizer: tapGestureRecognizer, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: S.of(context).privacy_policy4, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
height: 1.2, |
|
|
|
|
color: Color(0xFF010101), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 30, |
|
|
|
|
) |
|
|
|
@ -843,9 +865,9 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
TextSpan( |
|
|
|
|
text: S.of(context).yinsixieyi, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xff32A060), |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
recognizer: TapGestureRecognizer() |
|
|
|
|
..onTap = () { |
|
|
|
@ -955,8 +977,7 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//滑动拼图 |
|
|
|
|
loadingBlockPuzzle(BuildContext context, |
|
|
|
|
{barrierDismissible = true}) { |
|
|
|
|
loadingBlockPuzzle(BuildContext context, {barrierDismissible = true}) { |
|
|
|
|
showDialog<Null>( |
|
|
|
|
context: context, |
|
|
|
|
barrierDismissible: barrierDismissible, |
|
|
|
@ -973,10 +994,15 @@ class _NewLoginPage extends State<NewLoginPage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sendSms(v) async{ |
|
|
|
|
BaseData? baseData = await apiService?.sendVerify({"areaCode":area, "mobile": mobile, "verification": v}).catchError((onError) { |
|
|
|
|
sendSms(v) async { |
|
|
|
|
BaseData? baseData = await apiService?.sendVerify({ |
|
|
|
|
"areaCode": area, |
|
|
|
|
"mobile": mobile, |
|
|
|
|
"verification": v |
|
|
|
|
}).catchError((onError) { |
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), |
|
|
|
|
alignment: Alignment.center);}); |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
}); |
|
|
|
|
if (baseData?.isSuccess ?? false) { |
|
|
|
|
_sendCodeStatus = 1; |
|
|
|
|
countdown(); |
|
|
|
|