Commit ceacd07e1c8cf0222bf9049f5cb6c47a65242843

Authored by liangchengyou
1 parent a434ef7b

feat:评测失败问题修复

ios/Runner.xcodeproj/project.pbxproj
... ... @@ -495,7 +495,7 @@
495 495 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
496 496 CLANG_ENABLE_MODULES = YES;
497 497 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
498   - CURRENT_PROJECT_VERSION = 3;
  498 + CURRENT_PROJECT_VERSION = 4;
499 499 DEVELOPMENT_TEAM = T8P9KW8GWH;
500 500 ENABLE_BITCODE = NO;
501 501 INFOPLIST_FILE = Runner/Info.plist;
... ... @@ -680,7 +680,7 @@
680 680 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
681 681 CLANG_ENABLE_MODULES = YES;
682 682 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
683   - CURRENT_PROJECT_VERSION = 3;
  683 + CURRENT_PROJECT_VERSION = 4;
684 684 DEVELOPMENT_TEAM = T8P9KW8GWH;
685 685 ENABLE_BITCODE = NO;
686 686 INFOPLIST_FILE = Runner/Info.plist;
... ... @@ -709,7 +709,7 @@
709 709 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
710 710 CLANG_ENABLE_MODULES = YES;
711 711 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
712   - CURRENT_PROJECT_VERSION = 3;
  712 + CURRENT_PROJECT_VERSION = 4;
713 713 DEVELOPMENT_TEAM = T8P9KW8GWH;
714 714 ENABLE_BITCODE = NO;
715 715 INFOPLIST_FILE = Runner/Info.plist;
... ...
lib/pages/home/widgets/home_vidoe_item.dart
... ... @@ -53,12 +53,12 @@ class HomeVideoItem extends StatelessWidget {
53 53 color: CourseModuleModel(entity?.courseModuleCode??'Phase-1').color,
54 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 57 child: Text(
58 58 lessons?.name??'',
59 59 maxLines: 1,
60 60 style: TextStyle(
61   - fontSize: 25.sp,
  61 + fontSize: 12.sp,
62 62 color: const Color(0xFF333333)
63 63 ),
64 64 ),
... ...
lib/pages/practice/bloc/topic_picture_bloc.dart
1 1 import 'package:audioplayers/audioplayers.dart';
2 2 import 'package:flutter/cupertino.dart';
3   -import 'package:flutter/foundation.dart';
4 3 import 'package:flutter/services.dart';
5 4 import 'package:flutter_bloc/flutter_bloc.dart';
6 5 import 'package:flutter_easyloading/flutter_easyloading.dart';
... ... @@ -65,6 +64,7 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> {
65 64 on<RequestDataEvent>(_requestData);
66 65 on<XSVoiceTestEvent>(_voiceXsTest);
67 66 on<XSVoiceStopEvent>(_voiceXsStop);
  67 + on<XSVoiceFailEvent>(_voiceFail);
68 68 on<VoicePlayEvent>(_voicePlay);
69 69 on<InitBlocEvent>((event, emit) {
70 70 //音频播放器
... ... @@ -98,21 +98,17 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; {
98 98 }
99 99  
100 100 if (call.method == 'voiceStart') {//评测开始
101   - if (kDebugMode) {
102   - print('评测开始');
103   - }
104 101 return;
105 102 }
106 103  
107 104 if (call.method == 'voiceEnd') {//评测结束
108   - if (kDebugMode) {
109   - print('评测结束');
110   - }
  105 + add(XSVoiceFailEvent());
111 106 return;
112 107 }
113 108  
114 109 if (call.method == 'voiceFail') {//评测失败
115 110 EasyLoading.showToast('评测失败');
  111 + add(XSVoiceFailEvent());
116 112 return;
117 113 }
118 114 });
... ... @@ -201,7 +197,7 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; {
201 197 methodChannel.invokeMethod('cancelVoice');
202 198 }
203 199  
204   - ///先声评测结果
  200 + ///先声评测结果(评测成功)
205 201 void _voiceXsResult(XSVoiceResultEvent event,Emitter<TopicPictureState> emitter) async {
206 202 final Map args = event.message as Map;
207 203 final result = args['result'] as Map;
... ... @@ -211,6 +207,12 @@ class TopicPictureBloc extends Bloc&lt;TopicPictureEvent, TopicPictureState&gt; {
211 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 216 void _voicePlayStateChange(VoicePlayStateChangeEvent event,Emitter<TopicPictureState> emitter) async {
215 217 emitter(VoicePlayStateChange());
216 218 }
... ...
lib/pages/practice/bloc/topic_picture_event.dart
... ... @@ -30,6 +30,9 @@ class XSVoiceResultEvent extends TopicPictureEvent {
30 30 XSVoiceResultEvent(this.message);
31 31 }
32 32  
  33 +///评测失败
  34 +class XSVoiceFailEvent extends TopicPictureEvent {}
  35 +
33 36 ///音频播放状态变化
34 37 class VoicePlayStateChangeEvent extends TopicPictureEvent {}
35 38  
... ...
lib/pages/practice/topic_picture_page.dart
... ... @@ -31,7 +31,6 @@ class TopicPicturePage extends StatelessWidget {
31 31 'appKey':AppConsts.xsAppKey,
32 32 'service':AppConsts.xsAppService,
33 33 'secretKey':AppConsts.xsAppSecretKey,
34   - 'userId':UserUtil.getUser()!.id.toString(),
35 34 }
36 35 )),
37 36 child: _TopicPicturePage(),
... ... @@ -486,7 +485,7 @@ class _TopicPicturePage extends StatelessWidget {
486 485 if (bloc.isVoicing) {
487 486 return;
488 487 }
489   - if (topics?.type == 5 || topics?.type == 7) {
  488 + if (topics?.type == 5) {
490 489 bloc.add(XSVoiceTestEvent(topics?.keyWord??'', '0',UserUtil.getUser()!.id.toString()));
491 490 } else {
492 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 50  
51 51 return Scaffold(
52 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 61 child: Column(
61 62 children: [
62 63 Container(child: Image.asset(bannerUrl), constraints: BoxConstraints(maxHeight: 196.h)),
... ... @@ -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 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 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 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 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 168 style: normalButtonStyle,
154 169 child: Text(
155   - "兑换课程",
  170 + "隐私协议",
156 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 },
... ...