|
|
|
@ -10,6 +10,7 @@ import 'package:common_utils/common_utils.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:power_logger/power_logger.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
@ -26,7 +27,7 @@ class OtherLoginPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _OtherLoginPageState extends State<OtherLoginPage> {
|
|
|
|
|
PageController _controller = PageController();
|
|
|
|
|
List<String> _tabs = ['账号登录', '验证码登录'];
|
|
|
|
|
List<String> _tabs = ['验证码登录', '账号登录'];
|
|
|
|
|
int _currentIndex = 0;
|
|
|
|
|
TextEditingController _tel = TextEditingController();
|
|
|
|
|
TextEditingController _psd = TextEditingController();
|
|
|
|
@ -66,7 +67,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
|
|
|
|
Flexible(
|
|
|
|
|
child: PageView(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
children: [_accountView(), _verificationView()],
|
|
|
|
|
children: [_verificationView(), _accountView()],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
BottomTip(),
|
|
|
|
@ -102,16 +103,21 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var cancel = BotToast.showLoading();
|
|
|
|
|
var response = await SignFunc.login(
|
|
|
|
|
_tel.text,
|
|
|
|
|
_psd.text,
|
|
|
|
|
UserTool
|
|
|
|
|
.appProvider.pickedCityAndCommunity!.communityModel!.id);
|
|
|
|
|
if (response.data['success']) {
|
|
|
|
|
await UserTool.userProvider.setLogin(response.data['data']);
|
|
|
|
|
await UserTool.dataProvider.addHistories();
|
|
|
|
|
} else {
|
|
|
|
|
BotToast.showText(text: response.data['msg']);
|
|
|
|
|
try {
|
|
|
|
|
var response = await SignFunc.login(
|
|
|
|
|
_tel.text,
|
|
|
|
|
_psd.text,
|
|
|
|
|
UserTool.appProvider.pickedCityAndCommunity!.communityModel!
|
|
|
|
|
.id);
|
|
|
|
|
if (response.data['success']) {
|
|
|
|
|
await UserTool.userProvider.setLogin(response.data['data']);
|
|
|
|
|
await UserTool.dataProvider.addHistories();
|
|
|
|
|
} else {
|
|
|
|
|
BotToast.showText(text: response.data['msg']);
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
print(e.toString());
|
|
|
|
|
LoggerData.addData(e.toString());
|
|
|
|
|
}
|
|
|
|
|
cancel();
|
|
|
|
|
},
|
|
|
|
@ -135,7 +141,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
|
|
|
|
BotToast.showText(text: '请先选择小区!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (_currentIndex == 0 && _psd.text.isEmpty) {
|
|
|
|
|
if (_currentIndex == 1 && _psd.text.isEmpty) {
|
|
|
|
|
BotToast.showText(text: '密码不能为空');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|