From dad19b3dda2f68c36211830c8c46e42aa107f771 Mon Sep 17 00:00:00 2001
From: Weller <1812208341@qq.com>
Date: Tue, 15 Sep 2020 13:36:12 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B7=AF=E7=94=B1=E5=B7=A5?=
=?UTF-8?q?=E5=85=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/libraries/Flutter_Plugins.xml | 2 +-
.idea/vcs.xml | 7 +
.idea/workspace.xml | 251 +++++++++++++++++++++++-----
example/pubspec.lock | 16 +-
lib/pages/login_page.dart | 13 ++
lib/util/router_util.dart | 45 +++--
pubspec.lock | 16 +-
zhiying_comm.iml | 7 +
8 files changed, 299 insertions(+), 58 deletions(-)
create mode 100644 .idea/vcs.xml
create mode 100644 lib/pages/login_page.dart
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
index a4e2f32..8f69909 100644
--- a/.idea/libraries/Flutter_Plugins.xml
+++ b/.idea/libraries/Flutter_Plugins.xml
@@ -5,7 +5,6 @@
-
@@ -13,6 +12,7 @@
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..a6a0532
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1e66875..d9bd792 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,7 +1,24 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -15,53 +32,58 @@
-
-
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
@@ -70,10 +92,40 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,7 +136,7 @@
-
+
@@ -92,11 +144,39 @@
+
+
+
+
+
+ RouterUtil
+ UserInfoModel
+ getUserInfoModel
+ UserInfoNotifier
+ naviga
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
@@ -104,6 +184,7 @@
+
@@ -116,6 +197,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -132,12 +226,12 @@
-
-
+
+
@@ -185,7 +279,9 @@
-
+
+
+
@@ -204,6 +300,8 @@
+
+
@@ -211,16 +309,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -235,8 +323,6 @@
-
-
@@ -244,5 +330,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/pubspec.lock b/example/pubspec.lock
index f7471bc..d312e2e 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -267,7 +267,7 @@ packages:
name: fluttertoast
url: "https://pub.flutter-io.cn"
source: hosted
- version: "7.0.4"
+ version: "4.0.1"
glob:
dependency: transitive
description:
@@ -380,6 +380,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.7"
+ nested:
+ dependency: transitive
+ description:
+ name: nested
+ url: "https://pub.flutter-io.cn"
+ source: hosted
+ version: "0.0.4"
node_interop:
dependency: transitive
description:
@@ -485,6 +492,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.13"
+ provider:
+ dependency: transitive
+ description:
+ name: provider
+ url: "https://pub.flutter-io.cn"
+ source: hosted
+ version: "4.0.5+1"
pub_semver:
dependency: transitive
description:
diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart
new file mode 100644
index 0000000..db53dc1
--- /dev/null
+++ b/lib/pages/login_page.dart
@@ -0,0 +1,13 @@
+import 'package:flutter/material.dart';
+
+class LoginPage extends StatefulWidget {
+ @override
+ _LoginPageState createState() => _LoginPageState();
+}
+
+class _LoginPageState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return Material(child: Center(child: Text('登录页'),),);
+ }
+}
diff --git a/lib/util/router_util.dart b/lib/util/router_util.dart
index 584a952..eba8678 100644
--- a/lib/util/router_util.dart
+++ b/lib/util/router_util.dart
@@ -1,22 +1,37 @@
import 'package:flutter/material.dart';
+import 'package:zhiying_comm/pages/login_page.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
+import 'package:provider/provider.dart';
class RouterUtil {
- /**
- * @description: 公共方法页面跳转,如果flutter端已经注册,直接跳转,否则转交原生处理
- * @param {BasePageModel} 页面数据
- * @param {BuildContext} context
- * @return:
- */
- static void route(Map model, BuildContext context) {
- String name = model.containsKey('name') ? model['name'] : '';
- if (PageFactory.hasRegisted(name)) {
- Widget page = PageFactory.create(name, model);
- Navigator.push(context, MaterialPageRoute(builder: (context) {
- return page;
- }));
- } else {
- NativeUtil.openPage(context, model);
+
+ static Future route(Map model, BuildContext context) {
+ // 唯一跳转标识
+ String skipIdentifier = model['skip_identifier'].toString();
+ // 需要登录
+ String requiredLogin = model['required_login'].toString();
+ // 需要淘宝授权
+ String requiredTaobaoAuth = model['required_taobao_auth'].toString();
+
+
+ if (requiredLogin == '1') {
+ UserInfoModel user = Provider.of(context, listen: false).getUserInfoModel();
+ print(user.toString());
+ if (user?.token == null || user.token == '') {
+ print('need login...');
+ return Navigator.of(context)
+ .push(MaterialPageRoute(builder: (BuildContext context) {
+ return LoginPage();
+ }));
+ }
}
+
+ return Navigator.of(context)
+ .push(MaterialPageRoute(builder: (BuildContext context) {
+ if (PageFactory.hasRegisted(skipIdentifier)) {
+ return PageFactory.create(skipIdentifier, model);
+ }
+ return EmptyPage();
+ }));
}
}
diff --git a/pubspec.lock b/pubspec.lock
index 7bdcb17..3f68c7a 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -260,7 +260,7 @@ packages:
name: fluttertoast
url: "https://pub.flutter-io.cn"
source: hosted
- version: "7.0.4"
+ version: "4.0.1"
glob:
dependency: transitive
description:
@@ -373,6 +373,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.7"
+ nested:
+ dependency: transitive
+ description:
+ name: nested
+ url: "https://pub.flutter-io.cn"
+ source: hosted
+ version: "0.0.4"
node_interop:
dependency: transitive
description:
@@ -478,6 +485,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.13"
+ provider:
+ dependency: "direct main"
+ description:
+ name: provider
+ url: "https://pub.flutter-io.cn"
+ source: hosted
+ version: "4.0.5+1"
pub_semver:
dependency: transitive
description:
diff --git a/zhiying_comm.iml b/zhiying_comm.iml
index 73e7ebd..fd966eb 100644
--- a/zhiying_comm.iml
+++ b/zhiying_comm.iml
@@ -11,6 +11,13 @@
+
+
+
+
+
+
+