From 2753dfd79e054675c0aa3f699bb758fe3b26bea7 Mon Sep 17 00:00:00 2001 From: PH2 <1293456824@qq.com> Date: Sat, 17 Apr 2021 11:44:44 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=99=BA=E8=83=BD=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E9=99=A4=E4=BA=86=E5=88=86=E4=BA=AB=E9=A1=B5=EF=BC=8C=E9=83=BD?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E3=80=82=202=E3=80=81=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=EF=BC=8C=E6=95=B0=E6=8D=AE=E6=B2=A1?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=AE=8C=E6=AF=95=E7=82=B9=E5=87=BB=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E5=92=8C=E8=87=AA=E8=B4=AD=E6=97=A0=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intellect_create.dart | 4 ++-- .../footer/goods_details_footer_widget.dart | 8 +++----- lib/widgets/share/share_alert.dart | 12 ++++++++++++ lib/widgets/share/share_alert_select.dart | 12 ++++++++++++ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart index 1899de4..73259a8 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart @@ -21,7 +21,7 @@ class IntellectCreate { static bool isRequest = false; //是否检查粘贴板 - static bool check = false; + static bool check = true; static setCheck(bool isCheck){ check=isCheck; @@ -32,7 +32,7 @@ class IntellectCreate { if (state == AppLifecycleState.resumed && !isRequest &&check) { - + print("读取粘贴版"); isRequest = true; Timer(Duration(milliseconds: 2000), () { diff --git a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart index 7281d62..8346a41 100644 --- a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart +++ b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart @@ -1,13 +1,9 @@ -import 'dart:convert'; - import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:fluttertoast/fluttertoast.dart'; import 'package:provider/provider.dart'; import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_page.dart'; -import 'package:zhiying_base_widget/widgets/custom/multi_nav/cached_network_image_util.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_bloc.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_repository.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_sk.dart'; @@ -87,7 +83,7 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain /// 收藏 void _collectOnClick(GoodsDetailsFooterModel model) { ///获取用户信息,未登录需要先登录 - var _user = Provider.of(context,listen: false).userInfo; + // var _user = Provider.of(context,listen: false).userInfo; if (_user?.token == null || _user?.token?.length == 0) { RouterUtil.goLogin(context); return; @@ -104,6 +100,7 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain /// 分享 void _shareOnClick(GoodsDetailsFooterModel model) async { + if (EmptyUtil.isEmpty(model?.share_value)) return; Map result = await TurnChainUtil.getShareTurnChain(context, _user, model?.good_id, model.provider, model.convertArgs.toJson()); if (!EmptyUtil.isEmpty(result)) { model.shareUrlArgs.buyUrl = result['open_app_url']; @@ -113,6 +110,7 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain /// 自购省 void _saveMoneyOnClick(GoodsDetailsFooterModel model) async { + if (EmptyUtil.isEmpty(model?.self_buy_value)) return; await TurnChainUtil.openReceiveCoupon(context, _user, model?.good_id, model?.provider, model?.convertArgs?.toJson(), isFree: widget?.isFree); } diff --git a/lib/widgets/share/share_alert.dart b/lib/widgets/share/share_alert.dart index fd27da4..7e9a583 100644 --- a/lib/widgets/share/share_alert.dart +++ b/lib/widgets/share/share_alert.dart @@ -11,6 +11,7 @@ import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:share_extend/share_extend.dart'; import 'package:sharesdk_plugin/sharesdk_plugin.dart'; +import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart'; import 'package:zhiying_base_widget/dialog/loading/loading.dart'; import 'package:zhiying_base_widget/utils/image_download_util/image_download_util.dart'; import 'package:zhiying_base_widget/widgets/share/models/share_alert_model.dart'; @@ -36,6 +37,9 @@ class _ShareAlertState extends State { @override void initState() { + Logger.log('设置分享页面不弹'); + /// 设置分享页面不弹 + IntellectCreate.setCheck(false); NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) { // try{ // _parseData(data); @@ -50,6 +54,14 @@ class _ShareAlertState extends State { super.initState(); } + @override + void dispose() { + Logger.log('设置智能弹窗可以弹'); + /// 之后可以弹 + IntellectCreate.setCheck(true); + super.dispose(); + } + void _parseData(Map data) { List modList = data['mod_list']; Map d = modList.first; diff --git a/lib/widgets/share/share_alert_select.dart b/lib/widgets/share/share_alert_select.dart index 18d97ae..beb2b9b 100644 --- a/lib/widgets/share/share_alert_select.dart +++ b/lib/widgets/share/share_alert_select.dart @@ -17,6 +17,7 @@ import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:share_extend/share_extend.dart'; import 'package:sharesdk_plugin/sharesdk_plugin.dart'; +import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart'; import 'package:zhiying_base_widget/dialog/loading/loading.dart'; import 'package:zhiying_base_widget/utils/image_download_util/image_download_util.dart'; import 'package:zhiying_base_widget/widgets/share/models/share_alert_model.dart'; @@ -50,6 +51,9 @@ class _ShareAlertSelectState extends State { @override void initState() { + Logger.log('设置分享页面不弹'); + /// 设置分享页面不弹 + IntellectCreate.setCheck(false); NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) { // try{ // _parseData(data); @@ -70,6 +74,14 @@ class _ShareAlertSelectState extends State { super.initState(); } + @override + void dispose() { + Logger.log('设置智能弹窗可以弹'); + /// 之后可以弹 + IntellectCreate.setCheck(true); + super.dispose(); + } + void _parseData(Map data) { List modList = data['mod_list']; Map d = modList.first;