Commit ceacd07e1c8cf0222bf9049f5cb6c47a65242843

Authored by liangchengyou
1 parent a434ef7b

feat:评测失败问题修复

ios/Runner.xcodeproj/project.pbxproj
@@ -495,7 +495,7 @@ @@ -495,7 +495,7 @@
495 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 495 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
496 CLANG_ENABLE_MODULES = YES; 496 CLANG_ENABLE_MODULES = YES;
497 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 497 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
498 - CURRENT_PROJECT_VERSION = 3; 498 + CURRENT_PROJECT_VERSION = 4;
499 DEVELOPMENT_TEAM = T8P9KW8GWH; 499 DEVELOPMENT_TEAM = T8P9KW8GWH;
500 ENABLE_BITCODE = NO; 500 ENABLE_BITCODE = NO;
501 INFOPLIST_FILE = Runner/Info.plist; 501 INFOPLIST_FILE = Runner/Info.plist;
@@ -680,7 +680,7 @@ @@ -680,7 +680,7 @@
680 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 680 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
681 CLANG_ENABLE_MODULES = YES; 681 CLANG_ENABLE_MODULES = YES;
682 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 682 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
683 - CURRENT_PROJECT_VERSION = 3; 683 + CURRENT_PROJECT_VERSION = 4;
684 DEVELOPMENT_TEAM = T8P9KW8GWH; 684 DEVELOPMENT_TEAM = T8P9KW8GWH;
685 ENABLE_BITCODE = NO; 685 ENABLE_BITCODE = NO;
686 INFOPLIST_FILE = Runner/Info.plist; 686 INFOPLIST_FILE = Runner/Info.plist;
@@ -709,7 +709,7 @@ @@ -709,7 +709,7 @@
709 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 709 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
710 CLANG_ENABLE_MODULES = YES; 710 CLANG_ENABLE_MODULES = YES;
711 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 711 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
712 - CURRENT_PROJECT_VERSION = 3; 712 + CURRENT_PROJECT_VERSION = 4;
713 DEVELOPMENT_TEAM = T8P9KW8GWH; 713 DEVELOPMENT_TEAM = T8P9KW8GWH;
714 ENABLE_BITCODE = NO; 714 ENABLE_BITCODE = NO;
715 INFOPLIST_FILE = Runner/Info.plist; 715 INFOPLIST_FILE = Runner/Info.plist;
lib/pages/home/widgets/home_vidoe_item.dart
@@ -53,12 +53,12 @@ class HomeVideoItem extends StatelessWidget { @@ -53,12 +53,12 @@ class HomeVideoItem extends StatelessWidget {
53 color: CourseModuleModel(entity?.courseModuleCode??'Phase-1').color, 53 color: CourseModuleModel(entity?.courseModuleCode??'Phase-1').color,
54 borderRadius: BorderRadius.circular(6) 54 borderRadius: BorderRadius.circular(6)
55 ), 55 ),
56 - padding: EdgeInsets.symmetric(horizontal: 10.w), 56 + padding: EdgeInsets.symmetric(horizontal: 10.w,vertical: 10.h),
57 child: Text( 57 child: Text(
58 lessons?.name??'', 58 lessons?.name??'',
59 maxLines: 1, 59 maxLines: 1,
60 style: TextStyle( 60 style: TextStyle(
61 - fontSize: 25.sp, 61 + fontSize: 12.sp,
62 color: const Color(0xFF333333) 62 color: const Color(0xFF333333)
63 ), 63 ),
64 ), 64 ),
lib/pages/practice/bloc/topic_picture_bloc.dart
1 import 'package:audioplayers/audioplayers.dart'; 1 import 'package:audioplayers/audioplayers.dart';
2 import 'package:flutter/cupertino.dart'; 2 import 'package:flutter/cupertino.dart';
3 -import 'package:flutter/foundation.dart';  
4 import 'package:flutter/services.dart'; 3 import 'package:flutter/services.dart';
5 import 'package:flutter_bloc/flutter_bloc.dart'; 4 import 'package:flutter_bloc/flutter_bloc.dart';
6 import 'package:flutter_easyloading/flutter_easyloading.dart'; 5 import 'package:flutter_easyloading/flutter_easyloading.dart';
@@ -65,6 +64,7 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { @@ -65,6 +64,7 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> {
65 on<RequestDataEvent>(_requestData); 64 on<RequestDataEvent>(_requestData);
66 on<XSVoiceTestEvent>(_voiceXsTest); 65 on<XSVoiceTestEvent>(_voiceXsTest);
67 on<XSVoiceStopEvent>(_voiceXsStop); 66 on<XSVoiceStopEvent>(_voiceXsStop);
  67 + on<XSVoiceFailEvent>(_voiceFail);
68 on<VoicePlayEvent>(_voicePlay); 68 on<VoicePlayEvent>(_voicePlay);
69 on<InitBlocEvent>((event, emit) { 69 on<InitBlocEvent>((event, emit) {
70 //音频播放器 70 //音频播放器
@@ -98,21 +98,17 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; { @@ -98,21 +98,17 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; {
98 } 98 }
99 99
100 if (call.method == 'voiceStart') {//评测开始 100 if (call.method == 'voiceStart') {//评测开始
101 - if (kDebugMode) {  
102 - print('评测开始');  
103 - }  
104 return; 101 return;
105 } 102 }
106 103
107 if (call.method == 'voiceEnd') {//评测结束 104 if (call.method == 'voiceEnd') {//评测结束
108 - if (kDebugMode) {  
109 - print('评测结束');  
110 - } 105 + add(XSVoiceFailEvent());
111 return; 106 return;
112 } 107 }
113 108
114 if (call.method == 'voiceFail') {//评测失败 109 if (call.method == 'voiceFail') {//评测失败
115 EasyLoading.showToast('评测失败'); 110 EasyLoading.showToast('评测失败');
  111 + add(XSVoiceFailEvent());
116 return; 112 return;
117 } 113 }
118 }); 114 });
@@ -201,7 +197,7 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; { @@ -201,7 +197,7 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; {
201 methodChannel.invokeMethod('cancelVoice'); 197 methodChannel.invokeMethod('cancelVoice');
202 } 198 }
203 199
204 - ///先声评测结果 200 + ///先声评测结果(评测成功)
205 void _voiceXsResult(XSVoiceResultEvent event,Emitter<TopicPictureState> emitter) async { 201 void _voiceXsResult(XSVoiceResultEvent event,Emitter<TopicPictureState> emitter) async {
206 final Map args = event.message as Map; 202 final Map args = event.message as Map;
207 final result = args['result'] as Map; 203 final result = args['result'] as Map;
@@ -211,6 +207,12 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; { @@ -211,6 +207,12 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; {
211 emitter(XSVoiceTestState()); 207 emitter(XSVoiceTestState());
212 } 208 }
213 209
  210 + ///评测结束
  211 + void _voiceFail(XSVoiceFailEvent event,Emitter<TopicPictureState> emitter) async {
  212 + _isVoicing = false;
  213 + emitter(XSVoiceTestState());
  214 + }
  215 +
214 void _voicePlayStateChange(VoicePlayStateChangeEvent event,Emitter<TopicPictureState> emitter) async { 216 void _voicePlayStateChange(VoicePlayStateChangeEvent event,Emitter<TopicPictureState> emitter) async {
215 emitter(VoicePlayStateChange()); 217 emitter(VoicePlayStateChange());
216 } 218 }
lib/pages/practice/bloc/topic_picture_event.dart
@@ -30,6 +30,9 @@ class XSVoiceResultEvent extends TopicPictureEvent { @@ -30,6 +30,9 @@ class XSVoiceResultEvent extends TopicPictureEvent {
30 XSVoiceResultEvent(this.message); 30 XSVoiceResultEvent(this.message);
31 } 31 }
32 32
  33 +///评测失败
  34 +class XSVoiceFailEvent extends TopicPictureEvent {}
  35 +
33 ///音频播放状态变化 36 ///音频播放状态变化
34 class VoicePlayStateChangeEvent extends TopicPictureEvent {} 37 class VoicePlayStateChangeEvent extends TopicPictureEvent {}
35 38
lib/pages/practice/topic_picture_page.dart
@@ -31,7 +31,6 @@ class TopicPicturePage extends StatelessWidget { @@ -31,7 +31,6 @@ class TopicPicturePage extends StatelessWidget {
31 'appKey':AppConsts.xsAppKey, 31 'appKey':AppConsts.xsAppKey,
32 'service':AppConsts.xsAppService, 32 'service':AppConsts.xsAppService,
33 'secretKey':AppConsts.xsAppSecretKey, 33 'secretKey':AppConsts.xsAppSecretKey,
34 - 'userId':UserUtil.getUser()!.id.toString(),  
35 } 34 }
36 )), 35 )),
37 child: _TopicPicturePage(), 36 child: _TopicPicturePage(),
@@ -486,7 +485,7 @@ class _TopicPicturePage extends StatelessWidget { @@ -486,7 +485,7 @@ class _TopicPicturePage extends StatelessWidget {
486 if (bloc.isVoicing) { 485 if (bloc.isVoicing) {
487 return; 486 return;
488 } 487 }
489 - if (topics?.type == 5 || topics?.type == 7) { 488 + if (topics?.type == 5) {
490 bloc.add(XSVoiceTestEvent(topics?.keyWord??'', '0',UserUtil.getUser()!.id.toString())); 489 bloc.add(XSVoiceTestEvent(topics?.keyWord??'', '0',UserUtil.getUser()!.id.toString()));
491 } else { 490 } else {
492 bloc.add(XSVoiceTestEvent(topics?.word??'', '0',UserUtil.getUser()!.id.toString())); 491 bloc.add(XSVoiceTestEvent(topics?.word??'', '0',UserUtil.getUser()!.id.toString()));
lib/pages/user/user_page.dart
@@ -50,13 +50,14 @@ class _UserView extends StatelessWidget { @@ -50,13 +50,14 @@ class _UserView extends StatelessWidget {
50 50
51 return Scaffold( 51 return Scaffold(
52 appBar: const WEAppBar(), 52 appBar: const WEAppBar(),
53 - body: SingleChildScrollView(  
54 - padding: EdgeInsets.only(left: 17.w, right: 17.w, top: 10.h, bottom: 22.h),  
55 - child: Column(  
56 - mainAxisAlignment: MainAxisAlignment.center,  
57 - children: <Widget>[  
58 - // todo banner,暂时没有接口获取banner URL  
59 - /*Offstage( 53 + body: SafeArea(
  54 + child: SingleChildScrollView(
  55 + padding: EdgeInsets.only(left: 17.w, right: 17.w, top: 10.h, bottom: 22.h),
  56 + child: Column(
  57 + mainAxisAlignment: MainAxisAlignment.center,
  58 + children: <Widget>[
  59 + // todo banner,暂时没有接口获取banner URL
  60 + /*Offstage(
60 child: Column( 61 child: Column(
61 children: [ 62 children: [
62 Container(child: Image.asset(bannerUrl), constraints: BoxConstraints(maxHeight: 196.h)), 63 Container(child: Image.asset(bannerUrl), constraints: BoxConstraints(maxHeight: 196.h)),
@@ -64,156 +65,157 @@ class _UserView extends StatelessWidget { @@ -64,156 +65,157 @@ class _UserView extends StatelessWidget {
64 ], 65 ],
65 ), 66 ),
66 ),*/ 67 ),*/
67 - Row(  
68 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
69 - children: [  
70 - CircleAvatar(  
71 - radius: 40.r,  
72 - backgroundColor: const Color(0xFF140C10),  
73 - child: CircleAvatar(  
74 - radius: 38.5.r,  
75 - backgroundImage: ImageUtil.getImageProviderOnDefault(user.avatarUrl),  
76 - ),  
77 - /*child: ClipOval( 68 + Row(
  69 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  70 + children: [
  71 + CircleAvatar(
  72 + radius: 40.r,
  73 + backgroundColor: const Color(0xFF140C10),
  74 + child: CircleAvatar(
  75 + radius: 38.5.r,
  76 + backgroundImage: ImageUtil.getImageProviderOnDefault(user.avatarUrl),
  77 + ),
  78 + /*child: ClipOval(
78 child: OwImageWidget(name: user.avatarUrl ?? AssetsConst.wowLogo, fit: BoxFit.contain,), 79 child: OwImageWidget(name: user.avatarUrl ?? AssetsConst.wowLogo, fit: BoxFit.contain,),
79 )*/ 80 )*/
80 - ),  
81 - 32.horizontalSpace,  
82 - Expanded(  
83 - child: Column(  
84 - children: [  
85 - Row(  
86 - children: [  
87 - LimitedBox(  
88 - maxWidth: 220.w,  
89 - child: Text(  
90 - user.name,  
91 - //'1231231231312312312312312312312312312312312312312',  
92 - style: textStyle21sp,  
93 - overflow: TextOverflow.ellipsis,  
94 - ),  
95 - ),  
96 - 14.horizontalSpace,  
97 - Text(  
98 - user.getGenderString(),  
99 - style: textStyle21sp,  
100 - ),  
101 - 14.horizontalSpace,  
102 - Offstage(  
103 - offstage: user.effectiveDate == null,  
104 - child: Image.asset(  
105 - AssetsConst.icVip,  
106 - height: 18.h,  
107 - ),  
108 - )  
109 - ],  
110 - ),  
111 - Offstage(  
112 - offstage: user.effectiveDate == null,  
113 - child: Row( 81 + ),
  82 + 32.horizontalSpace,
  83 + Expanded(
  84 + child: Column(
  85 + children: [
  86 + Row(
114 children: [ 87 children: [
  88 + LimitedBox(
  89 + maxWidth: 220.w,
  90 + child: Text(
  91 + user.name,
  92 + //'1231231231312312312312312312312312312312312312312',
  93 + style: textStyle21sp,
  94 + overflow: TextOverflow.ellipsis,
  95 + ),
  96 + ),
  97 + 14.horizontalSpace,
115 Text( 98 Text(
116 - "${user.effectiveDate} 到期",  
117 - style: TextStyle(  
118 - color: const Color(0xFFE11212),  
119 - fontSize: 17.sp, 99 + user.getGenderString(),
  100 + style: textStyle21sp,
  101 + ),
  102 + 14.horizontalSpace,
  103 + Offstage(
  104 + offstage: user.effectiveDate == null,
  105 + child: Image.asset(
  106 + AssetsConst.icVip,
  107 + height: 18.h,
120 ), 108 ),
121 ) 109 )
122 ], 110 ],
123 ), 111 ),
124 - )  
125 - ], 112 + Offstage(
  113 + offstage: user.effectiveDate == null,
  114 + child: Row(
  115 + children: [
  116 + Text(
  117 + "${user.effectiveDate} 到期",
  118 + style: TextStyle(
  119 + color: const Color(0xFFE11212),
  120 + fontSize: 17.sp,
  121 + ),
  122 + )
  123 + ],
  124 + ),
  125 + )
  126 + ],
  127 + )),
  128 + TextButton(
  129 + child: Text(
  130 + "修改个人信息>",
  131 + style: textStyle21sp,
  132 + ),
  133 + onPressed: () {
  134 + pushNamed(AppRouteName.userInformation);
  135 + },
  136 + )
  137 + ],
  138 + ),
  139 + 30.verticalSpace,
  140 + OutlinedButton(
  141 + onPressed: () => pushNamed(AppRouteName.fogPwd),
  142 + style: normalButtonStyle,
  143 + child: Text(
  144 + "修改密码",
  145 + style: textStyle21sp,
  146 + ),
  147 + ),
  148 + 12.verticalSpace,
  149 + // todo 为了过审,把测试账号兑换功能下掉
  150 + Offstage(
  151 + offstage: UserUtil.getUser()?.phoneNum == '17730280759',
  152 + child: OutlinedButton(
  153 + onPressed: () => pushNamed(AppRouteName.exLesson),
  154 + style: normalButtonStyle,
  155 + child: Text(
  156 + "兑换课程",
  157 + style: textStyle21sp,
126 )), 158 )),
127 - TextButton(  
128 - child: Text(  
129 - "修改个人信息>",  
130 - style: textStyle21sp,  
131 - ), 159 + ),
  160 + Offstage(
  161 + offstage: UserUtil.getUser()?.phoneNum == '17730280759',
  162 + child: 12.verticalSpace,
  163 + ),
  164 + OutlinedButton(
132 onPressed: () { 165 onPressed: () {
133 - pushNamed(AppRouteName.userInformation); 166 + pushNamed(AppRouteName.webView,arguments: {'urlStr': AppConsts.userPrivacyPolicyUrl, 'webViewTitle': '隐私协议'});
134 }, 167 },
135 - )  
136 - ],  
137 - ),  
138 - 30.verticalSpace,  
139 - OutlinedButton(  
140 - onPressed: () => pushNamed(AppRouteName.fogPwd),  
141 - style: normalButtonStyle,  
142 - child: Text(  
143 - "修改密码",  
144 - style: textStyle21sp,  
145 - ),  
146 - ),  
147 - 12.verticalSpace,  
148 - // todo 为了过审,把测试账号兑换功能下掉  
149 - Offstage(  
150 - offstage: UserUtil.getUser()?.phoneNum == '17730280759',  
151 - child: OutlinedButton(  
152 - onPressed: () => pushNamed(AppRouteName.exLesson),  
153 style: normalButtonStyle, 168 style: normalButtonStyle,
154 child: Text( 169 child: Text(
155 - "兑换课程", 170 + "隐私协议",
156 style: textStyle21sp, 171 style: textStyle21sp,
157 )), 172 )),
158 - ),  
159 - Offstage(  
160 - offstage: UserUtil.getUser()?.phoneNum == '17730280759',  
161 - child: 12.verticalSpace,  
162 - ),  
163 - OutlinedButton(  
164 - onPressed: () {  
165 - pushNamed(AppRouteName.webView,arguments: {'urlStr': AppConsts.userPrivacyPolicyUrl, 'webViewTitle': '隐私协议'});  
166 - },  
167 - style: normalButtonStyle,  
168 - child: Text(  
169 - "隐私协议",  
170 - style: textStyle21sp,  
171 - )),  
172 - 30.verticalSpace,  
173 - OutlinedButton(  
174 - onPressed: () {  
175 - showTwoActionDialog(barrierDismissible:false,'提示', '取消', '确认', '您确认要退出Wow English吗?', () {  
176 - popPage();  
177 - }, () {  
178 - popPage();  
179 - userBloc.add(UserLogout());  
180 - });  
181 - },  
182 - style: ButtonStyle(  
183 - side: MaterialStateProperty.all(const BorderSide(color: Color(0xFF140C10), width: 1.5)),  
184 - shape: MaterialStateProperty.all(  
185 - RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))),  
186 - minimumSize: MaterialStateProperty.all(Size(295.w, 40.h)),  
187 - backgroundColor: MaterialStateProperty.all(const Color(0xFFFBB621)),  
188 - ),  
189 - child: Text(  
190 - "退出登录",  
191 - style: TextStyle(  
192 - //fontWeight: FontWeight.w600,  
193 - color: Colors.white,  
194 - fontSize: 17.sp,  
195 - ),  
196 - )),  
197 - 30.verticalSpace,  
198 - TextButton(  
199 - onPressed: () {  
200 - //userBloc.add(UserDelete())  
201 - showTwoActionDialog('注销账号', '取消', '注销', '请谨慎操作!\n注销后不可恢复哦!', () {  
202 - popPage();  
203 - }, () {  
204 - userBloc.add(UserDelete());  
205 - popPage();  
206 - });  
207 - },  
208 - child: Text(  
209 - "注销账号",  
210 - style: TextStyle(  
211 - //fontWeight: FontWeight.w600,  
212 - color: Colors.red,  
213 - fontSize: 15.sp, 173 + 30.verticalSpace,
  174 + OutlinedButton(
  175 + onPressed: () {
  176 + showTwoActionDialog(barrierDismissible:false,'提示', '取消', '确认', '您确认要退出Wow English吗?', () {
  177 + popPage();
  178 + }, () {
  179 + popPage();
  180 + userBloc.add(UserLogout());
  181 + });
  182 + },
  183 + style: ButtonStyle(
  184 + side: MaterialStateProperty.all(const BorderSide(color: Color(0xFF140C10), width: 1.5)),
  185 + shape: MaterialStateProperty.all(
  186 + RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))),
  187 + minimumSize: MaterialStateProperty.all(Size(295.w, 40.h)),
  188 + backgroundColor: MaterialStateProperty.all(const Color(0xFFFBB621)),
214 ), 189 ),
215 - )),  
216 - ], 190 + child: Text(
  191 + "退出登录",
  192 + style: TextStyle(
  193 + //fontWeight: FontWeight.w600,
  194 + color: Colors.white,
  195 + fontSize: 17.sp,
  196 + ),
  197 + )),
  198 + 30.verticalSpace,
  199 + TextButton(
  200 + onPressed: () {
  201 + //userBloc.add(UserDelete())
  202 + showTwoActionDialog('注销账号', '取消', '注销', '请谨慎操作!\n注销后不可恢复哦!', () {
  203 + popPage();
  204 + }, () {
  205 + userBloc.add(UserDelete());
  206 + popPage();
  207 + });
  208 + },
  209 + child: Text(
  210 + "注销账号",
  211 + style: TextStyle(
  212 + //fontWeight: FontWeight.w600,
  213 + color: Colors.red,
  214 + fontSize: 15.sp,
  215 + ),
  216 + )),
  217 + ],
  218 + ),
217 ), 219 ),
218 )); 220 ));
219 }, 221 },