|
|
|
@ -6,6 +6,9 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
|
|
abstract class BaseState<T extends StatefulWidget> extends State<T> |
|
|
|
|
with WidgetsBindingObserver { |
|
|
|
|
|
|
|
|
|
int lastTime = DateTime.now().millisecondsSinceEpoch; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void dispose() { |
|
|
|
|
super.dispose(); |
|
|
|
@ -20,8 +23,11 @@ abstract class BaseState<T extends StatefulWidget> extends State<T>
|
|
|
|
|
break; |
|
|
|
|
case AppLifecycleState.resumed: //从后台切换前台,界面可见 |
|
|
|
|
pushRoute(); |
|
|
|
|
if(DateTime.now().millisecondsSinceEpoch - lastTime > 300000) |
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/main_page'); |
|
|
|
|
break; |
|
|
|
|
case AppLifecycleState.paused: // 界面不可见,后台 |
|
|
|
|
lastTime = DateTime.now().millisecondsSinceEpoch; |
|
|
|
|
break; |
|
|
|
|
case AppLifecycleState.detached: // APP结束时调用 |
|
|
|
|
break; |
|
|
|
@ -49,41 +55,41 @@ abstract class BaseState<T extends StatefulWidget> extends State<T>
|
|
|
|
|
if (pushMap != null) { |
|
|
|
|
String routeName = ""; |
|
|
|
|
Map<String, dynamic> params = {}; |
|
|
|
|
switch (pushMap["typed"]) { |
|
|
|
|
case 1: |
|
|
|
|
routeName = "/router/store_detail_page"; |
|
|
|
|
params["articleId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
routeName = "/router/store_detail_page"; |
|
|
|
|
params["activityId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
routeName = "/router/store_order"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
params["tenant"] = pushMap["tenant"]; |
|
|
|
|
params["storeName"] = pushMap["storeName"]; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
routeName = "/router/integral_store_page"; |
|
|
|
|
params["goodsId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
routeName = "/router/order_details"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case 6: |
|
|
|
|
routeName = "/router/community_details"; |
|
|
|
|
params["businessId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case 8: |
|
|
|
|
routeName = "/router/mine_wallet"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case 9: |
|
|
|
|
routeName = "/router/welfare_page"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
switch (pushMap["typed"].toString()) { |
|
|
|
|
case "1":case "ARTICLE": |
|
|
|
|
routeName = "/router/web_page"; |
|
|
|
|
params["articleId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case "2":case "ACTIVITY": |
|
|
|
|
routeName = "/router/web_page"; |
|
|
|
|
params["activityId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case "3":case "SHOP": |
|
|
|
|
routeName = "/router/store_order"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
params["tenant"] = pushMap["tenant"]; |
|
|
|
|
params["storeName"] = pushMap["storeName"]; |
|
|
|
|
break; |
|
|
|
|
case "4":case "CREDIT_GOODS": |
|
|
|
|
routeName = "/router/integral_store_page"; |
|
|
|
|
params["goodsId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case "5":case "ORDER": |
|
|
|
|
routeName = "/router/order_details"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case "6":case "MEMBER": |
|
|
|
|
routeName = "/router/community_details"; |
|
|
|
|
params["businessId"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case "8":case "WALLET": |
|
|
|
|
routeName = "/router/mine_wallet"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
case "9":case "WELFARE": |
|
|
|
|
routeName = "/router/welfare_page"; |
|
|
|
|
params["id"] = pushMap["info"]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
sharedPreferences.setString("pushData", ""); |
|
|
|
|
print("xgPushClickAction: routeName: $routeName"); |
|
|
|
|