Parcourir la source

6.21 1.1.05
退出登录提示
注册验证码
忘记密码
订单bug

huxiaoqiang il y a 4 ans
Parent
commit
fd1b908bcf

+ 10 - 2
lib/my_tools/order_processing/order_processing.dart

@@ -162,8 +162,15 @@ class OrderProcessing {
 
   bool parseOrder(TemplateBeanData element) {
     print('=======parseOrder========');
-    var res = parseString2(
-        element.template.replaceAll('\r', ''), '''$clipboardData''');
+    print(
+        '=========================|${element.template}|=============================');
+    print(
+        '=========================|$clipboardData|=============================');
+    var res;
+    try {
+      res = parseString2(
+          element.template.replaceAll('\r', ''), '''$clipboardData''');
+    } catch (e) {}
     print(res.toString());
     if (res != null) {
       print('-----------data[i].template-----------');
@@ -252,6 +259,7 @@ class OrderProcessing {
                         right: 0,
                         child: GestureDetector(
                           onTap: () {
+                            initialization();
                             PopUpQueue().onShow = false;
                             PopUpQueue().showNext();
                           },

+ 113 - 23
lib/paegs/forget_password_page/forget_password_page.dart

@@ -1,3 +1,6 @@
+import 'dart:async';
+
+import 'package:bbyyy/https/MyDio.dart';
 import 'package:bbyyy/my_tools/my_colors.dart';
 import 'package:bbyyy/my_tools/my_tools.dart';
 import 'package:bbyyy/paegs/login_page/login_page.dart';
@@ -16,6 +19,8 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
   TextEditingController _pw = TextEditingController();
   TextEditingController _verificationCode = TextEditingController();
   int focus = -1;
+  String verificationCodeText = '发送验证码';
+  Timer _timer;
 
   @override
   Widget build(BuildContext context) {
@@ -71,7 +76,7 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
                         children: [
                           Container(
                             child: Text(
-                              'Hello Welcome !',
+                              '忘记密码',
                               style: TextStyle(
                                   color: MyColors.cFF4233, fontSize: 24),
                             ),
@@ -229,17 +234,29 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
                                       fontSize: 16,
                                       height: 1.3,
                                       letterSpacing: 0.2),
-                                  keyboardType: TextInputType.text,
+                                  keyboardType: TextInputType.number,
                                   onChanged: (t) {},
                                 ),
                               ),
-                              Container(
-                                decoration: BoxDecoration(
-                                    color: MyColors.c19FF4233,
-                                    borderRadius:
-                                        BorderRadius.all(Radius.circular(4))),
-                                height: 34,
-                                width: 90,
+                              GestureDetector(
+                                onTap: (){
+                                  if(verificationCodeText!='发送验证码'){
+                                    showToast('验证码发送中');
+                                    return;
+                                  }
+                                  sendTheVerificationCode();
+                                },
+                                behavior: HitTestBehavior.translucent,
+                                child: Container(
+                                  decoration: BoxDecoration(
+                                      color: MyColors.c19FF4233,
+                                      borderRadius:
+                                          BorderRadius.all(Radius.circular(4))),
+                                  child: Text(verificationCodeText,style: TextStyle(color: MyColors.cFF4233,fontSize: 14),),
+                                  alignment: Alignment.center,
+                                  height: 34,
+                                  width: 90,
+                                ),
                               )
                             ],
                           ),
@@ -250,23 +267,41 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
                                 : MyColors.cD7D7D7,
                             margin: EdgeInsets.only(top: 8, bottom: 39),
                           ),
-                          Container(
-                            decoration: BoxDecoration(
-                              borderRadius: BorderRadius.all(
-                                Radius.circular(20),
+                          GestureDetector(
+                            onTap: (){
+                              if(_phoneNum.text.isEmpty||_phoneNum.text.length!=11){
+                                showToast('请输入手机号');
+                                return;
+                              }
+                              if (_pw.text.isEmpty || _pw.text.length < 6) {
+                                showToast('请填写正确的密码(由数字和字母组合的至少6位的组合)');
+                                return;
+                              }
+                              if(_verificationCode.text.isEmpty||_verificationCode.text.length!=4){
+                                showToast('请输入真确的验证码');
+                                return;
+                              }
+                              resetPassword();
+                            },
+                            behavior: HitTestBehavior.translucent,
+                            child: Container(
+                              decoration: BoxDecoration(
+                                borderRadius: BorderRadius.all(
+                                  Radius.circular(20),
+                                ),
+                                gradient: LinearGradient(
+                                  colors: MyColors.lg,
+                                ),
                               ),
-                              gradient: LinearGradient(
-                                colors: MyColors.lg,
+                              height: 44,
+                              child: Text(
+                                '确 定',
+                                style:
+                                    TextStyle(color: Colors.white, fontSize: 17),
                               ),
+                              alignment: Alignment.center,
+                              padding: EdgeInsets.only(bottom: 2),
                             ),
-                            height: 44,
-                            child: Text(
-                              '确 定',
-                              style:
-                                  TextStyle(color: Colors.white, fontSize: 17),
-                            ),
-                            alignment: Alignment.center,
-                            padding: EdgeInsets.only(bottom: 2),
                           ),
                           Expanded(
                             child: SafeArea(
@@ -341,4 +376,59 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
       ),
     );
   }
+
+
+  int countdown = 60;
+  void sendTheVerificationCode() {
+    if(_phoneNum.text.isEmpty||_phoneNum.text.length!=11){
+      showToast('请输入正确的手机号');
+      return;
+    }
+    MyDio().post('/hms/sendCode', {
+      'mobile':_phoneNum.text
+    }, (response, hasError) {
+      if(!hasError){
+
+      }
+    }, (error) {
+      showToast('发送失败');
+      countdown = 2;
+    });
+    setState(() {
+      setState(() {
+        verificationCodeText = '$countdown s';
+        countdown--;
+      });
+    });
+  _timer =  Timer.periodic(Duration(seconds: 1), (timer) {
+      if(countdown==0){
+        timer.cancel();
+        setState(() {
+          countdown = 60;
+          verificationCodeText = '发送验证码';
+        });
+        return;
+      }
+      setState(() {
+        verificationCodeText = '$countdown s';
+        countdown--;
+      });
+    });
+  }
+
+  void resetPassword() {
+    MyDio().post('/model/userResetPwd', {
+      'user':_phoneNum.text,
+      'code':int.parse(_verificationCode.text),
+      'password':MyTools.base64Encode(_pw.text),
+    }, (response, hasError) {
+      if(!hasError){
+        showToast('重新设置成功,请重新登录');
+        _timer.cancel();
+        MyTools().toPage(
+            context, LoginPage(), (then) {},
+            noBack: true);
+      }
+    }, (error) { });
+  }
 }

+ 73 - 72
lib/paegs/login_page/login_page.dart

@@ -7,6 +7,7 @@ import 'package:bbyyy/https/my_request.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/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';
@@ -262,82 +263,82 @@ class _LoginPageState extends State<LoginPage> {
                                 ),
                               ),
                             ),
-                            Container(
-                              alignment: Alignment.centerRight,
-                              child: GestureDetector(
-                                onTap: () {
-                                  MyTools().toPage(
-                                      context, RegisteredPage(), (then) {},
-                                      noBack: true);
-                                },
-                                behavior: HitTestBehavior.translucent,
-                                child: Container(
-                                  child: Text(
-                                    '没有账号,去注册',
-                                    style: TextStyle(
-                                        color: MyColors.cFF4233, fontSize: 13),
-                                  ),
-                                  padding: EdgeInsets.all(8),
-                                  margin: EdgeInsets.only(top: 22),
-                                ),
-                              ),
-                            ),
-                            // Expanded(
-                            //   child: SafeArea(
-                            //     bottom: true,
+                            // Container(
+                            //   alignment: Alignment.centerRight,
+                            //   child: GestureDetector(
+                            //     onTap: () {
+                            //       MyTools().toPage(
+                            //           context, RegisteredPage(), (then) {},
+                            //           noBack: true);
+                            //     },
+                            //     behavior: HitTestBehavior.translucent,
                             //     child: Container(
-                            //       padding: EdgeInsets.only(bottom: 50),
-                            //       alignment: Alignment.bottomCenter,
-                            //       child: Row(
-                            //         children: [
-                            //           GestureDetector(
-                            //             onTap: () {
-                            //               MyTools().toPage(
-                            //                   context, RegisteredPage(), (then) {},
-                            //                   noBack: true);
-                            //             },
-                            //             behavior: HitTestBehavior.translucent,
-                            //             child: Container(
-                            //               padding: EdgeInsets.all(8),
-                            //               child: Text(
-                            //                 '注册账号',
-                            //                 style: TextStyle(
-                            //                     color: MyColors.c666666, fontSize: 14),
-                            //               ),
-                            //             ),
-                            //           ),
-                            //           Container(
-                            //             height: 13,
-                            //             width: 2,
-                            //             decoration: BoxDecoration(
-                            //               borderRadius:
-                            //                   BorderRadius.all(Radius.circular(1)),
-                            //               color: MyColors.cFF4233,
-                            //             ),
-                            //             margin: EdgeInsets.only(left: 27, right: 27),
-                            //           ),
-                            //           GestureDetector(
-                            //             onTap: () {
-                            //               MyTools().toPage(
-                            //                   context, ForgetPasswordPage(), (then) {},
-                            //                   noBack: true);
-                            //             },
-                            //             behavior: HitTestBehavior.translucent,
-                            //             child: Container(
-                            //               padding: EdgeInsets.all(8),
-                            //               child: Text(
-                            //                 '忘记密码',
-                            //                 style: TextStyle(
-                            //                     color: MyColors.c666666, fontSize: 14),
-                            //               ),
-                            //             ),
-                            //           ),
-                            //         ],
-                            //         mainAxisAlignment: MainAxisAlignment.center,
+                            //       child: Text(
+                            //         '没有账号,去注册',
+                            //         style: TextStyle(
+                            //             color: MyColors.cFF4233, fontSize: 13),
                             //       ),
+                            //       padding: EdgeInsets.all(8),
+                            //       margin: EdgeInsets.only(top: 22),
                             //     ),
                             //   ),
-                            // )
+                            // ),
+                            Expanded(
+                              child: SafeArea(
+                                bottom: true,
+                                child: Container(
+                                  padding: EdgeInsets.only(bottom: 50),
+                                  alignment: Alignment.bottomCenter,
+                                  child: Row(
+                                    children: [
+                                      GestureDetector(
+                                        onTap: () {
+                                          MyTools().toPage(
+                                              context, RegisteredPage(), (then) {},
+                                              noBack: true);
+                                        },
+                                        behavior: HitTestBehavior.translucent,
+                                        child: Container(
+                                          padding: EdgeInsets.all(8),
+                                          child: Text(
+                                            '注册账号',
+                                            style: TextStyle(
+                                                color: MyColors.c666666, fontSize: 14),
+                                          ),
+                                        ),
+                                      ),
+                                      Container(
+                                        height: 13,
+                                        width: 2,
+                                        decoration: BoxDecoration(
+                                          borderRadius:
+                                              BorderRadius.all(Radius.circular(1)),
+                                          color: MyColors.cFF4233,
+                                        ),
+                                        margin: EdgeInsets.only(left: 27, right: 27),
+                                      ),
+                                      GestureDetector(
+                                        onTap: () {
+                                          MyTools().toPage(
+                                              context, ForgetPasswordPage(), (then) {},
+                                              noBack: true);
+                                        },
+                                        behavior: HitTestBehavior.translucent,
+                                        child: Container(
+                                          padding: EdgeInsets.all(8),
+                                          child: Text(
+                                            '忘记密码',
+                                            style: TextStyle(
+                                                color: MyColors.c666666, fontSize: 14),
+                                          ),
+                                        ),
+                                      ),
+                                    ],
+                                    mainAxisAlignment: MainAxisAlignment.center,
+                                  ),
+                                ),
+                              ),
+                            )
                           ],
                           crossAxisAlignment: CrossAxisAlignment.start,
                         ),

+ 105 - 4
lib/paegs/mine_page/set_page/set_page.dart

@@ -215,10 +215,111 @@ class _SetPageState extends State<SetPage> {
             margin: EdgeInsets.symmetric(vertical: 101, horizontal: 62),
             child: GestureDetector(
               onTap: () {
-                MyCookie().prefs.remove('LoginInformationBeanEntity');
-                // MyCookie().prefs.clear();
-                RootPageView().bNIndex = 0;
-                MyTools().toPage(context, LoginPage(), (then) {}, noBack: true);
+                showDialog(
+                  context: context,
+                  builder: (BuildContext context) {
+                    return WillPopScope(
+                      onWillPop: () {
+                        return Future.value(false);
+                      },
+                      child: StreamBuilder<Object>(builder: (context, snapshot) {
+                        return Material(
+                          color: Colors.black12,
+                          child: Center(
+                            child: Container(
+                              decoration: BoxDecoration(
+                                borderRadius: BorderRadius.circular(16),
+                                color: Colors.white,
+                              ),
+                              height: 165,
+                              margin: EdgeInsets.symmetric(horizontal: 18),
+                              padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
+                              child: StatefulBuilder(
+                                builder: (BuildContext context,
+                                    void Function(void Function()) setState) {
+
+                                    return Column(
+                                      children: [
+                                        Container(
+                                          height: 88,
+                                          child: MyViews().myText('确认退出登录重新登录吗?',
+                                              MyColors.c333333,
+                                              14),
+                                          margin: EdgeInsets.symmetric(horizontal: 20),
+                                          alignment: Alignment.center,
+                                        ),
+                                        Container(
+                                          height: 0.5,
+                                          color: MyColors.cE7E7E7,
+                                          margin: EdgeInsets.only(bottom: 12),
+                                        ),
+                                       Row(
+                                          children: [
+                                            Expanded(
+                                              child: GestureDetector(
+                                                onTap: () {
+      Navigator.pop(context);
+                                                },
+                                                behavior: HitTestBehavior.translucent,
+                                                child: Container(
+                                                  margin: EdgeInsets.only(left: 10),
+                                                  decoration: BoxDecoration(
+                                                      borderRadius: BorderRadius.only(
+                                                        topLeft: Radius.circular(20),
+                                                        bottomLeft: Radius.circular(20),
+                                                      ),
+                                                      border: Border.all(
+                                                          color: MyColors.cFF4233,
+                                                          width: 1.1),
+                                                      color: Colors.white),
+                                                  child: MyViews().myText(
+                                                      '取消', MyColors.cFF4233, 14),
+                                                  height: 40,
+                                                  alignment: Alignment.center,
+                                                ),
+                                              ),
+                                            ),
+                                            Expanded(
+                                              child: GestureDetector(
+                                                behavior: HitTestBehavior.translucent,
+                                                onTap: () {
+                                                  MyCookie().prefs.remove('LoginInformationBeanEntity');
+                                                  // MyCookie().prefs.clear();
+                                                  RootPageView().bNIndex = 0;
+                                                  MyTools().toPage(context, LoginPage(), (then) {}, noBack: true);
+                                                },
+                                                child: Container(
+                                                  margin: EdgeInsets.only(right: 10),
+                                                  decoration: BoxDecoration(
+                                                      borderRadius: BorderRadius.only(
+                                                        topRight: Radius.circular(20),
+                                                        bottomRight:
+                                                        Radius.circular(20),
+                                                      ),
+                                                      color: MyColors.cFF4233),
+                                                  height: 40,
+                                                  child: MyViews()
+                                                      .myText('确认', Colors.white, 14),
+                                                  alignment: Alignment.center,
+                                                ),
+                                              ),
+                                            )
+                                          ],
+                                        )
+                                      ],
+                                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                                    );
+
+                                },
+                              ),
+                            ),
+                          ),
+                        );
+                      }),
+                    );
+                  },
+                );
+
               },
               behavior: HitTestBehavior.translucent,
               child: Container(

+ 148 - 64
lib/paegs/registered_page/registered_page.dart

@@ -1,3 +1,4 @@
+import 'dart:async';
 import 'dart:convert';
 import 'dart:io';
 
@@ -27,14 +28,17 @@ class RegisteredPage extends StatefulWidget {
 
 class _RegisteredPageState extends State<RegisteredPage> {
   TextEditingController _phoneNum = TextEditingController(text: '');
+  TextEditingController _verificationCode = TextEditingController(text: '');
   TextEditingController _nickname = TextEditingController(text: '');
   TextEditingController _pw = TextEditingController(text: '');
   bool showPW = true;
   int focus = -1;
   bool haveRead = false;
+  String verificationCodeText = '发送验证码';
 
   File _image;
   final picker = ImagePicker();
+  Timer _timer;
 
   @override
   Widget build(BuildContext context) {
@@ -152,14 +156,14 @@ class _RegisteredPageState extends State<RegisteredPage> {
                     padding: EdgeInsets.only(left: 47, right: 47, top: 26),
                     child: Column(
                       children: [
-                        Container(
-                          child: Text(
-                            'Hello Welcome !',
-                            style: TextStyle(
-                                color: MyColors.cFF4233, fontSize: 24),
-                          ),
-                          margin: EdgeInsets.only(bottom: 25),
-                        ),
+                        // Container(
+                        //   child: Text(
+                        //     'Hello Welcome !',
+                        //     style: TextStyle(
+                        //         color: MyColors.cFF4233, fontSize: 24),
+                        //   ),
+                        //   margin: EdgeInsets.only(bottom: 25),
+                        // ),
                         Row(
                           children: [
                             Container(
@@ -262,62 +266,84 @@ class _RegisteredPageState extends State<RegisteredPage> {
                             ),
                           ],
                         ),
-                        // Row(
-                        //   children: [
-                        //     Container(
-                        //       child: SvgPicture.asset(
-                        //         'images/svg/验证码.svg',
-                        //         height: 22,
-                        //         width: 22,
-                        //       ),
-                        //       height: 22,
-                        //       width: 22,
-                        //     ),
-                        //     Expanded(
-                        //       child: TextField(
-                        //         controller: _verificationCode,
-                        //         cursorColor: MyColors.cFF4233,
-                        //         cursorWidth: 1.0,
-                        //         onTap: () {
-                        //           setState(() {
-                        //             focus = 1;
-                        //           });
-                        //         },
-                        //         decoration: InputDecoration(
-                        //             border: InputBorder.none,
-                        //             disabledBorder: InputBorder.none,
-                        //             enabledBorder: InputBorder.none,
-                        //             focusedBorder: InputBorder.none,
-                        //             hintText: '请输入验证码',
-                        //             hintStyle: TextStyle(
-                        //                 color: MyColors.c999999, fontSize: 16),
-                        //             isDense: true,
-                        //             contentPadding:
-                        //             const EdgeInsets.fromLTRB(14, 4.5, 8, 4.5)),
-                        //         maxLines: 1,
-                        //         style: TextStyle(
-                        //             color: MyColors.c333333,
-                        //             fontSize: 16,
-                        //             height: 1.3,
-                        //             letterSpacing: 0.2),
-                        //         keyboardType: TextInputType.text,
-                        //         onChanged: (t) {},
-                        //       ),
-                        //     ),
-                        //     Container(
-                        //       decoration: BoxDecoration(
-                        //           color: MyColors.c19FF4233,
-                        //           borderRadius:
-                        //           BorderRadius.all(Radius.circular(4))),
-                        //       height: 34,
-                        //       width: 90,
-                        //     )
-                        //   ],
-                        // ),
                         Container(
                           height: 1,
                           color:
-                              focus == 2 ? MyColors.cFF4233 : MyColors.cD7D7D7,
+                          focus == 2 ? MyColors.cFF4233 : MyColors.cD7D7D7,
+                          margin: EdgeInsets.only(top: 8, bottom: 39),
+                        ),
+                        Row(
+                          children: [
+                            Container(
+                              child: SvgPicture.asset(
+                                'images/svg/验证码.svg',
+                                height: 22,
+                                width: 22,
+                              ),
+                              height: 22,
+                              width: 22,
+                            ),
+                            Expanded(
+                              child: TextField(
+                                controller: _verificationCode,
+                                cursorColor: MyColors.cFF4233,
+                                cursorWidth: 1.0,
+                                inputFormatters: [
+                                  onlyInputNumberAndWorkFormatter(),
+                                  LengthLimitingTextInputFormatter(6)
+                                ],
+                                onTap: () {
+                                  setState(() {
+                                    focus = 1;
+                                  });
+                                },
+                                decoration: InputDecoration(
+                                    border: InputBorder.none,
+                                    disabledBorder: InputBorder.none,
+                                    enabledBorder: InputBorder.none,
+                                    focusedBorder: InputBorder.none,
+                                    hintText: '请输入验证码',
+                                    hintStyle: TextStyle(
+                                        color: MyColors.c999999, fontSize: 16),
+                                    isDense: true,
+                                    contentPadding:
+                                    const EdgeInsets.fromLTRB(14, 4.5, 8, 4.5)),
+                                maxLines: 1,
+                                style: TextStyle(
+                                    color: MyColors.c333333,
+                                    fontSize: 16,
+                                    height: 1.3,
+                                    letterSpacing: 0.2),
+                                keyboardType: TextInputType.number,
+                                onChanged: (t) {},
+                              ),
+                            ),
+                            GestureDetector(
+                              onTap: (){
+                                if(verificationCodeText!='发送验证码'){
+                                  showToast('验证码发送中');
+                                  return;
+                                }
+                                sendTheVerificationCode();
+                              },
+                              behavior: HitTestBehavior.translucent,
+                              child: Container(
+                                decoration: BoxDecoration(
+                                    color: MyColors.c19FF4233,
+                                    borderRadius:
+                                    BorderRadius.all(Radius.circular(4))),
+                                child: Text(verificationCodeText,style: TextStyle(color: MyColors.cFF4233,fontSize: 14),),
+                                alignment: Alignment.center,
+                                height: 34,
+                                width: 90,
+                              ),
+                            )
+                          ],
+                        ),
+                        Container(
+                          height: 1,
+                          color:
+                              focus == 1 ? MyColors.cFF4233 : MyColors.cD7D7D7,
                           margin: EdgeInsets.only(top: 8, bottom: 39),
                         ),
                         Row(
@@ -342,7 +368,7 @@ class _RegisteredPageState extends State<RegisteredPage> {
                                 cursorWidth: 1.0,
                                 onTap: () {
                                   setState(() {
-                                    focus = 1;
+                                    focus = 3;
                                   });
                                 },
                                 decoration: InputDecoration(
@@ -385,7 +411,7 @@ class _RegisteredPageState extends State<RegisteredPage> {
                         Container(
                           height: 1,
                           color:
-                              focus == 1 ? MyColors.cFF4233 : MyColors.cD7D7D7,
+                              focus == 3 ? MyColors.cFF4233 : MyColors.cD7D7D7,
                           margin: EdgeInsets.only(top: 8, bottom: 20),
                         ),
                         Row(
@@ -455,6 +481,10 @@ class _RegisteredPageState extends State<RegisteredPage> {
                               showToast('请填写昵称');
                               return;
                             }
+                            if (_verificationCode.text.isEmpty) {
+                              showToast('请填写验证码');
+                              return;
+                            }
                             if (_image == null) {
                               showToast('请设置头像');
                               return;
@@ -463,7 +493,7 @@ class _RegisteredPageState extends State<RegisteredPage> {
                               showToast('请阅读并同意《隐私政策》');
                               return;
                             }
-                            uploadAvatar();
+                            verificationCode();
                           },
                           behavior: HitTestBehavior.translucent,
                           child: Container(
@@ -540,6 +570,7 @@ class _RegisteredPageState extends State<RegisteredPage> {
         // MyTools().toPage(
         //     context, LoginPage(), (then) {},
         //     noBack: true);
+        _timer.cancel();
         loginAccount({
           'user': _phoneNum.text,
           'password': MyTools.base64Encode(_pw.text),
@@ -557,6 +588,59 @@ class _RegisteredPageState extends State<RegisteredPage> {
       }
     }, (error) {});
   }
+
+  int countdown = 60;
+  void sendTheVerificationCode() {
+    if(_phoneNum.text.isEmpty||_phoneNum.text.length!=11){
+      showToast('请输入正确的手机号');
+      return;
+    }
+    MyDio().post('/hms/sendCode', {
+      'mobile':_phoneNum.text
+    }, (response, hasError) {
+      if(!hasError){
+
+      }
+    }, (error) {
+      showToast('发送失败');
+      countdown = 2;
+    });
+
+    setState(() {
+      setState(() {
+        verificationCodeText = '$countdown s';
+        countdown--;
+      });
+    });
+    _timer = Timer.periodic(Duration(seconds: 1), (timer) {
+      if(countdown==0){
+        timer.cancel();
+        setState(() {
+          countdown = 60;
+          verificationCodeText = '发送验证码';
+        });
+        return;
+      }
+      setState(() {
+        verificationCodeText = '$countdown s';
+        countdown--;
+      });
+    });
+  }
+
+  void verificationCode() {
+    MyDio().post('/hms/verifyCode', {
+      'mobile':_phoneNum.text,
+      'code':int.parse(_verificationCode.text),
+    }, (response, hasError) {
+      if(!hasError){
+        uploadAvatar();
+      }
+    }, (error) {
+      showToast('验证码错误');
+      return;
+    });
+  }
 }
 
 class PrivacyPolicyPage extends StatefulWidget {

+ 1 - 1
pubspec.yaml

@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 1.1.04+1
+version: 1.1.05+1
 
 environment:
   sdk: ">=2.7.0 <3.0.0"