From 727333af5ff7b80d8d0d6e4d31dd9a5448c41031 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 19 Jan 2021 17:46:14 +0800 Subject: [PATCH] update change tel phone page --- lib/constants/api.dart | 8 ++++++-- .../convenient_phone/convenient_phone_page.dart | 1 - lib/pages/personal/update_tel_page.dart | 15 ++++++++++++++- lib/pages/sign/sign_func.dart | 9 ++++++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index e533950d..fa715e92 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -22,6 +22,9 @@ class _Login { /// app用户注册 String get signUp => '/login/register'; + + ///通过新手机号发送修改验证码 + String get sendNewMSCode => '/user/personalData/sendTelUpdateCode'; } class _User { @@ -38,15 +41,16 @@ class _User { String get logout => '/user/signOut'; ///修改用户昵称 - String get updateNickName =>'/user/personalData/updateNickName'; + String get updateNickName => '/user/personalData/updateNickName'; ///修改用户手机号 - String get updateTel =>'/user/personalData/updateTel'; + String get updateTel => '/user/personalData/updateTel'; } class _Manager { ///获取业委会列表 String get commiteeStaff => '/ownersCommittee/findAll'; + ///获取便民电话联系人列表 String get convenientPhone => '/convenientTelephone/list'; } diff --git a/lib/pages/convenient_phone/convenient_phone_page.dart b/lib/pages/convenient_phone/convenient_phone_page.dart index 4e599a0d..6d4d3b5d 100644 --- a/lib/pages/convenient_phone/convenient_phone_page.dart +++ b/lib/pages/convenient_phone/convenient_phone_page.dart @@ -6,7 +6,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:multi_image_picker/multi_image_picker.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:akuCommunity/const/resource.dart'; diff --git a/lib/pages/personal/update_tel_page.dart b/lib/pages/personal/update_tel_page.dart index c52400ec..695aeb0e 100644 --- a/lib/pages/personal/update_tel_page.dart +++ b/lib/pages/personal/update_tel_page.dart @@ -7,6 +7,7 @@ import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -71,6 +72,9 @@ class _UpdateTelPageState extends State { 55.heightBox, '旧号码'.text.black.size(28.sp).make(), TextFormField( + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]*')) + ], controller: _oldTelController, decoration: InputDecoration( contentPadding: EdgeInsets.zero, @@ -87,14 +91,20 @@ class _UpdateTelPageState extends State { 24.heightBox, '新号码'.text.black.size(28.sp).make(), TextFormField( + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]*')), + ], controller: _newTelController, + onChanged: (value) { + setState(() {}); + }, decoration: InputDecoration( suffixIconConstraints: BoxConstraints(minHeight: 0.w, minWidth: 0.w), suffixIcon: MaterialButton( onPressed: _canGetCode ? () { - SignFunc.sendMessageCode(_newTelController.text); + SignFunc.sendNewMessageCode(_newTelController.text); startTick(); } : () {}, @@ -134,6 +144,9 @@ class _UpdateTelPageState extends State { 24.heightBox, '验证码'.text.black.size(28.sp).make(), TextFormField( + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]*')) + ], controller: _codeController, decoration: InputDecoration( contentPadding: EdgeInsets.zero, diff --git a/lib/pages/sign/sign_func.dart b/lib/pages/sign/sign_func.dart index b2ff6c04..68e173e1 100644 --- a/lib/pages/sign/sign_func.dart +++ b/lib/pages/sign/sign_func.dart @@ -19,7 +19,14 @@ class SignFunc { ); return baseModel; } - + static Future sendNewMessageCode(String newTel) async{ + BaseModel baseModel =await NetUtil().post( + API.login.sendNewMSCode, + params: {'newTel':newTel}, + showMessage: true, + ); + return baseModel; + } static Future login(String phone, String code) async { Response response = await NetUtil().dio.post( API.login.loginBySMS,