Commit 159879414a4ac05e7bbdbafed3cfd5201fff87ca

Authored by liangchengyou
1 parent 31d42f06

feat:兑换码接口+本地密码加密

lib/common/request/apis.dart
... ... @@ -71,6 +71,9 @@ class Apis {
71 71 /// get
72 72 static const String homePopup = 'home/popup';
73 73  
  74 + /// 兑换
  75 + static const String exchange = '/exchange';
  76 +
74 77 /// 获取阿里云oss鉴权信息
75 78 static const String aliyunOssSts = 'oss/sts/upload';
76 79 }
... ...
lib/common/request/dao/request_dao.dart 0 → 100644
  1 +import '../request_client.dart';
  2 +
  3 +class RequestDao {
  4 + ///视频跟读提交结果
  5 + static Future exchange(code) async {
  6 + var data = await requestClient.post(Apis.exchange,data: {'code':code});
  7 + return data;
  8 + }
  9 +}
0 10 \ No newline at end of file
... ...
lib/pages/login/forgetpwd/forget_password_home_page.dart
... ... @@ -48,36 +48,36 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
48 48 }
49 49  
50 50 Widget _buildForgetPwdView() => BlocBuilder<ForgetPwdHomeBloc, ForgetPwdHomeState>(builder: (context, state) {
51   - final bloc = BlocProvider.of<ForgetPwdHomeBloc>(context);
52   - return Scaffold(
53   - body: Container(
54   - color: Colors.white,
55   - child: SafeArea(
56   - child: SingleChildScrollView(
57   - child: Padding(
58   - padding: EdgeInsets.only(left: 49.w, right: 10.w),
59   - child: Column(
  51 + final bloc = BlocProvider.of<ForgetPwdHomeBloc>(context);
  52 + return Scaffold(
  53 + body: Container(
  54 + color: Colors.white,
  55 + child: SafeArea(
  56 + child: SingleChildScrollView(
  57 + child: Padding(
  58 + padding: EdgeInsets.only(left: 49.w, right: 10.w),
  59 + child: Column(
  60 + children: [
  61 + 34.verticalSpace,
  62 + Row(
60 63 children: [
61   - 34.verticalSpace,
62   - Row(
63   - children: [
64   - Image.asset(
65   - 'wow_logo'.assetPng,
66   - height: 49.w,
67   - width: 83.5.h,
68   - ),
69   - 12.5.horizontalSpace,
70   - Text(
71   - '修改密码\n请输入您的手机号和验证码吧',
72   - style: TextStyle(fontSize: 16.sp, color: const Color(0xFF666666)),
73   - )
74   - ],
  64 + Image.asset(
  65 + 'wow_logo'.assetPng,
  66 + height: 49.w,
  67 + width: 83.5.h,
75 68 ),
76   - Row(
77   - crossAxisAlignment: CrossAxisAlignment.start,
78   - children: [
79   - Expanded(
80   - child: Column(
  69 + 12.5.horizontalSpace,
  70 + Text(
  71 + '修改密码\n请输入您的手机号和验证码吧',
  72 + style: TextStyle(fontSize: 16.sp, color: const Color(0xFF666666)),
  73 + )
  74 + ],
  75 + ),
  76 + Row(
  77 + crossAxisAlignment: CrossAxisAlignment.start,
  78 + children: [
  79 + Expanded(
  80 + child: Column(
81 81 children: [
82 82 44.5.verticalSpace,
83 83 Row(
... ... @@ -90,15 +90,15 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
90 90 15.horizontalSpace,
91 91 Expanded(
92 92 child: TextFieldCustomerWidget(
93   - height: 50.h,
94   - hitText: '请输入当前手机号',
95   - textInputType: TextInputType.phone,
96   - bgImageName: 'Input_layer_up',
97   - onChangeValue: (String value) {
98   - bloc.add(PhoneNumChangeEvent());
99   - },
100   - controller: bloc.phoneNumController,
101   - ))
  93 + height: 50.h,
  94 + hitText: '请输入当前手机号',
  95 + textInputType: TextInputType.phone,
  96 + bgImageName: 'Input_layer_up',
  97 + onChangeValue: (String value) {
  98 + bloc.add(PhoneNumChangeEvent());
  99 + },
  100 + controller: bloc.phoneNumController,
  101 + ))
102 102 ],
103 103 ),
104 104 11.5.verticalSpace,
... ... @@ -113,14 +113,14 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
113 113 18.5.horizontalSpace,
114 114 Expanded(
115 115 child: TextFieldCustomerWidget(
116   - hitText: '请输入验证码',
117   - bgImageName: 'Input_layer_down',
118   - onChangeValue: (String value) {
119   - bloc.add(CheckCodeChangeEvent());
120   - },
121   - textInputType: TextInputType.emailAddress,
122   - controller: bloc.checkNumController,
123   - )),
  116 + hitText: '请输入验证码',
  117 + bgImageName: 'Input_layer_down',
  118 + onChangeValue: (String value) {
  119 + bloc.add(CheckCodeChangeEvent());
  120 + },
  121 + textInputType: TextInputType.emailAddress,
  122 + controller: bloc.checkNumController,
  123 + )),
124 124 16.5.horizontalSpace,
125 125 TimerWidget(
126 126 pageType: 1,
... ... @@ -131,39 +131,39 @@ class _ForgetPasswordHomePageView extends StatelessWidget {
131 131 )
132 132 ],
133 133 )),
134   - 2.verticalSpace,
135   - Image.asset(
136   - 'steven_bride'.assetPng,
137   - height: 173.h,
138   - width: 157.w,
139   - )
140   - ],
141   - ),
142   - GestureDetector(
143   - onTap: () {
144   - if (bloc.canSetPwd) {
145   - bloc.add(SetPassWordEvent());
146   - }
147   - },
148   - child: Container(
149   - decoration: BoxDecoration(
150   - image: DecorationImage(
151   - image: AssetImage(bloc.canSetPwd ? 'login_enter'.assetPng : 'login_enter_dis'.assetPng),
152   - fit: BoxFit.fill),
153   - ),
154   - padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 14.h),
155   - child: Text(
156   - '确定',
157   - style: TextStyle(fontSize: 16.sp, color: Colors.white),
158   - ),
159   - ),
  134 + 2.verticalSpace,
  135 + Image.asset(
  136 + 'steven_bride'.assetPng,
  137 + height: 173.h,
  138 + width: 157.w,
160 139 )
161 140 ],
162 141 ),
163   - ),
  142 + GestureDetector(
  143 + onTap: () {
  144 + if (bloc.canSetPwd) {
  145 + bloc.add(SetPassWordEvent());
  146 + }
  147 + },
  148 + child: Container(
  149 + decoration: BoxDecoration(
  150 + image: DecorationImage(
  151 + image: AssetImage(bloc.canSetPwd ? 'login_enter'.assetPng : 'login_enter_dis'.assetPng),
  152 + fit: BoxFit.fill),
  153 + ),
  154 + padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 14.h),
  155 + child: Text(
  156 + '确定',
  157 + style: TextStyle(fontSize: 16.sp, color: Colors.white),
  158 + ),
  159 + ),
  160 + )
  161 + ],
164 162 ),
165 163 ),
166 164 ),
167   - );
168   - });
  165 + ),
  166 + ),
  167 + );
  168 + });
