diff --git a/android/app/build.gradle b/android/app/build.gradle index 69a82c20..aa38b250 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -143,7 +143,7 @@ android { ndk { /// 选择要添加的对应.so 库。 - abiFilters 'armeabi-v7a' + abiFilters 'armeabi-v7a','arm64-v8a','x86' } } debug { diff --git a/assets/image/2x/icon_mine_online_service.webp b/assets/image/2x/icon_mine_online_service.webp index 71cc6ca2..b2cd9aef 100644 Binary files a/assets/image/2x/icon_mine_online_service.webp and b/assets/image/2x/icon_mine_online_service.webp differ diff --git a/assets/image/2x/recharge.png b/assets/image/2x/recharge.png new file mode 100644 index 00000000..a353e763 Binary files /dev/null and b/assets/image/2x/recharge.png differ diff --git a/assets/image/3x/icon_mine_online_service.webp b/assets/image/3x/icon_mine_online_service.webp index 01fe923b..5e44161c 100644 Binary files a/assets/image/3x/icon_mine_online_service.webp and b/assets/image/3x/icon_mine_online_service.webp differ diff --git a/assets/image/3x/recharge.png b/assets/image/3x/recharge.png new file mode 100644 index 00000000..0f3c3f3c Binary files /dev/null and b/assets/image/3x/recharge.png differ diff --git a/assets/image/icon_mine_online_service.webp b/assets/image/icon_mine_online_service.webp index 79640cde..be33bb54 100644 Binary files a/assets/image/icon_mine_online_service.webp and b/assets/image/icon_mine_online_service.webp differ diff --git a/assets/image/recharge.png b/assets/image/recharge.png new file mode 100644 index 00000000..15ead2f5 Binary files /dev/null and b/assets/image/recharge.png differ diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 61ea508c..421c89d0 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -24,10 +24,10 @@ class _CommunityPage extends State List lables = [ "关注", - "推荐", - "头条", - "课程", - "关于我们", + "分享健康", + "了解健康", + "学习健康", + "关于回乡", // "直播", ]; @@ -94,16 +94,16 @@ class _CommunityPage extends State child: TabBarView( physics: BouncingScrollPhysics(), children: lables.map((e) { - if (e == "关于我们") { + if (e == "关于回乡") { return BrandPage(); - }else if(e == "头条"){ + }else if(e == "了解健康"){ return ArticlePage(); - }else if(e == "课程"){ + }else if(e == "学习健康"){ return CommunityCourse(); } - else if(e == "推荐"){ + else if(e == "分享健康"){ if (tuijian == null){ - tuijian = CommunityChildPage("推荐"); + tuijian = CommunityChildPage("分享健康"); } return tuijian; }else if(e == "关注"){ diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 103b526d..7e081cec 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -410,25 +410,27 @@ class _CommunityDynamic extends State { ], ), ), - // Expanded( - // child: GestureDetector( - // behavior: HitTestBehavior.opaque, - // onTap: () { - // setState(() { - // choiceShowBottomSheet(); - // }); - // }, - // child: Container( - // alignment: Alignment.center, - // child: Text( - // "...", - // style: TextStyle( - // fontSize: 18.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.black, - // ), - // ), - // ))), + if (widget?.article?.author != widget.userId ?? "") + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + choiceShowBottomSheet(); + }); + }, + child: Container( + padding: EdgeInsets.only(top:3), + alignment: Alignment.center, + child: Text( + "...", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + ))), ], ), ], @@ -772,50 +774,53 @@ class _CommunityDynamic extends State { SizedBox( height: 10, ), - GestureDetector( - onTap: () { - setState(() { - Navigator.of(context).pop(); - share(); - }); - }, - child: Container( - child: Row( - children: [ - SizedBox( - width: 4, - ), - Image.asset( - "assets/image/icon_share.webp", - fit: BoxFit.cover, - width: 25, - height: 25, - color: Color(0xff515151), - ), - SizedBox( - width: 12, - ), - Text( - "分享", - style: TextStyle( - fontSize: 17.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF1A1A1A), - ), - ), - ], - ), - )), - Container( - margin: EdgeInsets.symmetric(vertical: 12), - height: 1.h, - color: Color(0xFFF7F7F7), - ), + // GestureDetector( + // onTap: () { + // setState(() { + // Navigator.of(context).pop(); + // share(); + // }); + // }, + // child: Container( + // child: Row( + // children: [ + // SizedBox( + // width: 4, + // ), + // Image.asset( + // "assets/image/icon_share.webp", + // fit: BoxFit.cover, + // width: 25, + // height: 25, + // color: Color(0xff515151), + // ), + // SizedBox( + // width: 12, + // ), + // Text( + // "分享", + // style: TextStyle( + // fontSize: 17.sp, + // fontWeight: MyFontWeight.medium, + // color: Color(0xFF1A1A1A), + // ), + // ), + // ], + // ), + // )), + // Container( + // margin: EdgeInsets.symmetric(vertical: 12), + // height: 1.h, + // color: Color(0xFFF7F7F7), + // ), GestureDetector( onTap: () { setState(() { Navigator.of(context) - .popAndPushNamed('/router/report_page'); + .popAndPushNamed('/router/report_page',arguments: { + "userName":widget?.article?.authorName ?? "", + "authorId":widget?.article?.author ?? "", + }); }); }, child: Row( diff --git a/lib/community/report/report_page.dart b/lib/community/report/report_page.dart index d857f279..0b10e0d9 100644 --- a/lib/community/report/report_page.dart +++ b/lib/community/report/report_page.dart @@ -1,13 +1,16 @@ import 'dart:ui'; +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:huixiang/generated/l10n.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class ReportPage extends StatefulWidget { final Map arguments; @@ -24,10 +27,35 @@ class _ReportPage extends State { ApiService apiService; int textLength = 0; final TextEditingController editingController = TextEditingController(); + String textCon; + String userName; + String authorId; @override void initState() { super.initState(); + userName = widget.arguments['userName']; + authorId = widget.arguments['authorId']; + } + + report() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = await apiService.complaint({ + "content": checkIndex == 9 ? editingController.text : textCon, + "informationId": authorId, + }).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + Navigator.of(context).popAndPushNamed('/router/report_success'); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } } @override @@ -67,7 +95,7 @@ class _ReportPage extends State { ), ), TextSpan( - text: "@百花谷", + text: "@${userName.toString()}", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.medium, @@ -86,41 +114,42 @@ class _ReportPage extends State { ), ), ), - report(), + reportContent(), SizedBox(height: 12), - Container( - width: double.infinity, - height: 186.h, - margin: EdgeInsets.only(right: 16,left:40,bottom:100), - decoration: new BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4.0), - ), - child: Container( - margin: EdgeInsets.fromLTRB(20.w, 5.h, 20.w, 0), - alignment: Alignment.topLeft, - child: TextField( - maxLines: 5, - controller: editingController, - onChanged: (value) { - setState(() { - textLength = value.length; - }); - }, - maxLength: 100, - decoration: InputDecoration( - border: InputBorder.none, - hintText: "请输入举报原因,以便我们更快定位问题,快速处理", - hintStyle: TextStyle( - fontSize: 12.sp, - height: 1.2, - fontWeight: MyFontWeight.regular, - color: Color(0xFF999999), - ), + if (checkIndex == 9) + Container( + width: double.infinity, + height: 186.h, + margin: + EdgeInsets.only(right: 16, left: 40, bottom: 100), + decoration: new BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4.0), ), - ), - ) - ) + child: Container( + margin: EdgeInsets.fromLTRB(20.w, 5.h, 20.w, 0), + alignment: Alignment.topLeft, + child: TextField( + maxLines: 5, + controller: editingController, + onChanged: (value) { + setState(() { + textLength = value.length; + }); + }, + maxLength: 100, + decoration: InputDecoration( + border: InputBorder.none, + hintText: "请输入举报原因,以便我们更快定位问题,快速处理", + hintStyle: TextStyle( + fontSize: 12.sp, + height: 1.2, + fontWeight: MyFontWeight.regular, + color: Color(0xFF999999), + ), + ), + ), + )) ], ), ), @@ -128,7 +157,7 @@ class _ReportPage extends State { alignment: Alignment.bottomCenter, child: Container( width: double.infinity, - height:95, + height: 95, child: Column( children: [ GestureDetector( @@ -138,7 +167,7 @@ class _ReportPage extends State { }, child: Container( alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(bottom:25), + margin: EdgeInsets.only(bottom: 25), child: Text( "投诉须知", style: TextStyle( @@ -148,15 +177,20 @@ class _ReportPage extends State { ), ), )), - Expanded(child: - GestureDetector( - onTap: (){ - Navigator.of(context) - .pushNamed('/router/report_success'); - }, - child: Container( + Expanded( + child: GestureDetector( + onTap: () { + if(checkIndex == 9 && editingController.text == ""){ + SmartDialog.showToast("请输入举报原因", alignment: Alignment.center); + return; + } + report(); + }, + child: Opacity( + opacity: checkIndex == 0 ? 0.3 : 0.9, + child: Container( width: double.infinity, - height:double.infinity, + height: double.infinity, color: Color(0xFF319E5F), alignment: Alignment.center, child: Text( @@ -167,7 +201,9 @@ class _ReportPage extends State { color: Color(0xFFFFFFFF), ), ), - ),)) + ), + ), + )) ], ), )) @@ -177,55 +213,95 @@ class _ReportPage extends State { ); } - Widget report() { + Widget reportContent() { return Container( - padding: EdgeInsets.only(left: 16, right: 16), - child: - // (articles == null || articles.length == 0) - // ? NoDataView( - // src: "assets/image/dong_tai.webp", - // isShowBtn: false, - // text: "目前暂无发布动态,要把开心的事讲出来哦~", - // fontSize: 16.sp, - // margin: EdgeInsets.only(left: 60.w, right: 60.w), - // ) : - ListView.builder( - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: reportList(), - ); - }, - itemCount: 9, - ), - ); - } - - Widget reportList() { - return Container( - padding: EdgeInsets.only(top: 18, bottom: 20), - color: Color(0xFFFFFFFF), - child: Row( + width: double.infinity, + padding: EdgeInsets.only(left: 16, right: 16, top: 20), + child: Column( children: [ - Image.asset( - "assets/image/icon_radio_unselected.webp", - width: 16, - height: 16, + content("色情低俗", 1), + SizedBox( + height: 18, ), + content("政治宗教", 2), SizedBox( - width: 8, + height: 18, ), - Expanded( - child: Text( - "色情低俗", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular), - )) + content("广告骚扰", 3), + SizedBox( + height: 18, + ), + content("虚假欺骗", 4), + SizedBox( + height: 18, + ), + content("侵权(诽谤、抄袭、冒用)", 5), + SizedBox( + height: 18, + ), + content("不良封面/标题", 6), + SizedBox( + height: 18, + ), + content("赌博诈骗", 7), + SizedBox( + height: 18, + ), + content("违禁内容(暴利恐怖、令人不适、宣言仇恨)", 8), + SizedBox( + height: 18, + ), + content("其他", 9), ], )); } + + var checkIndex = 0; + + Widget checkView(var index) { + return Container( + padding: EdgeInsets.only(right: 16.w, left: 5), + alignment: Alignment.center, + // color: Colors.red, + child: Image.asset( + checkIndex != index + ? "assets/image/icon_radio_unselected.webp" + : "assets/image/icon_radio_selected.webp", + width: 20.w, + height: 20.h, + ), + ); + } + + Widget content(textContext, var index) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = index; + textCon = textContext; + }); + }, + child: Container( + alignment: Alignment.center, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + checkView(index), + Container(), + Expanded( + child: Text( + textContext, + style: TextStyle( + fontSize: 16.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + ), + ), + ) + ], + ), + )); + } } diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 56650179..1a4a0838 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -290,7 +290,7 @@ class MessageLookup extends MessageLookupByLibrary { "jifendejisuanshuoming" : MessageLookupByLibrary.simpleMessage("积分的计算说明"), "jifendidaogao" : MessageLookupByLibrary.simpleMessage("积分从低到高"), "jifengaodaodi" : MessageLookupByLibrary.simpleMessage("积分从高到低"), - "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("积分商城"), + "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("净弼积分商城"), "jifenxiangqing" : MessageLookupByLibrary.simpleMessage("积分详情"), "jingbilianmenghuiyuandian" : MessageLookupByLibrary.simpleMessage("净弼联盟会员店"), "jinkahuiyuan" : MessageLookupByLibrary.simpleMessage("金卡会员"), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index e1d59ac9..2d94046a 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -288,7 +288,7 @@ class MessageLookup extends MessageLookupByLibrary { "jifendejisuanshuoming" : MessageLookupByLibrary.simpleMessage("积分的计算说明"), "jifendidaogao" : MessageLookupByLibrary.simpleMessage("积分从低到高"), "jifengaodaodi" : MessageLookupByLibrary.simpleMessage("积分从高到低"), - "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("积分商城"), + "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("净弼积分商城"), "jifenxiangqing" : MessageLookupByLibrary.simpleMessage("积分详情"), "jingbilianmenghuiyuandian" : MessageLookupByLibrary.simpleMessage("净弼联盟会员店"), "jinkahuiyuan" : MessageLookupByLibrary.simpleMessage("金卡会员"), diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index 63b3f40c..c441640b 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -288,7 +288,7 @@ class MessageLookup extends MessageLookupByLibrary { "jifendejisuanshuoming" : MessageLookupByLibrary.simpleMessage("积分的计算说明"), "jifendidaogao" : MessageLookupByLibrary.simpleMessage("积分从低到高"), "jifengaodaodi" : MessageLookupByLibrary.simpleMessage("积分从高到低"), - "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("积分商城"), + "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("净弼积分商城"), "jifenxiangqing" : MessageLookupByLibrary.simpleMessage("积分详情"), "jingbilianmenghuiyuandian" : MessageLookupByLibrary.simpleMessage("净弼联盟会员店"), "jinkahuiyuan" : MessageLookupByLibrary.simpleMessage("金卡会员"), diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index c5161822..9306dfd3 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -288,7 +288,7 @@ class MessageLookup extends MessageLookupByLibrary { "jifendejisuanshuoming" : MessageLookupByLibrary.simpleMessage("積分的計算説明"), "jifendidaogao" : MessageLookupByLibrary.simpleMessage("積分從低到高"), "jifengaodaodi" : MessageLookupByLibrary.simpleMessage("積分從高到低"), - "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("積分商城"), + "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("淨弼積分商城"), "jifenxiangqing" : MessageLookupByLibrary.simpleMessage("積分詳情"), "jingbilianmenghuiyuandian" : MessageLookupByLibrary.simpleMessage("淨弼聯盟會員店"), "jinkahuiyuan" : MessageLookupByLibrary.simpleMessage("金卡会员"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index 2d174d30..026f8527 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -288,7 +288,7 @@ class MessageLookup extends MessageLookupByLibrary { "jifendejisuanshuoming" : MessageLookupByLibrary.simpleMessage("積分的計算説明"), "jifendidaogao" : MessageLookupByLibrary.simpleMessage("積分從低到高"), "jifengaodaodi" : MessageLookupByLibrary.simpleMessage("積分從高到低"), - "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("積分商城"), + "jifenshangcheng" : MessageLookupByLibrary.simpleMessage("淨弼積分商城"), "jifenxiangqing" : MessageLookupByLibrary.simpleMessage("積分詳情"), "jingbilianmenghuiyuandian" : MessageLookupByLibrary.simpleMessage("淨弼聯盟會員店"), "jinkahuiyuan" : MessageLookupByLibrary.simpleMessage("金卡会员"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 5976a619..c869c31d 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -225,10 +225,10 @@ class S { ); } - /// `积分商城` + /// `净弼积分商城` String get jifenshangcheng { return Intl.message( - '积分商城', + '净弼积分商城', name: 'jifenshangcheng', desc: '', args: [], diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 32b382df..96ed8aa6 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -18,7 +18,7 @@ "main_menu4": "我的", "shouye": "首页", "huodongliebiao": "活动列表", - "jifenshangcheng": "积分商城", + "jifenshangcheng": "净弼积分商城", "jinrihuiyuanrenwu": "今日会员任务", "renwuzhongxin": "任务中心", "qiandaolingqujinfen": "签到领取积分", diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 0151ed71..71f61742 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -18,7 +18,7 @@ "main_menu4": "我的", "shouye": "首页", "huodongliebiao": "活动列表", - "jifenshangcheng": "积分商城", + "jifenshangcheng": "净弼积分商城", "jinrihuiyuanrenwu": "今日会员任务", "renwuzhongxin": "任务中心", "qiandaolingqujinfen": "签到领取积分", diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb index 17bdfa3e..918ed547 100644 --- a/lib/l10n/intl_zh_Hans_CN.arb +++ b/lib/l10n/intl_zh_Hans_CN.arb @@ -18,7 +18,7 @@ "main_menu4": "我的", "shouye": "首页", "huodongliebiao": "活动列表", - "jifenshangcheng": "积分商城", + "jifenshangcheng": "净弼积分商城", "jinrihuiyuanrenwu": "今日会员任务", "renwuzhongxin": "任务中心", "qiandaolingqujinfen": "签到领取积分", diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb index 4df95fbc..b1b3bfab 100644 --- a/lib/l10n/intl_zh_Hant_CN.arb +++ b/lib/l10n/intl_zh_Hant_CN.arb @@ -18,7 +18,7 @@ "main_menu4": "我的", "shouye": "首頁", "huodongliebiao": "活動列表", - "jifenshangcheng": "積分商城", + "jifenshangcheng": "淨弼積分商城", "jinrihuiyuanrenwu": "今日會員任務", "renwuzhongxin": "任務中心", "qiandaolingqujinfen": "簽到領取積分", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index cbcc9430..30c97cdb 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -18,7 +18,7 @@ "main_menu4": "我的", "shouye": "首頁", "huodongliebiao": "活動列表", - "jifenshangcheng": "積分商城", + "jifenshangcheng": "淨弼積分商城", "jinrihuiyuanrenwu": "今日會員任務", "renwuzhongxin": "任務中心", "qiandaolingqujinfen": "簽到領取積分", diff --git a/lib/main.dart b/lib/main.dart index 7ebc1f22..bc39a419 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -116,7 +116,7 @@ void main() async { locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); } ImgCachePath(); - initSdk(); + // initSdk(); bool isFirst = sharedPreferences.getBool("isFirst"); runApp(MyApp(locale, isFirst)); @@ -127,47 +127,7 @@ void main() async { final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); -initSdk() async { - ///ios 调用startXg前需要调用此方法 - xgFlutterPlugin.configureClusterDomainName("tpns.sh.tencent.com"); - xgFlutterPlugin.setEnableDebug(true); - ///此处配置为iOS的appID信息,Android信息在build.gradle文件中 - xgFlutterPlugin.startXg("1680005688", "IYIB3R2XRE22"); - - if (Platform.isAndroid) { - XgAndroidApi androidApi = xgFlutterPlugin.getXgAndroidApi(); - //小米 - androidApi.setMiPushAppId(appId: "2882303761520050452"); - androidApi.setMiPushAppKey(appKey: "5582005091452"); - - androidApi.enableOtherPush(); - androidApi.regPush(); - } - - ShareSDKRegister shareSDKRegister = ShareSDKRegister(); - shareSDKRegister.setupWechat( - "wx3b269e795ed23e5f", - "64020361b8ec4c99936c0e3999a9f249", - "https://hx.lotus-wallet.com/app/", - ); - shareSDKRegister.setupFacebook( - "523308712059457", - "d3a1b6377100871799d8973fbe84794a", - "一心回乡", - ); - SharesdkPlugin.regist(shareSDKRegister); - - if (Platform.isIOS) { - LocationFlutterPlugin.setApiKey("ylW2QPlsbERkho7jOgU4GQSeawmdUIoR"); - BMFMapSDK.setApiKeyAndCoordType( - 'ylW2QPlsbERkho7jOgU4GQSeawmdUIoR', - BMF_COORD_TYPE.COMMON, - ); - } else if (Platform.isAndroid) { - BMFMapSDK.setCoordType(BMF_COORD_TYPE.COMMON); - } -} EventBus eventBus = EventBus(sync: true); diff --git a/lib/main_page.dart b/lib/main_page.dart index 2946c003..96ae17e0 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -2,6 +2,8 @@ import 'dart:convert'; import 'dart:io'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:huixiang/community/community_page.dart'; @@ -20,6 +22,9 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/native_event_handler.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:sharesdk_plugin/sharesdk_interface.dart'; +import 'package:sharesdk_plugin/sharesdk_register.dart'; +import 'package:tpns_flutter_plugin/android/xg_android_api.dart'; import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; import 'community/order_page.dart'; @@ -81,6 +86,9 @@ class _MainPage extends State with WidgetsBindingObserver { ..userInteractions = false ..dismissOnTap = false; + + initSdk(); + pushRoute(); String invite = ""; @@ -130,11 +138,53 @@ class _MainPage extends State with WidgetsBindingObserver { }); queryUserInfo(); + } + + initSdk() async { + ///ios 调用startXg前需要调用此方法 + xgFlutterPlugin.configureClusterDomainName("tpns.sh.tencent.com"); + xgFlutterPlugin.setEnableDebug(true); + + ///此处配置为iOS的appID信息,Android信息在build.gradle文件中 + xgFlutterPlugin.startXg("1680005688", "IYIB3R2XRE22"); + + if (Platform.isAndroid) { + XgAndroidApi androidApi = xgFlutterPlugin.getXgAndroidApi(); + //小米 + androidApi.setMiPushAppId(appId: "2882303761520050452"); + androidApi.setMiPushAppKey(appKey: "5582005091452"); + + androidApi.enableOtherPush(); + androidApi.regPush(); + } + + ShareSDKRegister shareSDKRegister = ShareSDKRegister(); + shareSDKRegister.setupWechat( + "wx3b269e795ed23e5f", + "64020361b8ec4c99936c0e3999a9f249", + "https://hx.lotus-wallet.com/app/", + ); + shareSDKRegister.setupFacebook( + "523308712059457", + "d3a1b6377100871799d8973fbe84794a", + "一心回乡", + ); + SharesdkPlugin.regist(shareSDKRegister); + + if (Platform.isIOS) { + LocationFlutterPlugin.setApiKey("ylW2QPlsbERkho7jOgU4GQSeawmdUIoR"); + BMFMapSDK.setApiKeyAndCoordType( + 'ylW2QPlsbERkho7jOgU4GQSeawmdUIoR', + BMF_COORD_TYPE.COMMON, + ); + } else if (Platform.isAndroid) { + BMFMapSDK.setCoordType(BMF_COORD_TYPE.COMMON); + } if (Platform.isAndroid) { xgFlutterPlugin.getXgAndroidApi().addNativeEventHandler( MyNativeEventHandler( - (String title, String message, String customContent, int type) { + (String title, String message, String customContent, int type) { print("xgPushClickAction2: $customContent"); SharedPreferences.getInstance().then((value) { value.setString("pushData", customContent); @@ -151,7 +201,7 @@ class _MainPage extends State with WidgetsBindingObserver { if (Platform.isAndroid ? (event["actionType"] == 0) : (event["xg"]["msgtype"] == 1) && - event[Platform.isAndroid ? "customMessage" : "custom"] != null) { + event[Platform.isAndroid ? "customMessage" : "custom"] != null) { SharedPreferences.getInstance().then((value) { value.setString("pushData", event[Platform.isAndroid ? "customMessage" : "custom"]); @@ -307,7 +357,7 @@ class _MainPage extends State with WidgetsBindingObserver { // bottomNavigationBigItem(S.of(context).pinpai, 0), bottomNavigationItem(S.of(context).main_menu1, 0), bottomNavigationItem(S.of(context).main_menu2, 1), - bottomNavigationItem((Theme.of(context).platform == TargetPlatform.android) ? "订单" :S.of(context).main_menu3 , 2), + bottomNavigationItem(S.of(context).main_menu3 , 2), bottomNavigationItem(S.of(context).main_menu4, 3), ], ), diff --git a/lib/message/system_details.dart b/lib/message/system_details.dart index c3593d90..0a14b538 100644 --- a/lib/message/system_details.dart +++ b/lib/message/system_details.dart @@ -198,7 +198,7 @@ class _SystemDetails extends State { children: [ (messages == null || messages.length == 0) ? NoDataView( - src: "assets/image/icon_empty.png", + src: "assets/image/icon_empty.webp", isShowBtn: false, text: S.of(context).haimeiyouxiaoxi, fontSize: 16.sp, @@ -323,7 +323,7 @@ class _SystemDetails extends State { children: [ (messages == null || messages.length == 0) ? NoDataView( - src:"assets/image/icon_empty.png", + src:"assets/image/icon_empty.webp", isShowBtn: false, text: S.of(context).haimeiyouxiaoxi, fontSize: 16.sp, @@ -365,10 +365,10 @@ class _SystemDetails extends State { children: [ Image.asset( (message.typed == 1) - ? "assets/image/icon_system_message.png" + ? "assets/image/icon_system_message.webp" : (message.typed == 2) - ? "assets/image/icon_system_message.png" - : "assets/image/c_z.png", + ? "assets/image/icon_system_message.webp" + : "assets/image/c_z.webp", width: 24.w, height: 24.h, ), @@ -459,7 +459,7 @@ class _SystemDetails extends State { children: [ (messages == null || messages.length == 0) ? NoDataView( - src:"assets/image/icon_empty.png", + src:"assets/image/icon_empty.webp", isShowBtn: false, text: S.of(context).haimeiyouxiaoxi, fontSize: 16.sp, @@ -606,7 +606,7 @@ class _SystemDetails extends State { children: [ (messages == null || messages.length == 0) ? NoDataView( - src:"assets/image/icon_empty.png", + src:"assets/image/icon_empty.webp", isShowBtn: false, text: S.of(context).haimeiyouxiaoxi, fontSize: 16.sp, @@ -850,7 +850,7 @@ class _SystemDetails extends State { children: [ (messages == null || messages.length == 0) ? NoDataView( - src:"assets/image/icon_empty.png", + src:"assets/image/icon_empty.webp", isShowBtn: false, text: S.of(context).haimeiyouxiaoxi, fontSize: 16.sp, diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 108ee702..c346c14c 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -157,16 +157,15 @@ class _MineItem extends State { ), ),), ///联系客服 - // Expanded(child: InkWell( - // onTap: () { - // showCallMobile(); - // }, - // child: mineItem( - // "联系客服", - // "assets/image/icon_mine_online_service.png", - // ), - // ),), - Expanded(child:Container()), + Expanded(child: InkWell( + onTap: () { + showCallMobile(); + }, + child: mineItem( + "联系客服", + "assets/image/icon_mine_online_service.webp", + ), + ),), Expanded(child:Container()), Expanded(child:Container()) ], diff --git a/lib/mine/mine_view/wallet_coupon_view.dart b/lib/mine/mine_view/wallet_coupon_view.dart index 5a76028e..70763885 100644 --- a/lib/mine/mine_view/wallet_coupon_view.dart +++ b/lib/mine/mine_view/wallet_coupon_view.dart @@ -31,59 +31,7 @@ class _WalletCoupon extends State { ), ], ), - child: (Theme.of(context).platform == TargetPlatform.android) - ? GestureDetector( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/roll_center_page'); - }); - }, - child: Row( - children: [ - Image.asset( - "assets/image/icon_mine_invoice_assistant.webp", - width: 48.h, - height: 48.h, - ), - SizedBox( - width: 12.w, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - S.of(context).lingquanzhongxin, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Color(0xFF353535), - ), - ), - SizedBox( - height: 3, - ), - Text( - "联盟下单享不停、海量优惠券等你来领!", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 12.sp, - color: Color(0xFF7B7B7B), - ), - ), - ], - ), - ) - ], - )) - : Row( + child: Row( children: [ Expanded( flex: 1, diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 0281dcab..1aa782a8 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -9,10 +9,13 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:fluwx/fluwx.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/recharge_list.dart'; +import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; import 'package:huixiang/retrofit/data/vip_rule_details.dart'; import 'package:huixiang/retrofit/data/wx_pay.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/utils/min.dart'; import 'package:huixiang/view_widget/item_input_widget.dart'; @@ -35,6 +38,10 @@ class _RechargePage extends State { List vipBenefitList = []; Color color = Colors.black; double discount = 100; + List rechargeA; + int selectIndex = 0; + UserInfo userInfo; + dynamic mBalance; @override void initState() { @@ -45,11 +52,13 @@ class _RechargePage extends State { context: context, token: value.getString("token"), pay: true); queryBenefitList(); queryRuleDetails(); + queryRechargeList(); + queryUserBalance(); }); weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); - if(event.errCode == 0){ - Navigator.of(context).pop(); + if (event.errCode == 0) { + queryUserBalance(); SmartDialog.showToast("充值成功", alignment: Alignment.center); } // else{ @@ -59,29 +68,40 @@ class _RechargePage extends State { }); } - ///会员权益列表 queryBenefitList() async { - BaseData> baseData = await apiService.benefitList().catchError((onError) {}); + BaseData> baseData = + await apiService.benefitList().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { vipBenefitList.clear(); vipBenefitList.addAll(baseData.data); vipBenefitList.forEach((element) { - if(element.have && element.config != null && element.code == "RECHARGE"){ + if (element.have && + element.config != null && + element.code == "RECHARGE") { discount = double.parse(element.config); } - }); }); } EasyLoading.dismiss(); } + queryUserBalance() async { + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + mBalance = double.tryParse(userInfo?.money ?? "0"); + if (mounted) setState(() {}); + } + } + ///会员权益介绍/规则/说明/储值说明 queryRuleDetails() async { BaseData baseData = - await apiService.vipBenefit().catchError((onError) {}); + await apiService.vipBenefit().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { vipRuleDetails = baseData.data; @@ -90,6 +110,25 @@ class _RechargePage extends State { EasyLoading.dismiss(); } + ///充值列表 + queryRechargeList() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.rechargeAct().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + rechargeA = baseData.data; + }); + } + EasyLoading.dismiss(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -100,266 +139,391 @@ class _RechargePage extends State { background: Color(0xFFFFFFFF), leadingColor: Colors.black, ), - body:Stack( - children: [ - SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - child: Column( - children: [ - Container( - child: Column(children: [ - ItemInputWidget( - S.of(context).qingshuruchongzhijine, - hintText: "", - controller: controller, - padding: EdgeInsets.all(20), - errorText: S.of(context).chongzhizuixiaojine(100), - titleColor: Color(0xFF727272), - errorTextColor: Color(0xFF32A060), - radius: 8, - discount: discount/10, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 27.sp, - color: color, - ), - inputLimit: 6, - textInputType: TextInputType.number, - textInputFormatter: FilteringTextInputFormatter.digitsOnly, - onChanged: (value) { - if (value != null && - value != "" && - double.tryParse(value) < 100) { - color = Colors.red; - } else { - color = Colors.black; - } - setState(() {}); - }, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - if (vipRuleDetails?.recharge != null && - vipRuleDetails.recharge != "") - Expanded(child:Container( - color: Colors.white, - padding: EdgeInsets.only(left: 8), - child: Html( - data: "注意:${vipRuleDetails?.recharge??""}", - customImageRenders: { - networkSourceMatcher(): networkImageRender( - loadingWidget: () { - return Container(); - }, - ), - }, - ), - ),) - ], - ), - ],), - ), - Container( - width: double.infinity, - margin: EdgeInsets.only( - left: 0.w, - right: 0.w, - top: 16.h, - bottom: 4.h, - ), - padding: EdgeInsets.only( - left: 20.w, - right: 16.w, - top: 20.h, - bottom: 20.h, - ), - decoration: BoxDecoration( - color: Colors.white, - // borderRadius: BorderRadius.circular(4), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, + body: Container( + color: Color(0xFFFFFFFF), + child: Stack( + children: [ + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Column( + children: [ + Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ + // ItemInputWidget( + // S.of(context).qingshuruchongzhijine, + // hintText: "", + // controller: controller, + // padding: EdgeInsets.all(20), + // errorText: S.of(context).chongzhizuixiaojine(100), + // titleColor: Color(0xFF727272), + // errorTextColor: Color(0xFF32A060), + // radius: 8, + // discount: discount / 10, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 27.sp, + // color: color, + // ), + // inputLimit: 6, + // textInputType: TextInputType.number, + // textInputFormatter: + // FilteringTextInputFormatter.digitsOnly, + // onChanged: (value) { + // if (value != null && + // value != "" && + // double.tryParse(value) < 100) { + // color = Colors.red; + // } else { + // color = Colors.black; + // } + // setState(() {}); + // }, + // ), Padding( - padding: EdgeInsets.only(bottom: 16.h), + padding: EdgeInsets.only(top: 26, bottom: 28), child: Text( - S.of(context).zhifufangshi, + S.of(context).chongzhi, style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: FontWeight.bold, - ), + fontSize: 28.sp, + color: Color(0xFF181818), + fontWeight: MyFontWeight.semi_bold), ), ), - GestureDetector( - onTap: () { - setState(() { - checkIndex = 1; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset("assets/image/icon_we_chat.webp"), + Row( + children: [ + Expanded( + child: Text( + S.of(context).zhanghuyue, + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF181818), + fontWeight: MyFontWeight.semi_bold), + )), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "$mBalance", + style: TextStyle( + fontSize: 26.sp, + color: Color(0xFF181818), + fontWeight: MyFontWeight.semi_bold), + ), + TextSpan( + text: "元", + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF181818), + fontWeight: MyFontWeight.semi_bold), + ), + ]), + ), + ], + ), + SizedBox(height: 28), + rechargeList(), + SizedBox(height:22), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + if (vipRuleDetails?.recharge != null && + vipRuleDetails.recharge != "") Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), + child: Container( + color: Colors.white, + child: Html( + data: "注意:${vipRuleDetails?.recharge ?? ""}", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, ), ), - ), - checkView(1), - ], - ), - ), - ], - ), - ), - // InkWell( - // onTap: () { - // recharge(); - // }, - // child: Container( - // // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h), - // child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // RoundButton( - // width: double.infinity, - // height: 46.h, - // text: S.of(context).querenchongzhi, - // textColor: Colors.white, - // fontSize: 14.sp, - // backgroup: Color(0xff32A060), - // fontWeight: FontWeight.bold, - // ), - // ], - // ), - // ), - // ), - ], - ), - ), - ), - Align(alignment: Alignment.bottomCenter,child: - Container( - height: 56.h, - color: Colors.white, - child: Row( - children: [ - Expanded(child:Container( - padding:EdgeInsets.only(top: 7.h,left:16), - child:Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - S.of(context).heji, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, - ), - ), - Text( - controller.text, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), + ) + ], ), ], ), - if(controller.text != "") - Text.rich( - TextSpan( - children: [ - TextSpan( - text: "充值", - style: TextStyle( - fontSize:12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFADADAD), - ), - ), - TextSpan( - text:"¥${controller.text}", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color:Color(0xff3541C9), - ), - ), - TextSpan( - text: "赠送", + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 16.h, + bottom: 4.h, + ), + padding: EdgeInsets.only( + top: 20.h, + bottom: 20.h, + ), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(4), + // ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, style: TextStyle( - fontSize:12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFADADAD), + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, ), ), - TextSpan( - text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xff3541C9), - ), - ),TextSpan( - text: "元", - style: TextStyle( - fontSize:12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFADADAD), - ), + ), + GestureDetector( + onTap: () { + setState(() { + checkIndex = 1; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_we_chat.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(1), + ], ), - ], - ), + ), + ], ), + ), ], - )) ), - GestureDetector( - onTap: () { - recharge(); - }, - child: RoundButton( - width: 103.w, - height: 54.h, - text: S.of(context).chongzhi, - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), - radius: 0, - fontSize: 16.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: (){ + recharge(); + }, + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only(left: 16,right: 16,bottom: 21), + child: Text( + S.of(context).querenchongzhi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), ), ), - ], - ), - )) - ], - ), + ), + // Container( + // height: 56.h, + // color: Colors.white, + // child: Row( + // children: [ + // Expanded(child:Container( + // padding:EdgeInsets.only(top: 7.h,left:16), + // child:Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Text( + // S.of(context).heji, + // style: TextStyle( + // fontSize: 14.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.black, + // ), + // ), + // Text( + // controller.text, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: MyFontWeight.medium, + // color: Color(0xFF32A060), + // ), + // ), + // ], + // ), + // if(controller.text != "") + // Text.rich( + // TextSpan( + // children: [ + // TextSpan( + // text: "充值", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${controller.text}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color:Color(0xff3541C9), + // ), + // ), + // TextSpan( + // text: "赠送", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xff3541C9), + // ), + // ),TextSpan( + // text: "元", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // ], + // ), + // ), + // ], + // )) + // ), + // GestureDetector( + // onTap: () { + // recharge(); + // }, + // child: RoundButton( + // width: 103.w, + // height: 54.h, + // text: S.of(context).chongzhi, + // textColor: Colors.white, + // fontWeight: MyFontWeight.regular, + // backgroup: Color(0xFF32A060), + // radius: 0, + // fontSize: 16.sp, + // padding: EdgeInsets.symmetric(vertical: 5.h), + // ), + // ), + // ], + // ), + // ) + ) + ], + ), + ), ); } var checkIndex = 1; + Widget rechargeList() { + return GridView.builder( + itemCount: rechargeA == null ? 0 : rechargeA.length, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 3, + //水平子Widget之间间距 + crossAxisSpacing:11, + //垂直子Widget之间间距 + mainAxisSpacing: 0, + childAspectRatio: 1.5, + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + setState(() { + selectIndex = index; + }); + }, + child: rechargeItem(rechargeA[index],index), + ); + }, + ); + } + + Widget rechargeItem(RechargeList rechargeA,index) { + return Container( + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Container( + alignment: Alignment.center, + height: 69.h, + decoration: BoxDecoration( + color: selectIndex == index ?Color(0x2432A060) : Color(0xFFFAFAFA), + borderRadius: BorderRadius.circular(4), + ), + // margin: EdgeInsets.only(right: 11,bottom: 16), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "${AppUtils.calculateDouble(double.tryParse(rechargeA.rechargeMoney)??0)}元", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF868686), + fontWeight: MyFontWeight.medium, + fontSize:18.sp, + ), + ), + SizedBox(height:2,), + Text( + "实际到账:${AppUtils.calculateDouble((double.tryParse(rechargeA.rechargeMoney)??0) + (double.tryParse(rechargeA.giftdMoney)??0) +((double.tryParse(rechargeA.rechargeMoney)??0) - ((double.tryParse(rechargeA.rechargeMoney)??0) * (discount/100))))}元", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF868686), + fontWeight: MyFontWeight.regular, + fontSize:10.sp, + ), + ), + ], + ), + ), + if(selectIndex == index) + Image.asset( + "assets/image/recharge.png", + width: 20, + height:20, + ), + ], + )); + } + Widget checkView(var index) { return Container( padding: EdgeInsets.only(right: 16.w), @@ -375,30 +539,31 @@ class _RechargePage extends State { } recharge() async { - String money = controller.text; - if (money == null || money == "") { - SmartDialog.showToast(S.of(context).qingshuruchongzhijine, - alignment: Alignment.center); - return; - } - int amount = int.tryParse(money); - if (checkIndex == 1) { - if (amount < 100) { - SmartDialog.showToast(S.of(context).chongzhizuixiaojine(100), - alignment: Alignment.center); - return; - } + // String money = controller.text; + // if (money == null || money == "") { + // SmartDialog.showToast(S.of(context).qingshuruchongzhijine, + // alignment: Alignment.center); + // return; + // } + // int amount = int.tryParse(money); + // if (checkIndex == 1) { + // if (amount < 100) { + // SmartDialog.showToast(S.of(context).chongzhizuixiaojine(100), + // alignment: Alignment.center); + // return; + // } - if(Platform.isAndroid){ - if (!(await Min.isInitialize())) { - // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, - // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, - // 故而在此初始化一下 - await Min.initialize(); - }} + if (Platform.isAndroid) { + if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + await Min.initialize(); + } + } - BaseData baseData = - await apiService.recharge({"amount": amount, "rechargeType": 2}).catchError((error) {}); + BaseData baseData = await apiService.recharge( + {"amount": 0,"rechargeActId":rechargeA[selectIndex].id, "rechargeType": 2}).catchError((error) {}); if (baseData != null && baseData.isSuccess) { WxPay wxPay = WxPay.fromJson(baseData.data); await registerWxApi( @@ -415,10 +580,9 @@ class _RechargePage extends State { timeStamp: int.tryParse(wxPay.timeStamp), sign: wxPay.sign, ); - } - else{ + } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } } - } + // } } diff --git a/lib/retrofit/data/coupon.dart b/lib/retrofit/data/coupon.dart index b8aef9eb..8da93e46 100644 --- a/lib/retrofit/data/coupon.dart +++ b/lib/retrofit/data/coupon.dart @@ -21,6 +21,7 @@ class Coupon { String useEndTime; String promotionId; bool centreDisplay; + bool allProduct; String tenantCode; String tenantName; int isDelete; @@ -52,6 +53,7 @@ class Coupon { ..useEndTime = json['useEndTime'] as String ..promotionId = json['promotionId'] as String ..centreDisplay = json['centreDisplay'] as bool + ..allProduct = json['allProduct'] as bool ..tenantCode = json['tenantCode'] as String ..tenantName = json['tenantName'] as String ..isDelete = json['isDelete'] as int @@ -84,6 +86,7 @@ class Coupon { 'useEndTime': this.useEndTime, 'promotionId': this.promotionId, 'centreDisplay': this.centreDisplay, + 'allProduct' : this.allProduct, 'tenantCode': this.tenantCode, 'tenantName': this.tenantName, 'isDelete': this.isDelete, diff --git a/lib/retrofit/data/recharge_list.dart b/lib/retrofit/data/recharge_list.dart new file mode 100644 index 00000000..4e6c5d71 --- /dev/null +++ b/lib/retrofit/data/recharge_list.dart @@ -0,0 +1,78 @@ +/// id : "1494622230208839681" +/// rechargeMoney : "100.00" +/// giftdMoney : "0.00" +/// gitfdCouponId : null +/// tenantCode : "admin" +/// createTime : "2022-03-23 10:53:37" +/// isDeleted : 0 +/// rechargeType : 0 +/// remark : "充充充" + +class RechargeList { + RechargeList({ + String id, + String rechargeMoney, + String giftdMoney, + dynamic gitfdCouponId, + String tenantCode, + String createTime, + int isDeleted, + int rechargeType, + String remark,}){ + _id = id; + _rechargeMoney = rechargeMoney; + _giftdMoney = giftdMoney; + _gitfdCouponId = gitfdCouponId; + _tenantCode = tenantCode; + _createTime = createTime; + _isDeleted = isDeleted; + _rechargeType = rechargeType; + _remark = remark; +} + + RechargeList.fromJson(dynamic json) { + _id = json['id']; + _rechargeMoney = json['rechargeMoney']; + _giftdMoney = json['giftdMoney']; + _gitfdCouponId = json['gitfdCouponId']; + _tenantCode = json['tenantCode']; + _createTime = json['createTime']; + _isDeleted = json['isDeleted']; + _rechargeType = json['rechargeType']; + _remark = json['remark']; + } + String _id; + String _rechargeMoney; + String _giftdMoney; + dynamic _gitfdCouponId; + String _tenantCode; + String _createTime; + int _isDeleted; + int _rechargeType; + String _remark; + + String get id => _id; + String get rechargeMoney => _rechargeMoney; + String get giftdMoney => _giftdMoney; + dynamic get gitfdCouponId => _gitfdCouponId; + String get tenantCode => _tenantCode; + String get createTime => _createTime; + int get isDeleted => _isDeleted; + int get rechargeType => _rechargeType; + String get remark => _remark; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['rechargeMoney'] = _rechargeMoney; + map['giftdMoney'] = _giftdMoney; + map['gitfdCouponId'] = _gitfdCouponId; + map['tenantCode'] = _tenantCode; + map['createTime'] = _createTime; + map['isDeleted'] = _isDeleted; + map['rechargeType'] = _rechargeType; + map['remark'] = _remark; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index d50b5e95..3fe839b8 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -43,6 +43,7 @@ import 'data/message.dart'; import 'data/msg_stats.dart'; import 'data/page.dart'; import 'data/rank.dart'; +import 'data/recharge_list.dart'; import 'data/second_card_list.dart'; import 'data/sign_info.dart'; import 'data/social_info.dart'; @@ -57,14 +58,14 @@ import 'data/vip_rule_details.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 -// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +const base_url = "http://192.168.10.236:8776/app/"; ///费韬 +const baseUrl = "http://192.168.10.236:8776/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; @@ -218,6 +219,10 @@ abstract class ApiService { @POST("/wallet/recharge") Future> recharge(@Body() Map param); + ///充值活动列表 + @GET("/wallet/rechargeAct") + Future>> rechargeAct(); + ///领取优惠券 @GET("/coupon/receive?couponId={couponId}") Future receiveCoupon(@Path("couponId") String couponId); @@ -380,9 +385,9 @@ abstract class ApiService { @Path("shipperCode") String shipperCode, @Path("logisticCode") String logisticCode); - ///反馈 - @POST("/other/report") - Future> report(@Body() Map map); + // ///反馈 + // @POST("/other/report") + // Future> report(@Body() Map map); ///取消订单 @GET("/order/cancel/{id}") @@ -512,4 +517,8 @@ abstract class ApiService { @GET("/member/deleteMine") Future deleteMine(); + ///投诉资讯/动态 + @POST("/information/complaint") + Future complaint(@Body() Map param); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index c49773a4..35c2bbd6 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -298,6 +298,27 @@ class _ApiService implements ApiService { return value; } + @override + Future>> rechargeAct() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/wallet/rechargeAct', + 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) => RechargeList.fromJson(i as Map)) + .toList()); + return value; + } + @override Future> receiveCoupon(couponId) async { ArgumentError.checkNotNull(couponId, 'couponId'); @@ -1166,27 +1187,27 @@ class _ApiService implements ApiService { return value; } - @override - Future> report(map) async { - ArgumentError.checkNotNull(map, 'map'); - const _extra = {}; - final queryParameters = {}; - final _data = {}; - _data.addAll(map ?? {}); - final _result = await _dio.request>('/other/report', - queryParameters: queryParameters, - options: RequestOptions( - method: 'POST', - headers: {}, - extra: _extra, - baseUrl: baseUrl), - data: _data); - final value = BaseData.fromJson( - _result.data, - (json) => json as bool, - ); - return value; - } + // @override + // Future> report(map) async { + // ArgumentError.checkNotNull(map, 'map'); + // const _extra = {}; + // final queryParameters = {}; + // final _data = {}; + // _data.addAll(map ?? {}); + // final _result = await _dio.request>('/other/report', + // queryParameters: queryParameters, + // options: RequestOptions( + // method: 'POST', + // headers: {}, + // extra: _extra, + // baseUrl: baseUrl), + // data: _data); + // final value = BaseData.fromJson( + // _result.data, + // (json) => json as bool, + // ); + // return value; + // } @override Future> orderCancel(id) async { @@ -1837,7 +1858,7 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>('/coupon/detail/', + final _result = await _dio.request>('coupon/detail/', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -1858,8 +1879,7 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>( - '/member/detail/$id', + final _result = await _dio.request>('/member/detail/$id', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -1869,17 +1889,19 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => MemberInfor.fromJson(json), + (json) => MemberInfor.fromJson(json), ); return value; } + @override Future> appPopup() async { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>('/home/appPopup', + final _result = await _dio.request>( + '/home/appPopup', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -1889,7 +1911,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => ActivityPos.fromJson(json), + (json) => ActivityPos.fromJson(json), ); return value; } @@ -1899,8 +1921,7 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>( - '/member/deleteMine', + final _result = await _dio.request>('/member/deleteMine', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -1910,8 +1931,31 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, + ); + return value; + } + + @override + Future> complaint(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/information/complaint', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, ); return value; } + } diff --git a/lib/setting/help_feedback_page.dart b/lib/setting/help_feedback_page.dart index cf97d1d5..62128a1e 100644 --- a/lib/setting/help_feedback_page.dart +++ b/lib/setting/help_feedback_page.dart @@ -140,6 +140,10 @@ class _HelpFeedbackPage extends State { ), InkWell( onTap: () { + if(phoneController.text == ""){ + SmartDialog.showToast("请输入有效手机号码", alignment: Alignment.center); + return; + } report(); }, child: Container( @@ -162,17 +166,23 @@ class _HelpFeedbackPage extends State { } report() async { - var content = editingController.text; - var phone = phoneController.text; - BaseData baseData = await apiService.report({ - "mobile": phone, - "reportContent": content, + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = await apiService.complaint({ + "content": phoneController.text, + "informationId":0, }).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { SmartDialog.showToast("反馈成功"); Navigator.of(context).pop(); } else { - SmartDialog.showToast("反馈失败"); + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); } } diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index d9b016bc..7e08db55 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -15,6 +15,20 @@ class AppUtils { return "${numberFormat.format(mi / 1000)}"; } + static String trimEnd(String resString,String char){ + while(resString.endsWith(char)){ + resString = resString.substring(0,resString.length - 1); + } + return resString; + } + + ///金额保留整数/后两位 + static String calculateDouble(double res){ + String resString = res.toStringAsFixed(2); + resString = trimEnd(resString, "0"); + resString = trimEnd(resString, "."); + return resString; + } static Future coordConvert(BMFCoordinate latLng) async { return BMFCalculateUtils.coordConvert( diff --git a/lib/view_widget/new_coupon_widget.dart b/lib/view_widget/new_coupon_widget.dart index afc6e94c..1f16bb3a 100644 --- a/lib/view_widget/new_coupon_widget.dart +++ b/lib/view_widget/new_coupon_widget.dart @@ -120,7 +120,8 @@ class NewCouponWidget extends StatelessWidget { children: [ Visibility( child: Text( - S.of(context).quanchangtongyong, + // S.of(context).quanchangtongyong, + (coupon?.allProduct ?? false) ? S.of(context).quanchangtongyong :"", style: TextStyle( color: Color(0xFF353535), fontSize: 12.sp,