@fairys/taro-tools-react 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/context/auth.data.instance.d.ts +3 -3
- package/esm/context/auth.data.instance.js +6 -6
- package/esm/context/global.data.instance.d.ts +4 -0
- package/esm/context/global.data.instance.js +5 -0
- package/esm/context/page.info.data.instance.d.ts +1 -1
- package/lib/components/EnterLoading/index.d.ts +14 -0
- package/lib/components/EnterLoading/index.js +112 -0
- package/lib/components/MainPage/index.d.ts +10 -0
- package/lib/components/MainPage/index.js +102 -0
- package/lib/components/Mesage/index.d.ts +48 -0
- package/lib/components/Mesage/index.js +172 -0
- package/lib/components/Portal/index.d.ts +8 -0
- package/lib/components/Portal/index.js +45 -0
- package/lib/components/Toast/index.d.ts +1 -0
- package/lib/components/Toast/index.js +54 -0
- package/lib/components/connectToastMessage/index.d.ts +10 -0
- package/lib/components/connectToastMessage/index.js +62 -0
- package/lib/components/index.d.ts +6 -0
- package/lib/components/index.js +105 -0
- package/lib/context/auth.data.instance.d.ts +81 -0
- package/lib/context/auth.data.instance.js +155 -0
- package/lib/context/global.data.instance.d.ts +54 -0
- package/lib/context/global.data.instance.js +122 -0
- package/lib/context/global.setting.data.instance.d.ts +56 -0
- package/lib/context/global.setting.data.instance.js +79 -0
- package/lib/context/index.d.ts +5 -0
- package/lib/context/index.js +96 -0
- package/lib/context/page.data.instance.d.ts +151 -0
- package/lib/context/page.data.instance.js +382 -0
- package/lib/context/page.info.data.instance.d.ts +93 -0
- package/lib/context/page.info.data.instance.js +226 -0
- package/lib/index.d.ts +3 -0
- package/lib/styles/index.css +715 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +87 -0
- package/lib/utils/navigate.d.ts +109 -0
- package/lib/utils/navigate.js +99 -0
- package/lib/utils/request.d.ts +179 -0
- package/lib/utils/request.js +358 -0
- package/lib/utils/useId.d.ts +2 -0
- package/lib/utils/useId.js +50 -0
- package/lib/utils/valtio/index.d.ts +9 -0
- package/lib/utils/valtio/index.js +99 -0
- package/lib/utils/valtio/instance.d.ts +17 -0
- package/lib/utils/valtio/instance.js +80 -0
- package/package.json +4 -3
- package/src/context/auth.data.instance.ts +6 -6
- package/src/context/global.data.instance.ts +11 -0
- package/src/context/page.info.data.instance.tsx +1 -1
- package/src/utils/navigate.ts +1 -0
|
@@ -75,8 +75,19 @@ export class GlobalDataInstance extends ProxyInstanceObjectBase<GlobalDataInstan
|
|
|
75
75
|
this.store.toastData = ref({ ...this.store.toastData, visible: false });
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* 跳转登录页面前执行
|
|
80
|
+
*/
|
|
81
|
+
onBeforetToLoginPage?: () => boolean | void;
|
|
78
82
|
/**跳转登录页面*/
|
|
79
83
|
toLoginPage = () => {
|
|
84
|
+
if (this.onBeforetToLoginPage) {
|
|
85
|
+
const f = this.onBeforetToLoginPage();
|
|
86
|
+
if (f === false) {
|
|
87
|
+
// 如果返回false则不跳转登录页面
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
80
91
|
const loginPageRoute = globalSettingDataInstance.store.loginPageRoute || '';
|
|
81
92
|
const isLoginPage = navigate.isCurrentPage(loginPageRoute || '');
|
|
82
93
|
const _loginPageRoute = `${loginPageRoute || ''}`.replace(/^\//, '');
|
|
@@ -188,7 +188,7 @@ export interface PageInfoDataOptions<T extends PageInfoDataInstanceState = PageI
|
|
|
188
188
|
|
|
189
189
|
/**初始化实例*/
|
|
190
190
|
export const usePageInfoDataInstance = <T extends PageInfoDataInstanceState = PageInfoDataInstanceState>(
|
|
191
|
-
instance
|
|
191
|
+
instance?: PageInfoDataInstance<T>,
|
|
192
192
|
) => {
|
|
193
193
|
const ref = useRef<PageInfoDataInstance<T>>();
|
|
194
194
|
if (!ref.current) {
|
package/src/utils/navigate.ts
CHANGED
|
@@ -17,6 +17,7 @@ class NavigateInstance {
|
|
|
17
17
|
if (useAuthHasMenuPermission && typeof isAuthFunction !== 'function' && isEnableAuth) {
|
|
18
18
|
isAuthFunction = authDataInstance.hasMenuPermission;
|
|
19
19
|
}
|
|
20
|
+
|
|
20
21
|
if (url && typeof isAuthFunction === 'function' && !isIgnoreAuthRoutes && isEnableAuth) {
|
|
21
22
|
isAuthTo = await isAuthFunction(url);
|
|
22
23
|
}
|