Browse Source

1、智能弹窗除了分享页,都显示。

2、商品详情页,数据没加载完毕点击分享和自购无响应
tags/0.0.14+2
PH2 3 years ago
parent
commit
2753dfd79e
4 changed files with 29 additions and 7 deletions
  1. +2
    -2
      lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart
  2. +3
    -5
      lib/widgets/goods_details/footer/goods_details_footer_widget.dart
  3. +12
    -0
      lib/widgets/share/share_alert.dart
  4. +12
    -0
      lib/widgets/share/share_alert_select.dart

+ 2
- 2
lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart View File

@@ -21,7 +21,7 @@ class IntellectCreate {
static bool isRequest = false; static bool isRequest = false;


//是否检查粘贴板 //是否检查粘贴板
static bool check = false;
static bool check = true;


static setCheck(bool isCheck){ static setCheck(bool isCheck){
check=isCheck; check=isCheck;
@@ -32,7 +32,7 @@ class IntellectCreate {




if (state == AppLifecycleState.resumed && !isRequest &&check) { if (state == AppLifecycleState.resumed && !isRequest &&check) {
print("读取粘贴版"); print("读取粘贴版");
isRequest = true; isRequest = true;
Timer(Duration(milliseconds: 2000), () { Timer(Duration(milliseconds: 2000), () {


+ 3
- 5
lib/widgets/goods_details/footer/goods_details_footer_widget.dart View File

@@ -1,13 +1,9 @@
import 'dart:convert';

import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_page.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_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/bloc/goods_details_footer_repository.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_sk.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) { void _collectOnClick(GoodsDetailsFooterModel model) {
///获取用户信息,未登录需要先登录 ///获取用户信息,未登录需要先登录
var _user = Provider.of<UserInfoNotifier>(context,listen: false).userInfo;
// var _user = Provider.of<UserInfoNotifier>(context,listen: false).userInfo;
if (_user?.token == null || _user?.token?.length == 0) { if (_user?.token == null || _user?.token?.length == 0) {
RouterUtil.goLogin(context); RouterUtil.goLogin(context);
return; return;
@@ -104,6 +100,7 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain


/// 分享 /// 分享
void _shareOnClick(GoodsDetailsFooterModel model) async { void _shareOnClick(GoodsDetailsFooterModel model) async {
if (EmptyUtil.isEmpty(model?.share_value)) return;
Map<String, dynamic> result = await TurnChainUtil.getShareTurnChain(context, _user, model?.good_id, model.provider, model.convertArgs.toJson()); Map<String, dynamic> result = await TurnChainUtil.getShareTurnChain(context, _user, model?.good_id, model.provider, model.convertArgs.toJson());
if (!EmptyUtil.isEmpty(result)) { if (!EmptyUtil.isEmpty(result)) {
model.shareUrlArgs.buyUrl = result['open_app_url']; model.shareUrlArgs.buyUrl = result['open_app_url'];
@@ -113,6 +110,7 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain


/// 自购省 /// 自购省
void _saveMoneyOnClick(GoodsDetailsFooterModel model) async { 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); await TurnChainUtil.openReceiveCoupon(context, _user, model?.good_id, model?.provider, model?.convertArgs?.toJson(), isFree: widget?.isFree);
} }




+ 12
- 0
lib/widgets/share/share_alert.dart View File

@@ -11,6 +11,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:share_extend/share_extend.dart'; import 'package:share_extend/share_extend.dart';
import 'package:sharesdk_plugin/sharesdk_plugin.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/dialog/loading/loading.dart';
import 'package:zhiying_base_widget/utils/image_download_util/image_download_util.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'; import 'package:zhiying_base_widget/widgets/share/models/share_alert_model.dart';
@@ -36,6 +37,9 @@ class _ShareAlertState extends State<ShareAlert> {


@override @override
void initState() { void initState() {
Logger.log('设置分享页面不弹');
/// 设置分享页面不弹
IntellectCreate.setCheck(false);
NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) { NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) {
// try{ // try{
// _parseData(data); // _parseData(data);
@@ -50,6 +54,14 @@ class _ShareAlertState extends State<ShareAlert> {
super.initState(); super.initState();
} }


@override
void dispose() {
Logger.log('设置智能弹窗可以弹');
/// 之后可以弹
IntellectCreate.setCheck(true);
super.dispose();
}

void _parseData(Map<String, dynamic> data) { void _parseData(Map<String, dynamic> data) {
List modList = data['mod_list']; List modList = data['mod_list'];
Map d = modList.first; Map d = modList.first;


+ 12
- 0
lib/widgets/share/share_alert_select.dart View File

@@ -17,6 +17,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:share_extend/share_extend.dart'; import 'package:share_extend/share_extend.dart';
import 'package:sharesdk_plugin/sharesdk_plugin.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/dialog/loading/loading.dart';
import 'package:zhiying_base_widget/utils/image_download_util/image_download_util.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'; import 'package:zhiying_base_widget/widgets/share/models/share_alert_model.dart';
@@ -50,6 +51,9 @@ class _ShareAlertSelectState extends State<ShareAlertSelect> {


@override @override
void initState() { void initState() {
Logger.log('设置分享页面不弹');
/// 设置分享页面不弹
IntellectCreate.setCheck(false);
NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) { NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) {
// try{ // try{
// _parseData(data); // _parseData(data);
@@ -70,6 +74,14 @@ class _ShareAlertSelectState extends State<ShareAlertSelect> {
super.initState(); super.initState();
} }


@override
void dispose() {
Logger.log('设置智能弹窗可以弹');
/// 之后可以弹
IntellectCreate.setCheck(true);
super.dispose();
}

void _parseData(Map<String, dynamic> data) { void _parseData(Map<String, dynamic> data) {
List modList = data['mod_list']; List modList = data['mod_list'];
Map d = modList.first; Map d = modList.first;


Loading…
Cancel
Save