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});