Browse Source

短信验证码更改

dev
huixiang_app 1 year ago
parent
commit
89f5f58acc
  1. 47
      lib/login/captcha/block_puzzle_captcha.dart
  2. 5
      lib/login/captcha/click_word_captcha.dart
  3. 6
      lib/login/new_login_page.dart
  4. 6
      lib/setting/logout_ing.dart

47
lib/login/captcha/block_puzzle_captcha.dart

@ -3,6 +3,7 @@ import 'dart:math';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../retrofit/retrofit_api.dart'; import '../../retrofit/retrofit_api.dart';
import '../../utils/captcha_util.dart'; import '../../utils/captcha_util.dart';
@ -58,7 +59,7 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
// //
GlobalKey _slideImageKey = new GlobalKey(); GlobalKey _slideImageKey = new GlobalKey();
double _bottomSliderSize = 60; double _bottomSliderSize = 60.h;
//------------------------ //------------------------
@ -293,7 +294,7 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
child: Container( child: Container(
key: _containerKey, key: _containerKey,
width: dialogWidth, width: dialogWidth,
height: 340, height: 340.h,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -312,10 +313,10 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
///+ ///+
_topContainer() { _topContainer() {
return Container( return Container(
height: 50, height: 50.h,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border(bottom: BorderSide(width: 1, color: Color(0xffe5e5e5))), border: Border(bottom: BorderSide(width: 1.w, color: Color(0xffe5e5e5))),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -340,7 +341,7 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
_middleContainer() { _middleContainer() {
//// ////
return Container( return Container(
margin: EdgeInsets.symmetric(vertical: 10), margin: EdgeInsets.symmetric(vertical: 10.h),
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
/// 310*155 /// 310*155
@ -352,14 +353,14 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
gaplessPlayback: true, gaplessPlayback: true,
) )
: Container( : Container(
width: 310, width: 310.w,
height: 155, height: 155.h,
alignment: Alignment.center, alignment: Alignment.center,
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
), ),
/// ///
slideImageBase64.length > 0 (baseImageBase64.length > 0 && slideImageBase64.length > 0)
? Container( ? Container(
margin: EdgeInsets.fromLTRB(sliderXMoved, 0, 0, 0), margin: EdgeInsets.fromLTRB(sliderXMoved, 0, 0, 0),
child: Image.memory( child: Image.memory(
@ -386,15 +387,15 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
), ),
Positioned( Positioned(
bottom: 0, bottom: 0,
left: -10, left: -10.w,
right: -10, right: -10.w,
child: Offstage( child: Offstage(
offstage: !_showTimeLine, offstage: !_showTimeLine,
child: FractionalTranslation( child: FractionalTranslation(
translation: Offset(0, offsetAnimation.value), translation: Offset(0, offsetAnimation.value),
child: Container( child: Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10.w, right: 10.w),
height: 40, height: 40.h,
color: _checkSuccess color: _checkSuccess
? Color(0x7F66BB6A) ? Color(0x7F66BB6A)
: Color.fromRGBO(200, 100, 100, 0.4), : Color.fromRGBO(200, 100, 100, 0.4),
@ -409,14 +410,14 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
), ),
)), )),
Positioned( Positioned(
bottom: -20, bottom: -20.h,
left: 0, left: 0,
right: 0, right: 0,
child: Offstage( child: Offstage(
offstage: !_showTimeLine, offstage: !_showTimeLine,
child: Container( child: Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10.w, right: 10.w),
height: 20, height: 20.h,
color: Colors.white, color: Colors.white,
), ),
)) ))
@ -429,7 +430,7 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
_bottomContainer() { _bottomContainer() {
return baseSize.width > 0 return baseSize.width > 0
? Container( ? Container(
height: 70, height: 70.h,
width: baseSize.width, width: baseSize.width,
// color: Colors.cyanAccent, // color: Colors.cyanAccent,
child: Stack( child: Stack(
@ -439,7 +440,7 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
height: _bottomSliderSize, height: _bottomSliderSize,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: 1, width: 1.w,
color: Color(0xffe5e5e5), color: Color(0xffe5e5e5),
), ),
color: Color(0xfff8f9fb), color: Color(0xfff8f9fb),
@ -449,12 +450,12 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
'向右拖动滑块填充拼图', '向右拖动滑块填充拼图',
style: TextStyle(fontSize: 16), style: TextStyle(fontSize: 16.sp),
), ),
), ),
Container( Container(
width: sliderXMoved, width: sliderXMoved,
height: _bottomSliderSize - 2, height: _bottomSliderSize - 2.h,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: sliderXMoved > 0 ? 1 : 0, width: sliderXMoved > 0 ? 1 : 0,
@ -506,15 +507,15 @@ class _BlockPuzzleCaptchaPageState extends State<BlockPuzzleCaptchaPage>
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
top: BorderSide( top: BorderSide(
width: 1, width: 1.w,
color: Color(0xffe5e5e5), color: Color(0xffe5e5e5),
), ),
right: BorderSide( right: BorderSide(
width: 1, width: 1.w,
color: Color(0xffe5e5e5), color: Color(0xffe5e5e5),
), ),
bottom: BorderSide( bottom: BorderSide(
width: 1, width: 1.w,
color: Color(0xffe5e5e5), color: Color(0xffe5e5e5),
), ),
), ),

5
lib/login/captcha/click_word_captcha.dart

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../retrofit/retrofit_api.dart'; import '../../retrofit/retrofit_api.dart';
import '../../utils/captcha_util.dart'; import '../../utils/captcha_util.dart';
@ -178,7 +179,7 @@ class _ClickWordCaptchaState extends State<ClickWordCaptcha> {
body: Center( body: Center(
child: Container( child: Container(
width: dialogWidth, width: dialogWidth,
height: 320, height: 320.h,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -264,7 +265,7 @@ class _ClickWordCaptchaState extends State<ClickWordCaptcha> {
// //
_bottomContainer() { _bottomContainer() {
return Container( return Container(
height: 50, height: 50.h,
margin: EdgeInsets.only(top: 10), margin: EdgeInsets.only(top: 10),
alignment: Alignment.center, alignment: Alignment.center,
width: baseSize.width, width: baseSize.width,

6
lib/login/new_login_page.dart

@ -961,7 +961,7 @@ class _NewLoginPage extends State<NewLoginPage> {
builder: (BuildContext context) { builder: (BuildContext context) {
return BlockPuzzleCaptchaPage( return BlockPuzzleCaptchaPage(
onSuccess: (v) { onSuccess: (v) {
sendSms(); sendSms(v);
}, },
onFail: () { onFail: () {
print("onFail"); print("onFail");
@ -971,8 +971,8 @@ class _NewLoginPage extends State<NewLoginPage> {
); );
} }
sendSms() async{ sendSms(v) async{
BaseData baseData = await apiService.sendVerify({"areaCode":area, "mobile": mobile, "verification": ""}).catchError((onError) { BaseData baseData = await apiService.sendVerify({"areaCode":area, "mobile": mobile, "verification": v}).catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);}); alignment: Alignment.center);});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {

6
lib/setting/logout_ing.dart

@ -77,7 +77,7 @@ class _LogoutIng extends State<LogoutIng> {
loadingBlockPuzzle(context); loadingBlockPuzzle(context);
} }
sendProving() async{ sendProving(v) async{
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(
@ -87,7 +87,7 @@ class _LogoutIng extends State<LogoutIng> {
showLoading: true showLoading: true
); );
} }
BaseData baseData = await apiService.sendVerify({"areaCode": "+86", "mobile": phoneController.text, "verification": ""}).catchError((onError) {}); BaseData baseData = await apiService.sendVerify({"areaCode": "+86", "mobile": phoneController.text, "verification": v}).catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
countdown(); countdown();
SmartDialog.showToast(baseData.data, SmartDialog.showToast(baseData.data,
@ -512,7 +512,7 @@ class _LogoutIng extends State<LogoutIng> {
builder: (BuildContext context) { builder: (BuildContext context) {
return BlockPuzzleCaptchaPage( return BlockPuzzleCaptchaPage(
onSuccess: (v) { onSuccess: (v) {
sendProving(); sendProving(v);
}, },
onFail: () { onFail: () {
print("onFail"); print("onFail");

Loading…
Cancel
Save