diff --git a/assets/image/2x/integral_return.png b/assets/image/2x/integral_return.png new file mode 100644 index 00000000..1e1699bc Binary files /dev/null and b/assets/image/2x/integral_return.png differ diff --git a/assets/image/3x/integral_return.png b/assets/image/3x/integral_return.png new file mode 100644 index 00000000..13290b60 Binary files /dev/null and b/assets/image/3x/integral_return.png differ diff --git a/assets/image/integral_return.png b/assets/image/integral_return.png new file mode 100644 index 00000000..c90e78b6 Binary files /dev/null and b/assets/image/integral_return.png differ 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(() {}); + }); } }