From ceacd07e1c8cf0222bf9049f5cb6c47a65242843 Mon Sep 17 00:00:00 2001 From: lcy <2503978335@qq.com> Date: Fri, 21 Jul 2023 11:52:22 +0800 Subject: [PATCH] feat:评测失败问题修复 --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- lib/pages/home/widgets/home_vidoe_item.dart | 4 ++-- lib/pages/practice/bloc/topic_picture_bloc.dart | 18 ++++++++++-------- lib/pages/practice/bloc/topic_picture_event.dart | 3 +++ lib/pages/practice/topic_picture_page.dart | 3 +-- lib/pages/user/user_page.dart | 284 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------- 6 files changed, 162 insertions(+), 156 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9f1e7e6..ece2d18 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -495,7 +495,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = T8P9KW8GWH; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -680,7 +680,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = T8P9KW8GWH; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -709,7 +709,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = T8P9KW8GWH; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/lib/pages/home/widgets/home_vidoe_item.dart b/lib/pages/home/widgets/home_vidoe_item.dart index 5917e54..095b50e 100644 --- a/lib/pages/home/widgets/home_vidoe_item.dart +++ b/lib/pages/home/widgets/home_vidoe_item.dart @@ -53,12 +53,12 @@ class HomeVideoItem extends StatelessWidget { color: CourseModuleModel(entity?.courseModuleCode??'Phase-1').color, borderRadius: BorderRadius.circular(6) ), - padding: EdgeInsets.symmetric(horizontal: 10.w), + padding: EdgeInsets.symmetric(horizontal: 10.w,vertical: 10.h), child: Text( lessons?.name??'', maxLines: 1, style: TextStyle( - fontSize: 25.sp, + fontSize: 12.sp, color: const Color(0xFF333333) ), ), diff --git a/lib/pages/practice/bloc/topic_picture_bloc.dart b/lib/pages/practice/bloc/topic_picture_bloc.dart index c37e3cd..5be6fd0 100644 --- a/lib/pages/practice/bloc/topic_picture_bloc.dart +++ b/lib/pages/practice/bloc/topic_picture_bloc.dart @@ -1,6 +1,5 @@ import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; @@ -65,6 +64,7 @@ class TopicPictureBloc extends Bloc { on(_requestData); on(_voiceXsTest); on(_voiceXsStop); + on(_voiceFail); on(_voicePlay); on((event, emit) { //音频播放器 @@ -98,21 +98,17 @@ class TopicPictureBloc extends Bloc { } if (call.method == 'voiceStart') {//评测开始 - if (kDebugMode) { - print('评测开始'); - } return; } if (call.method == 'voiceEnd') {//评测结束 - if (kDebugMode) { - print('评测结束'); - } + add(XSVoiceFailEvent()); return; } if (call.method == 'voiceFail') {//评测失败 EasyLoading.showToast('评测失败'); + add(XSVoiceFailEvent()); return; } }); @@ -201,7 +197,7 @@ class TopicPictureBloc extends Bloc { methodChannel.invokeMethod('cancelVoice'); } - ///先声评测结果 + ///先声评测结果(评测成功) void _voiceXsResult(XSVoiceResultEvent event,Emitter emitter) async { final Map args = event.message as Map; final result = args['result'] as Map; @@ -211,6 +207,12 @@ class TopicPictureBloc extends Bloc { emitter(XSVoiceTestState()); } + ///评测结束 + void _voiceFail(XSVoiceFailEvent event,Emitter emitter) async { + _isVoicing = false; + emitter(XSVoiceTestState()); + } + void _voicePlayStateChange(VoicePlayStateChangeEvent event,Emitter emitter) async { emitter(VoicePlayStateChange()); } diff --git a/lib/pages/practice/bloc/topic_picture_event.dart b/lib/pages/practice/bloc/topic_picture_event.dart index f69ef33..fcca565 100644 --- a/lib/pages/practice/bloc/topic_picture_event.dart +++ b/lib/pages/practice/bloc/topic_picture_event.dart @@ -30,6 +30,9 @@ class XSVoiceResultEvent extends TopicPictureEvent { XSVoiceResultEvent(this.message); } +///评测失败 +class XSVoiceFailEvent extends TopicPictureEvent {} + ///音频播放状态变化 class VoicePlayStateChangeEvent extends TopicPictureEvent {} diff --git a/lib/pages/practice/topic_picture_page.dart b/lib/pages/practice/topic_picture_page.dart index 3e41235..09b2aaf 100644 --- a/lib/pages/practice/topic_picture_page.dart +++ b/lib/pages/practice/topic_picture_page.dart @@ -31,7 +31,6 @@ class TopicPicturePage extends StatelessWidget { 'appKey':AppConsts.xsAppKey, 'service':AppConsts.xsAppService, 'secretKey':AppConsts.xsAppSecretKey, - 'userId':UserUtil.getUser()!.id.toString(), } )), child: _TopicPicturePage(), @@ -486,7 +485,7 @@ class _TopicPicturePage extends StatelessWidget { if (bloc.isVoicing) { return; } - if (topics?.type == 5 || topics?.type == 7) { + if (topics?.type == 5) { bloc.add(XSVoiceTestEvent(topics?.keyWord??'', '0',UserUtil.getUser()!.id.toString())); } else { bloc.add(XSVoiceTestEvent(topics?.word??'', '0',UserUtil.getUser()!.id.toString())); diff --git a/lib/pages/user/user_page.dart b/lib/pages/user/user_page.dart index 55dfee2..113613b 100644 --- a/lib/pages/user/user_page.dart +++ b/lib/pages/user/user_page.dart @@ -50,13 +50,14 @@ class _UserView extends StatelessWidget { return Scaffold( appBar: const WEAppBar(), - body: SingleChildScrollView( - padding: EdgeInsets.only(left: 17.w, right: 17.w, top: 10.h, bottom: 22.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // todo banner,暂时没有接口获取banner URL - /*Offstage( + body: SafeArea( + child: SingleChildScrollView( + padding: EdgeInsets.only(left: 17.w, right: 17.w, top: 10.h, bottom: 22.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // todo banner,暂时没有接口获取banner URL + /*Offstage( child: Column( children: [ Container(child: Image.asset(bannerUrl), constraints: BoxConstraints(maxHeight: 196.h)), @@ -64,156 +65,157 @@ class _UserView extends StatelessWidget { ], ), ),*/ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CircleAvatar( - radius: 40.r, - backgroundColor: const Color(0xFF140C10), - child: CircleAvatar( - radius: 38.5.r, - backgroundImage: ImageUtil.getImageProviderOnDefault(user.avatarUrl), - ), - /*child: ClipOval( + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CircleAvatar( + radius: 40.r, + backgroundColor: const Color(0xFF140C10), + child: CircleAvatar( + radius: 38.5.r, + backgroundImage: ImageUtil.getImageProviderOnDefault(user.avatarUrl), + ), + /*child: ClipOval( child: OwImageWidget(name: user.avatarUrl ?? AssetsConst.wowLogo, fit: BoxFit.contain,), )*/ - ), - 32.horizontalSpace, - Expanded( - child: Column( - children: [ - Row( - children: [ - LimitedBox( - maxWidth: 220.w, - child: Text( - user.name, - //'1231231231312312312312312312312312312312312312312', - style: textStyle21sp, - overflow: TextOverflow.ellipsis, - ), - ), - 14.horizontalSpace, - Text( - user.getGenderString(), - style: textStyle21sp, - ), - 14.horizontalSpace, - Offstage( - offstage: user.effectiveDate == null, - child: Image.asset( - AssetsConst.icVip, - height: 18.h, - ), - ) - ], - ), - Offstage( - offstage: user.effectiveDate == null, - child: Row( + ), + 32.horizontalSpace, + Expanded( + child: Column( + children: [ + Row( children: [ + LimitedBox( + maxWidth: 220.w, + child: Text( + user.name, + //'1231231231312312312312312312312312312312312312312', + style: textStyle21sp, + overflow: TextOverflow.ellipsis, + ), + ), + 14.horizontalSpace, Text( - "${user.effectiveDate} 到期", - style: TextStyle( - color: const Color(0xFFE11212), - fontSize: 17.sp, + user.getGenderString(), + style: textStyle21sp, + ), + 14.horizontalSpace, + Offstage( + offstage: user.effectiveDate == null, + child: Image.asset( + AssetsConst.icVip, + height: 18.h, ), ) ], ), - ) - ], + Offstage( + offstage: user.effectiveDate == null, + child: Row( + children: [ + Text( + "${user.effectiveDate} 到期", + style: TextStyle( + color: const Color(0xFFE11212), + fontSize: 17.sp, + ), + ) + ], + ), + ) + ], + )), + TextButton( + child: Text( + "修改个人信息>", + style: textStyle21sp, + ), + onPressed: () { + pushNamed(AppRouteName.userInformation); + }, + ) + ], + ), + 30.verticalSpace, + OutlinedButton( + onPressed: () => pushNamed(AppRouteName.fogPwd), + style: normalButtonStyle, + child: Text( + "修改密码", + style: textStyle21sp, + ), + ), + 12.verticalSpace, + // todo 为了过审,把测试账号兑换功能下掉 + Offstage( + offstage: UserUtil.getUser()?.phoneNum == '17730280759', + child: OutlinedButton( + onPressed: () => pushNamed(AppRouteName.exLesson), + style: normalButtonStyle, + child: Text( + "兑换课程", + style: textStyle21sp, )), - TextButton( - child: Text( - "修改个人信息>", - style: textStyle21sp, - ), + ), + Offstage( + offstage: UserUtil.getUser()?.phoneNum == '17730280759', + child: 12.verticalSpace, + ), + OutlinedButton( onPressed: () { - pushNamed(AppRouteName.userInformation); + pushNamed(AppRouteName.webView,arguments: {'urlStr': AppConsts.userPrivacyPolicyUrl, 'webViewTitle': '隐私协议'}); }, - ) - ], - ), - 30.verticalSpace, - OutlinedButton( - onPressed: () => pushNamed(AppRouteName.fogPwd), - style: normalButtonStyle, - child: Text( - "修改密码", - style: textStyle21sp, - ), - ), - 12.verticalSpace, - // todo 为了过审,把测试账号兑换功能下掉 - Offstage( - offstage: UserUtil.getUser()?.phoneNum == '17730280759', - child: OutlinedButton( - onPressed: () => pushNamed(AppRouteName.exLesson), style: normalButtonStyle, child: Text( - "兑换课程", + "隐私协议", style: textStyle21sp, )), - ), - Offstage( - offstage: UserUtil.getUser()?.phoneNum == '17730280759', - child: 12.verticalSpace, - ), - OutlinedButton( - onPressed: () { - pushNamed(AppRouteName.webView,arguments: {'urlStr': AppConsts.userPrivacyPolicyUrl, 'webViewTitle': '隐私协议'}); - }, - style: normalButtonStyle, - child: Text( - "隐私协议", - style: textStyle21sp, - )), - 30.verticalSpace, - OutlinedButton( - onPressed: () { - showTwoActionDialog(barrierDismissible:false,'提示', '取消', '确认', '您确认要退出Wow English吗?', () { - popPage(); - }, () { - popPage(); - userBloc.add(UserLogout()); - }); - }, - style: ButtonStyle( - side: MaterialStateProperty.all(const BorderSide(color: Color(0xFF140C10), width: 1.5)), - shape: MaterialStateProperty.all( - RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))), - minimumSize: MaterialStateProperty.all(Size(295.w, 40.h)), - backgroundColor: MaterialStateProperty.all(const Color(0xFFFBB621)), - ), - child: Text( - "退出登录", - style: TextStyle( - //fontWeight: FontWeight.w600, - color: Colors.white, - fontSize: 17.sp, - ), - )), - 30.verticalSpace, - TextButton( - onPressed: () { - //userBloc.add(UserDelete()) - showTwoActionDialog('注销账号', '取消', '注销', '请谨慎操作!\n注销后不可恢复哦!', () { - popPage(); - }, () { - userBloc.add(UserDelete()); - popPage(); - }); - }, - child: Text( - "注销账号", - style: TextStyle( - //fontWeight: FontWeight.w600, - color: Colors.red, - fontSize: 15.sp, + 30.verticalSpace, + OutlinedButton( + onPressed: () { + showTwoActionDialog(barrierDismissible:false,'提示', '取消', '确认', '您确认要退出Wow English吗?', () { + popPage(); + }, () { + popPage(); + userBloc.add(UserLogout()); + }); + }, + style: ButtonStyle( + side: MaterialStateProperty.all(const BorderSide(color: Color(0xFF140C10), width: 1.5)), + shape: MaterialStateProperty.all( + RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))), + minimumSize: MaterialStateProperty.all(Size(295.w, 40.h)), + backgroundColor: MaterialStateProperty.all(const Color(0xFFFBB621)), ), - )), - ], + child: Text( + "退出登录", + style: TextStyle( + //fontWeight: FontWeight.w600, + color: Colors.white, + fontSize: 17.sp, + ), + )), + 30.verticalSpace, + TextButton( + onPressed: () { + //userBloc.add(UserDelete()) + showTwoActionDialog('注销账号', '取消', '注销', '请谨慎操作!\n注销后不可恢复哦!', () { + popPage(); + }, () { + userBloc.add(UserDelete()); + popPage(); + }); + }, + child: Text( + "注销账号", + style: TextStyle( + //fontWeight: FontWeight.w600, + color: Colors.red, + fontSize: 15.sp, + ), + )), + ], + ), ), )); }, -- libgit2 0.22.2