From 25184b5e88d85534ab433180162bf5fffac3ea96 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Wed, 2 Mar 2022 14:53:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E7=BE=A4=E6=96=B0=E5=A2=9E=E6=9B=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_child_page.dart | 6 +- .../community_view/class_list_view.dart | 2 +- .../community_view/community_dynamic.dart | 135 ++- lib/community/community_view/home_class.dart | 2 +- lib/community/new_community_details.dart | 4 +- lib/community/release_dynamic.dart | 252 +++--- lib/home/home_page.dart | 12 +- lib/main.dart | 4 +- lib/mine/edit_signature.dart | 99 +++ lib/mine/mine_page.dart | 2 +- lib/mine/mine_view/mine_item.dart | 60 +- lib/mine/personal_page.dart | 832 +++++++++++++++--- lib/mine/recharge_page.dart | 1 + lib/mine/release_page.dart | 5 +- lib/mine/user_info_page.dart | 61 +- lib/retrofit/data/article.dart | 426 +++++---- lib/retrofit/data/comunity_comment.dart | 39 +- lib/retrofit/data/member_Infor.dart | 134 +++ lib/retrofit/data/user_info.dart | 10 +- lib/retrofit/min_api.dart | 4 +- lib/retrofit/retrofit_api.dart | 15 +- lib/retrofit/retrofit_api.g.dart | 21 + lib/settlement/settlement.dart | 5 +- lib/store/store_order.dart | 2 - lib/web/web_view/web_content.dart | 2 +- 25 files changed, 1657 insertions(+), 478 deletions(-) create mode 100644 lib/mine/edit_signature.dart create mode 100644 lib/retrofit/data/member_Infor.dart diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 6747abf6..968a0140 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -62,6 +62,7 @@ class _CommunityChildPage extends State with AutomaticKeepAl } else pageNum = 1; BaseData> baseData = await apiService.trendList({ + "mid":"", "onlyFollow": widget.typeStr == "关注" ? true : false, "onlyMe": false, "pageNum": pageNum, @@ -83,11 +84,12 @@ class _CommunityChildPage extends State with AutomaticKeepAl article.id = element.id; article.content = jsonEncode(element.subjectInfo); article.mainTitle =element.subject; - article.isFollow = element.selfFollow; + article.followed = element.selfFollow; article.authorHeadImg = element.memberInfo?.avatar; article.authorName = element.memberInfo?.nickname; + article.location = element.location; article.createTime = element.createTime; - article.updateUser = element.memberInfo?.mid; + article.author = element.memberInfo?.mid; article.viewers = element?.viewers; article.likes = element?.likes; article.comments = element?.comments; diff --git a/lib/community/community_view/class_list_view.dart b/lib/community/community_view/class_list_view.dart index 4622a8e8..1d98a33f 100644 --- a/lib/community/community_view/class_list_view.dart +++ b/lib/community/community_view/class_list_view.dart @@ -94,7 +94,7 @@ class _ClassListView extends State { child: ClipRRect( child: Opacity( - opacity: 0.6, + opacity: 0.7, child:MImage( classList.coverImg, width: double.infinity, diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 6e894817..ec888c6b 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -14,7 +14,11 @@ 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:huixiang/view_widget/share_dialog.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:sharesdk_plugin/sharesdk_defines.dart'; +import 'package:sharesdk_plugin/sharesdk_interface.dart'; +import 'package:sharesdk_plugin/sharesdk_map.dart'; import 'package:video_player/video_player.dart'; import '../photo_view_gallery_screen.dart'; @@ -121,7 +125,7 @@ class _CommunityDynamic extends State { alignment: Alignment.center); setState(() {}); } else { - // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } } @@ -172,16 +176,19 @@ class _CommunityDynamic extends State { children: [ GestureDetector( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PhotoViewGalleryScreen( - images: [(widget?.article?.authorHeadImg ?? "").isEmpty? - "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":widget?.article?.authorHeadImg - ], //传入图片list - index: 0, //传入当前点击的图片的index - ), - )); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => PhotoViewGalleryScreen( + // images: [(widget?.article?.authorHeadImg ?? "").isEmpty? + // "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":widget?.article?.authorHeadImg + // ], //传入图片list + // index: 0, //传入当前点击的图片的index + // ), + // )); + Navigator.of(context).pushNamed('/router/personal_page', + arguments:{"memberId":(widget.article.author == widget.userId) ? "0" :widget.article.author, + }); }, child: MImage( @@ -222,14 +229,14 @@ class _CommunityDynamic extends State { ], ), ), - if (widget?.article?.updateUser != widget.userId ?? "") + if (widget?.article?.author != widget.userId ?? "") GestureDetector( onTap: () { setState(() { if (widget.commentType == 0) { - widget.article.isFollow = !(widget.article.isFollow ?? false); - _vipFollow(widget.article.updateUser, - widget.article.isFollow ?? false); + widget.article.followed = !(widget.article.followed ?? false); + _vipFollow(widget.article.author, + widget.article.followed ?? false); } else { showDeleteDialog(); } @@ -242,21 +249,21 @@ class _CommunityDynamic extends State { alignment: Alignment.center, child: RoundButton( height: 25.h, - backgroup: (widget?.article?.isFollow ?? false) + backgroup: (widget?.article?.followed ?? false) ? Color(0xFFE6E6E6) : Color(0xFF32A060), - textColor: (widget?.article?.isFollow ?? false) + textColor: (widget?.article?.followed ?? false) ? Color(0xFF808080) : Colors.white, - text: (widget?.article?.isFollow ?? false) + text: (widget?.article?.followed ?? false) ? "已关注" : "关注", radius: 20, icons: Icon( - (widget?.article?.isFollow ?? false) + (widget?.article?.followed ?? false) ? Icons.check : Icons.add, - color: (widget?.article?.isFollow ?? false) + color: (widget?.article?.followed ?? false) ? Color(0xFF808080) : Colors.white, size: 15, @@ -287,9 +294,34 @@ class _CommunityDynamic extends State { ), ), buildMedia(widget?.article?.content), + SizedBox( + height:5.h, + ), + if(widget.article.location != "") + Row( + children: [ + Icon( + Icons.place, + size: 16, + color: Color(0xFFB3B2B2), + ), + SizedBox(width:2,), + Expanded(child: + Text( + widget?.article?.location ?? "", + overflow:TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize:12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFB3B2B2), + ), + )), + ], + ), if (!widget.isDetails) SizedBox( - height: 12.h, + height:5.h, ), if (!widget.isDetails) Row( @@ -328,6 +360,27 @@ class _CommunityDynamic extends State { ), ), ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + share(); + }); + }, + child: Container( + // color: Colors.red, + padding: EdgeInsets.only(left:30,right:10), + // alignment: Alignment.center, + child: Text( + "...", + style: TextStyle( + fontSize:18.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + ), + ), ], ), ], @@ -341,6 +394,46 @@ class _CommunityDynamic extends State { ); } + share() async { + SSDKMap params = SSDKMap() + ..setGeneral( + widget?.article?.mainTitle, + "", + [ + jsonDecode(widget.article.content) + ], + "", + "", + buildShareUrl(), + "", + "", + "", + "", + SSDKContentTypes.webpage, + ); + + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return ShareDialog((platform) { + if (platform == ShareSDKPlatforms.line) { + params.map["type"] = SSDKContentTypes.text.value; + params.map["text"] = + "${widget.article.mainTitle} ${buildShareUrl()}"; + } + SharesdkPlugin.share(platform, params, + (state, userData, contentEntity, error) { + print("share!$state"); + }); + }); + }); + } + + String buildShareUrl() { + return "https://hx.lotus-wallet.com/index.html?id=${widget.article.id }&type=${""}"; + } + ///动态内容 Widget buildMedia(String subjectInfo) { if (subjectInfo == null || !subjectInfo.startsWith("{")) { diff --git a/lib/community/community_view/home_class.dart b/lib/community/community_view/home_class.dart index 2d960d4f..c7651740 100644 --- a/lib/community/community_view/home_class.dart +++ b/lib/community/community_view/home_class.dart @@ -149,7 +149,7 @@ class _HomeClass extends State { ), child: ClipRRect( child: Opacity( - opacity: 0.6, + opacity: 0.7, child: MImage( collect.coverImg, width: double.infinity, diff --git a/lib/community/new_community_details.dart b/lib/community/new_community_details.dart index 9c441cd3..3c5afc10 100644 --- a/lib/community/new_community_details.dart +++ b/lib/community/new_community_details.dart @@ -216,13 +216,13 @@ class _NewCommunityDetails extends State with WidgetsBindin ], ), ), - if (article?.updateUser != userId) + if (article?.author != userId) GestureDetector( onTap: () { setState(() { article.liked = !(article.liked ?? false); - _vipFollow(article.updateUser, + _vipFollow(article.author, article.liked ?? false); }); }, diff --git a/lib/community/release_dynamic.dart b/lib/community/release_dynamic.dart index 78ec8d23..1b3833a7 100644 --- a/lib/community/release_dynamic.dart +++ b/lib/community/release_dynamic.dart @@ -6,6 +6,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/upload_result.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; @@ -28,8 +29,12 @@ class _ReleaseDynamic extends State { List mediaPaths = []; bool isRelease = false; int dynamicType = 0; - TextEditingController textEditingController = TextEditingController(); + TextEditingController textController = TextEditingController(); + TextEditingController addressController = TextEditingController(); + // TextEditingController houseNumberController = TextEditingController(); ApiService apiService; + Map addressMap; + Address preAddress; @override void initState() { @@ -88,7 +93,7 @@ class _ReleaseDynamic extends State { Container( width: double.infinity, margin: EdgeInsets.all(16), - padding: EdgeInsets.only(left: 16,right: 16), + padding: EdgeInsets.only(left: 16, right: 16), child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, @@ -98,21 +103,25 @@ class _ReleaseDynamic extends State { overflow: TextOverflow.ellipsis, style: TextStyle( fontWeight: MyFontWeight.semi_bold, - fontSize:18.sp, + fontSize: 18.sp, color: Colors.red, ), ), - SizedBox(width: 10,), - Expanded(child: Text( - "用户发布内容需要等待系统审核,审核通过后才会在推荐广场展示", - maxLines:2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Colors.black, + SizedBox( + width: 10, + ), + Expanded( + child: Text( + "用户发布内容需要等待系统审核,审核通过后才会在推荐广场展示", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Colors.black, + ), ), - ),) + ) ], ), ), @@ -150,7 +159,7 @@ class _ReleaseDynamic extends State { } releaseDynamic() async { - String dynamicText = textEditingController.text; + String dynamicText = textController.text; if (dynamicText == null || dynamicText == "") { SmartDialog.showToast("请输入您此刻的想法!"); return; @@ -185,6 +194,11 @@ class _ReleaseDynamic extends State { "subjectType": subjectType, "video": remoteVideoUrl, "coverImg": remoteVideoCoverImg, + "latitude": "", + "location": addressController.text == "" + ? "" + : addressController.text, + "longitude": "", }).catchError((onError) { EasyLoading.dismiss(); }); @@ -225,10 +239,7 @@ class _ReleaseDynamic extends State { thumbnail != "" && await File(thumbnail).exists()) { BaseData baseData = await apiService.upload( - File(thumbnail), - 123123123, - dynamicType == 2 - ); + File(thumbnail), 123123123, dynamicType == 2); if (baseData != null && baseData.isSuccess) { UploadResult uploadResult = baseData.data; mediaPaths[mediaPaths.indexOf(element)].thumbPath = @@ -236,11 +247,8 @@ class _ReleaseDynamic extends State { } } } - BaseData baseData = await apiService.upload( - file, - 123123123, - dynamicType == 2 - ); + BaseData baseData = + await apiService.upload(file, 123123123, dynamicType == 2); if (baseData != null && baseData.isSuccess) { UploadResult uploadResult = baseData.data; mediaPaths[mediaPaths.indexOf(element)].remotePath = @@ -278,7 +286,6 @@ class _ReleaseDynamic extends State { ///显示图片选择方式 showImagePicker() { - FocusScope.of(context).requestFocus(FocusNode()); if (dynamicType == 1) { @@ -422,95 +429,134 @@ class _ReleaseDynamic extends State { setState(() {}); } + toMap() async { + Navigator.of(context).pushNamed('/router/address_map_page').then( + (value) => { + setState(() { + if (value != null) { + addressMap = value; + addressController.text = "${(value as Map)['cityInfo']}"; + if (preAddress != null) { + preAddress.cityInfo = addressMap['cityInfo']; + } + // houseNumberController.text = "${(value as Map)['address']}"; + } + }) + }, + ); + } + ///动态输入框 Widget buildEdit() { return Container( - height: 174.h, - margin: EdgeInsets.symmetric(horizontal: 16.w), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1.w, - color: Color(0xFFD8D8D8), - style: BorderStyle.solid, + // height: 174.h, + margin: EdgeInsets.symmetric(horizontal: 16.w), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 1.w, + color: Color(0xFFD8D8D8), + style: BorderStyle.solid, + ), ), ), - ), - child: Column( - children: [ - TextField( - controller: textEditingController, - maxLines: 5, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF4C4C4C), - ), - onChanged: (text) { - bool release = text != "" && text != null; - if (release != isRelease) { - isRelease = release; - setState(() {}); - } - }, - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 18.h, - ), - errorBorder: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - hintText: "此时此刻的想法~", - hintStyle: TextStyle( + child: Column( + children: [ + TextField( + controller: textController, + maxLines: 5, + style: TextStyle( fontSize: 14.sp, - color: Color(0xFFA29E9E), + fontWeight: MyFontWeight.medium, + color: Color(0xFF4C4C4C), ), - ), - ), - Row( - children: [ - Container( - margin: EdgeInsets.only(top: 8, right: 8), - padding: EdgeInsets.only(left:10, right:8), - height: 21.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.5), - color: Color(0xFFF2F2F2), + onChanged: (text) { + bool release = text != "" && text != null; + if (release != isRelease) { + isRelease = release; + setState(() {}); + } + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 18.h, ), - child: Row( - children: [ - Image.asset( - "assets/image/icon_union_location_black.png", - color: Color(0xFFB3B2B2), - width: 16, - height: 16, - ), - SizedBox(width:2,), - Text( - "你在哪里呢?", - overflow:TextOverflow.ellipsis, - style: TextStyle( - fontSize: 11.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFFB3B2B2), - ), + errorBorder: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + hintText: "此时此刻的想法~", + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xFFA29E9E), + ), + ), + ), + Container( + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + toMap(); + }, + child:Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon( + Icons.place, + size: 16, + color: Color(0xFFB3B2B2), + ), + SizedBox( + width: 2, + ), + Text( + addressController.text == "" + ? "你在哪里呢?" + : addressController.text , + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 11.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFB3B2B2), + ), + ), + ], ), - ], - ) + )), + addressController.text == "" + ? Container() + : GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + addressController.text = ""; + }); + }, + child: Container( + // color: Colors.red, + height: 21.h, + padding: EdgeInsets.only(left: 10, right: 10), + alignment: Alignment.centerRight, + child: Icon( + Icons.close, + color: Colors.black, + size: 16, + ), + ), + ), + ], ), - Spacer(), - Align(alignment: Alignment.centerRight, - child:Icon( - Icons.close, - color: Colors.black, - size: 16, - ),) - ], - ), - ], - ) - ); + ), + SizedBox( + height: 5, + ) + ], + )); } } diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 55ba4d15..52e69705 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -321,12 +321,12 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ), child: GestureDetector( onTap: () { - // Navigator.of(context).pushNamed('/router/system_msg_page').then((value) { - // setState(() { - // totalMsg = 0; - // }); - // }); - Navigator.of(context).pushNamed('/router/web_turntable_activity'); + Navigator.of(context).pushNamed('/router/system_msg_page').then((value) { + setState(() { + totalMsg = 0; + }); + }); + // Navigator.of(context).pushNamed('/router/web_turntable_activity'); }, child: Container( height: 24, diff --git a/lib/main.dart b/lib/main.dart index 04807350..463ebf14 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -78,6 +78,7 @@ import 'home/guide_page.dart'; import 'home/home_view/activity_list.dart'; import 'main_page.dart'; import 'message/system_details.dart'; +import 'mine/edit_signature.dart'; import 'mine/invitation_record.dart'; import 'mine/manage_address_page.dart'; import 'mine/mine_view/community_follow.dart'; @@ -299,6 +300,7 @@ Map routers = { '/router/login_page': (context, {arguments}) => LoginPage(arguments: arguments), '/router/edit_name': (context, {arguments}) => EditName(arguments: arguments), + '/router/edit_signature': (context, {arguments}) => EditSignature(arguments: arguments), '/router/mine_card_invalid': (context, {arguments}) => MineCardInvalidPage(), '/router/store_selector_page': (context, {arguments}) => StoreSelectorPage(), '/router/video_playback_page': (context, {arguments}) => VideoPlaybackPage(), @@ -348,5 +350,5 @@ Map routers = { '/router/invitation_record': (context, {arguments}) => InvitationRecord(), '/router/personal_page': (context, {arguments}) => - PersonalPage(), + PersonalPage(arguments:arguments), }; diff --git a/lib/mine/edit_signature.dart b/lib/mine/edit_signature.dart new file mode 100644 index 00000000..77a30c47 --- /dev/null +++ b/lib/mine/edit_signature.dart @@ -0,0 +1,99 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class EditSignature extends StatefulWidget { + final Map arguments; + + EditSignature({this.arguments}); + + @override + State createState() { + return _EditSignature(); + } +} + +class _EditSignature extends State { + TextEditingController _controller = TextEditingController(); + int textLength = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "个性签名", + titleColor: Colors.black, + leadingColor: Colors.black, + action: Container( + alignment: Alignment.center, + margin: EdgeInsets.only(right: 16.w), + child: GestureDetector( + onTap: () { + String signature = _controller.text; + if (signature != null && signature != "") { + Navigator.of(context).pop(signature); + } else { + SmartDialog.showToast("请输入个性签名~", alignment: Alignment.center); + } + }, + child:Container( + width: 46.w, + height: 24.h, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF319E5F), + borderRadius: BorderRadius.all(Radius.circular(4))), + child: Text( + "保存", + style: TextStyle( + color: Colors.white, + fontSize:14.sp, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + ), + body: Container( + margin: EdgeInsets.all(16), + child: Column( + children: [ + TextField( + maxLines: 5, + controller: _controller, + keyboardType: TextInputType.text, + onChanged: (value) { + setState(() { + textLength = value.length; + }); + }, + maxLength: 50, + decoration: InputDecoration( + errorBorder: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + hintText: widget.arguments['signature'], + // contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12), + hintStyle: TextStyle( + fontSize: 10.sp, + color: Color(0xFFA29E9E), + ), + ), + textInputAction: TextInputAction.next, + ), + Container( + height: 1.h, + color: Color(0xFFD8D8D8), + ), + ], + ), + ), + ); + } + + +} diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 6a3ff2dd..18e7c182 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -47,7 +47,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { return; } // await Navigator.of(context).pushNamed('/router/user_info_page'); - await Navigator.of(context).pushNamed('/router/personal_page'); + await Navigator.of(context).pushNamed('/router/personal_page',arguments:{"memberId":"0",}); setState(() {}); } diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index c3d37113..d0335c75 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -62,24 +62,27 @@ class _MineItem extends State { ), 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/releasePage', + // arguments: {}); + // }); + // }, + // child: mineItem( + // S.of(context).wodedongtai, + // "assets/image/dynamic.png", + // ), + // ), + // ), Expanded(child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { @@ -128,20 +131,20 @@ class _MineItem extends State { S.of(context).guanlidizhi, "assets/image/icon_location_address.png", ), - ),) + ),), + Expanded(child:InkWell( + onTap: () { + Navigator.of(context).pushNamed('/router/qr_share', arguments: {}); + }, + child: mineItem( + S.of(context).tuiguangma, + "assets/image/icon_mine_promotion_code.png", + ), + ),), ], ), Row( children: [ - Expanded(child:InkWell( - onTap: () { - Navigator.of(context).pushNamed('/router/qr_share', arguments: {}); - }, - child: mineItem( - S.of(context).tuiguangma, - "assets/image/icon_mine_promotion_code.png", - ), - ),), Expanded(child:InkWell( onTap: () { Navigator.of(context).pushNamed('/router/invitation_record', arguments: {}); @@ -152,6 +155,7 @@ class _MineItem extends State { ), ),), Expanded(child:Container()), + Expanded(child:Container()), Expanded(child:Container()) ], ), diff --git a/lib/mine/personal_page.dart b/lib/mine/personal_page.dart index b9f546be..3b9cab84 100644 --- a/lib/mine/personal_page.dart +++ b/lib/mine/personal_page.dart @@ -1,35 +1,283 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/community/community_view/community_dynamic.dart'; +import 'package:huixiang/community/photo_view_gallery_screen.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/comunity_comment.dart'; +import 'package:huixiang/retrofit/data/member_Infor.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/data/social_info.dart'; +import 'package:huixiang/retrofit/data/upload_result.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:image_pickers/image_pickers.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class PersonalPage extends StatefulWidget { + final Map arguments; + + PersonalPage({this.arguments}); @override State createState() { return _PersonalPage(); } } -class _PersonalPage extends State - with WidgetsBindingObserver { +class _PersonalPage extends State with WidgetsBindingObserver { ApiService apiService; final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); + var isShrink = false; + int pageNum = 1; + String userId; + List
articles = []; + MemberInfor memberInfor; + String filePath; + bool isLoadMore = false; + String memberId; + Map modifyInfo = { + "background": "" + }; @override void initState() { super.initState(); + memberId = widget.arguments["memberId"]; WidgetsBinding.instance.addObserver(this); - _onRefresh(); + SharedPreferences.getInstance().then((value) => { + apiService = ApiService(Dio(), + showLoading: true, + context: context, token: value.getString('token')), + _onRefresh(), + }); + } + + _onRefresh() async { + pageNum = 1; + setState(() { + queryCommunity(); + queryMember(memberId); + }); + } + + ///查询会员信息 + queryMember(id) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = + await apiService.memberDetail(id).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + memberInfor = baseData.data; + }); + refreshController.refreshCompleted(); + }else { + refreshController.refreshFailed(); + } + } + + ///动态列表 + queryCommunity() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + userId = value.getString('userId'); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + if(isLoadMore){ + pageNum += 1; + isLoadMore = false; + } + BaseData> baseData = await apiService.trendList({ + "mid":memberId == "0" ? userId : memberId, + "onlyFollow": false, + "onlyMe": true, + "pageNum": pageNum, + "pageSize": 10, + "searchKey": "" + }).catchError((error) { + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + + refreshController.refreshCompleted(); + refreshController.loadComplete(); + if (baseData.isSuccess) { + if (pageNum == 1) { + articles.clear(); + } + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle = element.subject; + article.followed = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.location = element.location; + article.createTime = element.createTime; + article.author = 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(); + } + } + } + + ///去编辑个人资料 + _toUserInfo() async { + SharedPreferences shared = await SharedPreferences.getInstance(); + if (shared.getString("token") == null || shared.getString("token") == "") { + Navigator.of(context) + .pushNamed('/router/login_page', arguments: {"login": "login"}); + return; + } + await Navigator.of(context).pushNamed('/router/user_info_page').then((value) { + _onRefresh(); + setState(() {}); + }); + setState(() {}); + } + + ///显示图片选择方式 + showImagePicker() { + showCupertinoModalPopup( + context: context, + builder: (contetx) { + return CupertinoActionSheet( + title: Text(S.of(context).genghuantouxiang), + actions: [ + CupertinoActionSheetAction( + child: Text(S.of(context).paizhao), + onPressed: () { + openCamera(); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), + CupertinoActionSheetAction( + child: Text(S.of(context).xiangce), + onPressed: () { + openStorage(); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), + ], + cancelButton: CupertinoActionSheetAction( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(S.of(context).quxiao), + isDestructiveAction: true, + ), + ); + }); + } + + ///拍照 + openCamera() async { + if (await Permission.camera.isGranted) { + Media medias = await ImagePickers.openCamera( + cameraMimeType: CameraMimeType.photo, + cropConfig: CropConfig( + enableCrop: true, + width: 200, + height: 200, + ), + compressSize: 500, + ); + if (medias == null) return; + filePath = medias.path; + fileUpload(); + } else { + await Permission.camera.request(); + openCamera(); + } + } + + ///打开相册 + openStorage() async { + if (await Permission.storage.isGranted) { + List medias = await ImagePickers.pickerPaths( + galleryMode: GalleryMode.image, + selectCount: 1, + showGif: true, + showCamera: false, + compressSize: 500, + uiConfig: UIConfig( + uiThemeColor: Color(0xFFFFFFFF), + ), + cropConfig: CropConfig( + enableCrop: true, + width: 200, + height: 200, + ), + ); + if (medias == null || medias.length == 0) return; + filePath = medias[0].path; + setState(() {}); + fileUpload(); + } else { + await Permission.storage.request(); + openStorage(); + } } - _onRefresh() { + ///调用修改用户信息接口 + modifyInfos() async { + var info = await apiService.editInfo(modifyInfo).catchError((onError) {}); + if (info.isSuccess) { + setState(() { + SmartDialog.showToast("用户信息修改成功", alignment: Alignment.center); + }); + _onRefresh(); + } + } + ///文件上传 + fileUpload() async { + if (filePath != null && filePath != "" && await File(filePath).exists()) { + BaseData baseData = await apiService.upload(File(filePath), 123123123,false).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + UploadResult uploadResult = baseData.data; + modifyInfo["background"] = uploadResult.url; + modifyInfos(); + } + } } @override @@ -51,112 +299,320 @@ class _PersonalPage extends State ), onRefresh: _onRefresh, onLoading: () { - _onRefresh(); + isLoadMore = true; + setState(() { + _onRefresh(); + }); }, physics: BouncingScrollPhysics(), scrollController: scrollController, child: Container( + height: double.infinity, child: SingleChildScrollView( physics: BouncingScrollPhysics(), - child: Container( - color: Color(0xFFF7F7F7), - child:Column( - children: [ - Stack( - alignment: Alignment.bottomLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + alignment: Alignment.bottomLeft, + children: [ + Container( + height: 286, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Stack( + children: [ + Positioned( + child: Container( + color: Colors.black, + child: Opacity( + opacity: 0.9, + child: MImage( + memberInfor?.background ?? "", + 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( + top: 50.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.transparent, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.png", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ], + ), + if(memberId == "0") + Positioned( + bottom: 49.h, + right: 16.w, + child:GestureDetector( + onTap: (){ + showImagePicker(); + }, + child:Container( + padding: EdgeInsets.only(left: 2, right: 2), + width: 59.w, + height: 21.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0x80000000), + ), + child: Text( + "更换背景", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFFFFFFF), + ), + ), + ), + ), + ), + ], + ), + ), + homeInfo(), + ], + ), + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - // height: 286, - child: - Stack( - alignment: Alignment.bottomCenter, - children: [ - Stack( + margin: EdgeInsets.only( + left: 86, top: 12, right: 16), + child: GestureDetector( + onTap: () { + setState(() { + isShrink = !isShrink; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - Positioned( - child: Container( - color: Colors.black, - child:Opacity( - opacity:0.9, - child: MImage( - "", - width: double.infinity, - height: 260.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ) - ) - ) + Expanded( + flex: 1, + child: Text( + memberId == "0" ? ((memberInfor?.signature == null) ? "还未编辑个性签名~" : memberInfor?.signature ?? "") + :"个性签名: ${memberInfor?.signature ?? "还未编辑个性签名~"}", + overflow: isShrink + ? TextOverflow.visible + : TextOverflow.ellipsis, + maxLines: isShrink ? 10 : 2, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF868686), + fontWeight: + MyFontWeight.regular, + height: 1.5), + )), + Icon( + (isShrink != null && !isShrink) + ? Icons.chevron_right + : Icons.keyboard_arrow_up, + color: Colors.black, + size: 18, ), - Container( - margin: EdgeInsets.only( - top: 50.h, left: 16.w, right: 16.w), - decoration: BoxDecoration( + ], + ), + )), + Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( color: Colors.transparent, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - GestureDetector( - child: Image.asset( - "assets/image/integral_return.png", - width: 24, - height: 24, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null ? memberInfor.follow.toString() : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: + MyFontWeight.semi_bold, + ), ), - onTap: () { - Navigator.of(context).pop(); - }, - ), - ], - ), - ), - ], + SizedBox( + height: 4, + ), + Text( + S.of(context).guanzhu, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: + MyFontWeight.regular, + ), + ), + ], + )), + ), ), - Container( - child: Column( - children: [ - Padding(padding:EdgeInsets.only(right:16.w,bottom:16.h), - child: Row( - children: [ - Spacer(), - Container( - margin: EdgeInsets.only(top: 8, right: 8), - padding: EdgeInsets.only(left: 2, right: 2), - width: 59.w, - height: 21.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0x80000000), - ), - child: Text( - "更换背景", - overflow:TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFFFFFFF), - ), - ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null ? memberInfor.fans.toString() : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: + MyFontWeight.semi_bold, ), - ], - )), - - ], + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).fensi, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: + MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.trendTotal??0).toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: + MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + "动态", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: + MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.gainLikeTotal ?? 0).toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: + MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + "获赞", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: + MyFontWeight.regular, + ), + ), + ], + )), ), ), ], ), ), - // homeInfo(), + Container( + margin: EdgeInsets.all(16), + height: 1.h, + color: Color(0xFFF7F7F7), + ), + Padding( + padding: EdgeInsets.only(left: 16), + child: Text( + memberId != "0" ? + "TA的动态": + "我的动态", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )), + dynamicList() ], ), - ], - ), + ), + ], ), ), ), @@ -171,23 +627,201 @@ class _PersonalPage extends State ); } - Widget homeInfo(){ + Widget homeInfo() { return Container( - margin: EdgeInsets.only(left: 16), + margin: EdgeInsets.only( + left: 16, + right: 16, + ), child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - MImage( - "", - isCircle: true, - width: 66, - height: 66, - fit: BoxFit.cover, - errorSrc: "assets/image/default_user.png", - fadeSrc: "assets/image/default_user.png", + GestureDetector( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: [(memberInfor?.headimg ?? "").isEmpty? + "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":memberInfor?.headimg + ], //传入图片list + index: 0, //传入当前点击的图片的index + ), + )); + }, + child: MImage( + memberInfor?.headimg ?? "", + isCircle: true, + width: 66, + height: 66, + fit: BoxFit.cover, + errorSrc: "assets/image/default_user.png", + fadeSrc: "assets/image/default_user.png", + ), + ), + SizedBox(width: 10.w), + Text( + memberInfor?.nickname ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), ), + SizedBox(width: 4.w), + Image.asset( + "assets/image/vip_yk.png", + width: 20, + height: 20, + ), + Spacer(), + if(memberId == "0") + GestureDetector( + onTap: () { + setState(() { + _toUserInfo(); + }); + }, + child: Container( + padding: EdgeInsets.only(left: 6, right: 6, bottom: 2, top: 2), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Color(0xFF353535), + style: BorderStyle.solid, + ), + ), + child: Text( + "编辑个人资料", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ), + ) + // 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, + // ), + // ) + // // 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, + // // ), + // // ), + // // ], + // // ), + // // ) + // ) ], ), ); } + Widget dynamicList() { + return Container( + color: Color(0xFFFFFFFF), + child: (articles == null || articles.length == 0)? NoDataView( + src: "assets/image/dong_tai.png", + isShowBtn: false, + text: "目前暂无发布动态,要把开心的事讲出来哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(left: 60.w,right: 60.w), + ):ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return InkWell( + child: CommunityDynamic( + articles[position], + memberId == "0" ? 1 : 0, + exitFull: () { + setState(() { + _onRefresh(); + }); + }, + removalDynamic: () { + setState(() { + _onRefresh(); + }); + }, + ), + onTap: () { + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId": articles[position].id, + "userId": userId, + }, + ).then((value) { + _onRefresh(); + }); + }, + ); + }, + itemCount: articles.length, + ), + ); + } } diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index e44217cc..0f46b319 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -1,3 +1,4 @@ + import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/mine/release_page.dart b/lib/mine/release_page.dart index d38f1ba1..68ffbd42 100644 --- a/lib/mine/release_page.dart +++ b/lib/mine/release_page.dart @@ -55,6 +55,7 @@ class _ReleasePage extends State { } pageNum += 1; BaseData> baseData = await apiService.trendList({ + "mid":"", "onlyFollow": false, "onlyMe": true, "pageNum": pageNum, @@ -76,11 +77,11 @@ class _ReleasePage extends State { article.id = element.id; article.content = jsonEncode(element.subjectInfo); article.mainTitle =element.subject; - article.isFollow = element.selfFollow; + article.followed = element.selfFollow; article.authorHeadImg = element.memberInfo?.avatar; article.authorName = element.memberInfo?.nickname; article.createTime = element.createTime; - article.updateUser = element.memberInfo?.mid; + article.author = element.memberInfo?.mid; article.viewers = element?.viewers; article.likes = element?.likes; article.comments = element?.comments; diff --git a/lib/mine/user_info_page.dart b/lib/mine/user_info_page.dart index e774a7aa..53e495c0 100644 --- a/lib/mine/user_info_page.dart +++ b/lib/mine/user_info_page.dart @@ -10,6 +10,7 @@ import 'package:huixiang/retrofit/data/upload_result.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/cupertino_date_picker.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -33,7 +34,8 @@ class _UserInfoPage extends State { "birth": "", "headimg": "", "nickname": "", - "sex": "" + "sex": "", + "signature":"" }; @override @@ -44,6 +46,7 @@ class _UserInfoPage extends State { user = UserInfo.fromJson(jsonDecode(value.getString('user'))), mobile = value.getString('mobile'), modifyInfo["nickname"] = user.nickname, + modifyInfo["signature"] = user.signature, modifyInfo["birth"] = user.birth, modifyInfo["headimg"] = user.headimg, modifyInfo["sex"] = user.sex, @@ -173,17 +176,24 @@ class _UserInfoPage extends State { child: avatarItem(1, (modifyInfo["nickname"]) == "" ? "回乡" : modifyInfo["nickname"]), ), + InkWell( + onTap: () { + editSignature(); + }, + child:avatarItem(2, + (modifyInfo["signature"]) == "" ? "还未编辑个性签名~" : modifyInfo["signature"]), + ), InkWell( onTap:(modifyInfo["birth"] == "")?showDateSelector:(){}, child: avatarItem( - 2, + 3, (modifyInfo["birth"] != null && modifyInfo["birth"] != "") ? modifyInfo["birth"] : S.of(context).wanshanshengrixinxi_yhq), ), - avatarItem(3, mobile), + avatarItem(4, mobile), avatarItem( - 4, + 5, (age == null || age == "") ? S.of(context).wanshanshengrixinxi_nl : S.of(context).sui(age)), @@ -202,9 +212,20 @@ class _UserInfoPage extends State { } } + editSignature() async { + dynamic signature = await Navigator.of(context).pushNamed('/router/edit_signature', + arguments: {"signature": modifyInfo['signature']}); + if (signature != null && signature != "") { + modifyInfo["signature"] = signature; + setState(() {}); + modifyInfos(); + } + } + List itemLefts = [ S.current.touxiang, S.current.yonghuming, + "个性签名", S.current.wodeshengri, S.current.shoujihao, S.current.wodenianling, @@ -347,6 +368,9 @@ class _UserInfoPage extends State { modifyInfos() async { var info = await apiService.editInfo(modifyInfo).catchError((onError) {}); if (info.isSuccess) { + SharedPreferences.getInstance().then((value){ + value.setString('user', jsonEncode(modifyInfo)); + }); setState(() { SmartDialog.showToast("用户信息修改成功", alignment: Alignment.center); }); @@ -365,6 +389,8 @@ class _UserInfoPage extends State { } } + + Widget avatarItem(type, value) { print("object: $value"); return Container( @@ -383,7 +409,8 @@ class _UserInfoPage extends State { flex: 1, ), buildValue(type, value), - if (type != 4 && type != 3 && (((modifyInfo["birth"] == "")) || type != 2)) valueEnd(), + if (type != 5 && type != 4 && type != 3 && (((modifyInfo["birth"] == "")) || type != 3)) + valueEnd(), ], ), ); @@ -391,17 +418,10 @@ class _UserInfoPage extends State { Widget valueEnd() { return Container( - child: Row( - children: [ - SizedBox( - width: 8.w, - ), - Icon( - Icons.keyboard_arrow_right, - size: 20.sp, - ) - ], - ), + child: Icon( + Icons.keyboard_arrow_right, + size: 20.sp, + ) ); } @@ -433,6 +453,8 @@ class _UserInfoPage extends State { } else if (type == 1) { return Text( value, + maxLines: 1, + overflow:TextOverflow.ellipsis, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 14.sp, @@ -440,14 +462,17 @@ class _UserInfoPage extends State { ), ); } else { - return Text( + return Expanded(child: Text( value, + maxLines: 1, + overflow:TextOverflow.ellipsis, + textAlign: TextAlign.right, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 14.sp, color: Color(0xFF727272), ), - ); + )); } } } diff --git a/lib/retrofit/data/article.dart b/lib/retrofit/data/article.dart index 5af314d9..e1a3be86 100644 --- a/lib/retrofit/data/article.dart +++ b/lib/retrofit/data/article.dart @@ -1,269 +1,359 @@ import 'dart:convert'; -import 'package:huixiang/retrofit/data/author.dart'; - +import 'author.dart'; + +/// id : "1498607093517647872" +/// createTime : "2022-03-01 18:32:29" +/// createUser : "1495959790726152192" +/// updateTime : "2022-03-01 18:45:04" +/// updateUser : "1495959790726152192" +/// storeId : "0" +/// categoryId : "0" +/// mainTitle : "哈哈哈哈" +/// viceTitle : null +/// content : "{\"images\":[],\"video\":\"\",\"type\":\"text\"}" +/// coverImg : "" +/// author : "1495959790726152192" +/// type : 3 +/// likes : 0 +/// viewers : 2 +/// startTime : "2022-03-01 18:32:28" +/// endTime : "2121-03-01 18:32:28" +/// isHot : false +/// state : 1 +/// location : "" +/// longitude : "0.000000" +/// latitude : "0.000000" +/// remark : "" +/// isDelete : 0 +/// tenantCode : "" +/// storeName : null +/// liked : false +/// followed : false +/// comments : null +/// authorName : "小帽子" +/// authorHeadImg : "https://pos.upload.gznl.top/admin/2022/02/5877a3fe-0d25-405b-a86b-7bac293ab048.jpeg" class Article { + Article({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String categoryId, + String mainTitle, + dynamic viceTitle, + String content, + String coverImg, + dynamic author, + int type, + int likes, + int viewers, + String startTime, + String endTime, + bool isHot, + int state, + String location, + String longitude, + String latitude, + String remark, + int isDelete, + String tenantCode, + dynamic storeName, + bool liked, + bool followed, + dynamic comments, + String authorName, + String authorHeadImg,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _categoryId = categoryId; + _mainTitle = mainTitle; + _viceTitle = viceTitle; + _content = content; + _coverImg = coverImg; + _author = author; + _type = type; + _likes = likes; + _viewers = viewers; + _startTime = startTime; + _endTime = endTime; + _isHot = isHot; + _state = state; + _location = location; + _longitude = longitude; + _latitude = latitude; + _remark = remark; + _isDelete = isDelete; + _tenantCode = tenantCode; + _storeName = storeName; + _liked = liked; + _followed = followed; + _comments = comments; + _authorName = authorName; + _authorHeadImg = authorHeadImg; + } + + Article.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _categoryId = json['categoryId']; + _mainTitle = json['mainTitle']; + _viceTitle = json['viceTitle']; + _content = json['content']; + _coverImg = json['coverImg']; + _author = json["author"] == null ? author : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):json["author"]; + _type = json['type']; + _likes = json['likes']; + _viewers = json['viewers']; + _startTime = json['startTime']; + _endTime = json['endTime']; + _isHot = json['isHot']; + _state = json['state']; + _location = json['location']; + _longitude = json['longitude']; + _latitude = json['latitude']; + _remark = json['remark']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + _storeName = json['storeName']; + _liked = json['liked']; + _followed = json['followed']; + _comments = json['comments']; + _authorName = json['authorName']; + _authorHeadImg = json['authorHeadImg']; + } String _id; String _createTime; - dynamic _createUser; + String _createUser; String _updateTime; - dynamic _updateUser; + String _updateUser; String _storeId; + String _categoryId; String _mainTitle; dynamic _viceTitle; String _content; String _coverImg; dynamic _author; int _type; + int _likes; + int _viewers; String _startTime; - String _categoryId; String _endTime; + bool _isHot; int _state; + String _location; + String _longitude; + String _latitude; + String _remark; int _isDelete; - int _likes; - bool _isHot; + String _tenantCode; + dynamic _storeName; bool _liked; - int _viewers; - int _comments; + bool _followed; + dynamic _comments; String _authorName; String _authorHeadImg; - bool isFollow; - dynamic _storeName; String get id => _id; String get createTime => _createTime; - dynamic get createUser => _createUser; + String get createUser => _createUser; String get updateTime => _updateTime; - dynamic get updateUser => _updateUser; + String get updateUser => _updateUser; String get storeId => _storeId; + String get categoryId => _categoryId; String get mainTitle => _mainTitle; dynamic get viceTitle => _viceTitle; String get content => _content; String get coverImg => _coverImg; dynamic get author => _author; int get type => _type; + int get likes => _likes; + int get viewers => _viewers; String get startTime => _startTime; - String get categoryId => _categoryId; String get endTime => _endTime; + bool get isHot => _isHot; int get state => _state; + String get location => _location; + String get longitude => _longitude; + String get latitude => _latitude; + String get remark => _remark; int get isDelete => _isDelete; - int get likes => _likes; - bool get isHot => _isHot; + String get tenantCode => _tenantCode; + dynamic get storeName => _storeName; bool get liked => _liked; - int get viewers => _viewers; - int get comments => _comments; + bool get followed => _followed; + dynamic get comments => _comments; String get authorName => _authorName; String get authorHeadImg => _authorHeadImg; - dynamic get storeName => _storeName; - set id(String value) { - _id = value; + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['categoryId'] = _categoryId; + map['mainTitle'] = _mainTitle; + map['viceTitle'] = _viceTitle; + map['content'] = _content; + map['coverImg'] = _coverImg; + map["author"] = _author.toJson() ?? _author; + map['type'] = _type; + map['likes'] = _likes; + map['viewers'] = _viewers; + map['startTime'] = _startTime; + map['endTime'] = _endTime; + map['isHot'] = _isHot; + map['state'] = _state; + map['location'] = _location; + map['longitude'] = _longitude; + map['latitude'] = _latitude; + map['remark'] = _remark; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + map['storeName'] = _storeName; + map['liked'] = _liked; + map['followed'] = _followed; + map['comments'] = _comments; + map['authorName'] = _authorName; + map['authorHeadImg'] = _authorHeadImg; + return map; } - set likes(int value) { - _likes = value; + set authorHeadImg(String value) { + _authorHeadImg = value; + } + + set authorName(String value) { + _authorName = value; + } + + set comments(dynamic value) { + _comments = value; + } + + set followed(bool value) { + _followed = value; } set liked(bool value) { _liked = value; } - set viewers(int value) { - _viewers = value; + set storeName(dynamic value) { + _storeName = value; } - set comments(int value) { - _comments = value; + set tenantCode(String value) { + _tenantCode = value; } - set authorName(String value) { - _authorName = value; + set isDelete(int value) { + _isDelete = value; } - set authorHeadImg(String value) { - _authorHeadImg = value; + set remark(String value) { + _remark = value; } - Article({ - 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 likes, - bool isHot, - int viewers, - int comments, - String authorName, - String authorHeadImg, - - dynamic storeName}){ - _id = id; - _createTime = createTime; - _createUser = createUser; - _updateTime = updateTime; - _updateUser = updateUser; - _storeId = storeId; - _mainTitle = mainTitle; - _viceTitle = viceTitle; - _content = content; - _coverImg = coverImg; - _author = author; - _type = type; - _startTime = startTime; - _categoryId = categoryId; - _endTime = endTime; - _state = state; - _isDelete = isDelete; - _likes = likes; - _isHot = isHot; - _liked = liked; - _viewers = viewers; - _comments = comments; - _authorName = authorName; - _authorHeadImg = authorHeadImg; - _storeName = storeName; -} + set latitude(String value) { + _latitude = value; + } - Article.fromJson(dynamic json) { - _id = json["id"]; - _createTime = json["createTime"]; - _createUser = json["createUser"]; - _updateTime = json["updateTime"]; - _updateUser = json["updateUser"]; - _storeId = json["storeId"]; - _mainTitle = json["mainTitle"]; - _viceTitle = json["viceTitle"]; - _content = json["content"]; - _coverImg = json["coverImg"]; - _author = json["author"] == null ? null : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):null; - _type = json["type"]; - _startTime = json["startTime"]; - _categoryId = json["categoryId"]; - _endTime = json["endTime"]; - _state = json["state"]; - _isDelete = json["isDelete"]; - _likes = json["likes"]; - _isHot = json["isHot"]; - _liked = json["liked"]; - _viewers = json["viewers"]; - _comments = json["comments"]; - _authorName = json["authorName"]; - _authorHeadImg = json["authorHeadImg"]; - _storeName = json["storeName"]; + set longitude(String value) { + _longitude = value; } - Map toJson() { - var map = {}; - map["id"] = _id; - map["createTime"] = _createTime; - map["createUser"] = _createUser; - map["updateTime"] = _updateTime; - map["updateUser"] = _updateUser; - map["storeId"] = _storeId; - map["mainTitle"] = _mainTitle; - map["viceTitle"] = _viceTitle; - map["content"] = _content; - map["coverImg"] = _coverImg; - map["author"] = _author.toJson(); - map["type"] = _type; - map["startTime"] = _startTime; - map["categoryId"] = _categoryId; - map["endTime"] = _endTime; - map["state"] = _state; - map["isDelete"] = _isDelete; - map["likes"] = _likes; - map["isHot"] = _isHot; - map["liked"] = _liked; - map["viewers"] = _viewers; - map["comments"] = _comments; - map["authorName"] = _authorName; - map["authorHeadImg"] = _authorHeadImg; - map["storeName"] = _storeName; - return map; + set location(String value) { + _location = value; } - set createTime(String value) { - _createTime = value; + set state(int value) { + _state = value; } - set createUser(dynamic value) { - _createUser = value; + set isHot(bool value) { + _isHot = value; } - set updateTime(String value) { - _updateTime = value; + set endTime(String value) { + _endTime = value; } - set updateUser(dynamic value) { - _updateUser = value; + set startTime(String value) { + _startTime = value; } - set storeId(String value) { - _storeId = value; + set viewers(int value) { + _viewers = value; } - set mainTitle(String value) { - _mainTitle = value; + set likes(int value) { + _likes = value; } - set viceTitle(dynamic value) { - _viceTitle = value; + set type(int value) { + _type = value; } - set content(String value) { - _content = value; + set author(dynamic value) { + _author = value; } set coverImg(String value) { _coverImg = value; } - set author(dynamic value) { - _author = value; + set content(String value) { + _content = value; } - set type(int value) { - _type = value; + set viceTitle(dynamic value) { + _viceTitle = value; } - set startTime(String value) { - _startTime = value; + set mainTitle(String value) { + _mainTitle = value; } set categoryId(String value) { _categoryId = value; } - set endTime(String value) { - _endTime = value; + set storeId(String value) { + _storeId = value; } - set state(int value) { - _state = value; + set updateUser(String value) { + _updateUser = value; } - set isDelete(int value) { - _isDelete = value; + set updateTime(String value) { + _updateTime = value; } - set isHot(bool value) { - _isHot = value; + set createUser(String value) { + _createUser = value; } - set storeName(dynamic value) { - _storeName = value; + set createTime(String value) { + _createTime = value; + } + + set id(String value) { + _id = value; } } \ No newline at end of file diff --git a/lib/retrofit/data/comunity_comment.dart b/lib/retrofit/data/comunity_comment.dart index 3cb78955..ba218cd3 100644 --- a/lib/retrofit/data/comunity_comment.dart +++ b/lib/retrofit/data/comunity_comment.dart @@ -11,16 +11,19 @@ class ComunityComment { ComunityComment({ - String id, - String subject, - SubjectInfo subjectInfo, - MemberInfo memberInfo, - int likes, - int viewers, - int comments, - bool selfLike, + String id, + String subject, + SubjectInfo subjectInfo, + MemberInfo memberInfo, + int likes, + int viewers, + int comments, + bool selfLike, bool selfFollow, String createTime, + String location, + String longitude, + String latitude, String coverImg,}){ this.id = id; this.subject = subject; @@ -32,6 +35,9 @@ class ComunityComment { this.selfLike = selfLike; this.selfFollow = selfFollow; this.createTime = createTime; + this.location = location; + this.longitude = longitude; + this.latitude = latitude; this.coverImg = coverImg; } @@ -46,6 +52,9 @@ class ComunityComment { this.selfLike = json['selfLike']; this.selfFollow = json['selfFollow']; this.createTime = json['createTime']; + this.location = json['location']; + this.longitude = json['longitude']; + this.latitude = json['latitude']; this.coverImg = json['coverImg']; } String id; @@ -58,6 +67,9 @@ class ComunityComment { bool selfLike; bool selfFollow; String createTime; + String location; + String longitude; + String latitude; String coverImg; Map toJson() { @@ -76,6 +88,9 @@ class ComunityComment { map['selfLike'] = this.selfLike; map['selfFollow'] = this.selfFollow; map['createTime'] = this.createTime; + map['location'] = this.location; + map['longitude'] = this.longitude; + map['latitude'] = this.latitude; map['coverImg'] = this.coverImg; return map; } @@ -88,8 +103,8 @@ class ComunityComment { class MemberInfo { MemberInfo({ - dynamic mid, - dynamic nickname, + dynamic mid, + dynamic nickname, String avatar,}){ this.mid = mid; this.nickname = nickname; @@ -121,8 +136,8 @@ class MemberInfo { class SubjectInfo { SubjectInfo({ - String type, - List images, + String type, + List images, String video, String coverImg,}){ this.type = type; diff --git a/lib/retrofit/data/member_Infor.dart b/lib/retrofit/data/member_Infor.dart new file mode 100644 index 00000000..c9daf168 --- /dev/null +++ b/lib/retrofit/data/member_Infor.dart @@ -0,0 +1,134 @@ +/// id : "1379254113602109440" +/// nickname : "哈哈哈" +/// headimg : "https://pos.upload.gznl.top/admin/2021/08/1f8d55ed-85d2-42a2-b155-6737a66226e8.jpg" +/// userType : true +/// sex : "0" +/// level : 1 +/// remark : "" +/// createTime : "2021-04-06 10:06:21" +/// birth : "1998-09-17" +/// organic : 0 +/// age : 23 +/// signature : "" +/// background : "" +/// follow : 1 +/// fans : 0 +/// trendTotal : 4 +/// gainLikeTotal : 9 + +class MemberInfor { + MemberInfor({ + String id, + String nickname, + String headimg, + bool userType, + String sex, + int level, + String remark, + String createTime, + String birth, + int organic, + int age, + String signature, + String background, + int follow, + int fans, + int trendTotal, + int gainLikeTotal,}){ + _id = id; + _nickname = nickname; + _headimg = headimg; + _userType = userType; + _sex = sex; + _level = level; + _remark = remark; + _createTime = createTime; + _birth = birth; + _organic = organic; + _age = age; + _signature = signature; + _background = background; + _follow = follow; + _fans = fans; + _trendTotal = trendTotal; + _gainLikeTotal = gainLikeTotal; +} + + MemberInfor.fromJson(dynamic json) { + _id = json['id']; + _nickname = json['nickname']; + _headimg = json['headimg']; + _userType = json['userType']; + _sex = json['sex']; + _level = json['level']; + _remark = json['remark']; + _createTime = json['createTime']; + _birth = json['birth']; + _organic = json['organic']; + _age = json['age']; + _signature = json['signature']; + _background = json['background']; + _follow = json['follow']; + _fans = json['fans']; + _trendTotal = json['trendTotal']; + _gainLikeTotal = json['gainLikeTotal']; + } + String _id; + String _nickname; + String _headimg; + bool _userType; + String _sex; + int _level; + String _remark; + String _createTime; + String _birth; + int _organic; + int _age; + String _signature; + String _background; + int _follow; + int _fans; + int _trendTotal; + int _gainLikeTotal; + + String get id => _id; + String get nickname => _nickname; + String get headimg => _headimg; + bool get userType => _userType; + String get sex => _sex; + int get level => _level; + String get remark => _remark; + String get createTime => _createTime; + String get birth => _birth; + int get organic => _organic; + int get age => _age; + String get signature => _signature; + String get background => _background; + int get follow => _follow; + int get fans => _fans; + int get trendTotal => _trendTotal; + int get gainLikeTotal => _gainLikeTotal; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['nickname'] = _nickname; + map['headimg'] = _headimg; + map['userType'] = _userType; + map['sex'] = _sex; + map['level'] = _level; + map['remark'] = _remark; + map['createTime'] = _createTime; + map['birth'] = _birth; + map['organic'] = _organic; + map['age'] = _age; + map['signature'] = _signature; + map['background'] = _background; + map['follow'] = _follow; + map['fans'] = _fans; + map['trendTotal'] = _trendTotal; + map['gainLikeTotal'] = _gainLikeTotal; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/user_info.dart b/lib/retrofit/data/user_info.dart index ad65f6f7..2eb63867 100644 --- a/lib/retrofit/data/user_info.dart +++ b/lib/retrofit/data/user_info.dart @@ -41,6 +41,10 @@ class UserInfo { String masterCardRankName; MemberRank memberRankVo; String inviteCode; + String signature; + String background; + + factory UserInfo.fromJson(Map json) => UserInfo() @@ -65,6 +69,8 @@ class UserInfo { ..todayInviteNumber = json['todayInviteNumber'] as int ..masterCardRankName = json['masterCardRankName'] as String ..inviteCode = json['inviteCode'] as String + ..signature = json['signature'] as String + ..background = json['background'] as String ..memberRankVo = json['memberRankVo'] == null ? null : MemberRank.fromJson(json['memberRankVo'] as Map); @@ -91,6 +97,8 @@ class UserInfo { "todayInviteNumber": this.todayInviteNumber, 'masterCardRankName': this.masterCardRankName, 'inviteCode' : this.inviteCode, - 'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(), + 'signature' : this.signature, + 'background' : this.background, + 'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(), }; } diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 84461685..0c0e7b7e 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -32,8 +32,8 @@ const base_url = "http://192.168.10.236:8765/app/";///费韬 const baseUrl = "http://192.168.10.236:8765/app/";///费韬 -// const base_url = "http://192.168.10.88:8765/app/";///詹云久 -// const baseUrl = "http://192.168.10.88:8765/app/";///詹云久 +// const base_url = "http://192.168.10.143:8765/app/";///詹云久 +// const baseUrl = "http://192.168.10.143:8765/app/";///詹云久 // const base_url = "http://192.168.10.37:8766/app/"; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 55730ee0..287592f9 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -36,6 +36,7 @@ import 'data/headlines_list.dart'; import 'data/headlines_list_details.dart'; import 'data/invitation_list.dart'; import 'data/logistics.dart'; +import 'data/member_Infor.dart'; import 'data/member_comment_list.dart'; import 'data/message.dart'; import 'data/msg_stats.dart'; @@ -69,8 +70,8 @@ const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const baseUrl = "http://192.168.10.37:8766/app/"; -// const base_url = "http://192.168.10.88:8766/app/";///詹云久 -// const baseUrl = "http://192.168.10.88:8766/app/";///詹云久 +// const base_url = "http://192.168.10.143:8766/app/";///詹云久 +// const baseUrl = "http://192.168.10.143:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { @@ -88,8 +89,8 @@ abstract class ApiService { headers["Environment"] = "app"; } dio.options = BaseOptions( - connectTimeout: 20000, - receiveTimeout: 20000, + connectTimeout: 60000, + receiveTimeout: 60000, headers: headers, responseType: ResponseType.json, ); @@ -496,7 +497,11 @@ abstract class ApiService { Future wiped(@Path("memberCouponId") String memberCouponId); ///查询优惠券详情 - @GET("coupon/detail/") + @GET("/coupon/detail/") Future> couponDetail(@Path("") String memberCouponId); + ///查询会员信息 + @GET("/member/detail/{id}") + Future> memberDetail(@Path("id") String id); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index ad727613..205b7a37 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -1851,4 +1851,25 @@ class _ApiService implements ApiService { ); return value; } + + @override + Future> memberDetail(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/member/detail/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => MemberInfor.fromJson(json), + ); + return value; + } } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 60bc4a6c..03e494ee 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -284,8 +284,9 @@ class _Settlement extends State { this.downOrder = baseData.data; querySettlement(); } else { - SmartDialog.showToast("下单失败:订单实付金额不能为0", alignment: Alignment.center); - // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + baseData?.isSuccess ?? false ? + SmartDialog.showToast("下单失败:订单实付金额不能为0", alignment: Alignment.center): + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } } else { ///火锅店下单, 等待结算 diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 9c1738c4..ea98a22a 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -506,8 +506,6 @@ class _StoreOrderPage extends State } } - - /// 领取成功弹窗 showAlertDialog() { //显示对话框 diff --git a/lib/web/web_view/web_content.dart b/lib/web/web_view/web_content.dart index 16227c23..fcbc63f9 100644 --- a/lib/web/web_view/web_content.dart +++ b/lib/web/web_view/web_content.dart @@ -59,7 +59,7 @@ class _WebContent extends State { // + "立即购买", style: { "html": Style( - backgroundColor: Colors.white + backgroundColor: Color(0xffffffff) ) }, onLinkTap: (url, ct, attributes, element) {