添加单个号码

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

@ -12,27 +12,57 @@ class ExcludeSinglePage extends StatefulWidget {
} }
class _ExcludeSinglePageState extends State<ExcludeSinglePage> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ScaffoldThemeWidget( return ScaffoldThemeWidget(
title: '添加单个或批量号码', title: '添加单个或批量号码',
bottom: "添加", bottom: "添加",
onTap: () {}, onTap: () {},
isOpacity:
_phoneController.text.isNotEmpty && _nameController.text.isNotEmpty,
child: Container( child: Container(
padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w), padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
addNumber("号码", "请输入号码"), addNumber("号码", "请输入号码", _phoneController),
15.heightBox,
addNumber("名称", "请输入名称"),
15.heightBox, 15.heightBox,
addNumber("名称", "请输入名称", _nameController),
30.heightBox,
RichText( RichText(
text: const TextSpan( text: const TextSpan(
children: [ children: [
TextSpan(text: "使用说明:"), TextSpan(
TextSpan(text: "如输入000*可屏蔽所有000开头的号码") 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( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
title, title,
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 16,
color: Colors.black38, color: Color(0xFF999999),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
15.heightBox, 15.heightBox,
TextField( TextField(
controller: controller,
onChanged: (value) {
setState(() {});
},
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.all(30.w),
hintText: content, 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
),
), ),
), ),
), ),

@ -41,9 +41,11 @@ class _LoginPageState extends State<LoginPage> {
late TextEditingController _phoneController; late TextEditingController _phoneController;
late TextEditingController _smsCodeController; late TextEditingController _smsCodeController;
late FocusNode _phoneFocusNode; late FocusNode _phoneFocusNode;
late FocusNode _smsCodeFocusNode; late FocusNode _smsCodeFocusNode;
bool _cantSelected = false; bool _cantSelected = false;
DateTime? _lastTap; DateTime? _lastTap;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -130,26 +132,27 @@ class _LoginPageState extends State<LoginPage> {
} else if (!_chooseAgreement) { } else if (!_chooseAgreement) {
BotToast.showText(text: "请同意并勾选隐私政策"); BotToast.showText(text: "请同意并勾选隐私政策");
} else { } else {
if(_lastTap != null &&DateTime.now().difference(_lastTap!).inSeconds < 2){ if (_lastTap != null &&
DateTime.now().difference(_lastTap!).inSeconds < 2) {
// BotToast.showText(text: "过快"); // BotToast.showText(text: "过快");
return; return;
} }
_lastTap = DateTime.now(); _lastTap = DateTime.now();
var base = await apiClient.request(API.app.login, var base = await apiClient.request(API.app.login, data: {
data: {'phone': _phoneController.text, 'code': _smsCodeController.text}); 'phone': _phoneController.text,
'code': _smsCodeController.text
});
if (base.code == 0) { if (base.code == 0) {
print("123123${base.data['token']}"); print("123123${base.data['token']}");
await UserTool.userProvider.setToken(base.data['token']); await UserTool.userProvider.setToken(base.data['token']);
// print(a); // print(a);
// print("4567899"); // print("4567899");
Get.offAll(const TabNavigator()); Get.offAll(const TabNavigator());
} } else {
else {
CloudToast.show(base.msg); CloudToast.show(base.msg);
} }
} }
}, },
text: "立即登录", text: "立即登录",
), ),
32.hb, 32.hb,
@ -223,8 +226,10 @@ class _LoginPageState extends State<LoginPage> {
await apiClient.request(API.app.captcha, data: { await apiClient.request(API.app.captcha, data: {
'phone': _phoneController.text, '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}$'); var res = RegExp(
if((_phoneController.text).isNotEmpty && res.hasMatch(_phoneController.text)){ 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(); _beginCountDown();
} else { } else {
BotToast.showText(text: "手机号不能为空且手机号格式错误"); BotToast.showText(text: "手机号不能为空且手机号格式错误");
@ -311,6 +316,7 @@ class _LoginPageState extends State<LoginPage> {
Get.to(() => const ContentAuthorityPage()); Get.to(() => const ContentAuthorityPage());
// print("点击协议了"); // print("点击协议了");
} }
/// ///
}; };
return recognizer; return recognizer;
@ -336,12 +342,11 @@ class _LoginPageState extends State<LoginPage> {
: const Icon(CupertinoIcons.checkmark_circle, : const Icon(CupertinoIcons.checkmark_circle,
size: 18, color: Colors.blue), size: 18, color: Colors.blue),
), ),
RichText( RichText(
text: TextSpan( text: TextSpan(
text: "我已阅读并同意", text: "我已阅读并同意",
style: TextStyle( style:
color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp), TextStyle(color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
children: [ children: [
// TextSpan( // TextSpan(
// text: '《用户服务协议》', // text: '《用户服务协议》',
@ -356,7 +361,9 @@ class _LoginPageState extends State<LoginPage> {
text: '《短信帮手隐私协议》', text: '《短信帮手隐私协议》',
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp), style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
recognizer: _recognizer(context, 2)), recognizer: _recognizer(context, 2)),
])) ],
),
),
], ],
), ),
); );

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

Loading…
Cancel
Save