From 97b8a0c446bc537fe619ae20c26b154fd38f8532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Tue, 18 May 2021 16:28:59 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=88=B7=E6=96=B0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/base/base_change_notifier.dart | 16 +++++++++------- lib/models/base/skip_model.dart | 3 +++ lib/util/turn_chain/turn_chain_util.dart | 6 ++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/models/base/base_change_notifier.dart b/lib/models/base/base_change_notifier.dart index 05cbf5c..b32638d 100644 --- a/lib/models/base/base_change_notifier.dart +++ b/lib/models/base/base_change_notifier.dart @@ -6,12 +6,15 @@ import 'package:provider/provider.dart'; class BaseChangeNotifier extends ChangeNotifier { StreamController pageController = StreamController.broadcast(); + static Map hasKeys = Map(); + ///刷新通知方法 void refresh() { pageController.add("refresh"); notifyListeners(); } + void close() { pageController.close(); } @@ -29,8 +32,8 @@ enum EventType { ///页面刷新辅助类 class RefreshListener { bool isListen = false; - StreamSubscription streamSubscription; - + Map hasKeys = Map(); + StreamSubscription streamSubscription; ///监听方法 ///已废弃 void _listen(BuildContext context, Function(String) refresh) { @@ -54,19 +57,18 @@ class RefreshListener { } ///监听构造 - RefreshListener.listen(BuildContext context, Function(String) refresh) { + void listen(BuildContext context, Function(String) refresh) { + BaseChangeNotifier baseChangeNotifier; try { baseChangeNotifier = Provider.of(context); } catch (e, s) { print(e); print(s); - throw Exception( - "父页面或父控件必须添加 BaseChangeNotifier 的 Provide值才能使用RefreshListener对象"); } if (!isListen && baseChangeNotifier != null) { isListen = true; - baseChangeNotifier.stream.listen((event) { + streamSubscription= baseChangeNotifier.stream.listen((event) { if (refresh != null) { refresh(event); } @@ -77,7 +79,7 @@ class RefreshListener { ///关闭监听 void close() { if (streamSubscription != null) { - streamSubscription.cancel(); + streamSubscription?.cancel(); } } } \ No newline at end of file diff --git a/lib/models/base/skip_model.dart b/lib/models/base/skip_model.dart index b914142..14bb590 100644 --- a/lib/models/base/skip_model.dart +++ b/lib/models/base/skip_model.dart @@ -4,6 +4,7 @@ class SkipModel { String requiredTaobaoAuth; String skipIdentifier; String isJump; + String skipName; Map data; SkipModel({ @@ -26,6 +27,7 @@ class SkipModel { requiredTaobaoAuth = json['required_taobao_auth']?.toString(); skipIdentifier = json['skip_identifier']; isJump = json['is_jump']?.toString(); + skipName=json['skip_name']; } Map toJson() { @@ -36,6 +38,7 @@ class SkipModel { data['skip_identifier'] = this.skipIdentifier; data['is_jump'] = this.isJump; data['data'] = this.data; + data['skip_name']=this.skipName; return data; } } diff --git a/lib/util/turn_chain/turn_chain_util.dart b/lib/util/turn_chain/turn_chain_util.dart index 6414b58..99ddc23 100644 --- a/lib/util/turn_chain/turn_chain_util.dart +++ b/lib/util/turn_chain/turn_chain_util.dart @@ -231,10 +231,8 @@ class TurnChainUtil { RouterUtil.openWebview(webUrl, context); rlt = true; } else { - tradeResult = await FlutterAlibc.openByUrl( - url: openAppUrl, - schemeType: provider == GlobalConfig.PROVIDER_TM ? AlibcSchemeType.AlibcSchemeTmall : AlibcSchemeType.AlibcSchemeTaoBao, - ); + + tradeResult = await FlutterAlibc.openByUrl(url: openAppUrl,schemeType: provider==GlobalConfig.PROVIDER_TB?AlibcSchemeType.AlibcSchemeTaoBao:AlibcSchemeType.AlibcSchemeTmall,); rlt = true; } }