添加单个号码

master
戴余标 2 years ago
parent c85c2ebd10
commit 300caf7f27

@ -12,27 +12,57 @@ class ExcludeSinglePage extends StatefulWidget {
}
class _ExcludeSinglePageState extends State<ExcludeSinglePage> {
late TextEditingController _phoneController;
late TextEditingController _nameController;
@override
void initState() {
super.initState();
_phoneController = TextEditingController();
_nameController = TextEditingController();
}
@override
void dispose() {
super.dispose();
_phoneController.dispose();
_nameController.dispose();
}
@override
Widget build(BuildContext context) {
return ScaffoldThemeWidget(
title: '添加单个或批量号码',
bottom: "添加",
onTap: () {},
isOpacity:
_phoneController.text.isNotEmpty && _nameController.text.isNotEmpty,
child: Container(
padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
addNumber("号码", "请输入号码"),
15.heightBox,
addNumber("名称", "请输入名称"),
addNumber("号码", "请输入号码", _phoneController),
15.heightBox,
addNumber("名称", "请输入名称", _nameController),
30.heightBox,
RichText(
text: const TextSpan(
children: [
TextSpan(text: "使用说明:"),
TextSpan(text: "如输入000*可屏蔽所有000开头的号码")
TextSpan(
text: "使用说明:\n",
style: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.black38,
),
),
TextSpan(
text: "如输入000*可屏蔽所有000开头的号码",
style: TextStyle(
color: Colors.black38,
),
),
],
),
),
@ -42,23 +72,52 @@ class _ExcludeSinglePageState extends State<ExcludeSinglePage> {
);
}
addNumber(String title, content) {
addNumber(String title, content, TextEditingController controller) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 18,
color: Colors.black38,
fontSize: 16,
color: Color(0xFF999999),
fontWeight: FontWeight.w600,
),
),
15.heightBox,
TextField(
controller: controller,
onChanged: (value) {
setState(() {});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(30.w),
hintText: content,
border: const OutlineInputBorder(
hintStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xFF999999),
),
fillColor: const Color(0xFFF9F9F9),
filled: true,
enabledBorder: const OutlineInputBorder(
/*边角*/
borderRadius: BorderRadius.all(
Radius.circular(5), //5
),
borderSide: BorderSide(
color: Colors.white, //线
width: 1, //线2
),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white, //
width: 1, //5
),
borderRadius: BorderRadius.all(
Radius.circular(5), //30
),
),
),
),

@ -40,10 +40,12 @@ class _LoginPageState extends State<LoginPage> {
int _countDownNum = 59;
late TextEditingController _phoneController;
late TextEditingController _smsCodeController;
late FocusNode _phoneFocusNode ;
late FocusNode _phoneFocusNode;
late FocusNode _smsCodeFocusNode;
bool _cantSelected = false;
DateTime? _lastTap;
@override
void initState() {
super.initState();
@ -121,35 +123,36 @@ class _LoginPageState extends State<LoginPage> {
blM: false,
border: _phoneController.text.length != 11,
opacity: _phoneController.text.length == 11 ? 1 : 0.4,
onTap: () async{
onTap: () async {
// DateTime? _lastTap;
if (_phoneController.text.length < 11) {
BotToast.showText(text: "请输入手机号");
}else if(_smsCodeController.text.length < 6){
} else if (_smsCodeController.text.length < 6) {
BotToast.showText(text: "请输入验证码");
}else if(!_chooseAgreement){
} else if (!_chooseAgreement) {
BotToast.showText(text: "请同意并勾选隐私政策");
}else{
if(_lastTap != null &&DateTime.now().difference(_lastTap!).inSeconds < 2){
} else {
if (_lastTap != null &&
DateTime.now().difference(_lastTap!).inSeconds < 2) {
// BotToast.showText(text: "过快");
return ;
return;
}
_lastTap = DateTime.now();
var base = await apiClient.request(API.app.login,
data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
var base = await apiClient.request(API.app.login, data: {
'phone': _phoneController.text,
'code': _smsCodeController.text
});
if (base.code == 0) {
print("123123${base.data['token']}");
await UserTool.userProvider.setToken(base.data['token']);
// print(a);
// print("4567899");
Get.offAll(const TabNavigator());
}
else {
} else {
CloudToast.show(base.msg);
}
}
},
text: "立即登录",
),
32.hb,
@ -223,10 +226,12 @@ class _LoginPageState extends State<LoginPage> {
await apiClient.request(API.app.captcha, data: {
'phone': _phoneController.text,
});
var res= RegExp( r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
if((_phoneController.text).isNotEmpty && res.hasMatch(_phoneController.text)){
var res = RegExp(
r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
if ((_phoneController.text).isNotEmpty &&
res.hasMatch(_phoneController.text)) {
_beginCountDown();
}else{
} else {
BotToast.showText(text: "手机号不能为空且手机号格式错误");
}
if (_cantSelected) return;
@ -308,9 +313,10 @@ class _LoginPageState extends State<LoginPage> {
final TapGestureRecognizer recognizer = TapGestureRecognizer();
recognizer.onTap = () {
if (kDebugMode) {
Get.to(()=>const ContentAuthorityPage());
Get.to(() => const ContentAuthorityPage());
// print("点击协议了");
}
///
};
return recognizer;
@ -336,12 +342,11 @@ class _LoginPageState extends State<LoginPage> {
: const Icon(CupertinoIcons.checkmark_circle,
size: 18, color: Colors.blue),
),
RichText(
text: TextSpan(
text: "我已阅读并同意",
style: TextStyle(
color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
style:
TextStyle(color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
children: [
// TextSpan(
// text: '《用户服务协议》',
@ -356,7 +361,9 @@ class _LoginPageState extends State<LoginPage> {
text: '《短信帮手隐私协议》',
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
recognizer: _recognizer(context, 2)),
]))
],
),
),
],
),
);

@ -29,7 +29,7 @@ class ScaffoldThemeWidget extends StatefulWidget {
required this.title,
required this.child,
required this.bottom,
this.isBorder = false,
this.isBorder = true,
this.isOpacity = true,
required this.onTap,
}) : super(key: key);

Loading…
Cancel
Save