|
|
@@ -1,19 +1,24 @@
|
|
|
import 'dart:convert';
|
|
|
import 'dart:io';
|
|
|
|
|
|
+import 'package:bbyyy/beans/app_store_review_bean_entity.dart';
|
|
|
import 'package:bbyyy/beans/login_information_bean_entity.dart';
|
|
|
import 'package:bbyyy/https/MyDio.dart';
|
|
|
import 'package:bbyyy/https/my_request.dart';
|
|
|
+import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
|
|
|
+import 'package:bbyyy/my_tools/event_bus.dart';
|
|
|
import 'package:bbyyy/my_tools/my_colors.dart';
|
|
|
import 'package:bbyyy/my_tools/my_cookie.dart';
|
|
|
import 'package:bbyyy/my_tools/my_tools.dart';
|
|
|
+import 'package:bbyyy/my_tools/my_views.dart';
|
|
|
import 'package:bbyyy/paegs/forget_password_page/forget_password_page.dart';
|
|
|
import 'package:bbyyy/paegs/guest_login_page/root_page.dart';
|
|
|
import 'package:bbyyy/paegs/registered_page/registered_page.dart';
|
|
|
import 'package:bbyyy/paegs/root_page/root_page.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
-import 'package:flutter_svg/flutter_svg.dart';import 'package:bbyyy/beans/app_store_review_bean_entity.dart';
|
|
|
+import 'package:flutter/services.dart';
|
|
|
+import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
|
class LoginPage extends StatefulWidget {
|
|
|
@override
|
|
|
@@ -30,7 +35,20 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
void initState() {
|
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
|
- checkAuditStatus();
|
|
|
+ print('MyCookie().reNum===========${MyCookie().reNum}');
|
|
|
+ EventBus().on('服务器异常,请稍后再试', (arg) {
|
|
|
+ qAPP();
|
|
|
+ });
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
+ MyCookie().reNum = 0;
|
|
|
+ checkAuditStatus();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ @override
|
|
|
+ void dispose() {
|
|
|
+ // TODO: implement dispose
|
|
|
+ super.dispose();
|
|
|
+ EventBus().off('服务器异常,请稍后再试');
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
@@ -239,7 +257,12 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
- Visibility(child: Container(width: 20,),visible: showBrowse,),
|
|
|
+ Visibility(
|
|
|
+ child: Container(
|
|
|
+ width: 20,
|
|
|
+ ),
|
|
|
+ visible: showBrowse,
|
|
|
+ ),
|
|
|
Visibility(
|
|
|
visible: showBrowse,
|
|
|
child: Expanded(
|
|
|
@@ -261,7 +284,8 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
child: Text(
|
|
|
'游客登录',
|
|
|
style: TextStyle(
|
|
|
- color: Colors.white, fontSize: 17),
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 17),
|
|
|
),
|
|
|
alignment: Alignment.center,
|
|
|
padding: EdgeInsets.only(bottom: 2),
|
|
|
@@ -302,8 +326,8 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
- MyTools().toPage(
|
|
|
- context, RegisteredPage(), (then) {},
|
|
|
+ MyTools().toPage(context,
|
|
|
+ RegisteredPage(), (then) {},
|
|
|
noBack: true);
|
|
|
},
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
@@ -312,7 +336,8 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
child: Text(
|
|
|
'注册账号',
|
|
|
style: TextStyle(
|
|
|
- color: MyColors.c666666, fontSize: 14),
|
|
|
+ color: MyColors.c666666,
|
|
|
+ fontSize: 14),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
@@ -320,16 +345,17 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
height: 13,
|
|
|
width: 2,
|
|
|
decoration: BoxDecoration(
|
|
|
- borderRadius:
|
|
|
- BorderRadius.all(Radius.circular(1)),
|
|
|
+ borderRadius: BorderRadius.all(
|
|
|
+ Radius.circular(1)),
|
|
|
color: MyColors.cFF4233,
|
|
|
),
|
|
|
- margin: EdgeInsets.only(left: 27, right: 27),
|
|
|
+ margin: EdgeInsets.only(
|
|
|
+ left: 27, right: 27),
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
- MyTools().toPage(
|
|
|
- context, ForgetPasswordPage(), (then) {},
|
|
|
+ MyTools().toPage(context,
|
|
|
+ ForgetPasswordPage(), (then) {},
|
|
|
noBack: true);
|
|
|
},
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
@@ -338,7 +364,8 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
child: Text(
|
|
|
'忘记密码',
|
|
|
style: TextStyle(
|
|
|
- color: MyColors.c666666, fontSize: 14),
|
|
|
+ color: MyColors.c666666,
|
|
|
+ fontSize: 14),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
@@ -364,11 +391,13 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
}
|
|
|
|
|
|
void login() {
|
|
|
+ print(MyCookie().switching);
|
|
|
loginAccount({
|
|
|
'user': _phoneNum.text,
|
|
|
'password': MyTools.base64Encode(_pw.text),
|
|
|
- 'version':MyCookie().packageInfo.version,
|
|
|
- 'phone': Platform.isAndroid?'Android':'IOS'
|
|
|
+ 'version': MyCookie().packageInfo.version,
|
|
|
+ 'phone': Platform.isAndroid ? 'Android' : 'IOS',
|
|
|
+ 'seq': int.parse(MyCookie().prefs.getString('serverID'))
|
|
|
}, (r, hE) {
|
|
|
if (!hE) {
|
|
|
LoginInformationBeanEntity entity = LoginInformationBeanEntity()
|
|
|
@@ -381,23 +410,87 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
}
|
|
|
|
|
|
void checkAuditStatus() {
|
|
|
- MyDio().post('/model/appStoreReview', {
|
|
|
- 'version':MyCookie().packageInfo.version
|
|
|
- }, (response, hasError) {
|
|
|
- if(!hasError){
|
|
|
- AppStoreReviewBeanEntity e = AppStoreReviewBeanEntity().fromJson(json.decode(response.data.toString()));
|
|
|
+ EasyLoading.show();
|
|
|
+ MyDio().post(
|
|
|
+ '/model/appStoreReview', {'version': MyCookie().packageInfo.version},
|
|
|
+ (response, hasError) {
|
|
|
+ if (!hasError) {
|
|
|
+ EasyLoading.dismiss();
|
|
|
+ AppStoreReviewBeanEntity e = AppStoreReviewBeanEntity()
|
|
|
+ .fromJson(json.decode(response.data.toString()));
|
|
|
print(e.data);
|
|
|
- if(e.data&&Platform.isIOS){
|
|
|
+ if (e.data && Platform.isIOS) {
|
|
|
setState(() {
|
|
|
showBrowse = true;
|
|
|
MyCookie().underReview = showBrowse;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- }, (error) { });
|
|
|
+ }, (error) {});
|
|
|
}
|
|
|
|
|
|
void guestLogin() {
|
|
|
- MyTools().toPage(context, RootPage1(), (then){});
|
|
|
+ MyTools().toPage(context, RootPage1(), (then) {});
|
|
|
+ }
|
|
|
+
|
|
|
+ void qAPP() {
|
|
|
+ showDialog(
|
|
|
+ context: context,
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return Material(
|
|
|
+ color: Colors.black12,
|
|
|
+ child: Center(
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: BorderRadius.circular(16),
|
|
|
+ color: Colors.white,
|
|
|
+ ),
|
|
|
+ height: 180,
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 18),
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: Center(
|
|
|
+ child: Container(
|
|
|
+ child: MyViews()
|
|
|
+ .myText('服务器出现异常,请稍后再试。', MyColors.c333333, 14),
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 20),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ height: 0.5,
|
|
|
+ color: MyColors.cE7E7E7,
|
|
|
+ margin: EdgeInsets.only(bottom: 12),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 10),
|
|
|
+ child: Expanded(
|
|
|
+ child: GestureDetector(
|
|
|
+ behavior: HitTestBehavior.translucent,
|
|
|
+ onTap: () async {
|
|
|
+ await SystemChannels.platform
|
|
|
+ .invokeMethod('SystemNavigator.pop');
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: BorderRadius.circular(20),
|
|
|
+ color: MyColors.cFF4233),
|
|
|
+ height: 40,
|
|
|
+ child: MyViews().myText('退 出', Colors.white, 14),
|
|
|
+ alignment: Alignment.center,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ );
|
|
|
}
|
|
|
}
|