From c7e227ad4d84452fd0e083604d44ca647b20a0dc Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Wed, 8 Mar 2023 11:26:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A6=96=E9=A1=B5=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=B5=B7=E6=8A=A5=E5=BC=B9=E7=AA=97-=E6=96=B0?= =?UTF-8?q?=E4=BA=BA=E5=BC=B9=E7=AA=97=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/home/home_page.dart | 34 +++++++++-------------- lib/retrofit/min_api.dart | 2 +- lib/retrofit/retrofit_api.dart | 2 +- lib/view_widget/activity_poster.dart | 37 +++++++++++++++++++++++--- lib/view_widget/new_people_reward.dart | 2 +- 5 files changed, 48 insertions(+), 29 deletions(-) diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 8973c95c..01b98566 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -81,10 +81,9 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { widget.interviewCouponList != null && widget.interviewCouponList.length > 0) showInvite = true; - if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) - showNew = true; - - + //判断新人弹窗 + // if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) + // showNew = true; } ///邀请成功 @@ -98,19 +97,8 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ); } - ///新用户奖励弹窗 - newShowAlertDialog(newUserCouponList) { - //显示对话框 - showDialog( - context: context, - builder: (BuildContext context) { - return NewPeopleReward(newUserCouponList); - }, - ); - } - ///活动海报弹窗 - posterShowAlertDialog(ActivityPos activityPos) { + posterShowAlertDialog(ActivityPos activityPos,firstLoginCouponList) { var today = DateTime.now().day; SharedPreferences.getInstance().then((value) { if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};")) @@ -121,7 +109,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { showDialog( context: context, builder: (BuildContext context) { - return ActivityPoster(activityPos); + return ActivityPoster(activityPos,firstLoginCouponList); }, ); }); @@ -283,10 +271,12 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]); showInvite = false; } - if (showNew) { - newShowAlertDialog(widget.firstLoginCouponList); - showNew = false; - } + + //判断新人弹窗 + // if (showNew) { + // newShowAlertDialog(widget.firstLoginCouponList); + // showNew = false; + // } } queryUserBalance() async { @@ -337,7 +327,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { }); if (baseData != null && baseData.isSuccess) { if(baseData.data?.enabled ?? true) - posterShowAlertDialog(baseData.data); + posterShowAlertDialog(baseData.data,widget.firstLoginCouponList); } } diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 1308a39d..f7e60731 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 // const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 57d5221c..7b1581b7 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -64,7 +64,7 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 // const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 diff --git a/lib/view_widget/activity_poster.dart b/lib/view_widget/activity_poster.dart index 45b0b334..7fb3ef37 100644 --- a/lib/view_widget/activity_poster.dart +++ b/lib/view_widget/activity_poster.dart @@ -6,12 +6,15 @@ import 'package:flutter/material.dart'; import 'package:huixiang/retrofit/data/activity_pos.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/login_info.dart'; import 'custom_image.dart'; +import 'new_people_reward.dart'; class ActivityPoster extends StatefulWidget { final ActivityPos activityPos; + final List firstLoginCouponList; - ActivityPoster(this.activityPos); + ActivityPoster(this.activityPos,this.firstLoginCouponList); @override State createState() { @@ -20,6 +23,15 @@ class ActivityPoster extends StatefulWidget { } class _ActivityPoster extends State { + bool showNew = false; + + @override + void initState() { + super.initState(); + if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) + showNew = true; + } + @override Widget build(BuildContext context) { return WillPopScope( @@ -60,6 +72,11 @@ class _ActivityPoster extends State { behavior: HitTestBehavior.opaque, onTap: (){ Navigator.of(context).pop(); + + if (showNew) { + newShowAlertDialog(widget.firstLoginCouponList); + showNew = false; + } }, child: Image.asset( "assets/image/yq_qx.webp", @@ -74,6 +91,17 @@ class _ActivityPoster extends State { )); } + ///新用户奖励弹窗 + newShowAlertDialog(newUserCouponList) { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return NewPeopleReward(newUserCouponList); + }, + ); + } + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) jumpClick(ActivityPos activityPos) async { switch (activityPos.jumpType) { @@ -95,11 +123,12 @@ class _ActivityPoster extends State { break; case 4: String router = widget.activityPos.jumpUrl; + + // String router = "/router/store_order?{\"id\":\"1333246101343436800\",\"tenant\":\"1175\",\"storeName\":\"海峡姐妹茶(汉街店)\"}"; if (router.contains("?")) { - String params = router.substring(router.indexOf("?")); - params = params.replaceAll("?", ""); + String params = router.substring(router.indexOf("?")+1); Map map = jsonDecode(params); - Navigator.of(context).pushNamed(router, arguments: map); + Navigator.of(context).pushNamed(router.substring(0,router.indexOf("?")), arguments: map); } else { Navigator.of(context).pushNamed(router); } diff --git a/lib/view_widget/new_people_reward.dart b/lib/view_widget/new_people_reward.dart index 7acf376d..ad29fd59 100644 --- a/lib/view_widget/new_people_reward.dart +++ b/lib/view_widget/new_people_reward.dart @@ -42,7 +42,7 @@ class _NewPeopleReward extends State { GestureDetector( onTap: () { Navigator.of(context).pop(); - SmartDialog.showToast("领取成功"); + SmartDialog.showToast("领取成功",alignment: Alignment.center); }, child: Container( margin: EdgeInsets.only(