From 0247ab84f3cafd7c624772156468f7abdafb019a Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Wed, 19 Jan 2022 16:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81,=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=9B=B4=E6=94=B9,=E7=A4=BE=E7=BE=A4=E4=B8=93?= =?UTF-8?q?=E6=A0=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_child_page.dart | 31 +- lib/community/community_details.dart | 53 +- .../community_view/community_dynamic.dart | 94 +-- .../headlines/headlines_collection.dart | 95 +-- .../headlines/headlines_column_details.dart | 24 +- lib/home/home_page.dart | 156 ++++- lib/home/home_view/featured_acticvity.dart | 61 +- lib/home/home_view/quick_order.dart | 2 +- lib/home/home_view/shortcut_operation.dart | 41 +- .../points_mall_view/points_goods_title.dart | 5 + lib/login/login_page.dart | 24 +- lib/main.dart | 2 +- lib/message/system_details.dart | 635 ++++++++++++------ lib/message/system_message.dart | 392 ++++++----- lib/mine/mine_page.dart | 69 +- lib/mine/mine_view/mine_item.dart | 179 ++--- lib/mine/mine_view/mine_view.dart | 8 +- lib/mine/mine_wallet_page.dart | 29 +- lib/mine/release_page.dart | 34 +- lib/order/order_view/order_commodity.dart | 2 +- lib/retrofit/data/article.dart | 130 +++- lib/retrofit/data/message.dart | 129 ++-- lib/retrofit/data/msg_stats.dart | 29 + lib/retrofit/retrofit_api.dart | 17 +- lib/retrofit/retrofit_api.g.dart | 24 +- .../settlement_order_commodity.dart | 2 +- lib/store/store_order.dart | 2 +- lib/store/store_view/store_info.dart | 2 +- lib/view_widget/item_input_widget.dart | 3 +- lib/view_widget/request_permission.dart | 8 +- 30 files changed, 1475 insertions(+), 807 deletions(-) create mode 100644 lib/retrofit/data/msg_stats.dart diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index fce17374..0295df8b 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -1,6 +1,9 @@ +import 'dart:convert'; + import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart'; +import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/page.dart'; @@ -27,7 +30,7 @@ class _CommunityChildPage extends State { int pageNum = 0; String userId; - List comments = []; + List
articles = []; @override void initState() { @@ -67,11 +70,25 @@ class _CommunityChildPage extends State { refreshController.loadComplete(); if (baseData.isSuccess) { if (pageNum == 1) { - comments.clear(); + articles.clear(); } - comments.addAll(baseData.data.list); + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.liked = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.createTime = element.createTime; + article.updateUser = element.memberInfo?.mid; + article.viewers = element?.viewers; + article.likes = element?.likes; + article.comments = element?.comments; + articles.add(article); + }); // comments.sort((a,b)=>b.createTime.compareTo(a.createTime)); - print("comments: ${comments.length}"); + // print("comments: ${comments.length}"); if (int.tryParse(baseData.data.total) < (pageNum * 10)) { refreshController.loadNoData(); } @@ -103,7 +120,7 @@ class _CommunityChildPage extends State { itemBuilder: (context, position) { return InkWell( child: CommunityDynamic( - comments[position], + articles[position], 0, userId: userId, isList: true, @@ -117,14 +134,14 @@ class _CommunityChildPage extends State { Navigator.of(context).pushNamed( '/router/community_details', arguments: { - "comment": comments[position], + "businessId": articles[position].id, "userId": userId, }, ); }, ); }, - itemCount: comments.length, + itemCount: articles.length, ), ); }, diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index ded19a6e..4b627168 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -30,7 +30,7 @@ class CommunityDetails extends StatefulWidget { class _CommunityDetails extends State with WidgetsBindingObserver { double height = 0; double commentHeight = 60.h; - ComunityComment comunity; + // ComunityComment comunity; String parenId = "0"; final GlobalKey commentKey = GlobalKey(); final ScrollController scrollController = ScrollController(); @@ -43,6 +43,8 @@ class _CommunityDetails extends State with WidgetsBindingObser bool isKeyBoardShow = false; int commentTotal = 0; Article article; + String businessId; + @override void didChangeMetrics() { @@ -72,15 +74,16 @@ class _CommunityDetails extends State with WidgetsBindingObser @override void initState() { super.initState(); - comunity = widget.arguments["comment"]; + // comunity = widget.arguments["comment"]; + businessId = widget.arguments["businessId"]; WidgetsBinding.instance.addObserver(this); _queryMemberCommentList(); - queryDetails(); + queryDetails(businessId); } ///详情接口 - queryDetails() async { + queryDetails(id) async { SharedPreferences value = await SharedPreferences.getInstance(); if (apiService == null) apiService = ApiService( @@ -88,11 +91,15 @@ class _CommunityDetails extends State with WidgetsBindingObser context: context, token: value.getString("token"), ); - BaseData
baseData = await apiService.informationInfo(comunity.id) + BaseData
baseData = await apiService.informationInfo(id) .catchError((onError) { debugPrint(onError.toString()); }); - if (baseData != null && baseData.isSuccess) {} + if (baseData != null && baseData.isSuccess) { + setState(() { + article = baseData.data; + }); + } } @override @@ -114,13 +121,14 @@ class _CommunityDetails extends State with WidgetsBindingObser physics: BouncingScrollPhysics(), child: Column( children: [ + if(article != null) CommunityDynamic( - comunity, + article, 0, exitFull: () { setState(() {}); }, - userId:widget.arguments["userId"], + userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"], itemCount: 3, isDetails: true, heightFun: (height) { @@ -136,9 +144,9 @@ class _CommunityDetails extends State with WidgetsBindingObser ), CommentList( commentKey, - comunity?.likes ?? comunity?.likes.toString() ?? 0, - comunity.id, - 1, + article?.likes ?? 0, + businessId, + 4, isKeyBoardShow, _reply, _delCommentTips, @@ -154,8 +162,7 @@ class _CommunityDetails extends State with WidgetsBindingObser margin: EdgeInsets.only(top: 40), padding: EdgeInsets.all(22.h), child: Text( - S - .of(context) + S.of(context) .zanwupinglun, style: TextStyle( fontSize: 12, @@ -180,7 +187,7 @@ class _CommunityDetails extends State with WidgetsBindingObser _toComment, _queryMemberComment, _queryInformationLikes, - isLike: comunity.selfLike, + isLike: article?.liked ?? false, ), ], ), @@ -190,15 +197,15 @@ class _CommunityDetails extends State with WidgetsBindingObser ///给文章/活动点赞 _queryInformationLikes() async { - BaseData baseData = await apiService.informationLikes(comunity.id).catchError((onError) {}); + BaseData baseData = await apiService.informationLikes(businessId).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { commentKey.currentState.setState(() {}); setState(() { - if (comunity.selfLike ?? false) - comunity.likes -= 1; + if (article?.liked ?? false) + article?.likes -= 1; else - comunity.likes += 1; - comunity.selfLike = !comunity.selfLike ?? false; + article?.likes += 1; + article?.liked = !(article.liked ?? false); }); } else { // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); @@ -210,8 +217,8 @@ class _CommunityDetails extends State with WidgetsBindingObser BaseData baseData = await apiService.memberComment({ "content": content, "parentId": parenId, - "relationalId": comunity.id, - "relationalType":1 + "relationalId": businessId, + "relationalType":4 }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { CommentListState state = commentKey.currentState; @@ -295,8 +302,8 @@ class _CommunityDetails extends State with WidgetsBindingObser await apiService.memberCommentList({ "pageNum": 1, "pageSize": 100, - "relationalId": comunity.id, - "relationalType":1, + "relationalId": businessId, + "relationalType":4, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { commentTotal = baseData.data.size; diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index d72cfb61..dc9674df 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -1,10 +1,11 @@ +import 'dart:convert'; import 'dart:ui'; import 'package:chewie/chewie.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:chewie/src/chewie_progress_colors.dart' as chewie; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; @@ -13,8 +14,6 @@ import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:image_pickers/image_pickers.dart'; -import 'package:photo_view/photo_view.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:video_player/video_player.dart'; @@ -29,11 +28,11 @@ class CommunityDynamic extends StatefulWidget { final Function removalDynamic; final Function exitFull; final bool isList; - final ComunityComment comment; + final Article article; final String userId; CommunityDynamic( - this.comment, + this.article, this.commentType, { Key key, this.itemCount = 9, @@ -78,15 +77,18 @@ class _CommunityDynamic extends State { String filePath; initVideo() async { - if (widget.comment.subjectInfo.type == "video" && - widget.comment.subjectInfo.video.isNotEmpty) { + if(widget?.article?.content == null) + return; + var cnt = jsonDecode(widget.article.content); + if (cnt["type"] == "video" && + cnt["video"] != null) { if (widget.isList) { videoPlayerController = VideoPlayerController.network( - widget.comment.subjectInfo.video, + cnt["video"], )..initialize().then((value) {}); } else { videoPlayerController = VideoPlayerController.network( - widget.comment.subjectInfo.video, + cnt["video"], )..initialize().then((value) { chewieAudioController = ChewieController( videoPlayerController: videoPlayerController, @@ -172,13 +174,17 @@ class _CommunityDynamic extends State { children: [ GestureDetector( onTap: (){ + if(widget?.article?.authorHeadImg == ""){ + SmartDialog.showToast("用户暂未设置头像", alignment: Alignment.center); + return; + } Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:[widget?.comment?.memberInfo?.avatar ?? ""],//传入图片list + images:[widget?.article?.authorHeadImg ?? ""],//传入图片list index: 0,//传入当前点击的图片的index - ), ), ); + ), )); }, child: MImage( - widget?.comment?.memberInfo?.avatar ?? "", + widget?.article?.authorHeadImg ?? "", width: 44, height: 44, isCircle: true, @@ -195,7 +201,7 @@ class _CommunityDynamic extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - widget?.comment?.memberInfo?.nickname ?? "", + widget?.article?.authorName ?? "", style: TextStyle( fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, @@ -203,7 +209,7 @@ class _CommunityDynamic extends State { ), ), Text( - widget?.comment?.createTime ?? "", + widget?.article?.createTime ?? "", style: TextStyle( fontSize: 13.sp, fontWeight: MyFontWeight.regular, @@ -215,14 +221,14 @@ class _CommunityDynamic extends State { ], ), ), - if (widget?.comment?.memberInfo?.mid != widget.userId ?? "") + if (widget?.article?.updateUser != widget.userId ?? "") GestureDetector( onTap: () { setState(() { if (widget.commentType == 0) { - widget.comment.selfFollow = - !(widget.comment.selfFollow ?? false); - _vipFollow(widget.comment.memberInfo?.mid,widget.comment.selfFollow ?? false); + widget.article.liked = + !(widget.article.liked ?? false); + _vipFollow(widget.article.updateUser,widget.article.liked ?? false); } else { showDeleteDialog(); } @@ -235,21 +241,21 @@ class _CommunityDynamic extends State { alignment: Alignment.center, child: RoundButton( height: 25.h, - backgroup: (widget.comment.selfFollow ?? false) + backgroup: (widget?.article?.liked ?? false) ? Color(0xFFE6E6E6) : Color(0xFF32A060), - textColor: (widget.comment.selfFollow ?? false) + textColor: (widget?.article?.liked ?? false) ? Color(0xFF808080) : Colors.white, - text: (widget.comment.selfFollow ?? false) + text: (widget?.article?.liked ?? false) ? "已关注" : "关注", radius: 20, icons: Icon( - (widget.comment.selfFollow ?? false) + (widget?.article?.liked ?? false) ? Icons.check : Icons.add, - color: (widget.comment.selfFollow ?? false) + color: (widget?.article?.liked ?? false) ? Color(0xFF808080) : Colors.white, size: 15, @@ -267,7 +273,7 @@ class _CommunityDynamic extends State { height: 12.h, ), Text( - widget.comment.subject ?? "", + widget?.article?.mainTitle ?? "", maxLines: 5, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -276,7 +282,7 @@ class _CommunityDynamic extends State { fontSize: 15.sp, ), ), - buildMedia(widget.comment.subjectInfo), + buildMedia(widget?.article?.content), if (!widget.isDetails) SizedBox( height: 12.h, @@ -287,8 +293,8 @@ class _CommunityDynamic extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ IconText( - (widget.comment != null) - ? "${widget.comment.viewers}" + (widget.article != null) + ? "${widget.article.viewers}" : "", space: 4.w, leftImage: "assets/svg/liulanliang.svg", @@ -298,7 +304,7 @@ class _CommunityDynamic extends State { ), ), IconText( - "${widget.comment.comments ?? 0}", + "${widget.article.comments ?? 0}", space: 4.w, leftImage: "assets/svg/pinglun.svg", iconSize: 16, @@ -309,7 +315,7 @@ class _CommunityDynamic extends State { GestureDetector( onTap: () {}, child: IconText( - "${widget.comment.likes ?? 0}", + "${widget.article.likes ?? 0}", space: 4.w, leftImage: "assets/svg/xihuan.svg", iconSize: 16, @@ -332,24 +338,25 @@ class _CommunityDynamic extends State { } ///动态内容 - Widget buildMedia(SubjectInfo subjectInfo) { - if (subjectInfo == null) { + Widget buildMedia(String subjectInfo) { + if (subjectInfo == null || !subjectInfo.startsWith("{")) { return Container(); } + var cnt = jsonDecode(subjectInfo); Widget itemWidget = Container(); - if (subjectInfo.type == "image" && subjectInfo.images.length > 0) { - if (subjectInfo.images.length == 1) { + if (cnt["type"] == "image"&& cnt["images"] != null && cnt["images"].length > 0) { + if (cnt["images"].length == 1) { itemWidget = Container( child: InkWell( onTap: () { // ImagePickers.previewImages(subjectInfo.images,0); Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:subjectInfo.images,//传入图片list + images:cnt["images"],//传入图片list index: 0,//传入当前点击的图片的index ), ), ); }, child: MImage( - subjectInfo.images[0], + cnt["images"][0], fit: BoxFit.cover, radius: BorderRadius.circular(2), width: MediaQuery.of(context).size.width / 1.5, @@ -361,8 +368,8 @@ class _CommunityDynamic extends State { } else { itemWidget = GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: (subjectInfo.images.length == 2 || - subjectInfo.images.length == 4) + crossAxisCount: (cnt["images"].length == 2 || + cnt["images"].length == 4) ? 2 : 3, crossAxisSpacing: 12.w, @@ -378,12 +385,12 @@ class _CommunityDynamic extends State { onTap: () { // ImagePickers.previewImages(subjectInfo.images, position); Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:subjectInfo.images,//传入图片list + images:cnt["images"],//传入图片list index: position,//传入当前点击的图片的index ), ), ); }, child: MImage( - subjectInfo.images[position], + cnt["images"][position], fit: BoxFit.cover, aspectRatio: 1, radius: BorderRadius.circular(1), @@ -393,17 +400,18 @@ class _CommunityDynamic extends State { ), ); }, - itemCount: subjectInfo.images.length, + itemCount: cnt["images"].length, ); } - } else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) { + } + else if (cnt["type"] == "video" && cnt["video"]!= null && cnt["video"].isNotEmpty) { itemWidget = videoWidget( MediaQuery.of(context).size.width - 32, videoPlayerController != null ? (MediaQuery.of(context).size.width - 32) / videoPlayerController.value.aspectRatio : MediaQuery.of(context).size.width / 2, - !widget.isList ? subjectInfo.video : widget.comment.coverImg, + !widget.isList ? cnt["video"] : widget.article.coverImg, ); } return Column( @@ -551,7 +559,7 @@ class _CommunityDynamic extends State { fontWeight: FontWeight.bold, ), onTap: () { - _deleteDynamic(widget.comment.id); + _deleteDynamic(widget.article.id); Navigator.of(context).pop(); }, ), diff --git a/lib/community/headlines/headlines_collection.dart b/lib/community/headlines/headlines_collection.dart index 77ae7f4d..cc0fc2f3 100644 --- a/lib/community/headlines/headlines_collection.dart +++ b/lib/community/headlines/headlines_collection.dart @@ -37,7 +37,7 @@ class _HeadlinesCollection extends State { @override Widget build(BuildContext context) { return Container( - height: 60.h, + height: 100.h, margin: EdgeInsets.only(top:10), child: ListView.builder( scrollDirection: Axis.horizontal, @@ -61,7 +61,7 @@ class _HeadlinesCollection extends State { Widget headlinesCollectionItem(HeadlinesList headlines) { return Container( width: 225.w, - height:60.h, + height:100.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), boxShadow: [ @@ -85,7 +85,7 @@ class _HeadlinesCollection extends State { child: MImage( headlines?.coverImg ?? "", width: 225.w, - height: 60.h, + height: 100.h, fit: BoxFit.cover, errorSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png", @@ -97,69 +97,40 @@ class _HeadlinesCollection extends State { ), ), Container( - padding: EdgeInsets.only(left:12.w,right: 12.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Row( - children: [ - Container( - margin: EdgeInsets.only(right:4), - padding:EdgeInsets.only(left:2,right:2), - height:22.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(2), - color: Color(0xFF32A060), - ), - child: Text( - "专栏", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), + padding: EdgeInsets.only(left:12.w,right: 12.w,bottom: 8), + alignment: Alignment.bottomLeft, + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height:22.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF007EFF), ), - Expanded(child:Text( - headlines?.name ?? "", - overflow: TextOverflow.ellipsis, - maxLines: 2, + child: Text( + "专栏", style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, color: Colors.white, ), - ),), - ],)), - // Row( - // children: [ - // Expanded(child:Text( - // "更新3篇", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // )), - // Text( - // "查看专栏", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color: Colors.white, - // ), - // ), - // SizedBox(width: 2), - // Image.asset( - // "assets/image/t_right.png", - // width: 14, - // height: 14, - // ), - // ],), - ],), + ), + ), + Expanded(child:Text( + headlines?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ),), + ],) ), ], ), diff --git a/lib/community/headlines/headlines_column_details.dart b/lib/community/headlines/headlines_column_details.dart index 699795d0..ebf21fd3 100644 --- a/lib/community/headlines/headlines_column_details.dart +++ b/lib/community/headlines/headlines_column_details.dart @@ -142,14 +142,20 @@ class _HeadlinesColumnDetails extends State Stack( children: [ Positioned( - child: MImage( - headlinesListDetails?.bannerImg ?? "", - width: double.infinity, - height: 260.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), + child: Container( + color: Colors.black, + child:Opacity( + opacity:0.75, + child: MImage( + headlinesListDetails?.bannerImg ?? "", + width: double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ) + ) + ) ), Container( margin: EdgeInsets.only( @@ -194,7 +200,7 @@ class _HeadlinesColumnDetails extends State decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), - color: Color(0xFF32A060), + color: Color(0xFF007EFF), ), child: Text( "专栏", diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 6d30b07d..b2663c6e 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -21,14 +21,17 @@ import 'package:huixiang/retrofit/data/founder.dart'; import 'package:huixiang/retrofit/data/goods.dart'; import 'package:huixiang/retrofit/data/goods_category.dart'; import 'package:huixiang/retrofit/data/login_info.dart'; +import 'package:huixiang/retrofit/data/msg_stats.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; +import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/invite_success_dialog.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/new_people_reward.dart'; import 'package:huixiang/view_widget/request_permission.dart'; +import 'package:huixiang/view_widget/round_button.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -42,7 +45,8 @@ class HomePage extends StatefulWidget { final List interviewCouponList; final List newUserCouponList; - HomePage(this.changeTab, {this.invite,this.interviewCouponList,this.newUserCouponList}); + HomePage(this.changeTab, + {this.invite, this.interviewCouponList, this.newUserCouponList}); @override State createState() { @@ -63,21 +67,21 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { } }); - if((widget.invite??"") != "" || widget.interviewCouponList != null - && widget.interviewCouponList.length > 0) - showInvite = true; + if ((widget.invite ?? "") != "" || + widget.interviewCouponList != null && + widget.interviewCouponList.length > 0) showInvite = true; - if(widget.newUserCouponList != null && widget.newUserCouponList.length > 0) + if (widget.newUserCouponList != null && widget.newUserCouponList.length > 0) showNew = true; } ///邀请成功弹窗 - inviteShowAlertDialog(invite,InterviewCouponList interviewCouponList) { + inviteShowAlertDialog(invite, InterviewCouponList interviewCouponList) { //显示对话框 showDialog( context: context, builder: (BuildContext context) { - return InviteSuccessDialog(invite,interviewCouponList); + return InviteSuccessDialog(invite, interviewCouponList); }, ); } @@ -114,6 +118,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { List gooods = []; Founder founder; bool isSigned = false; + int totalMsg = 0; queryHome() async { EasyLoading.show(status: S.of(context).zhengzaijiazai); @@ -231,16 +236,43 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { refreshController.refreshFailed(); } EasyLoading.dismiss(); - if(showInvite){ - inviteShowAlertDialog(widget.invite,widget.interviewCouponList[0]); + if (showInvite) { + inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]); showInvite = false; } - if(showNew){ + if (showNew) { newShowAlertDialog(widget.newUserCouponList); showNew = false; } } + queryMsgStats() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.stats().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + baseData.data.forEach((element) { + totalMsg += element.number; + }); + }); + refreshController.loadComplete(); + refreshController.refreshCompleted(); + } + EasyLoading.dismiss(); + } + + _onRefresh(){ + queryHome(); + queryMsgStats(); + } + @override void dispose() { super.dispose(); @@ -259,17 +291,55 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { leading: false, actions: [ Container( - margin: EdgeInsets.only(right: 12.w), - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/system_msg_page'); - }, - child: SvgPicture.asset( - "assets/svg/tixing.svg", - width: 24, - height: 24, - ), + height: 24, + alignment: Alignment.center, + margin: EdgeInsets.only( + right: 12.w, ), + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/system_msg_page'); + }, + child: Container( + height: 24, + alignment:Alignment.center, + child:Stack( + children: [ + SvgPicture.asset( + "assets/svg/tixing.svg", + width: 24, + height: 24, + ), + if(totalMsg != 0) + Container( + width:36, + alignment: Alignment.topRight, + child:Container( + width:22, + height:14, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text:totalMsg.toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), + ) + ], + ), + ) + ) ), Container( margin: EdgeInsets.only(right: 16.w), @@ -300,7 +370,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { child: SingleChildScrollView( physics: NeverScrollableScrollPhysics(), child: FutureBuilder( - future: queryHome(), + future: _onRefresh(), builder: (context, snapshot) { return Column( children: [ @@ -308,14 +378,16 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { HomeBanner(bannerData, controller), ///快捷操作 - ShortcutOperation((){ + ShortcutOperation(() { widget.changeTab(1); }), ///签到 - SignView(isSigned,(value){setState(() { - isSigned = value; - });}), + SignView(isSigned, (value) { + setState(() { + isSigned = value; + }); + }), // ///热门文章 // HotArticle(articles), @@ -330,12 +402,16 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { ///超级优惠券 // CouponView(), - ///积分商城 - HomeIntegralStore(gooods), + SizedBox( + height: 28, + ), ///精选活动 FeaturedActivity(), + ///积分商城 + HomeIntegralStore(gooods), + ///积分商品头Tab PointsGoodsTitle( gooodsCategorys, @@ -384,7 +460,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { S.of(context).ninxiangjiquanxianweikaiqi, S.of(context).weilekaipaizhaoxuanzhetouxiang, S.of(context).kaiqiquanxian, - (result) async { + (result) async { if (result) { await openAppSettings(); } @@ -400,7 +476,12 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { String tableId = uri.queryParameters["tableId"]; String tenantCode = uri.queryParameters["tenantCode"]; String shopId = uri.queryParameters["shopId"]; - if (tableId != null && tableId != "" && tenantCode != null && tenantCode != "" && shopId != null && shopId != "") { + if (tableId != null && + tableId != "" && + tenantCode != null && + tenantCode != "" && + shopId != null && + shopId != "") { Navigator.of(context).pushNamed( '/router/store_order', arguments: { @@ -412,7 +493,22 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { ); } } else { - await Permission.camera.request(); + showCupertinoDialog( + context: context, + builder: (context) { + return RequestPermission( + "assets/image/icon_camera_permission_tips.png", + S.of(context).ninxiangjiquanxianweikaiqi, + S.of(context).weilekaipaizhaoxuanzhetouxiang, + S.of(context).kaiqiquanxian, + (result) async { + if (result) { + await Permission.camera.request(); + } + }, + heightRatioWithWidth: 0.82, + ); + }); } } diff --git a/lib/home/home_view/featured_acticvity.dart b/lib/home/home_view/featured_acticvity.dart index dfb3ac54..2aea1f43 100644 --- a/lib/home/home_view/featured_acticvity.dart +++ b/lib/home/home_view/featured_acticvity.dart @@ -78,9 +78,9 @@ class _FeaturedActivity extends State { child: stackItem(18.sp, activityList[0]), margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2, - height: 190.h, + height: 125.h, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), + borderRadius: BorderRadius.circular(6), color: Colors.red, image: DecorationImage( image: NetworkImage( @@ -106,9 +106,9 @@ class _FeaturedActivity extends State { child: stackItem(12.sp, activityList[1]), margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2, - height: 190.h / 2, + height:125.h, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), + borderRadius: BorderRadius.circular(6), color: Colors.green, image: DecorationImage( image: NetworkImage( @@ -122,28 +122,28 @@ class _FeaturedActivity extends State { SizedBox( height: 5, ), - GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/web_page', - arguments: {"activityId": activityList[2].id}); - }, - child: Container( - child: stackItem(12.sp, activityList[2]), - margin: EdgeInsets.symmetric(horizontal: 5.w), - width: (MediaQuery.of(context).size.width - 42) / 2, - height: 190.h / 2, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - color: Colors.blue, - image: DecorationImage( - image: NetworkImage( - activityList[2].coverImg, - ), - fit: BoxFit.fill, - ), - ), - ), - ), + // GestureDetector( + // onTap: () { + // Navigator.of(context).pushNamed('/router/web_page', + // arguments: {"activityId": activityList[2].id}); + // }, + // child: Container( + // child: stackItem(12.sp, activityList[2]), + // margin: EdgeInsets.symmetric(horizontal: 5.w), + // width: (MediaQuery.of(context).size.width - 42) / 2, + // height: 190.h / 2, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(4), + // color: Colors.blue, + // image: DecorationImage( + // image: NetworkImage( + // activityList[2].coverImg, + // ), + // fit: BoxFit.fill, + // ), + // ), + // ), + // ), ], ), ), @@ -160,7 +160,10 @@ class _FeaturedActivity extends State { Widget stackItem(double textSize, Activity activity) { return Container( - color: Color.fromARGB(80, 0, 0, 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + color: Color.fromARGB(80, 0, 0, 0), + ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, @@ -176,7 +179,7 @@ class _FeaturedActivity extends State { maxLines: 1, style: TextStyle( fontWeight: MyFontWeight.semi_bold, - fontSize: textSize, + fontSize: 14.sp, color: Colors.white, ), ), @@ -195,7 +198,7 @@ class _FeaturedActivity extends State { ), ), Container( - width: 58.w, + width: 48.w, margin: EdgeInsets.only(left: 8, bottom: 8), padding: EdgeInsets.symmetric( vertical: 4.h, diff --git a/lib/home/home_view/quick_order.dart b/lib/home/home_view/quick_order.dart index b21ff508..34ea054d 100644 --- a/lib/home/home_view/quick_order.dart +++ b/lib/home/home_view/quick_order.dart @@ -160,7 +160,7 @@ class _QuickOrder extends State { children: [ ItemTitle( text: "店铺推荐", - imgPath: "assets/image/icon_points_mall.png", + imgPath: "assets/image/icon_shop.png", ), Container( height: 170, diff --git a/lib/home/home_view/shortcut_operation.dart b/lib/home/home_view/shortcut_operation.dart index 82e76630..98e36e36 100644 --- a/lib/home/home_view/shortcut_operation.dart +++ b/lib/home/home_view/shortcut_operation.dart @@ -46,7 +46,18 @@ class _ShortcutOperation extends State { }, child: Container( width: 106, - color: Colors.white, + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(4), + ), margin: EdgeInsets.only(right:10), padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( @@ -84,7 +95,18 @@ class _ShortcutOperation extends State { }, child: Container( width: 106, - color: Colors.white, + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(4), + ), margin: EdgeInsets.only(right:10), padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( @@ -99,7 +121,7 @@ class _ShortcutOperation extends State { ), SizedBox(height: 5), Text( - "充值送会员!", + "会员享有赠送!", style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 12.sp, @@ -122,7 +144,18 @@ class _ShortcutOperation extends State { }, child:Container( width: 106, - color: Colors.white, + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(4), + ), padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( children: [ diff --git a/lib/home/points_mall_view/points_goods_title.dart b/lib/home/points_mall_view/points_goods_title.dart index a28e59c3..e9b12d45 100644 --- a/lib/home/points_mall_view/points_goods_title.dart +++ b/lib/home/points_mall_view/points_goods_title.dart @@ -3,6 +3,7 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/goods_category.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/my_tab.dart'; class PointsGoodsTitle extends StatefulWidget { @@ -41,6 +42,10 @@ class _PointsGoodsTitle extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + ItemTitle( + text: S.of(context).jifenshangcheng, + imgPath: "assets/image/icon_points_mall.png", + ), // ItemTitle( // text: S.of(context).jifenshangcheng, // imgPath: "assets/image/icon_points_mall.png", diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 76349a7b..986c1ae8 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -512,20 +512,16 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { ), ), ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/icon_login_logo.png", - width: 91.w, - height: 91.h, - ), - SizedBox( - height: 0.596.sh, - ), - ], - ), + Container( + height: MediaQuery.of(context).size.height * 0.78, + margin: EdgeInsets.only(top: 56.h), + alignment: Alignment.topCenter, + child:Image.asset( + "assets/image/icon_login_logo.png", + width: 91.w, + height: 91.h, + ), + ) ], ), ), diff --git a/lib/main.dart b/lib/main.dart index 45b26751..ff2580d3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -330,5 +330,5 @@ Map routers = { '/router/photo_view_gallery_screen': (context, {arguments}) => PhotoViewGalleryScreen(), '/router/system_details': (context, {arguments}) => - SystemDetails(), + SystemDetails(arguments:arguments), }; diff --git a/lib/message/system_details.dart b/lib/message/system_details.dart index 7a419575..b27b1a19 100644 --- a/lib/message/system_details.dart +++ b/lib/message/system_details.dart @@ -1,22 +1,31 @@ +import 'dart:convert'; + import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/message.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/comment_menu.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:huixiang/view_widget/round_button.dart'; +import 'package:huixiang/web/web_view/comment_list.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class SystemDetails extends StatefulWidget { + final Map arguments; + + SystemDetails({this.arguments}); @override State createState() { return _SystemDetails(); @@ -25,10 +34,22 @@ class SystemDetails extends StatefulWidget { class _SystemDetails extends State { ApiService apiService; + int pageNum = 1; + List messages = []; + int msgType = 0; + String parenId = "0"; + var commentFocus = FocusNode(); + String hintText = S.current.liuxianinjingcaidepinglunba; + bool isKeyBoardShow = false; + final GlobalKey commentKey = GlobalKey(); + final GlobalKey inputKey = GlobalKey(); + final TextEditingController commentTextController = TextEditingController(); + @override void initState() { super.initState(); + msgType = widget.arguments["msgType"]; SharedPreferences.getInstance().then((value) { apiService = @@ -37,8 +58,6 @@ class _SystemDetails extends State { }); } - int pageNum = 1; - List messages = []; _refresh() { pageNum = 1; @@ -51,7 +70,7 @@ class _SystemDetails extends State { "pageSize": 10, "searchKey": "", "state": "", - "typed": "" + "typed": msgType }).catchError((onError) { _refreshController.loadFailed(); _refreshController.refreshFailed(); @@ -75,6 +94,46 @@ class _SystemDetails extends State { } } + //关注/取关会员 + _vipFollow(followId,isFollow) async { + BaseData baseData = await apiService.follow(followId); + if (baseData != null && baseData.isSuccess) { + // widget.refresh(); + queryMessage(); + SmartDialog.showToast(isFollow?"取关成功":"关注成功", alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + ///评论 回复 + _reply(messageRelational) { + var messageRelational = jsonDecode(messages[0].relational), + parenId = messageRelational["mid"].toString(); + hintText = S.of(context).huifu_("${messageRelational["nickname"]}"); + } + + ///动态发布评论 + _queryMemberComment(String content) async { + BaseData baseData = await apiService.memberComment({ + "content": content, + "parentId": parenId, + "relationalId": messages[0].mid, + "relationalType":4 + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + // CommentListState state = commentKey.currentState; + // state.queryMemberCommentList(); + commentTextController.text = ""; + FocusScope.of(context).unfocus(); + Navigator.of(context).pop(); + SmartDialog.showToast("发布成功", alignment: Alignment.center); + } + else{ + SmartDialog.showToast("发布失败", alignment: Alignment.center); + } + } + RefreshController _refreshController = RefreshController(); @override @@ -83,13 +142,11 @@ class _SystemDetails extends State { appBar: MyAppBar( background: Colors.white, leadingColor: Colors.black, - // title: "订单通知", - // title: "充值消息", - title: "点赞", + title: (msgType == 2) ?"订单通知":(msgType == 3) ?"充值消息":(msgType == 4) ?"关注":(msgType == 5) ?"点赞":"评论", titleSize: 18.sp, titleColor: Colors.black, ), - body: SmartRefresher( + body:SmartRefresher( enablePullDown: true, enablePullUp: true, header: MyHeader(), @@ -97,7 +154,7 @@ class _SystemDetails extends State { footer: CustomFooter( loadStyle: LoadStyle.ShowWhenLoading, builder: (BuildContext context, LoadStatus mode) { - return MyFooter(mode); + return (messages.length == 0)?Container():MyFooter(mode); }, ), controller: _refreshController, @@ -105,23 +162,29 @@ class _SystemDetails extends State { onLoading: () { queryMessage(); }, - child: Container( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - child: Column( - children: [ - orderMessage(), - // rechargeMessage(), - // fabulousMessage(), - // commentMessage(), - // followMessage(), - ], + child: + Container( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: + Container( + child: Column( + children: [ + if(msgType == 2) + orderMessage(), + if(msgType == 3) + rechargeMessage(), + if(msgType == 5) + fabulousMessage(), + if(msgType == 6) + commentMessage(), + if(msgType == 4) + followMessage(), + ], + ), + ), ), ), - ), - ), - ), ); } @@ -410,10 +473,13 @@ class _SystemDetails extends State { itemBuilder: (context, position) { return GestureDetector( onTap: () { - // if (messages[position].typed == 2) { - // Navigator.of(context) - // .pushNamed('/router/exchange_order_details'); - // } + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId":jsonDecode(messages[position].relational)["businessId"].toString(), + "mid":messages[position].mid + }, + ); }, child: fabulousMessageItem(messages[position]), ); @@ -423,26 +489,27 @@ class _SystemDetails extends State { ); } Widget fabulousMessageItem(Message message) { + var messageRelational = jsonDecode(message.relational); return Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - "assets/image/c_z.png", - width: 44.w, - height: 44.h, - ), - // MImage( - // "", - // width: 44, - // height: 44, - // isCircle: true, - // fit: BoxFit.cover, - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", + // Image.asset( + // "assets/image/c_z.png", + // width: 44.w, + // height: 44.h, // ), + MImage( + messageRelational["avatar"], + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), SizedBox(width: 8,), Expanded(child:Column( mainAxisAlignment: MainAxisAlignment.start, @@ -451,7 +518,7 @@ class _SystemDetails extends State { Row( children: [ Text( - "张五", + messageRelational["nickname"], style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 14.sp, @@ -483,30 +550,30 @@ class _SystemDetails extends State { padding:EdgeInsets.all(5), child: Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( - "我的评论:", - style: TextStyle( - fontSize: 12.sp, - height: 1.3, - fontWeight: MyFontWeight.regular, - color: Color(0xFF1A1A1A), - ), - ), - // MImage( - // "", - // width: 38, - // height: 38, - // isCircle: true, - // fit: BoxFit.cover, - // radius: BorderRadius.circular(2), - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", + // Text( + // "我的评论:", + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), // ), + MImage( + messageRelational["nickname"], + width: 38, + height: 38, + isCircle: true, + fit: BoxFit.cover, + radius: BorderRadius.circular(2), + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), SizedBox(width:2.w), Expanded(child:Text( - "文本,是指书面语言的表现形式文本,文本,是指书面语言的表现形式文本。", + messageRelational["content"], maxLines: 2, overflow:TextOverflow.ellipsis, style: TextStyle( @@ -535,61 +602,60 @@ class _SystemDetails extends State { ///评论通知 Widget commentMessage(){ return Container( - color: Colors.white, - width: double.infinity, - padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w), - child:Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - (messages == null || messages.length == 0) - ? NoDataView( - isShowBtn: false, - text: S.of(context).haimeiyouxiaoxi, - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (messages == null || messages.length == 0) + ? NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId":jsonDecode(messages[position].relational)["businessId"].toString(), + "mid":messages[position].mid + }, + ); + }, + child: commentMessageItem(messages[position]), + ); + }), + ], ) - : ListView.builder( - padding: EdgeInsets.only(top: 16), - itemCount: messages.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - // if (messages[position].typed == 2) { - // Navigator.of(context) - // .pushNamed('/router/exchange_order_details'); - // } - }, - child: commentMessageItem(messages[position]), - ); - }), - ], - ) - ); + ); } Widget commentMessageItem(Message message) { + var messageRelational = jsonDecode(message.relational); return Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - "assets/image/c_z.png", - width: 44.w, - height: 44.h, + MImage( + messageRelational["avatar"], + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - // MImage( - // "", - // width: 44, - // height: 44, - // isCircle: true, - // fit: BoxFit.cover, - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", - // ), SizedBox(width: 8,), Expanded(child:Column( mainAxisAlignment: MainAxisAlignment.start, @@ -606,7 +672,7 @@ class _SystemDetails extends State { Row( children: [ Text( - "张五", + messageRelational["nickname"], style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 14.sp, @@ -633,73 +699,123 @@ class _SystemDetails extends State { ), ], ),), - Container( - height: 21.h, - width: 40.w, - padding:EdgeInsets.only(left:2,right:2), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(11), - border: Border.all( - width: 1, - color: Color(0xFF00A359), - style: BorderStyle.solid, + GestureDetector( + onTap: (){ + setState(() { + showDeleteDialog(); + _reply(messageRelational); + }); + }, + child: Container( + height:22.h, + width: 40.w, + padding:EdgeInsets.only(left:2,right:2), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(11), + border: Border.all( + width: 1, + color: Color(0xFF00A359), + style: BorderStyle.solid, + ), ), - ), - child: Text( - "回复", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF00A359), + child: Text( + "回复", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF00A359), + ), ), ), - ), + ) ], ), SizedBox(height:8.h,), - Text( - "文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Mess…", - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - height: 1.3, - fontWeight: MyFontWeight.regular, - color: Color(0xFF1A1A1A), - ), - ), - SizedBox(height:12.h,), + // Text( + // messageRelational["content"], + // maxLines: 2, + // overflow: TextOverflow.ellipsis, + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), + // ), + // SizedBox(height:12.h,), + // Container( + // width: double.infinity, + // color:Color(0xFFF2F2F2), + // padding:EdgeInsets.all(5), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "我的评论:", + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), + // ), + // // MImage( + // // "", + // // width: 38, + // // height: 38, + // // isCircle: true, + // // fit: BoxFit.cover, + // // radius: BorderRadius.circular(2), + // // errorSrc: "assets/image/default_1.png", + // // fadeSrc: "assets/image/default_1.png", + // // ), + // SizedBox(width:2.w), + // Expanded(child:Text( + // "文本,是指书面语言的表现形式文本,文本,是指书面语言的表现形式文本。", + // maxLines: 2, + // overflow:TextOverflow.ellipsis, + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF808080), + // ), + // ),) + // ], + // ), + // ), Container( width: double.infinity, color:Color(0xFFF2F2F2), padding:EdgeInsets.all(5), child: Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( - "我的评论:", - style: TextStyle( - fontSize: 12.sp, - height: 1.3, - fontWeight: MyFontWeight.regular, - color: Color(0xFF1A1A1A), - ), - ), - // MImage( - // "", - // width: 38, - // height: 38, - // isCircle: true, - // fit: BoxFit.cover, - // radius: BorderRadius.circular(2), - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", + // Text( + // "我的评论:", + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), // ), + MImage( + messageRelational["nickname"], + width: 38, + height: 38, + isCircle: true, + fit: BoxFit.cover, + radius: BorderRadius.circular(2), + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), SizedBox(width:2.w), Expanded(child:Text( - "文本,是指书面语言的表现形式文本,文本,是指书面语言的表现形式文本。", + messageRelational["content"], maxLines: 2, overflow:TextOverflow.ellipsis, style: TextStyle( @@ -763,26 +879,22 @@ class _SystemDetails extends State { ); } Widget followMessageItem(Message message) { + var messageRelational = jsonDecode(message.relational); return Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - "assets/image/c_z.png", - width: 44.w, - height: 44.h, + MImage( + messageRelational["avatar"], + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - // MImage( - // "", - // width: 44, - // height: 44, - // isCircle: true, - // fit: BoxFit.cover, - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", - // ), SizedBox(width: 8,), Expanded(child:Column( mainAxisAlignment: MainAxisAlignment.start, @@ -799,7 +911,7 @@ class _SystemDetails extends State { Row( children: [ Text( - "张五", + messageRelational["nickname"], style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 14.sp, @@ -826,36 +938,74 @@ class _SystemDetails extends State { ), ], ),), - Container( - height: 21.h, - width:56.w, - padding:EdgeInsets.only(left:5,right:5), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(11), - border: Border.all( - width: 1, - color: Color(0xFF00A359), - style: BorderStyle.solid, + GestureDetector( + onTap: (){ + setState(() { + _vipFollow(messageRelational["mid"].toString(),message?.followed ?? false); + }); + }, + child: + RoundButton( + height: 21.h, + width:56.w, + padding: EdgeInsets.all(2), + backgroup: (message?.followed ?? false) + ? Color(0xFFE6E6E6) + : Color(0xFF32A060), + textColor: (message?.followed ?? false) + ? Color(0xFF808080) + : Colors.white, + text: (message?.followed ?? false) ? "已关注" : "回关", + radius:20, + icons: Icon( + (message?.followed ?? false) + ? Icons.check + : Icons.add, + color: (message?.followed?? false) + ? Color(0xFF808080) + : Colors.white, + size: 12, ), - color: Color(0xFF00A359), - ), - child: Row( - children: [ - Icon(Icons.add, - color:Colors.white, - size: 16, - ), - Text( - "回关", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ], - ), + ) + // Container( + // height: 21.h, + // width:56.w, + // padding:EdgeInsets.only(left:5,right:5), + // alignment: Alignment.center, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(11), + // border: Border.all( + // width: 1, + // color: Color(0xFF00A359), + // style: BorderStyle.solid, + // ), + // color: (message?.followed ?? false) + // ? Color(0xFFE6E6E6) + // : Color(0xFF32A060), + // ), + // child: Row( + // children: [ + // Icon((message?.followed ?? false) + // ? Icons.check + // : Icons.add, + // color:(message?.followed?? false) + // ? Color(0xFF808080) + // : Colors.white, + // size: 16, + // ), + // Text( + // (message?.followed ?? false) ? "已关注" : "回关", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.medium, + // color:(message?.followed ?? false) + // ? Color(0xFF808080) + // : Colors.white, + // ), + // ), + // ], + // ), + // ) ), ], ), @@ -872,4 +1022,87 @@ class _SystemDetails extends State { ), ); } + + ///动态弹窗 + showDeleteDialog() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + content: Container( + height: 150.h, + // padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Container( + decoration: BoxDecoration( + color: Color(0xffF2F2F2), + borderRadius: BorderRadius.circular(2.0), + ), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 4.w), + alignment: Alignment.topLeft, + child: TextField( + maxLines: 8, + minLines: 1, + focusNode:commentFocus, + controller:commentTextController, + decoration: InputDecoration( + border: InputBorder.none, + hintText:hintText, + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xFF868686), + ), + ), + ), + ), + ), + ), + if (!isKeyBoardShow) + GestureDetector( + onTap: () { + setState(() { + var commentText = commentTextController.text; + if (commentText.trim() == "") { + return; + } + _queryMemberComment(commentText); + }); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 20.w), + child: Text( + S.of(context).fasong, + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0XFF1A1A1A), + ), + ), + ), + ), + ], + ), + ), + ); + }, + ); + } } diff --git a/lib/message/system_message.dart b/lib/message/system_message.dart index bf4967f7..9be81392 100644 --- a/lib/message/system_message.dart +++ b/lib/message/system_message.dart @@ -1,8 +1,10 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/message.dart'; +import 'package:huixiang/retrofit/data/msg_stats.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; @@ -24,6 +26,18 @@ class SystemMessagePage extends StatefulWidget { class _SystemMessagePage extends State { ApiService apiService; + int pageNum = 1; + List messages = []; + List msgStats = []; + Map msgNumber = { + "1":0, + "2":0, + "3":0, + "4":0, + "5":0, + "6":0, + }; + int state = 0; @override void initState() { @@ -33,15 +47,14 @@ class _SystemMessagePage extends State { apiService = ApiService(Dio(), token: value.getString("token"), context: context); queryMessage(); + queryMsgStats(); }); } - int pageNum = 1; - List messages = []; - _refresh() { pageNum = 1; queryMessage(); + queryMsgStats(); } queryMessage() async { @@ -60,7 +73,13 @@ class _SystemMessagePage extends State { if (pageNum == 1) { messages.clear(); } - messages.addAll(baseData.data.list); + List message = []; + message.addAll(baseData.data.list); + message.forEach((element) { + if(element.typed==2 || element.typed==3){ + messages.add(element); + } + }); _refreshController.loadComplete(); _refreshController.refreshCompleted(); if (mounted) setState(() {}); @@ -75,6 +94,32 @@ class _SystemMessagePage extends State { } } + queryMsgStats() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.stats().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + msgStats.clear(); + msgStats = baseData.data; + msgStats.forEach((element) { + if(msgNumber.containsKey(element.name)){ + msgNumber[element.name] = element.number; + } + }); + }); + _refreshController.loadComplete(); + _refreshController.refreshCompleted(); + } + EasyLoading.dismiss(); + } + RefreshController _refreshController = RefreshController(); @override @@ -92,6 +137,9 @@ class _SystemMessagePage extends State { alignment: Alignment.centerRight, child: GestureDetector( onTap: () { + setState(() { + queryMsgStats(); + }); }, child: Text( "标为已读", @@ -113,13 +161,15 @@ class _SystemMessagePage extends State { footer: CustomFooter( loadStyle: LoadStyle.ShowWhenLoading, builder: (BuildContext context, LoadStatus mode) { - return MyFooter(mode); + return (messages.length == 0)?Container():MyFooter(mode); }, ), controller: _refreshController, onRefresh: _refresh, onLoading: () { - queryMessage(); + setState(() { + _refresh(); + }); }, child: Container( child: SingleChildScrollView( @@ -146,49 +196,50 @@ class _SystemMessagePage extends State { padding: EdgeInsets.only(top: 16.h,bottom: 16.h), child: Row( children: [ - Expanded(child: Column( - children: [ - Stack( - children: [ - Image.asset( - "assets/image/icon_z.png", - width: 40, - height: 40, - ), - Container( - width:48, - alignment: Alignment.topRight, - child:Container( - width:20, - height:17, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Colors.white, - style: BorderStyle.solid, - ), - color:Color(0xFFFF441A), - ), - child:RoundButton( - text: "99+", - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:8.sp, - radius: 100, - ) + Expanded(child: GestureDetector( + onTap: (){ + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":5}); + }, + child:Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_z.png", + width: 40, + height: 40, ), - ) - ], - ), - SizedBox(height: 6.h), - GestureDetector( - onTap: (){ - Navigator.of(context) - .pushNamed('/router/system_details'); - }, - child:Text( + if(msgNumber["5"].toString() != "0") + Container( + width:48, + alignment: Alignment.topRight, + child:Container( + width:20, + height:17, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text:msgNumber["5"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), + ) + ], + ), + SizedBox(height: 6.h), + Text( "点赞", style: TextStyle( fontSize: 14.sp, @@ -196,103 +247,121 @@ class _SystemMessagePage extends State { color: Color(0xFF060606), ), ) - ), - ], - )), - Expanded(child:Column( - children: [ - Stack( - children: [ - Image.asset( - "assets/image/icon_pl.png", - width: 40, - height: 40, - ), - Container( - width:48, - alignment: Alignment.topRight, - child:Container( - width:16, - height:16, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Colors.white, - style: BorderStyle.solid, - ), - color:Color(0xFFFF441A), + ], + ) + ) + ), + Expanded(child: + GestureDetector( + onTap: (){ + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":6}); + }, + child: Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_pl.png", + width: 40, + height: 40, ), - child:RoundButton( - text: "99", - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:8.sp, - radius: 100, + if(msgNumber["6"].toString() != "0") + Container( + width:48, + alignment: Alignment.topRight, + child:Container( + width:16, + height:16, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text: msgNumber["6"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), ) + ], ), - ) - ], - ), - SizedBox(height: 6.h), - Text( - S.of(context).pinglun, - style: TextStyle( - fontSize: 14.sp, - fontWeight:MyFontWeight.medium, - color: Color(0xFF060606), - ), - ), - ], - )), - Expanded(child:Column( - children: [ - Stack( - children: [ - Image.asset( - "assets/image/icon_gz.png", - width: 40, - height: 40, - ), - Container( - width:48, - alignment: Alignment.topRight, - child:Container( - width:16, - height:16, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Colors.white, - style: BorderStyle.solid, - ), - color:Color(0xFFFF441A), + SizedBox(height: 6.h), + Text( + S.of(context).pinglun, + style: TextStyle( + fontSize: 14.sp, + fontWeight:MyFontWeight.medium, + color: Color(0xFF060606), + ), + ), + ], + ) + )), + Expanded(child: + GestureDetector( + onTap: (){ + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":4}); + }, + child:Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_gz.png", + width: 40, + height: 40, ), - child:RoundButton( - text: "1", - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:8.sp, - radius: 100, + if(msgNumber["4"].toString() != "0") + Container( + width:48, + alignment: Alignment.topRight, + child:Container( + width:16, + height:16, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text: msgNumber["4"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), ) + ], ), - ) - ], - ), - SizedBox(height: 6.h), - Text( - S.of(context).guanzhu, - style: TextStyle( - fontSize: 14.sp, - fontWeight:MyFontWeight.medium, - color: Color(0xFF060606), - ), - ), - ], - )), + SizedBox(height: 6.h), + Text( + S.of(context).guanzhu, + style: TextStyle( + fontSize: 14.sp, + fontWeight:MyFontWeight.medium, + color: Color(0xFF060606), + ), + ), + ], + ) + ) + ), ], ), ); @@ -322,7 +391,7 @@ class _SystemMessagePage extends State { fontSize: 16.sp, margin: EdgeInsets.only(top: 120.h), ) - : ListView.builder( + :ListView.builder( padding: EdgeInsets.only(top: 16), itemCount: messages.length, shrinkWrap: true, @@ -330,12 +399,12 @@ class _SystemMessagePage extends State { itemBuilder: (context, position) { return GestureDetector( onTap: () { - // if (messages[position].typed == 2) { - // Navigator.of(context) - // .pushNamed('/router/exchange_order_details'); - // } + if(messages[position].typed == 2) Navigator.of(context) - .pushNamed('/router/system_details'); + .pushNamed('/router/system_details',arguments: {"msgType":2}); + else if(messages[position].typed == 3) + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":3}); }, child: buildMessageItem(messages[position]), ); @@ -423,10 +492,11 @@ class _SystemMessagePage extends State { color: Color(0xFF353535), ), ),), + if(msgNumber["2"].toString() != "0") RoundButton( width: 16, height: 16, - text: "1", + text:msgNumber["2"].toString(), textColor: Colors.white, fontWeight: MyFontWeight.regular, backgroup: Color(0xFFFF441A), @@ -435,12 +505,30 @@ class _SystemMessagePage extends State { ), ], ): - Text( - message.content, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFF353535), - ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: + Text( + message.content, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF353535), + ), + )), + if(msgNumber["3"].toString() != "0") + RoundButton( + width: 16, + height: 16, + text:msgNumber["3"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:10.sp, + radius: 100, + ), + ], ), ], )), diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 6a118fd1..b6cdfcde 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -198,9 +198,6 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }, ), - ///关注度/粉丝/发布 - attention(), - ///我的 VIP等级信息 MineVipView( tag: "vip", @@ -214,6 +211,9 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ), ), + ///关注度/粉丝/发布 + attention(), + /// 钱包或领券中心 WalletCoupon(), @@ -311,7 +311,20 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ///关注度/粉丝/成就数量 Widget attention(){ return Container( - margin: EdgeInsets.only(left: 16,top: 10), + margin: EdgeInsets.only(left: 16,top: 10,right: 16), + padding: EdgeInsets.only(top: 16,bottom: 16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), child:GestureDetector( onTap:(){ Navigator.of(context).pushNamed( @@ -331,23 +344,23 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); }, child: - Row( + Column( children: [ Text( - S.of(context).guanzhu, + infoNumber != null ?infoNumber.follow.toString() :"0", style: TextStyle( color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, ), ), - SizedBox(width: 5,), + SizedBox(height:4,), Text( - infoNumber != null ?infoNumber.follow.toString() :"0", + S.of(context).guanzhu, style: TextStyle( color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, ), ), ], @@ -361,23 +374,23 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); }, child: - Row( + Column( children: [ Text( - S.of(context).fensi, + infoNumber != null ?infoNumber.fans.toString() :"0", style: TextStyle( color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, ), ), - SizedBox(width: 5,), + SizedBox(height:4,), Text( - infoNumber != null ?infoNumber.fans.toString() :"0", + S.of(context).fensi, style: TextStyle( color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, ), ), ], @@ -391,23 +404,23 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); }, child: - Row( + Column( children: [ Text( - "成就", + infoNumber != null ?infoNumber.achievementNumber.toString() :"0", style: TextStyle( color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, ), ), - SizedBox(width: 5,), + SizedBox(height:4,), Text( - infoNumber != null ?infoNumber.achievementNumber.toString() :"0", + "成就", style: TextStyle( color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, ), ), ], diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 092ca029..450338a0 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -17,7 +17,7 @@ class _MineItem extends State { Widget build(BuildContext context) { return Container( margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 28.h), - padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), + // padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -50,7 +50,7 @@ class _MineItem extends State { // ), // ), Container( - padding: EdgeInsets.symmetric(vertical: 4.h), + padding: EdgeInsets.only(left: 16,top:16,bottom:4), child: Text( S.of(context).wodegongju, style: TextStyle( @@ -60,74 +60,79 @@ class _MineItem extends State { ), ), ), - InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context) - .pushNamed('/router/releasePage', - arguments: {}); - }); - }, - child: mineItem( - S.of(context).wodedongtai, - "assets/image/dynamic.png", - ), - ), - InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context) - .pushNamed('/router/exchange_history_page'); - }); - }, - child: mineItem( - S.of(context).duihuanlishi, - "assets/image/icon_mine_records_of_consumption.png", - ), - ), - InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/mine_card'); - }); - }, - child: mineItem( - S.of(context).wodekaquan, - "assets/image/icon_mine_card.png", - ), + Row( + children: [ + Expanded(child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context) + .pushNamed('/router/releasePage', + arguments: {}); + }); + }, + child: mineItem( + S.of(context).wodedongtai, + "assets/image/dynamic.png", + ), + ),), + Expanded(child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context) + .pushNamed('/router/exchange_history_page'); + }); + }, + child: mineItem( + S.of(context).duihuanlishi, + "assets/image/icon_mine_records_of_consumption.png", + ), + ),), + Expanded(child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/mine_card'); + }); + }, + child: mineItem( + S.of(context).wodekaquan, + "assets/image/icon_mine_card.png", + ), + ),), + Expanded(child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/manage_address_page'); + }); + }, + child: mineItem( + S.of(context).guanlidizhi, + "assets/image/icon_location_address.png", + ), + ),) + ], ), - InkWell( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/manage_address_page'); - }); - }, - child: mineItem( - S.of(context).guanlidizhi, - "assets/image/icon_location_address.png", - ), - ), - InkWell( + Padding(padding:EdgeInsets.only(left:24), + child: InkWell( onTap: () { Navigator.of(context).pushNamed('/router/qr_share', arguments: {}); }, @@ -135,7 +140,8 @@ class _MineItem extends State { S.of(context).tuiguangma, "assets/image/icon_mine_promotion_code.png", ), - ), + ),) + // mineItem( // S.of(context).bangzhuyufankui, // "assets/image/icon_mine_feedback.png", @@ -150,34 +156,31 @@ class _MineItem extends State { return Container( color: Colors.white, margin: EdgeInsets.symmetric(vertical: 6.h), - child: Row( + child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( icon, - width: 28.w, - height: 28.h, + width: 32.w, + height: 32.w, ), SizedBox( - width: 8.w, + height: 2.h, ), - Expanded( - flex: 1, - child: Text( - text, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Color(0xFF353535), - ), + Text( + text, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 12.sp, + color: Color(0xFF353535), ), ), - Icon( - Icons.keyboard_arrow_right, - size: 20, - color: Colors.black, - ) + // Icon( + // Icons.keyboard_arrow_right, + // size: 20, + // color: Colors.black, + // ) ], ), ); diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart index 44baa223..9650f6d0 100644 --- a/lib/mine/mine_view/mine_view.dart +++ b/lib/mine/mine_view/mine_view.dart @@ -42,8 +42,8 @@ class _MineView extends State { padding: EdgeInsets.all(8.h), child: Image.asset( "assets/image/icon_scan_qr_code.png", - width: 24.w, - height: 24.h, + width:32.w, + height: 32.h, ), ), ), @@ -56,8 +56,8 @@ class _MineView extends State { margin: EdgeInsets.only(right: 12.w), child: Image.asset( "assets/image/icon_mine_setting.png", - width: 24.w, - height: 24.h, + width: 32.w, + height: 32.h, ), ), ), diff --git a/lib/mine/mine_wallet_page.dart b/lib/mine/mine_wallet_page.dart index 1a3eb244..faf730b8 100644 --- a/lib/mine/mine_wallet_page.dart +++ b/lib/mine/mine_wallet_page.dart @@ -12,6 +12,7 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -57,7 +58,8 @@ class _MineWalletPage extends State { } queryUserBalance() async { - BaseData baseData = await apiService.queryInfo().catchError((onError) {}); + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { userInfo = baseData.data; mBalance = double.tryParse(userInfo.money); @@ -168,14 +170,21 @@ class _MineWalletPage extends State { ), Container( margin: EdgeInsets.only(top: 14.h), - child: ListView.builder( - itemCount: userBills != null ? userBills.length : 0, - shrinkWrap: true, - padding: EdgeInsets.only(bottom: 20.h), - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return historyItem(userBills[position], position); - }), + child: (userBills == null || userBills.length == 0) + ? NoDataView( + isShowBtn: false, + text: "目前暂未记录哦", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + itemCount: userBills != null ? userBills.length : 0, + shrinkWrap: true, + padding: EdgeInsets.only(bottom: 20.h), + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return historyItem(userBills[position], position); + }), ), ], ), @@ -200,7 +209,7 @@ class _MineWalletPage extends State { Expanded( flex: 1, child: Container( - height: 34.h, + // height: 34.h, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/mine/release_page.dart b/lib/mine/release_page.dart index f4191078..7a52ff00 100644 --- a/lib/mine/release_page.dart +++ b/lib/mine/release_page.dart @@ -1,8 +1,11 @@ +import 'dart:convert'; + import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/page.dart'; @@ -26,7 +29,7 @@ class _ReleasePage extends State { int pageNum = 0; String userId; - List comments = []; + List
articles = []; @override void initState() { @@ -66,10 +69,24 @@ class _ReleasePage extends State { refreshController.loadComplete(); if (baseData.isSuccess) { if (pageNum == 1) { - comments.clear(); + articles.clear(); } - comments.addAll(baseData.data.list); - print("comments: ${comments.length}"); + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.liked = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.createTime = element.createTime; + article.updateUser = element.memberInfo?.mid; + article.viewers = element?.viewers; + article.likes = element?.likes; + article.comments = element?.comments; + articles.add(article); + }); + // print("comments: ${comments.length}"); if (int.tryParse(baseData.data.total) < (pageNum * 10)) { refreshController.loadNoData(); } @@ -109,8 +126,9 @@ class _ReleasePage extends State { itemBuilder: (context, position) { return InkWell( child: CommunityDynamic( - comments[position], - 1,exitFull: (){setState(() { + articles[position], + 1, + exitFull: (){setState(() { _onRefresh(); });}, removalDynamic: () { @@ -121,13 +139,13 @@ class _ReleasePage extends State { Navigator.of(context).pushNamed( '/router/community_details', arguments: { - "comment": comments[position],"userId":userId, + "businessId": articles[position].id,"userId":userId, }, ); }, ); }, - itemCount: comments.length, + itemCount: articles.length, )), ); }, diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index 1856edec..8ceae95e 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -169,7 +169,7 @@ class _OrderCommodity extends State { margin: EdgeInsets.only( left: 16.w, ), - height: 44.h, + // height: 44.h, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/retrofit/data/article.dart b/lib/retrofit/data/article.dart index 72a130e3..5af314d9 100644 --- a/lib/retrofit/data/article.dart +++ b/lib/retrofit/data/article.dart @@ -14,7 +14,7 @@ class Article { dynamic _viceTitle; String _content; String _coverImg; - Author _author; + dynamic _author; int _type; String _startTime; String _categoryId; @@ -26,6 +26,8 @@ class Article { bool _liked; int _viewers; int _comments; + String _authorName; + String _authorHeadImg; bool isFollow; dynamic _storeName; @@ -39,7 +41,7 @@ class Article { dynamic get viceTitle => _viceTitle; String get content => _content; String get coverImg => _coverImg; - Author get author => _author; + dynamic get author => _author; int get type => _type; String get startTime => _startTime; String get categoryId => _categoryId; @@ -51,8 +53,14 @@ class Article { bool get liked => _liked; int get viewers => _viewers; int get comments => _comments; + String get authorName => _authorName; + String get authorHeadImg => _authorHeadImg; dynamic get storeName => _storeName; + set id(String value) { + _id = value; + } + set likes(int value) { _likes = value; } @@ -69,27 +77,38 @@ class Article { _comments = value; } + set authorName(String value) { + _authorName = value; + } + + set authorHeadImg(String value) { + _authorHeadImg = value; + } + Article({ - String id, - String createTime, - dynamic createUser, - String updateTime, - dynamic updateUser, - String storeId, - String mainTitle, - dynamic viceTitle, - String content, + String id, + String createTime, + dynamic createUser, + String updateTime, + dynamic updateUser, + String storeId, + String mainTitle, + dynamic viceTitle, + String content, String coverImg, Author author, - int type, - String startTime, - String endTime, - int state, - int isDelete, + int type, + String startTime, + String endTime, + int state, + int isDelete, int likes, bool isHot, int viewers, int comments, + String authorName, + String authorHeadImg, + dynamic storeName}){ _id = id; _createTime = createTime; @@ -113,6 +132,8 @@ class Article { _liked = liked; _viewers = viewers; _comments = comments; + _authorName = authorName; + _authorHeadImg = authorHeadImg; _storeName = storeName; } @@ -127,7 +148,7 @@ class Article { _viceTitle = json["viceTitle"]; _content = json["content"]; _coverImg = json["coverImg"]; - _author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"])); + _author = json["author"] == null ? null : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):null; _type = json["type"]; _startTime = json["startTime"]; _categoryId = json["categoryId"]; @@ -139,6 +160,8 @@ class Article { _liked = json["liked"]; _viewers = json["viewers"]; _comments = json["comments"]; + _authorName = json["authorName"]; + _authorHeadImg = json["authorHeadImg"]; _storeName = json["storeName"]; } @@ -166,8 +189,81 @@ class Article { map["liked"] = _liked; map["viewers"] = _viewers; map["comments"] = _comments; + map["authorName"] = _authorName; + map["authorHeadImg"] = _authorHeadImg; map["storeName"] = _storeName; return map; } + set createTime(String value) { + _createTime = value; + } + + set createUser(dynamic value) { + _createUser = value; + } + + set updateTime(String value) { + _updateTime = value; + } + + set updateUser(dynamic value) { + _updateUser = value; + } + + set storeId(String value) { + _storeId = value; + } + + set mainTitle(String value) { + _mainTitle = value; + } + + set viceTitle(dynamic value) { + _viceTitle = value; + } + + set content(String value) { + _content = value; + } + + set coverImg(String value) { + _coverImg = value; + } + + set author(dynamic value) { + _author = value; + } + + set type(int value) { + _type = value; + } + + set startTime(String value) { + _startTime = value; + } + + set categoryId(String value) { + _categoryId = value; + } + + set endTime(String value) { + _endTime = value; + } + + set state(int value) { + _state = value; + } + + set isDelete(int value) { + _isDelete = value; + } + + set isHot(bool value) { + _isHot = value; + } + + set storeName(dynamic value) { + _storeName = value; + } } \ No newline at end of file diff --git a/lib/retrofit/data/message.dart b/lib/retrofit/data/message.dart index cc9a30d3..395b2bea 100644 --- a/lib/retrofit/data/message.dart +++ b/lib/retrofit/data/message.dart @@ -1,44 +1,18 @@ -/// id : "1420215467561189376" -/// createTime : "2021-07-28 10:58:26" +/// id : "1483062749750624256" +/// createTime : "2022-01-17 21:04:48" /// createUser : "0" -/// updateTime : "2021-07-28 10:58:29" +/// updateTime : "2022-01-17 21:04:48" /// updateUser : "0" -/// mid : "1406879717390286848" -/// title : "充值成功" -/// content : "你于2021-07-28 10:52:02充值0.01元,当前余额:0.08元。" -/// typed : 3 -/// relational : "" -/// state : 1 +/// mid : "1478548672881885184" +/// title : "粉丝关注" +/// content : "哈哈哈关注了你!" +/// typed : 4 +/// relational : "{\"businessId\":1483062749356359680,\"mid\":1379254113602109440,\"avatar\":\"https://pos.upload.gznl.top/admin/2021/08/1f8d55ed-85d2-42a2-b155-6737a66226e8.jpg\",\"typed\":\"MEMBER\",\"nickname\":\"哈哈哈\",\"action\":\"FOLLOW\",\"receiveMid\":1478548672881885184}" +/// state : 0 /// isDelete : 0 +/// followed : false class Message { - - String _id; - String _createTime; - String _createUser; - String _updateTime; - String _updateUser; - String _mid; - String _title; - String _content; - int _typed; - String _relational; - int _state; - int _isDelete; - - String get id => _id; - String get createTime => _createTime; - String get createUser => _createUser; - String get updateTime => _updateTime; - String get updateUser => _updateUser; - String get mid => _mid; - String get title => _title; - String get content => _content; - int get typed => _typed; - String get relational => _relational; - int get state => _state; - int get isDelete => _isDelete; - Message({ String id, String createTime, @@ -51,7 +25,8 @@ class Message { int typed, String relational, int state, - int isDelete}){ + int isDelete, + bool followed,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -64,37 +39,67 @@ class Message { _relational = relational; _state = state; _isDelete = isDelete; + _followed = followed; } Message.fromJson(dynamic json) { - _id = json["id"]; - _createTime = json["createTime"]; - _createUser = json["createUser"]; - _updateTime = json["updateTime"]; - _updateUser = json["updateUser"]; - _mid = json["mid"]; - _title = json["title"]; - _content = json["content"]; - _typed = json["typed"]; - _relational = json["relational"]; - _state = json["state"]; - _isDelete = json["isDelete"]; + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _mid = json['mid']; + _title = json['title']; + _content = json['content']; + _typed = json['typed']; + _relational = json['relational']; + _state = json['state']; + _isDelete = json['isDelete']; + _followed = json['followed']; } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _mid; + String _title; + String _content; + int _typed; + String _relational; + int _state; + int _isDelete; + bool _followed; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get mid => _mid; + String get title => _title; + String get content => _content; + int get typed => _typed; + String get relational => _relational; + int get state => _state; + int get isDelete => _isDelete; + bool get followed => _followed; Map toJson() { - var map = {}; - map["id"] = _id; - map["createTime"] = _createTime; - map["createUser"] = _createUser; - map["updateTime"] = _updateTime; - map["updateUser"] = _updateUser; - map["mid"] = _mid; - map["title"] = _title; - map["content"] = _content; - map["typed"] = _typed; - map["relational"] = _relational; - map["state"] = _state; - map["isDelete"] = _isDelete; + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['mid'] = _mid; + map['title'] = _title; + map['content'] = _content; + map['typed'] = _typed; + map['relational'] = _relational; + map['state'] = _state; + map['isDelete'] = _isDelete; + map['followed'] = _followed; return map; } diff --git a/lib/retrofit/data/msg_stats.dart b/lib/retrofit/data/msg_stats.dart new file mode 100644 index 00000000..cb3f4d17 --- /dev/null +++ b/lib/retrofit/data/msg_stats.dart @@ -0,0 +1,29 @@ +/// name : "4" +/// number : 8 + +class MsgStats { + MsgStats({ + String name, + int number,}){ + _name = name; + _number = number; +} + + MsgStats.fromJson(dynamic json) { + _name = json['name']; + _number = json['number']; + } + String _name; + int _number; + + String get name => _name; + int get number => _number; + + Map toJson() { + final map = {}; + map['name'] = _name; + map['number'] = _number; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index c62ed445..24fa7fba 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -36,6 +36,7 @@ import 'data/headlines_list_details.dart'; import 'data/logistics.dart'; import 'data/member_comment_list.dart'; import 'data/message.dart'; +import 'data/msg_stats.dart'; import 'data/page.dart'; import 'data/rank.dart'; import 'data/second_card_list.dart'; @@ -53,8 +54,8 @@ 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://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 @@ -62,12 +63,15 @@ part 'retrofit_api.g.dart'; // 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.159:8766/app/"; ///费韬 +// const baseUrl = "http://192.168.10.159: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.142:8766/app/";///詹云久 -const baseUrl = "http://192.168.10.142:8766/app/";///詹云久 +// const base_url = "http://192.168.10.142:8766/app/";///詹云久 +// const baseUrl = "http://192.168.10.142:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { @@ -345,6 +349,10 @@ abstract class ApiService { @GET("/app-msg/{id}") Future queryMsg(@Path("id") String id); + ///App消息 统计各类消息数量 + @GET("/app-msg/stats") + Future>> stats(); + ///给文章/活动点赞 @GET("/information/likes/{id}") Future informationLikes(@Path("id") String id); @@ -396,7 +404,6 @@ abstract class ApiService { @POST("/member/follow/list") Future>> followList(@Body() Map map); - ///关注/取关会员 @PUT("/member/follow/{followId}") Future follow(@Path("followId") String followId); diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 1e3aebc3..5735110a 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.142:8766/app/'; + baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; } final Dio _dio; @@ -1032,6 +1032,28 @@ class _ApiService implements ApiService { return value; } + @override + Future>> stats() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/app-msg/stats', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => MsgStats.fromJson(i as Map)) + .toList()); + return value; + } + @override Future> informationLikes(id) async { ArgumentError.checkNotNull(id, 'id'); diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index 4b7e12c1..67529d5b 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -134,7 +134,7 @@ class _SettlementOrderCommodity extends State { margin: EdgeInsets.only( left: 16.w, ), - height: 44.h, + // height: 44.h, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 2e9a186c..42bae5f3 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -313,7 +313,7 @@ class _StoreOrderPage extends State ], ), ), - top: 110.h, + top: 100.h, bottom: 0, left: 0, right: 0, diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index e7cd4870..cf0e46be 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -30,7 +30,7 @@ class _StoreInfoView extends State { top: 5.h, bottom: 6.h, ), - height: 138.h, + height: 140.h, padding: EdgeInsets.all(12.w), decoration: BoxDecoration( color: Colors.white, diff --git a/lib/view_widget/item_input_widget.dart b/lib/view_widget/item_input_widget.dart index c79ba14f..a5e15006 100644 --- a/lib/view_widget/item_input_widget.dart +++ b/lib/view_widget/item_input_widget.dart @@ -147,7 +147,8 @@ class ItemInputWidget extends StatelessWidget { margin: EdgeInsets.only(left: 5, bottom: 12.h), ), Container( - height: 0.035.sh, + // height: 0.035.sh, + margin: EdgeInsets.only(bottom:10.h), child: TextField( controller: controller, style: style, diff --git a/lib/view_widget/request_permission.dart b/lib/view_widget/request_permission.dart index 9558dd43..e02beb4d 100644 --- a/lib/view_widget/request_permission.dart +++ b/lib/view_widget/request_permission.dart @@ -37,7 +37,9 @@ class _RequestPermission extends State { type: MaterialType.transparency, child: Center( child: Container( - width: widget.width ?? 0.7867.sw, + // width: widget.width ?? 0.7867.sw, + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w), decoration: BoxDecoration( color: Colors.white, @@ -50,8 +52,8 @@ class _RequestPermission extends State { children: [ Image.asset( widget.src, - width: 0.7867.sw * 0.6, - height: 0.7867.sw * 0.6 * 0.7, + // width: 0.7867.sw * 0.6, + // height: 0.7867.sw * 0.6 * 0.7, fit: BoxFit.fill, ), SizedBox(