From 9a4847790266bf0e46e03b6c2a0fbb276277eb8f Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Wed, 3 Nov 2021 22:21:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=9B=B4=E6=94=B9,=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E6=9B=B4=E6=94=B9;=E7=A7=AF=E5=88=86ui=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/integral_return.png | Bin 0 -> 1160 bytes assets/image/3x/integral_return.png | Bin 0 -> 2037 bytes assets/image/integral_return.png | Bin 0 -> 526 bytes lib/community/community_course.dart | 16 +- .../community_view/class_details.dart | 407 ++++++++---------- .../community_view/course_banner.dart | 9 + lib/home/home_page.dart | 15 +- lib/home/home_view/home_integral_store.dart | 3 +- lib/home/home_view/shortcut_operation.dart | 6 +- .../integral_store_details_page.dart | 79 ++-- lib/main_page.dart | 6 +- lib/order/exchange_order_page.dart | 37 ++ lib/retrofit/retrofit_api.dart | 12 +- lib/retrofit/retrofit_api.g.dart | 6 +- lib/web/web_view/comment_list.dart | 16 +- 15 files changed, 329 insertions(+), 283 deletions(-) create mode 100644 assets/image/2x/integral_return.png create mode 100644 assets/image/3x/integral_return.png create mode 100644 assets/image/integral_return.png diff --git a/assets/image/2x/integral_return.png b/assets/image/2x/integral_return.png new file mode 100644 index 0000000000000000000000000000000000000000..1e1699bcb834d44ee47a83b061f60b6e6f06ec99 GIT binary patch literal 1160 zcmV;31b6$1P)Px(LP#^#a_NhQ7bGIwi5p=@_F7IcvE zsU#55hxEngm>!fFDzS$OY7*BhBQx10kVUPf-3LRI0xKMdfkv_&VVw9)bLH;rjC21w z&3T)-=X`&^?>)cs`**Gjd&X%X0GtIL2F?Hv0QcwN)4&}d3H%BC2K);AZB@L>0>Fd7 zQ$Q0?3mC=90)GIvfZM=7W^^$sRAf8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iF!Pzq)mbj7D5}As&A42B>a=%;q>{MUET=uk=+m%|Bcz2Q zt6R2gscUX-RywlE;mivA@C#K04jnbh+y?Vl+lO#Z;E)$o5qfrn zB$3_GX|vgsa?{=udgi!Pk-Xq6lkE9HyLRo`px5h}udP&mkiF}9lNVS)HR&(TpuCV_ z#x563e_;hxB~Up+QaDG^-j!qmmFiOPoK84RYHDg!d3pIOGH1E68y@YFDR``?$|O$b zEvLZ$E+ui=`(+w1(_sXmcpntE(tycBm5JmE{!nfwl5;Hg%cBTB1@sJk;v~BvuJL7Vd)Jrh|>)A_{PSC_Ku)_STC9 z>_7sqrf^|tPz?yY+{6V?f!E`>04eZ-B^Myss{~%rPx$$Vo&&R7gv;mcL6vQ545NMie;M6b4Sx7SWJX6d_s)QXmBln&8|JHTM^|HZ;2w z2-TtpqH6?gN`ynv&?F6FM1!Qpd3Z(4_wIX$chh_B`J5l$d+u{#y%vB~zz-|}?!NgC z@Cm#F&p^w}jmu<19Pa=tz>Fq{F7N_W#(~BGB;tKwPUCoVyA9;~84dPE0UN+BV3wJV z*#pYJqcR+JB#|FX;9U6>$i2!$0i@<9PRf$WWY*H@^p@A_y&992luQ0^DZpW0ExHmI z`?*|hI}(YkCzHwRVzDS{8n;AUcLI>;Pi?3Lx7$5aDwX#9e*aP|7Q3m{YTp(SiMlQY zu-TWSW%NFuZ@yeEAN6{@PAC+*Z8REE2HmO%;22o8vJ3lH9OdBHqWZn>T56Bp=70^^490i%`lc^w6ee{R>H}Pl7AKIL)Jr2UU QuK)l507*qoM6N<$f?pQsp8x;= literal 0 HcmV?d00001 diff --git a/lib/community/community_course.dart b/lib/community/community_course.dart index 1da62710..59c8f3a7 100644 --- a/lib/community/community_course.dart +++ b/lib/community/community_course.dart @@ -61,14 +61,24 @@ class _CommunityCourse extends State setState(() {}); } }); + queryCourseBanner(); classListAsync(); collectionList(); - // courseDetails("1451753512101740544"); + } + + ///banner + queryCourseBanner() async { + BaseData> banner = await apiService.queryBanner({ + "model": {"type": "COURSE_BANNER"}, + }).catchError((error) { + refreshController.refreshFailed(); + }); + bannerData.clear(); + bannerData.addAll(banner.data.records); } ///课程分类列表 - classListAsync() async - { + classListAsync() async { if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index 376645f9..9ed9a92e 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:chewie/chewie.dart'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; @@ -42,11 +44,9 @@ class _ClassDetails extends State with WidgetsBindingObserver{ var commentFocus = FocusNode(); String parenId = "0"; String hintText = S.current.liuxianinjingcaidepinglunba; - List memberList = []; final GlobalKey inputKey = GlobalKey(); final TextEditingController commentTextController = TextEditingController(); int commentTotal = 0; - double commentHeight = 60.h; CourseDetails course; List chapterList = []; bool isShowImg = true; @@ -149,203 +149,212 @@ class _ClassDetails extends State with WidgetsBindingObserver{ Widget build(BuildContext context) { return Scaffold( body: Container( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - Stack( + child:Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( children: [ - videoWidget( - MediaQuery.of(context).size.width, - videoPlayerController != null - ? (MediaQuery.of(context).size.width) / - videoPlayerController.value.aspectRatio - : MediaQuery.of(context).size.width / 2, - chapterList.length>chapterIndex?chapterList[chapterIndex].content.coverImg:"", + Stack( + children: [ + videoWidget( + MediaQuery.of(context).size.width, + videoPlayerController != null + ? (MediaQuery.of(context).size.width) / + videoPlayerController.value.aspectRatio + : MediaQuery.of(context).size.width / 2, + chapterList.length>chapterIndex?chapterList[chapterIndex].content.coverImg:"", + ), + Container( + margin: EdgeInsets.only(top: 40.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.transparent, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Icon( + Icons.arrow_back_ios, + color: Colors.white, + size: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ], ), Container( - margin: EdgeInsets.only(top: 40.h, left: 16.w, right: 16.w), + height: 123, + margin: EdgeInsets.only(bottom: 16.h), + padding: EdgeInsets.only(left: 16,top: 16,right: 10), decoration: BoxDecoration( - color: Colors.transparent, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - child: Icon( - Icons.arrow_back_ios, - color: Colors.white, - size: 24, - ), - onTap: () { - Navigator.of(context).pop(); - }, - ), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0, + ) ], ), - ), - ], - ), - Container( - height: 123, - margin: EdgeInsets.only(bottom: 16.h), - padding: EdgeInsets.only(left: 16,top: 16,right: 10), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 2), - blurRadius: 14, - spreadRadius: 0, - ) - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - height: 22.h, - width: 40.w, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - border: Border.all( - width: 1, - color: Color(0xFFFF7A1A), - style: BorderStyle.solid, + Row( + children: [ + Container( + height: 22.h, + width: 40.w, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFFF7A1A), + style: BorderStyle.solid, + ), + ), + child: Text( + ( course?.tags != null && course.tags.length > 0 )?course.tags[0] : "", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFFF7A1A), + ), + ), ), - ), - child: Text( - ( course?.tags != null && course.tags.length > 0 )?course.tags[0] : "", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFFFF7A1A), + SizedBox( + width: 6.w, ), - ), + Expanded( + child: Text( + course != null ?course.subject:"", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + flex: 1, + ) + ], ), SizedBox( - width: 6.w, + height:10.h, ), - Expanded( - child: Text( - course != null ?course.subject:"", - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF1A1A1A), - ), - ), - flex: 1, - ) - ], - ), - SizedBox( - height:10.h, - ), - Padding(padding: EdgeInsets.only(right: 16), - child: Row( - children: [ - Expanded( - child: Text( - "讲师:${course !=null ? course.author.name :""}", + Padding(padding: EdgeInsets.only(right: 16), + child: Row( + children: [ + Expanded( + child: Text( + "讲师:${course !=null ? course.author.name :""}", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + )), + Text( + "播放次数", overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, - color: Colors.black, + color: Color(0xFF808080), ), - )), - Text( - "播放次数", - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF808080), - ), - ), - SizedBox( - width:4, - ), - Text( - course != null ? course.viewers.toString() :"", - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF808080), - ), + ), + SizedBox( + width:4, + ), + Text( + course != null ? course.viewers.toString() :"", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + ), + ], + ),), + SizedBox( + height:10.h, + ), + Text( + course != null ?course.introduce:"", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, ), - ], - ),), - SizedBox( - height:10.h, + ), + ], ), - Text( - course != null ?course.introduce:"", - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, + ), + anthology(), + CommentList( + commentKey, + course?.likes ?? course?.likes?? 0, + widget.arguments["id"], + isKeyBoardShow, + _reply, + _delCommentTips, + 12.sp, + requestApiFinish: (total){setState(() { + commentTotal = total; + });}, + ), + if (commentTotal == 0) + Container( + width: double.infinity, + alignment: Alignment.topCenter, + margin: EdgeInsets.only(top: 40), + padding: EdgeInsets.all(22.h), + child: Text( + S + .of(context) + .zanwupinglun, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Color(0xFFA0A0A0), + ), ), ), - ], - ), - ), - anthology(), - CommentList( - commentKey, - course?.likes ?? course?.likes?? 0, - course?.id ?? course?.id ??"", - isKeyBoardShow, - _reply, - _delCommentTips, - 12.sp, - ), - if (memberList == null || memberList.length == 0) - Container( - width: double.infinity, - alignment: Alignment.topCenter, - margin: EdgeInsets.only(top: 40), - padding: EdgeInsets.all(22.h), - child: Text( - S - .of(context) - .zanwupinglun, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Color(0xFFA0A0A0), - ), - ), - ), - /// 富文本评论的输入框 - InputComment( - inputKey, - hintText, - isKeyBoardShow, - commentFocus, - commentTextController, - _toComment, - _queryMemberComment, - _queryInformationLikes, - isLike: false, + ], ), - ], - ), + ), + flex: 1,), + /// 富文本评论的输入框 + InputComment( + inputKey, + hintText, + isKeyBoardShow, + commentFocus, + commentTextController, + _toComment, + _queryMemberComment, + _queryInformationLikes, + isLike: false, + ), + ], ), ), ); @@ -517,25 +526,9 @@ class _ClassDetails extends State with WidgetsBindingObserver{ ); } - contentHeight() { - double contentHeight = MediaQuery - .of(context) - .size - .height - - kToolbarHeight - - MediaQuery - .of(context) - .padding - .top - - 160.h; - if ((contentHeight - 60.h) > (128.h * memberList.length)) { - commentHeight = contentHeight - (128.h * memberList.length); - } - } - ///给文章/活动点赞 _queryInformationLikes() async { - BaseData baseData = await apiService.informationLikes("1455102859841372160"); + BaseData baseData = await apiService.informationLikes(widget.arguments["id"]); if (baseData != null && baseData.isSuccess) { commentKey.currentState.setState(() {}); setState(() { @@ -555,7 +548,7 @@ class _ClassDetails extends State with WidgetsBindingObserver{ BaseData baseData = await apiService.memberComment({ "content": content, "parentId": parenId, - "relationalId":course.id, + "relationalId":widget.arguments["id"], "relationalType": 1 }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { @@ -563,32 +556,6 @@ class _ClassDetails extends State with WidgetsBindingObserver{ state.queryMemberCommentList(); commentTextController.text = ""; FocusScope.of(context).unfocus(); - _queryMemberCommentList(); - } - } - - ///评论列表 - _queryMemberCommentList() async { - SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - if (apiService == null) - apiService = ApiService( - Dio(), - context: context, - token: sharedPreferences.getString("token"), - showLoading: false, - ); - BaseData> baseData = - await apiService.memberCommentList({ - "pageNum": 1, - "pageSize": 100, - "relationalId":course.id, - "relationalType": 1, - }).catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - commentTotal = baseData.data.size; - memberList = baseData.data.list; - contentHeight(); - if (mounted) setState(() {}); } } diff --git a/lib/community/community_view/course_banner.dart b/lib/community/community_view/course_banner.dart index fc3078bb..d1ca2c79 100644 --- a/lib/community/community_view/course_banner.dart +++ b/lib/community/community_view/course_banner.dart @@ -4,7 +4,11 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/retrofit/data/banner.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; class CourseBanner extends StatefulWidget { @@ -20,6 +24,11 @@ class CourseBanner extends StatefulWidget { } class _CourseBanner extends State { + ApiService apiService; + final RefreshController refreshController = RefreshController(); + List bannerData = []; + + @override Widget build(BuildContext context) { return Container( diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 22ffdc79..257d70a9 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -35,21 +35,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'home_view/shortcut_operation.dart'; class HomePage extends StatefulWidget { - final GestureTapCallback callback; + final Function changeTab; - HomePage(this.callback); + HomePage(this.changeTab); @override State createState() { - return _HomePage(callback); + return _HomePage(); } } class _HomePage extends State with AutomaticKeepAliveClientMixin { ApiService apiService; - final GestureTapCallback callback; - - _HomePage(this.callback); @override void initState() { @@ -267,7 +264,9 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { HomeBanner(bannerData, controller), ///快捷操作 - ShortcutOperation(), + ShortcutOperation((){ + widget.changeTab(1); + }), ///签到 SignView(isSigned,(value){setState(() { @@ -288,7 +287,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { // CouponView(), ///积分商城 - HomeIntegralStore(gooods, callback), + HomeIntegralStore(gooods), ///精选活动 FeaturedActivity(), diff --git a/lib/home/home_view/home_integral_store.dart b/lib/home/home_view/home_integral_store.dart index cd10e1bf..f264618c 100644 --- a/lib/home/home_view/home_integral_store.dart +++ b/lib/home/home_view/home_integral_store.dart @@ -9,10 +9,9 @@ import 'package:huixiang/view_widget/item_title.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class HomeIntegralStore extends StatefulWidget { - final GestureTapCallback callback; final List gooods; - HomeIntegralStore(this.gooods, this.callback); + HomeIntegralStore(this.gooods); @override State createState() { diff --git a/lib/home/home_view/shortcut_operation.dart b/lib/home/home_view/shortcut_operation.dart index e7675d63..46401733 100644 --- a/lib/home/home_view/shortcut_operation.dart +++ b/lib/home/home_view/shortcut_operation.dart @@ -12,6 +12,10 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shared_preferences/shared_preferences.dart'; class ShortcutOperation extends StatefulWidget { + final Function goToOrder; + + ShortcutOperation(this.goToOrder); + @override State createState() { return _ShortcutOperation(); @@ -38,7 +42,7 @@ class _ShortcutOperation extends State { children: [ GestureDetector( onTap: (){ - + widget.goToOrder(); }, child: Container( width: 106, diff --git a/lib/integral_store/integral_store_details_page.dart b/lib/integral_store/integral_store_details_page.dart index 0aace98c..fcb008ca 100644 --- a/lib/integral_store/integral_store_details_page.dart +++ b/lib/integral_store/integral_store_details_page.dart @@ -194,62 +194,67 @@ class _IntegralStoreDetailsPage extends State { Container( padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( - child: Text( - goods == null ? "" : goods.name, - overflow: TextOverflow.ellipsis, + Text( + goods == null ? "" : S.of(context).jifen_(goods.price), style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 18.sp, - color: Color(0xFF353535), + color: Color(0xFF32A060), ), ), - flex: 1, + SizedBox( + width: 10.w, ), - Text( - goods == null - ? "" - : S.of(context).yiduihuanjian("${goods.sales}"), + Expanded(child: Text( + S.of(context).yuan_(goods.worth), style: TextStyle( - fontSize: 10.sp, + color: Color(0xFF585858), + decoration: TextDecoration.lineThrough, + decorationColor: Color(0xFF585858), fontWeight: MyFontWeight.regular, - color: Color(0xFFA29E9E), + fontSize: 14.sp, + ), + ),), + Text( + "库存:${goods.stock}份", + style: TextStyle( + color: Color(0xFF585858), + decorationColor: Color(0xFF353535), + fontWeight: MyFontWeight.medium, + fontSize: 12.sp, ), ), ], ), + SizedBox( + height: 8.h, + ), + Text( + goods == null ? "" : goods.name, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 15.sp, + color: Color(0xFF353535), + ), + ), SizedBox( height: 11.h, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - goods == null ? "" : goods.description, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF727272), - ), - ), - flex: 1, - ), - Text( - goods == null ? "" : S.of(context).jifen_(goods.price), - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 16.sp, - color: Color(0xFF32A060), - ), - ), - ], + Text( + goods == null ? "" : goods.description, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF727272), + ), ), ], ), diff --git a/lib/main_page.dart b/lib/main_page.dart index 37fddb5b..24ffd0cf 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -78,7 +78,11 @@ class _MainPage extends State with WidgetsBindingObserver { _widgetOptions = [ // BrandPage(), - HomePage(() {}), + HomePage((index) { + setState(() { + pageController.jumpToPage(index); + }); + }), // MainHomePage(), UnionPage(), CommunityPage(), diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index 5701cc22..a53cf3f9 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -4,11 +4,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:dio/dio.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:fluwx/fluwx.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; +import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/utils/min.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -662,10 +665,44 @@ class _ExchangeOrderPage extends State { "goodsId": widget.arguments["goodsId"], "number": 1, "useTyped": widget.arguments["useTyped"], + "payChannel":checkIndex == 3?"1":"4", if (widget.arguments["useTyped"] == 1) "storeId": storeId, if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId, }); if (baseDate.isSuccess) { + if(checkIndex == 3){ + if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + await Min.initialize(); + } + WxPay wxPay = WxPay.fromJson(baseDate.data); + await registerWxApi( + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/", + ); + payWithWeChat( + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign, + ); + weChatResponseEventHandler.listen((event) async { + print("payCallback: ${event.errCode}"); + Navigator.of(context).popAndPushNamed( + '/router/order_details', + arguments: { + "id": widget.arguments["goodsId"], + }, + ); + }); + return; + } await Navigator.of(context) .pushNamed('/router/exchange_order_success_page', arguments: { "price": widget.arguments["price"], diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 007c9611..c05a9209 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -45,15 +45,19 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; + +// const base_url = "http://192.168.10.130:8766/app/";///詹云久 +// const baseUrl = "http://192.168.10.130:8766/app/";///詹云久 + @RestApi(baseUrl: baseUrl) abstract class ApiService { factory ApiService( diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index cfab0889..f0cbde1f 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.236:8766/app/'; + baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; } final Dio _dio; @@ -346,13 +346,15 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; + final _headers = {}; + _headers.addAll({"Environment":"app"}); _data.addAll(param ?? {}); final _result = await _dio.request>( '/creditOrder/create', queryParameters: queryParameters, options: RequestOptions( method: 'POST', - headers: {}, + headers: _headers, extra: _extra, baseUrl: baseUrl), data: _data); diff --git a/lib/web/web_view/comment_list.dart b/lib/web/web_view/comment_list.dart index 06619ee5..e2b463f8 100644 --- a/lib/web/web_view/comment_list.dart +++ b/lib/web/web_view/comment_list.dart @@ -23,9 +23,10 @@ class CommentList extends StatefulWidget { final double fontSize; final String relationalId; final int like; + final Function requestApiFinish; CommentList(Key key, this.like, this.relationalId, - this.isKeyBoardShow, this.reply, this.delCommentTips, this.fontSize) + this.isKeyBoardShow, this.reply, this.delCommentTips, this.fontSize,{this.requestApiFinish}) : super(key: key); @override @@ -197,6 +198,8 @@ class CommentListState extends State { //评论列表 queryMemberCommentList() async { + if(widget?.relationalId == null || widget.relationalId.isEmpty) + return; SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); if (apiService == null) apiService = ApiService( @@ -213,10 +216,13 @@ class CommentListState extends State { "relationalType": 1, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { - commentTotal = baseData.data.size; - memberList = baseData.data.list; - contentHeight(); - setState(() {}); + setState(() { + commentTotal = baseData.data.size; + widget.requestApiFinish(commentTotal); + memberList.addAll(baseData.data.list); + contentHeight(); + setState(() {}); + }); } }