From 7b342708a8937403a88b16c767fe5ad65dc09040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Tue, 25 May 2021 16:42:57 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96url=E5=94=A4=E8=B5=B7?= =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E7=9A=84=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/util/router_util.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/util/router_util.dart b/lib/util/router_util.dart index c120f90..62d0fc9 100644 --- a/lib/util/router_util.dart +++ b/lib/util/router_util.dart @@ -6,6 +6,7 @@ import 'package:flutter_alibc/alibc_const_key.dart'; import 'package:flutter_alibc/flutter_alibc.dart'; import 'package:jdsdk/jdsdk.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'package:zhiying_comm/pages/login_page/account/login_account_page.dart'; import 'package:zhiying_comm/pages/login_page/login_page.dart'; import 'package:zhiying_comm/util/dialog/loading/loading.dart'; @@ -48,7 +49,7 @@ class RouterUtil { } } - // TODO webView 临时代码,IOS添加原生WebView需要改动这里 + if (skipModel?.skipIdentifier == 'pub.flutter.url') { if (skipModel?.url?.contains("sourceType=jd") ?? false) { Loading.show(context); @@ -57,10 +58,11 @@ class RouterUtil { var detailUrl = responds?.realUri?.toString(); Logger.debug(detailUrl ?? ""); Loading.dismiss(); - Jdsdk.openUrl(url: detailUrl); - return; + if (await canLaunch(detailUrl)) { + Jdsdk.openUrl(url: detailUrl); + return; + } } - RouterUtil.openWebview(skipModel?.url, context); return; }