Sfoglia il codice sorgente

1、优化网络请求超时,去除ioswebview打开限制

tags/0.0.15
“yanghuaxuan” 3 anni fa
parent
commit
93791a0c6c
2 ha cambiato i file con 11 aggiunte e 10 eliminazioni
  1. +5
    -4
      lib/util/net_util.dart
  2. +6
    -6
      lib/util/router_util.dart

+ 5
- 4
lib/util/net_util.dart Vedi File

@@ -218,7 +218,7 @@ class NetUtil {
OnSuccess onSuccess,
OnError onError,
OnCache onCache,
bool showToast = true,int timeOut=15000}) async {
bool showToast = true, int timeOut = 15000}) async {
var paramsData = {'postData': params ?? {}, 'queryParameters': queryParameters ?? {}};

// 根据请求参数,获取缓存的Key
@@ -234,7 +234,8 @@ class NetUtil {
params: params,
queryParameters: queryParameters,
showToast: showToast,
cache: onCache != null,timeOut: timeOut);
cache: onCache != null,
timeOut: timeOut);
// TODO 解密?
if (isSuccess(result)) {
if (onSuccess != null) {
@@ -250,8 +251,8 @@ class NetUtil {
: '未知错误'
: '未知错误');
}
} catch (e) {
Logger.error('error: ' + e.toString());
} catch (e, s) {
Logger.error('error: ' + e.toString() + "\n" + s.toString());
if (onError != null) {
onError(e?.toString() ?? '未知错误');
}


+ 6
- 6
lib/util/router_util.dart Vedi File

@@ -44,7 +44,7 @@ class RouterUtil {
}

// TODO webView 临时代码,IOS添加原生WebView需要改动这里
if (skipModel?.skipIdentifier == 'pub.flutter.url' && Platform.isAndroid) {
if (skipModel?.skipIdentifier == 'pub.flutter.url') {
RouterUtil.openWebview(skipModel?.url, context);
return;
}
@@ -88,11 +88,11 @@ class RouterUtil {
SkipModel model = SkipModel();
model.skipIdentifier = 'pub.flutter.url';
model.url = url;
if (Platform.isAndroid) {
Application.doStringParamsMethod("openUrl", data: {"url": model.url});
return null;
}
RouterUtil.route(model, model.toJson(), context);
Application.doStringParamsMethod("openUrl", data: {"url": model.url});
return null;
//
// RouterUtil.route(model, model.toJson(), context);
}

// 回到首页


Caricamento…
Annulla
Salva