169 169 }
... ...
lib/pages/login/loginpage/bloc/login_bloc.dart
... ... @@ -70,6 +70,9 @@ class LoginBloc extends Bloc&lt;LoginEvent, LoginState&gt; {
70 70 }
71 71 var checkKey = _isSmsLoginType ? 'smsCode' : 'password';
72 72 var type = _isSmsLoginType ? 'sms_code' : 'pwd';
  73 + if (type == 'pwd') {//md5加密
  74 + checkNumber = EncryptUtil.encodeMd5(checkNumber);
  75 + }
73 76  
74 77 try {
75 78 await loading(() async {
... ...
lib/pages/login/loginpage/login_page.dart
... ... @@ -38,152 +38,152 @@ class _LoginPageView extends StatelessWidget {
38 38 }
39 39  
40 40 Widget _buildLoginViewWidget() => BlocBuilder<LoginBloc, LoginState>(
41   - builder: (context, state) {
42   - final bloc = BlocProvider.of<LoginBloc>(context);
43   - return Scaffold(
44   - body: SafeArea(
45   - child: SingleChildScrollView(
46   - child: Container(
47   - padding: EdgeInsets.only(top: 25.h),
48   - child: Stack(
49   - children: [
50   - Positioned(
51   - right: 29.w,
52   - child: GestureDetector(
53   - onTap: () => bloc.add(ChangeLoginTypeEvent()),
54   - child: Container(
55   - decoration: BoxDecoration(
56   - image: DecorationImage(image: AssetImage('login_logo'.assetPng), fit: BoxFit.fill),
57   - ),
58   - padding: EdgeInsets.symmetric(horizontal: 18.w, vertical: 5.h),
59   - child: Text(
60   - bloc.isSmsLoginType ? '密码登录' : '验证码登录',
61   - style: TextStyle(fontSize: 16.sp),
62   - ),
63   - ),
64   - )),
65   - Center(
66   - child: Column(
  41 + builder: (context, state) {
  42 + final bloc = BlocProvider.of<LoginBloc>(context);
  43 + return Scaffold(
  44 + body: SafeArea(
  45 + child: SingleChildScrollView(
  46 + child: Container(
  47 + padding: EdgeInsets.only(top: 25.h),
  48 + child: Stack(
  49 + children: [
  50 + Positioned(
  51 + right: 29.w,
  52 + child: GestureDetector(
  53 + onTap: () => bloc.add(ChangeLoginTypeEvent()),
  54 + child: Container(
  55 + decoration: BoxDecoration(
  56 + image: DecorationImage(image: AssetImage('login_logo'.assetPng), fit: BoxFit.fill),
  57 + ),
  58 + padding: EdgeInsets.symmetric(horizontal: 18.w, vertical: 5.h),
  59 + child: Text(
  60 + bloc.isSmsLoginType ? '密码登录' : '验证码登录',
  61 + style: TextStyle(fontSize: 16.sp),
  62 + ),
  63 + ),
  64 + )),
  65 + Center(
  66 + child: Column(
  67 + children: [
  68 + Image.asset(
  69 + 'wow_logo'.assetPng,
  70 + height: 81.h,
  71 + width: 131.w,
  72 + ),
  73 + Offstage(
  74 + offstage: !bloc.isSmsLoginType,
  75 + child: _buildSmsViewWidget(),
  76 + ),
  77 + Offstage(
  78 + offstage: bloc.isSmsLoginType,
  79 + child: _buildPwdViewWidget(),
  80 + ),
  81 + Row(
  82 + mainAxisAlignment: MainAxisAlignment.center,
67 83 children: [
68   - Image.asset(
69   - 'wow_logo'.assetPng,
70   - height: 81.h,
71   - width: 131.w,
72   - ),
73   - Offstage(
74   - offstage: !bloc.isSmsLoginType,
75   - child: _buildSmsViewWidget(),
76   - ),
77   - Offstage(
78   - offstage: bloc.isSmsLoginType,
79   - child: _buildPwdViewWidget(),
80   - ),
81   - Row(
82   - mainAxisAlignment: MainAxisAlignment.center,
83   - children: [
84   - GestureDetector(
85   - onTap: () => bloc.add(AgreementChangeEvent()),
86   - child: Icon(bloc.agreement ? Icons.check_circle_outlined : Icons.circle_outlined,
87   - color: bloc.agreement ? Colors.green : Colors.black),
88   - ),
89   - 6.horizontalSpace,
90   - RichText(
91   - text: TextSpan(children: [
92   - TextSpan(
93   - text: '我已阅读并同意',
94   - style: TextStyle(
95   - fontSize: 12.sp,
96   - color: const Color(0xFF333333),
97   - )),
98   - TextSpan(
99   - text: '《用户隐私协议》',
100   - style: TextStyle(
101   - fontSize: 12.sp,
102   - color: const Color(0xFF333333),
103   - ),
104   - recognizer: TapGestureRecognizer()
105   - ..onTap = () {
106   - Navigator.of(context).pushNamed(AppRouteName.webView, arguments: {
107   - 'urlStr': AppConsts.userPrivacyPolicyUrl,
108   - 'webViewTitle': '用户隐私协议'
109   - });
110   - }),
111   - TextSpan(
112   - text: ',', style: TextStyle(fontSize: 12.sp, color: const Color(0xFF333333))),
113   - TextSpan(
114   - text: '《儿童隐私政策》',
115   - style: TextStyle(fontSize: 12.sp, color: const Color(0xFF333333)),
116   - recognizer: TapGestureRecognizer()
117   - ..onTap = () {
118   - Navigator.of(context).pushNamed(AppRouteName.webView, arguments: {
119   - 'urlStr': AppConsts.childrenPrivacyPolicyUrl,
120   - 'webViewTitle': '儿童隐私协议'
121   - });
122   - })
123   - ]),
124   - )
125   - ],
126   - ),
127 84 GestureDetector(
128   - onTap: () {
129   - if (bloc.canLogin) {
130   - bloc.add(RequestLoginEvent());
131   - }
132   - },
133   - child: Container(
134   - decoration: BoxDecoration(
135   - image: DecorationImage(
136   - image: AssetImage(
137   - bloc.canLogin ? 'login_enter'.assetPng : 'login_enter_dis'.assetPng),
138   - fit: BoxFit.fill),
139   - ),
140   - padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 14.h),
141   - child: Text(
142   - '登录',
143   - style: TextStyle(fontSize: 16.sp),
144   - ),
145   - ),
  85 + onTap: () => bloc.add(AgreementChangeEvent()),
  86 + child: Icon(bloc.agreement ? Icons.check_circle_outlined : Icons.circle_outlined,
  87 + color: bloc.agreement ? Colors.green : Colors.black),
  88 + ),
  89 + 6.horizontalSpace,
  90 + RichText(
  91 + text: TextSpan(children: [
  92 + TextSpan(
  93 + text: '我已阅读并同意',
  94 + style: TextStyle(
  95 + fontSize: 12.sp,
  96 + color: const Color(0xFF333333),
  97 + )),
  98 + TextSpan(
  99 + text: '《用户隐私协议》',
  100 + style: TextStyle(
  101 + fontSize: 12.sp,
  102 + color: const Color(0xFF333333),
  103 + ),
  104 + recognizer: TapGestureRecognizer()
  105 + ..onTap = () {
  106 + Navigator.of(context).pushNamed(AppRouteName.webView, arguments: {
  107 + 'urlStr': AppConsts.userPrivacyPolicyUrl,
  108 + 'webViewTitle': '用户隐私协议'
  109 + });
  110 + }),
  111 + TextSpan(
  112 + text: ',', style: TextStyle(fontSize: 12.sp, color: const Color(0xFF333333))),
  113 + TextSpan(
  114 + text: '《儿童隐私政策》',
  115 + style: TextStyle(fontSize: 12.sp, color: const Color(0xFF333333)),
  116 + recognizer: TapGestureRecognizer()
  117 + ..onTap = () {
  118 + Navigator.of(context).pushNamed(AppRouteName.webView, arguments: {
  119 + 'urlStr': AppConsts.childrenPrivacyPolicyUrl,
  120 + 'webViewTitle': '儿童隐私协议'
  121 + });
  122 + })
  123 + ]),
146 124 )
147 125 ],
148 126 ),
149   - )
150   - ],
151   - ),
152   - ),
  127 + GestureDetector(
  128 + onTap: () {
  129 + if (bloc.canLogin) {
  130 + bloc.add(RequestLoginEvent());
  131 + }
  132 + },
  133 + child: Container(
  134 + decoration: BoxDecoration(
  135 + image: DecorationImage(
  136 + image: AssetImage(
  137 + bloc.canLogin ? 'login_enter'.assetPng : 'login_enter_dis'.assetPng),
  138 + fit: BoxFit.fill),
  139 + ),
  140 + padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 14.h),
  141 + child: Text(
  142 + '登录',
  143 + style: TextStyle(fontSize: 16.sp),
  144 + ),
  145 + ),
  146 + )
  147 + ],
  148 + ),
  149 + )
  150 + ],
153 151 ),
154 152 ),
155   - );
156   - },
  153 + ),
  154 + ),
157 155 );
  156 + },
  157 + );
158 158  
159 159 Widget _buildSmsViewWidget() => BlocBuilder<LoginBloc, LoginState>(builder: (context, state) {
160   - final bloc = BlocProvider.of<LoginBloc>(context);
161   - return Padding(
162   - padding: EdgeInsets.symmetric(horizontal: 135.w),
163   - child: Column(
  160 + final bloc = BlocProvider.of<LoginBloc>(context);
  161 + return Padding(
  162 + padding: EdgeInsets.symmetric(horizontal: 135.w),
  163 + child: Column(
  164 + children: [
  165 + 15.verticalSpace,
  166 + TextFieldCustomerWidget(
  167 + height: 55.h,
  168 + hitText: '请输入手机号',
  169 + textInputType: TextInputType.phone,
  170 + bgImageName: 'Input_layer_up',
  171 + onChangeValue: (String value) {
  172 + bloc.add(PhoneNumChangeEvent());
  173 + },
  174 + controller: bloc.phoneNumController,
  175 + ),
  176 + 6.5.verticalSpace,
  177 + Text(
  178 + '未注册用户登录默认注册',
  179 + style: TextStyle(fontSize: 12.sp, color: const Color(0xFF999999)),
  180 + ),
  181 + 4.5.verticalSpace,
  182 + Row(
  183 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
164 184 children: [
165   - 15.verticalSpace,
166   - TextFieldCustomerWidget(
167   - height: 55.h,
168   - hitText: '请输入手机号',
169   - textInputType: TextInputType.phone,
170   - bgImageName: 'Input_layer_up',
171   - onChangeValue: (String value) {
172   - bloc.add(PhoneNumChangeEvent());
173   - },
174   - controller: bloc.phoneNumController,
175   - ),
176   - 6.5.verticalSpace,
177   - Text(
178   - '未注册用户登录默认注册',
179   - style: TextStyle(fontSize: 12.sp, color: const Color(0xFF999999)),
180   - ),
181   - 4.5.verticalSpace,
182   - Row(
183   - mainAxisAlignment: MainAxisAlignment.spaceBetween,
184   - children: [
185   - Expanded(
186   - child: TextFieldCustomerWidget(
  185 + Expanded(
  186 + child: TextFieldCustomerWidget(
187 187 height: 50.h,
188 188 hitText: '请输入验证码',
189 189 textInputType: TextInputType.number,
... ... @@ -193,35 +193,35 @@ class _LoginPageView extends StatelessWidget {
193 193 },
194 194 controller: bloc.checkNumController,
195 195 )),
196   - TimerWidget(
197   - canSendSms: bloc.canSendSms,
198   - sendSmsEvent: () => bloc.add(RequestSmsCodeEvent()),
199   - )
200   - ],
  196 + TimerWidget(
  197 + canSendSms: bloc.canSendSms,
  198 + sendSmsEvent: () => bloc.add(RequestSmsCodeEvent()),
201 199 )
202 200 ],
203   - ),
204   - );
205   - });
  201 + )
  202 + ],
  203 + ),
  204 + );
  205 + });
206 206  
207 207 Widget _buildPwdViewWidget() => BlocBuilder<LoginBloc, LoginState>(builder: (context, state) {
208   - final bloc = BlocProvider.of<LoginBloc>(context);
209   - return Padding(
210   - padding: EdgeInsets.symmetric(horizontal: 90.w),
211   - child: Column(
  208 + final bloc = BlocProvider.of<LoginBloc>(context);
  209 + return Padding(
  210 + padding: EdgeInsets.symmetric(horizontal: 90.w),
  211 + child: Column(
  212 + children: [
  213 + 15.verticalSpace,
  214 + Row(
  215 + mainAxisAlignment: MainAxisAlignment.center,
212 216 children: [
213   - 15.verticalSpace,
214   - Row(
215   - mainAxisAlignment: MainAxisAlignment.center,
216   - children: [
217   - Image.asset(
218   - 'phone'.assetPng,
219   - height: 45.h,
220   - width: 35.w,
221   - ),
222   - 10.5.horizontalSpace,
223   - Expanded(
224   - child: TextFieldCustomerWidget(
  217 + Image.asset(
  218 + 'phone'.assetPng,
  219 + height: 45.h,
  220 + width: 35.w,
  221 + ),
  222 + 10.5.horizontalSpace,
  223 + Expanded(
  224 + child: TextFieldCustomerWidget(
225 225 height: 50.h,
226 226 hitText: '请输入手机号',
227 227 textInputType: TextInputType.phone,
... ... @@ -231,51 +231,52 @@ class _LoginPageView extends StatelessWidget {
231 231 },
232 232 controller: bloc.phoneNumController,
233 233 )),
234   - 5.horizontalSpace,
235   - SizedBox(
236   - width: 100.w,
237   - height: 55.h,
238   - )
239   - ],
  234 + 5.horizontalSpace,
  235 + SizedBox(
  236 + width: 100.w,
  237 + height: 55.h,
  238 + )
  239 + ],
  240 + ),
  241 + 12.verticalSpace,
  242 + Row(
  243 + mainAxisAlignment: MainAxisAlignment.center,
  244 + children: [
  245 + Image.asset(
  246 + 'lock'.assetPng,
  247 + height: 34.h,
  248 + width: 31.w,
240 249 ),
241   - 12.verticalSpace,
242   - Row(
243   - mainAxisAlignment: MainAxisAlignment.center,
244   - children: [
245   - Image.asset(
246   - 'lock'.assetPng,
247   - height: 34.h,
248   - width: 31.w,
249   - ),
250   - 10.5.horizontalSpace,
251   - Expanded(
252   - child: TextFieldCustomerWidget(
  250 + 10.5.horizontalSpace,
  251 + Expanded(
  252 + child: TextFieldCustomerWidget(
253 253 hitText: '请输入密码',
  254 + obscureText: true,
254 255 bgImageName: 'Input_layer_down',
255 256 onChangeValue: (String value) {
256 257 bloc.add(CheckFieldChangeEvent());
257 258 },
258 259 controller: bloc.checkNumController,
259 260 )),
260   - 5.horizontalSpace,
261   - GestureDetector(
262   - onTap: () {
263   - Navigator.of(context).pushNamed(AppRouteName.fogPwd);
264   - },
265   - child: Container(
266   - width: 100.w,
267   - height: 55.h,
268   - alignment: Alignment.centerLeft,
269   - child: Text(
270   - '忘记密码 ?',
271   - style: TextStyle(fontSize: 12.sp),
272   - ),
273   - ),
274   - )
275   - ],
  261 + 5.horizontalSpace,
  262 + GestureDetector(
  263 + onTap: () {
  264 + Navigator.of(context).pushNamed(AppRouteName.fogPwd);
  265 + },
  266 + child: Container(
  267 + width: 100.w,
  268 + height: 55.h,
  269 + alignment: Alignment.centerLeft,
  270 + child: Text(
  271 + '忘记密码 ?',
  272 + style: TextStyle(fontSize: 12.sp),
  273 + ),
  274 + ),
276 275 )
277 276 ],
278   - ),
279   - );
280   - });
  277 + )
  278 + ],
  279 + ),
  280 + );
  281 + });
281 282 }
... ...
lib/pages/login/setpwd/bloc/set_pwd_bloc.dart
  1 +import 'package:common_utils/common_utils.dart';
1 2 import 'package:flutter/cupertino.dart';
2 3 import 'package:flutter_bloc/flutter_bloc.dart';
3 4 import 'package:wow_english/common/request/dao/user_dao.dart';
... ... @@ -128,11 +129,12 @@ class SetPwdBloc extends Bloc&lt;SetPwdEvent, SetPwdState&gt; {
128 129  
129 130 /// 设置密码,调接口
130 131 void _setPassword(SetPasswordEvent event, Emitter<SetPwdState> emitter) async {
  132 + var password = EncryptUtil.encodeMd5(passwordText);
131 133 try {
132 134 await loading(() async {
133 135 switch (pageType) {
134 136 case SetPwdPageType.initPwd:
135   - await UserDao.initPassword(passwordText);
  137 + await UserDao.initPassword(password);
136 138 break;
137 139 case SetPwdPageType.changePwd:
138 140 // 现在走同一个流程和接口
... ... @@ -145,7 +147,7 @@ class SetPwdBloc extends Bloc&lt;SetPwdEvent, SetPwdState&gt; {
145 147 if (smsCode == null || smsCode!.isEmpty) {
146 148 throw ApiException(ApiException.customErrorCode, '验证码为空');
147 149 }
148   - await UserDao.resetPassword(phoneNumber!, passwordText, smsCode!);
  150 + await UserDao.resetPassword(phoneNumber!, password, smsCode!);
149 151 break;
150 152 }
151 153 });
... ...
lib/pages/shop/exchane/bloc/exchange_lesson_bloc.dart
1 1 import 'package:flutter/cupertino.dart';
2 2 import 'package:flutter_bloc/flutter_bloc.dart';
  3 +import 'package:wow_english/common/request/exception.dart';
  4 +import 'package:wow_english/utils/loading.dart';
  5 +import 'package:wow_english/utils/toast_util.dart';
  6 +
  7 +import '../../../../common/request/dao/request_dao.dart';
3 8  
4 9 part 'exchange_lesson_event.dart';
5 10 part 'exchange_lesson_state.dart';
... ... @@ -32,6 +37,13 @@ class ExchangeLessonBloc extends Bloc&lt;ExchangeLessonEvent, ExchangeLessonState&gt;
32 37 }
33 38  
34 39 _requestCheckCode(CheckCodeEvent event, Emitter<ExchangeLessonState> emitter) async {
35   - emitter(CheckCodeResultState(false));
  40 + try {
  41 + await loading(() async {
  42 + await RequestDao.exchange(codeNumberController.text);
  43 + emitter(CheckCodeResultState(true));
  44 + });
  45 + } catch (e) {
  46 + emitter(CheckCodeResultState(false));
  47 + }
36 48 }
37 49 }
... ...
lib/pages/shop/exchane/exchange_lesson_page.dart
... ... @@ -5,7 +5,6 @@ import &#39;package:wow_english/common/extension/string_extension.dart&#39;;
5 5 import 'package:wow_english/common/widgets/textfield_customer_widget.dart';
6 6 import 'package:wow_english/pages/shop/exchane/widegts/exchange_result_dialog.dart';
7 7 import 'package:wow_english/route/route.dart';
8   -import 'package:wow_english/utils/toast_util.dart';
9 8  
10 9 import 'bloc/exchange_lesson_bloc.dart';
11 10  
... ... @@ -34,7 +33,7 @@ class _ExchangeLessonPage extends StatelessWidget {
34 33 return ExChangeResultDialog(
35 34 resultType:state.result,
36 35 onTap:(){
37   -
  36 + popPage();
38 37 }
39 38 );
40 39 });
... ...
lib/pages/shop/exchangelist/bloc/exchange_list_bloc.dart
1   -import 'dart:async';
2   -
3   -import 'package:bloc/bloc.dart';
4   -import 'package:meta/meta.dart';
  1 +import 'package:flutter/cupertino.dart';
  2 +import 'package:flutter_bloc/flutter_bloc.dart';
5 3  
6 4 part 'exchange_list_event.dart';
7 5 part 'exchange_list_state.dart';
... ...