Browse Source

优化首页活动海报弹窗-新人弹窗顺序

dart3_last
wurong 2 years ago
parent
commit
c7e227ad4d
  1. 34
      lib/home/home_page.dart
  2. 2
      lib/retrofit/min_api.dart
  3. 2
      lib/retrofit/retrofit_api.dart
  4. 37
      lib/view_widget/activity_poster.dart
  5. 2
      lib/view_widget/new_people_reward.dart

34
lib/home/home_page.dart

@ -81,10 +81,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
widget.interviewCouponList != null && widget.interviewCouponList != null &&
widget.interviewCouponList.length > 0) showInvite = true; 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<HomePage> 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; var today = DateTime.now().day;
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};")) if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};"))
@ -121,7 +109,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ActivityPoster(activityPos); return ActivityPoster(activityPos,firstLoginCouponList);
}, },
); );
}); });
@ -283,10 +271,12 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]); inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
showInvite = false; showInvite = false;
} }
if (showNew) {
newShowAlertDialog(widget.firstLoginCouponList); //
showNew = false; // if (showNew) {
} // newShowAlertDialog(widget.firstLoginCouponList);
// showNew = false;
// }
} }
queryUserBalance() async { queryUserBalance() async {
@ -337,7 +327,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
if(baseData.data?.enabled ?? true) if(baseData.data?.enabled ?? true)
posterShowAlertDialog(baseData.data); posterShowAlertDialog(baseData.data,widget.firstLoginCouponList);
} }
} }

2
lib/retrofit/min_api.dart

@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart';
part 'min_api.g.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 localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线

2
lib/retrofit/retrofit_api.dart

@ -64,7 +64,7 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.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 localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线

37
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:huixiang/retrofit/data/activity_pos.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/login_info.dart';
import 'custom_image.dart'; import 'custom_image.dart';
import 'new_people_reward.dart';
class ActivityPoster extends StatefulWidget { class ActivityPoster extends StatefulWidget {
final ActivityPos activityPos; final ActivityPos activityPos;
final List<FirstLoginCouponList> firstLoginCouponList;
ActivityPoster(this.activityPos); ActivityPoster(this.activityPos,this.firstLoginCouponList);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -20,6 +23,15 @@ class ActivityPoster extends StatefulWidget {
} }
class _ActivityPoster extends State<ActivityPoster> { class _ActivityPoster extends State<ActivityPoster> {
bool showNew = false;
@override
void initState() {
super.initState();
if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0)
showNew = true;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return WillPopScope(
@ -60,6 +72,11 @@ class _ActivityPoster extends State<ActivityPoster> {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: (){
Navigator.of(context).pop(); Navigator.of(context).pop();
if (showNew) {
newShowAlertDialog(widget.firstLoginCouponList);
showNew = false;
}
}, },
child: Image.asset( child: Image.asset(
"assets/image/yq_qx.webp", "assets/image/yq_qx.webp",
@ -74,6 +91,17 @@ class _ActivityPoster extends State<ActivityPoster> {
)); ));
} }
///
newShowAlertDialog(newUserCouponList) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return NewPeopleReward(newUserCouponList);
},
);
}
/// contentType 0123,4:,5: /// contentType 0123,4:,5:
jumpClick(ActivityPos activityPos) async { jumpClick(ActivityPos activityPos) async {
switch (activityPos.jumpType) { switch (activityPos.jumpType) {
@ -95,11 +123,12 @@ class _ActivityPoster extends State<ActivityPoster> {
break; break;
case 4: case 4:
String router = widget.activityPos.jumpUrl; String router = widget.activityPos.jumpUrl;
// String router = "/router/store_order?{\"id\":\"1333246101343436800\",\"tenant\":\"1175\",\"storeName\":\"海峡姐妹茶(汉街店)\"}";
if (router.contains("?")) { if (router.contains("?")) {
String params = router.substring(router.indexOf("?")); String params = router.substring(router.indexOf("?")+1);
params = params.replaceAll("?", "");
Map map = jsonDecode(params); Map map = jsonDecode(params);
Navigator.of(context).pushNamed(router, arguments: map); Navigator.of(context).pushNamed(router.substring(0,router.indexOf("?")), arguments: map);
} else { } else {
Navigator.of(context).pushNamed(router); Navigator.of(context).pushNamed(router);
} }

2
lib/view_widget/new_people_reward.dart

@ -42,7 +42,7 @@ class _NewPeopleReward extends State<NewPeopleReward> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
SmartDialog.showToast("领取成功"); SmartDialog.showToast("领取成功",alignment: Alignment.center);
}, },
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(

Loading…
Cancel
Save