From 0a9cbee88f24a86d391bd2845cd24466b67258d8 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 14:24:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E4=BA=AC=E4=B8=9C=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=8B=89=E8=B5=B7app=E7=9A=84url=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/util/router_util.dart | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/util/router_util.dart b/lib/util/router_util.dart index a955488..c120f90 100644 --- a/lib/util/router_util.dart +++ b/lib/util/router_util.dart @@ -2,13 +2,16 @@ import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +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: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'; import 'package:zhiying_comm/util/event_util/event_util.dart'; import 'package:zhiying_comm/util/event_util/login_success_event.dart'; +import 'package:zhiying_comm/util/pdd_auth/pdd_auth.dart'; import 'package:zhiying_comm/util/shared_prefe_util.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; @@ -47,19 +50,30 @@ class RouterUtil { // TODO webView 临时代码,IOS添加原生WebView需要改动这里 if (skipModel?.skipIdentifier == 'pub.flutter.url') { + if (skipModel?.url?.contains("sourceType=jd") ?? false) { + Loading.show(context); + Dio dio = Dio(); + var responds = await dio.get(skipModel.url); + var detailUrl = responds?.realUri?.toString(); + Logger.debug(detailUrl ?? ""); + Loading.dismiss(); + Jdsdk.openUrl(url: detailUrl); + return; + } + RouterUtil.openWebview(skipModel?.url, context); return; } if (skipModel?.skipIdentifier == 'pub.flutter.taobao_url') { - print("淘宝链接"+skipModel.url); + print("淘宝链接" + skipModel.url); Loading.show(context); Dio dio = Dio(); var responds = await dio.get(skipModel.url); var detailUrl = responds?.realUri?.toString(); - Logger.debug(detailUrl??""); + Logger.debug(detailUrl ?? ""); Loading.dismiss(); - FlutterAlibc.openByUrl(url: detailUrl); + FlutterAlibc.openByUrl(url: detailUrl, schemeType: AlibcSchemeType.AlibcSchemeTaoBao); return; } @@ -102,8 +116,8 @@ class RouterUtil { SkipModel model = SkipModel(); model.skipIdentifier = 'pub.flutter.url'; model.url = url; - if(model.url.contains("official/redirect_url")){ - model.url=model.url+"&zuid="+(UserInfoNotifier?.staitcUserInfo?.userId??""); + if (model.url.contains("official/redirect_url")) { + model.url = model.url + "&zuid=" + (UserInfoNotifier?.staitcUserInfo?.userId ?? ""); } Application.doStringParamsMethod("openUrl", data: {"url": model.url});