@pubinfo/core 2.0.4 → 2.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/dist/{AppSetting-BPm1iNZE.js → AppSetting-Bn7vxkwu.js} +28 -28
- package/dist/{HCheckList.vue_vue_type_script_setup_true_lang-DZdJleRQ.js → HCheckList.vue_vue_type_script_setup_true_lang-CHx9ghjT.js} +6 -7
- package/dist/{HToggle-D7rl1UyP.js → HToggle-CtjNyqPp.js} +1 -1
- package/dist/HeaderThinMenu-DOIRf9rF.js +4 -0
- package/dist/{PreferencesContent-3skbPeaO.js → PreferencesContent-DesQ1gs9.js} +42 -42
- package/dist/{SettingBreadcrumb-BfGDLhtF.js → SettingBreadcrumb-Dgz-kLlD.js} +5 -5
- package/dist/{SettingCopyright-BlaSjFFj.js → SettingCopyright-Bb_zsv8S.js} +3 -3
- package/dist/{SettingEnableTransition-C8T3WIUt.js → SettingEnableTransition-8Fk8bfQL.js} +11 -11
- package/dist/{SettingHome-QgBXhQ2Q.js → SettingHome-KGLeBn-Y.js} +4 -4
- package/dist/{SettingMenu-CEAs_0ys.js → SettingMenu-CbzwRzNT.js} +5 -5
- package/dist/{SettingMode-KmHfcY38.js → SettingMode-C22EONZU.js} +3 -3
- package/dist/{SettingNavSearch-D0e0I9B7.js → SettingNavSearch-ZEgspalS.js} +4 -4
- package/dist/{SettingOther-IHCEjsxI.js → SettingOther-0MjVwrIi.js} +11 -11
- package/dist/{SettingPage-DPBGOEtF.js → SettingPage-C-wDrzIC.js} +2 -2
- package/dist/{SettingTabbar-DrvOEs-w.js → SettingTabbar-IKM2fNxW.js} +10 -10
- package/dist/{SettingThemes-Dy8c7QLY.js → SettingThemes-DybjcBGx.js} +15 -15
- package/dist/{SettingToolbar-XbaNbaHm.js → SettingToolbar-fWSTNiLR.js} +6 -6
- package/dist/{SettingTopbar-_mX7FPh0.js → SettingTopbar-ddg9ZhqJ.js} +5 -5
- package/dist/{SettingWidthMode-C02CiFAb.js → SettingWidthMode-DPhge32Z.js} +4 -4
- package/dist/built-in/layout-component/Layout.vue.d.ts +1 -0
- package/dist/built-in/layout-component/components/Header/HeaderMenu.vue.d.ts +2 -0
- package/dist/built-in/layout-component/composables/useGetComputedStyle.d.ts +1 -1
- package/dist/built-in/layout-component/index.d.ts +5 -1
- package/dist/{colors-BljoNaBx.js → colors-Cw5YV1k2.js} +1 -1
- package/dist/features/components/index.d.ts +0 -1
- package/dist/features/stores/utils/index.d.ts +0 -1
- package/dist/{index-CzHYZgeY.js → index-B4WU4ykx.js} +3 -3
- package/dist/{index-DNYSd9ZF.js → index-Bm6KmENu.js} +2 -2
- package/dist/{index-C3c_sJSC.js → index-BrB42sd5.js} +2 -2
- package/dist/{index-ChJFQhqM.js → index-ClpIFmv2.js} +1 -1
- package/dist/{index-lqO17ZtF.js → index-Cq8mquS8.js} +29235 -28954
- package/dist/index-Cvhd8Wyw.js +4 -0
- package/dist/{index-DeZnnMdZ.js → index-QidxqFx5.js} +2 -2
- package/dist/{index-B8-URsHM.js → index-n76z6PLD.js} +4 -4
- package/dist/{index-DdB-0PGU.js → index-tnsLRhOC.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +35 -34
- package/dist/{pick-BYl3xBnk.js → pick-CKgJFfA4.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/publicKey.d.ts +4 -0
- package/package.json +5 -5
- package/src/built-in/layout-component/Layout.vue +14 -2
- package/src/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/index.vue +1 -1
- package/src/built-in/layout-component/components/Header/HeaderMenu.vue +19 -0
- package/src/built-in/layout-component/components/Header/{TopThinMode.vue → HeaderThinMenu.vue} +1 -1
- package/src/built-in/layout-component/components/Header/index.vue +2 -7
- package/src/built-in/layout-component/components/Menu/index.vue +1 -1
- package/src/{features → built-in/layout-component}/components/NotAllowed/index.vue +2 -32
- package/src/built-in/layout-component/composables/useGetComputedStyle.ts +12 -9
- package/src/built-in/layout-component/index.ts +16 -1
- package/src/features/components/PubinfoApp/index.vue +1 -14
- package/src/features/components/index.ts +0 -1
- package/src/features/settings/index.ts +1 -0
- package/src/features/stores/modules/menu.ts +2 -2
- package/src/features/stores/modules/route.ts +8 -3
- package/src/features/stores/modules/user.ts +4 -4
- package/src/features/stores/utils/index.ts +0 -1
- package/src/index.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/{features/stores/utils/crypto.ts → utils/publicKey.ts} +9 -10
- package/types/settings.d.ts +6 -0
- package/dist/TopThinMode-CgPi1Z9s.js +0 -35
- package/dist/features/stores/utils/crypto.d.ts +0 -1
- package/dist/index-Hu8-WkAC.js +0 -272
- /package/dist/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/More.vue.d.ts +0 -0
- /package/dist/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/NotCursor.vue.d.ts +0 -0
- /package/dist/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/index.vue.d.ts +0 -0
- /package/dist/built-in/layout-component/components/Header/{TopThinMode.vue.d.ts → HeaderThinMenu.vue.d.ts} +0 -0
- /package/dist/{features → built-in/layout-component}/components/NotAllowed/index.vue.d.ts +0 -0
- /package/src/{features/components/NotAllowed/assets → built-in/layout-component/assets/images}/403.svg +0 -0
- /package/src/{features/components/NotAllowed/assets → built-in/layout-component/assets/images}/403_dark.svg +0 -0
- /package/src/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/More.vue +0 -0
- /package/src/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/NotCursor.vue +0 -0
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.6",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"pinia": "^3.0.3",
|
|
27
27
|
"vue": "^3.5.17",
|
|
28
28
|
"vue-router": "^4.5.1",
|
|
29
|
-
"@pubinfo/config": "2.0.
|
|
30
|
-
"@pubinfo/vite": "2.0.
|
|
29
|
+
"@pubinfo/config": "2.0.6",
|
|
30
|
+
"@pubinfo/vite": "2.0.6"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@alova/adapter-axios": "^2.0.16",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"vite-plugin-dts": "^4.5.4",
|
|
86
86
|
"vue": "^3.5.17",
|
|
87
87
|
"vue-router": "^4.5.1",
|
|
88
|
-
"@pubinfo/config": "2.0.
|
|
89
|
-
"@pubinfo/vite": "2.0.
|
|
88
|
+
"@pubinfo/config": "2.0.6",
|
|
89
|
+
"@pubinfo/vite": "2.0.6"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"dev": "vite build -w -m watch",
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import RiLogoutBoxLine from '~icons/ri/logout-box-line';
|
|
3
|
+
import { useAuth } from '@/features/composables';
|
|
3
4
|
import BackTop from './components/BackTop/index.vue';
|
|
4
5
|
import LayoutContent from './components/Content/index.vue';
|
|
5
6
|
import Copyright from './components/Copyright/index.vue';
|
|
6
7
|
import LayoutHeader from './components/Header/index.vue';
|
|
8
|
+
import NotAllowed from './components/NotAllowed/index.vue';
|
|
7
9
|
import SettingBar from './components/SettingBar/index.vue';
|
|
8
10
|
import LayoutSidebar from './components/Sidebar/index.vue';
|
|
9
|
-
import LayoutTopbar from './components/Topbar/index.vue';
|
|
10
11
|
|
|
12
|
+
import LayoutTopbar from './components/Topbar/index.vue';
|
|
11
13
|
import { useContext } from './composables/useContext';
|
|
12
14
|
import { useGetSidebarActualWidth } from './composables/useGetComputedStyle';
|
|
13
15
|
import { useHotkey } from './composables/useHotkey';
|
|
@@ -18,6 +20,12 @@ defineOptions({
|
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
const routeInfo = useRoute();
|
|
23
|
+
const { auth } = useAuth();
|
|
24
|
+
|
|
25
|
+
const isAuth = computed(() => {
|
|
26
|
+
return routeInfo.matched.every(item => auth(item.meta.auth ?? ''));
|
|
27
|
+
});
|
|
28
|
+
|
|
21
29
|
const { settingsStore } = useContext();
|
|
22
30
|
const { mainSidebarActualWidth, subSidebarActualWidth } = useGetSidebarActualWidth();
|
|
23
31
|
useHotkey();
|
|
@@ -86,9 +94,13 @@ watch(() => routeInfo.path, () => {
|
|
|
86
94
|
<RiLogoutBoxLine />
|
|
87
95
|
</div>
|
|
88
96
|
|
|
89
|
-
<slot>
|
|
97
|
+
<slot v-if="isAuth">
|
|
90
98
|
<LayoutContent />
|
|
91
99
|
</slot>
|
|
100
|
+
|
|
101
|
+
<slot v-else name="notAllowed">
|
|
102
|
+
<NotAllowed />
|
|
103
|
+
</slot>
|
|
92
104
|
</div>
|
|
93
105
|
|
|
94
106
|
<slot name="footer">
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useContext } from '../../composables/useContext';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'LayoutHeaderMenu',
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const HeaderFullMenu = defineAsyncComponent(() => import('./HeaderFullMenu/index.vue'));
|
|
9
|
+
const HeaderThinMenu = defineAsyncComponent(() => import('./HeaderThinMenu.vue'));
|
|
10
|
+
|
|
11
|
+
const { settingsStore } = useContext();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<!-- 顶部模式 -->
|
|
16
|
+
<HeaderFullMenu v-if="settingsStore.settings.menu.menuMode === 'head'" />
|
|
17
|
+
<!-- 顶部精简模式 -->
|
|
18
|
+
<HeaderThinMenu v-else-if="settingsStore.settings.menu.menuMode === 'only-head'" />
|
|
19
|
+
</template>
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
import { useContext } from '../../composables/useContext';
|
|
3
3
|
import Logo from '../Logo/index.vue';
|
|
4
4
|
import Tools from '../Tools/index.vue';
|
|
5
|
+
import HeaderMenu from './HeaderMenu.vue';
|
|
5
6
|
|
|
6
7
|
defineOptions({
|
|
7
8
|
name: 'LayoutHeader',
|
|
8
9
|
});
|
|
9
10
|
|
|
10
|
-
const TopMode = defineAsyncComponent(() => import('./TopMode/index.vue'));
|
|
11
|
-
const TopThinMode = defineAsyncComponent(() => import('./TopThinMode.vue'));
|
|
12
|
-
|
|
13
11
|
const { settingsStore } = useContext();
|
|
14
12
|
</script>
|
|
15
13
|
|
|
@@ -23,10 +21,7 @@ const { settingsStore } = useContext();
|
|
|
23
21
|
</slot>
|
|
24
22
|
|
|
25
23
|
<slot name="menu">
|
|
26
|
-
|
|
27
|
-
<TopMode v-if="settingsStore.settings.menu.menuMode === 'head'" />
|
|
28
|
-
<!-- 顶部精简模式 -->
|
|
29
|
-
<TopThinMode v-else-if="settingsStore.settings.menu.menuMode === 'only-head'" />
|
|
24
|
+
<HeaderMenu />
|
|
30
25
|
</slot>
|
|
31
26
|
</div>
|
|
32
27
|
|
|
@@ -33,7 +33,7 @@ const isMenuPopup = computed<MenuInjection['isMenuPopup']>(() => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
// 解析传入的 menu 数据,并保存到 items 和 subMenus 对象中
|
|
36
|
-
function initItems(menu: MenuProps['menu'], parentPaths: string[] = []) {
|
|
36
|
+
function initItems(menu: MenuProps['menu'] = [], parentPaths: string[] = []) {
|
|
37
37
|
menu.forEach((item) => {
|
|
38
38
|
const index = item.path ?? JSON.stringify(item);
|
|
39
39
|
if (item.children && item.children.length > 0) {
|
|
@@ -6,40 +6,15 @@ defineOptions({
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
const route = useRoute();
|
|
9
|
-
const router = useRouter();
|
|
10
9
|
|
|
11
10
|
const settingsStore = useSettingsStore();
|
|
12
11
|
const tabbarStore = useTabbarStore();
|
|
13
12
|
|
|
14
|
-
const data = ref({
|
|
15
|
-
inter: Number.NaN,
|
|
16
|
-
countdown: 5,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
onUnmounted(() => {
|
|
20
|
-
if (data.value.inter) {
|
|
21
|
-
window.clearInterval(data.value.inter);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
13
|
onMounted(() => {
|
|
26
14
|
if (settingsStore.settings.tabbar.enable) {
|
|
27
15
|
tabbarStore.remove(route.meta.activeMenu || route.fullPath);
|
|
28
16
|
}
|
|
29
|
-
data.value.inter = window.setInterval(() => {
|
|
30
|
-
data.value.countdown--;
|
|
31
|
-
if (data.value.countdown === 0) {
|
|
32
|
-
if (data.value.inter) {
|
|
33
|
-
window.clearInterval(data.value.inter);
|
|
34
|
-
}
|
|
35
|
-
goBack();
|
|
36
|
-
}
|
|
37
|
-
}, 1000);
|
|
38
17
|
});
|
|
39
|
-
|
|
40
|
-
function goBack() {
|
|
41
|
-
router.push('/');
|
|
42
|
-
}
|
|
43
18
|
</script>
|
|
44
19
|
|
|
45
20
|
<template>
|
|
@@ -52,23 +27,18 @@ function goBack() {
|
|
|
52
27
|
<div class="desc mx-0 text-xl text-stone-5 dark:text-[#C9D6EF]">
|
|
53
28
|
抱歉,你无权访问该页面
|
|
54
29
|
</div>
|
|
55
|
-
<div>
|
|
56
|
-
<HButton @click="goBack">
|
|
57
|
-
{{ data.countdown }} 秒后,返回首页
|
|
58
|
-
</HButton>
|
|
59
|
-
</div>
|
|
60
30
|
</div>
|
|
61
31
|
</div>
|
|
62
32
|
</template>
|
|
63
33
|
|
|
64
34
|
<style scoped>
|
|
65
35
|
.noPermissionIcon {
|
|
66
|
-
background: url("
|
|
36
|
+
background: url("../../assets/images/403.svg") no-repeat;
|
|
67
37
|
background-size: 100% 100%;
|
|
68
38
|
}
|
|
69
39
|
|
|
70
40
|
[data-theme="dark"] .noPermissionIcon {
|
|
71
|
-
background: url("
|
|
41
|
+
background: url("../../assets/images/403_dark.svg") no-repeat;
|
|
72
42
|
background-size: 100% 100%;
|
|
73
43
|
}
|
|
74
44
|
</style>
|
|
@@ -7,10 +7,10 @@ import { useContext } from './useContext';
|
|
|
7
7
|
* @returns 样式属性值的整数形式
|
|
8
8
|
*/
|
|
9
9
|
export function useGetComputedStyle(property: string, root: HTMLElement = document.documentElement) {
|
|
10
|
-
return
|
|
10
|
+
return getComputedStyle(root).getPropertyValue(property).trim();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
type unit =
|
|
13
|
+
type unit = string;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* 根据各种设置和条件计算主侧边栏和子侧边栏的实际宽度。
|
|
@@ -28,7 +28,7 @@ export function useGetSidebarActualWidth() {
|
|
|
28
28
|
return '0px';
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
return
|
|
31
|
+
return useGetComputedStyle('--g-main-sidebar-width');
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
|
|
@@ -39,18 +39,18 @@ export function useGetSidebarActualWidth() {
|
|
|
39
39
|
*/
|
|
40
40
|
const subSidebarActualWidth = computed<unit>(() => {
|
|
41
41
|
let actualWidth = useGetComputedStyle('--g-sub-sidebar-width');
|
|
42
|
-
const
|
|
42
|
+
const _subSidebarActualWidth = settingsStore.settings.menu.subMenuCollapse;
|
|
43
43
|
const subMenuOnlyOneHide = settingsStore.settings.menu.subMenuOnlyOneHide;
|
|
44
44
|
const menuMode = settingsStore.settings.menu.menuMode;
|
|
45
45
|
const isMobile = settingsStore.mode !== 'mobile';
|
|
46
46
|
const onlySideOrHead = ['only-side', 'only-head'].includes(menuMode);
|
|
47
47
|
|
|
48
|
-
if (
|
|
48
|
+
if (_subSidebarActualWidth && isMobile) {
|
|
49
49
|
actualWidth = useGetComputedStyle('--g-sub-sidebar-collapse-width');
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (onlySideOrHead && isMobile) {
|
|
53
|
-
actualWidth =
|
|
53
|
+
actualWidth = '0px';
|
|
54
54
|
}
|
|
55
55
|
if (
|
|
56
56
|
subMenuOnlyOneHide
|
|
@@ -60,10 +60,13 @@ export function useGetSidebarActualWidth() {
|
|
|
60
60
|
|| menuStore.sidebarMenus[0]?.children.every(item => item.meta?.sidebar === false)
|
|
61
61
|
)
|
|
62
62
|
) {
|
|
63
|
-
actualWidth =
|
|
63
|
+
actualWidth = '0px';
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return actualWidth;
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
return {
|
|
68
|
+
return {
|
|
69
|
+
mainSidebarActualWidth,
|
|
70
|
+
subSidebarActualWidth,
|
|
71
|
+
};
|
|
69
72
|
}
|
|
@@ -6,12 +6,18 @@ import { defineSystemRoutes } from '@/features';
|
|
|
6
6
|
import { Provider as LayoutProvider } from './provider';
|
|
7
7
|
import Layout from './Layout.vue';
|
|
8
8
|
import LayoutContent from './components/Content/index.vue';
|
|
9
|
+
|
|
9
10
|
import LayoutHeader from './components/Header/index.vue';
|
|
11
|
+
import LayoutHeaderMenu from './components/Header/HeaderMenu.vue';
|
|
12
|
+
import LayoutHeaderFullMenu from './components/Header/HeaderFullMenu/index.vue';
|
|
13
|
+
import LayoutHeaderThinMenu from './components/Header/HeaderThinMenu.vue';
|
|
14
|
+
|
|
10
15
|
import LayoutSidebar from './components/Sidebar/index.vue';
|
|
11
16
|
import LayoutTopbar from './components/Topbar/index.vue';
|
|
12
17
|
|
|
13
18
|
import Logo from './components/Logo/index.vue';
|
|
14
19
|
import Tools from './components/Tools/index.vue';
|
|
20
|
+
import NotAllowed from './components/NotAllowed/index.vue';
|
|
15
21
|
import Fullscreen from './components/Tools/Fullscreen.vue';
|
|
16
22
|
import PageReload from './components/Tools/PageReload.vue';
|
|
17
23
|
import DarkModeToggle from './components/Tools/DarkModeToggle.vue';
|
|
@@ -71,6 +77,10 @@ export const Tool = {
|
|
|
71
77
|
|
|
72
78
|
Layout.Provider = LayoutProvider;
|
|
73
79
|
Layout.Header = LayoutHeader;
|
|
80
|
+
Layout.HeaderMenu = LayoutHeaderMenu;
|
|
81
|
+
Layout.HeaderFullMenu = LayoutHeaderFullMenu;
|
|
82
|
+
Layout.HeaderThinMenu = LayoutHeaderThinMenu;
|
|
83
|
+
Layout.Header = LayoutHeader;
|
|
74
84
|
Layout.Content = LayoutContent;
|
|
75
85
|
Layout.Sidebar = LayoutSidebar;
|
|
76
86
|
Layout.Topbar = LayoutTopbar;
|
|
@@ -79,12 +89,17 @@ export {
|
|
|
79
89
|
LayoutProvider,
|
|
80
90
|
Layout,
|
|
81
91
|
LayoutContent,
|
|
92
|
+
|
|
82
93
|
LayoutHeader,
|
|
94
|
+
LayoutHeaderMenu,
|
|
95
|
+
LayoutHeaderFullMenu,
|
|
96
|
+
LayoutHeaderThinMenu,
|
|
97
|
+
|
|
83
98
|
LayoutSidebar,
|
|
84
99
|
LayoutTopbar,
|
|
85
100
|
|
|
86
101
|
Logo,
|
|
87
102
|
Tools,
|
|
88
|
-
|
|
103
|
+
NotAllowed,
|
|
89
104
|
Copyright,
|
|
90
105
|
};
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useAuth } from '@/features/composables';
|
|
3
|
-
import NotAllowed from '../NotAllowed/index.vue';
|
|
4
|
-
|
|
5
2
|
defineOptions({
|
|
6
3
|
name: 'PubinfoApp',
|
|
7
4
|
});
|
|
8
|
-
|
|
9
|
-
const route = useRoute();
|
|
10
|
-
const { auth } = useAuth();
|
|
11
|
-
|
|
12
|
-
const isAuth = computed(() => {
|
|
13
|
-
return route.matched.every(item => auth(item.meta.auth ?? ''));
|
|
14
|
-
});
|
|
15
5
|
</script>
|
|
16
6
|
|
|
17
7
|
<template>
|
|
18
|
-
<RouterView
|
|
19
|
-
<component :is="Component" v-if="isAuth" />
|
|
20
|
-
<NotAllowed v-else />
|
|
21
|
-
</RouterView>
|
|
8
|
+
<RouterView />
|
|
22
9
|
</template>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { default as NotAllowed } from './NotAllowed/index.vue';
|
|
2
1
|
export { default as PageHeader } from './PageHeader/index.vue';
|
|
3
2
|
export { default as PageMain } from './PageMain/index.vue';
|
|
4
3
|
export { default as PassStrengthValidator } from './PassStrengthValidator/index.vue';
|
|
@@ -45,7 +45,7 @@ const useMenuStore = defineStore(
|
|
|
45
45
|
* // { path: '/app/about', title: 'About' },
|
|
46
46
|
* // ]
|
|
47
47
|
*/
|
|
48
|
-
function convertToFullPath(menu: any[], path: string = '') {
|
|
48
|
+
function convertToFullPath(menu: any[] = [], path: string = '') {
|
|
49
49
|
return menu.map((item) => {
|
|
50
50
|
item.path = resolveRoutePath(path, item.path);
|
|
51
51
|
if (item.children) {
|
|
@@ -174,7 +174,7 @@ const useMenuStore = defineStore(
|
|
|
174
174
|
* @param rootPath 根路径
|
|
175
175
|
* @returns 默认展开的路径数组
|
|
176
176
|
*/
|
|
177
|
-
function getDefaultOpenedPaths(menus: Menu.recordRaw[], rootPath = '') {
|
|
177
|
+
function getDefaultOpenedPaths(menus: Menu.recordRaw[] = [], rootPath = '') {
|
|
178
178
|
const defaultOpenedPaths: string[] = [];
|
|
179
179
|
menus.forEach((item) => {
|
|
180
180
|
if (item.meta?.defaultOpened && item.children) {
|
|
@@ -33,6 +33,12 @@ const useRouteStore = defineStore(
|
|
|
33
33
|
system?: boolean
|
|
34
34
|
}>>([]);
|
|
35
35
|
|
|
36
|
+
/** 如果权限功能开启 / 不展示无权限菜单,则需要对路由数据进行筛选过滤 */
|
|
37
|
+
const needFilterRoutes = computed(() => {
|
|
38
|
+
const { app, menu } = settingsStore.settings;
|
|
39
|
+
return app.enablePermission && !menu.showWithoutPermission;
|
|
40
|
+
});
|
|
41
|
+
|
|
36
42
|
/**
|
|
37
43
|
* 创建面包屑对象
|
|
38
44
|
* @param currentRouter 当前路由对象
|
|
@@ -273,8 +279,7 @@ const useRouteStore = defineStore(
|
|
|
273
279
|
*/
|
|
274
280
|
const routes = computed(() => {
|
|
275
281
|
let returnRoutes: Route.recordMainRaw[];
|
|
276
|
-
|
|
277
|
-
if (settingsStore.settings.app.enablePermission) {
|
|
282
|
+
if (needFilterRoutes.value) {
|
|
278
283
|
returnRoutes = filterAsyncRoutes(routesRaw.value, userStore.user.permissions);
|
|
279
284
|
}
|
|
280
285
|
else {
|
|
@@ -351,7 +356,7 @@ const useRouteStore = defineStore(
|
|
|
351
356
|
* 生成路由
|
|
352
357
|
*/
|
|
353
358
|
async function generateRoutes() {
|
|
354
|
-
const res = await postRbacResourceMineOrAllResourceTree({ needAll:
|
|
359
|
+
const res = await postRbacResourceMineOrAllResourceTree({ needAll: !needFilterRoutes.value });
|
|
355
360
|
if (res.success) {
|
|
356
361
|
remoteRoutesRaw.value = res?.data ?? [];
|
|
357
362
|
const staticRoutes = convertSingleRoutes(filterEnabledRoutes(cloneDeep(asyncRoutes)));
|
|
@@ -5,8 +5,8 @@ import { defineStore } from 'pinia';
|
|
|
5
5
|
import { postAuthChangeLoginOrg, postAuthLogin } from '@/features/api/modules/auth';
|
|
6
6
|
import { getRbacResourceGrantedResources, getRbacUserUserEntireInfo, putRbacUserChangePassword } from '@/features/api/modules/rbac';
|
|
7
7
|
import { usePubinfoContext } from '@/features/context';
|
|
8
|
+
import { publicKeyEncryption } from '@/utils';
|
|
8
9
|
import { STORE_NAME } from '../enum';
|
|
9
|
-
import { getEncryptedData } from '../utils';
|
|
10
10
|
|
|
11
11
|
export interface UserStore {
|
|
12
12
|
/** 用户信息 */
|
|
@@ -117,7 +117,7 @@ const useUserStore = defineStore<STORE_NAME.USER, UserStore>(
|
|
|
117
117
|
captchas: code,
|
|
118
118
|
loginType = 'password',
|
|
119
119
|
} = data;
|
|
120
|
-
const loginPwd = await
|
|
120
|
+
const loginPwd = await publicKeyEncryption(password);
|
|
121
121
|
const result = await postAuthLogin({
|
|
122
122
|
loginType,
|
|
123
123
|
loginName,
|
|
@@ -179,8 +179,8 @@ const useUserStore = defineStore<STORE_NAME.USER, UserStore>(
|
|
|
179
179
|
if (form.token) {
|
|
180
180
|
headers.authorization = form.token;
|
|
181
181
|
}
|
|
182
|
-
const encryptedOldpassword = await
|
|
183
|
-
const encryptedNewpassword = await
|
|
182
|
+
const encryptedOldpassword = await publicKeyEncryption(form.oldPassword);
|
|
183
|
+
const encryptedNewpassword = await publicKeyEncryption(form.newPassword);
|
|
184
184
|
const res = await putRbacUserChangePassword({
|
|
185
185
|
oldPassword: encryptedOldpassword,
|
|
186
186
|
newPassword: encryptedNewpassword,
|
package/src/index.ts
CHANGED
|
@@ -88,6 +88,7 @@ export {
|
|
|
88
88
|
LayoutSidebar,
|
|
89
89
|
LayoutTopbar,
|
|
90
90
|
Logo,
|
|
91
|
+
NotAllowed,
|
|
91
92
|
Tool,
|
|
92
93
|
Tools,
|
|
93
94
|
} from './built-in/layout-component';
|
|
@@ -114,6 +115,7 @@ export {
|
|
|
114
115
|
createRawContext,
|
|
115
116
|
getPersistedState,
|
|
116
117
|
getPubinfoNamespace,
|
|
118
|
+
publicKeyEncryption,
|
|
117
119
|
setPersistedState,
|
|
118
120
|
storage,
|
|
119
121
|
wrapProxy,
|
package/src/utils/index.ts
CHANGED
|
@@ -7,18 +7,17 @@ function compilePublicKey(key: string) {
|
|
|
7
7
|
return compiled({ publickKey: key });
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
async function
|
|
11
|
-
const
|
|
12
|
-
return compilePublicKey(data
|
|
10
|
+
async function getPublicKey() {
|
|
11
|
+
const res = await getAuthLoginKey();
|
|
12
|
+
return compilePublicKey(res.data ?? '');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 使用 `publicKey` 进行加密
|
|
17
|
+
*/
|
|
18
|
+
export async function publicKeyEncryption(content: string) {
|
|
19
|
+
const publicKey = await getPublicKey();
|
|
16
20
|
const encryptor = new JSEncrypt();
|
|
17
21
|
encryptor.setPublicKey(publicKey);
|
|
18
|
-
return encryptor.encrypt(
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function getEncryptedData(str: string) {
|
|
22
|
-
const key = await getPem();
|
|
23
|
-
return await encryptWithPublicKey(key, str);
|
|
22
|
+
return encryptor.encrypt(content) as string;
|
|
24
23
|
}
|
package/types/settings.d.ts
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { defineComponent as a, ref as l, createElementBlock as m, openBlock as i, withModifiers as c, createVNode as d, normalizeClass as f, unref as e } from "vue";
|
|
2
|
-
import { bL as p, bT as _ } from "./index-lqO17ZtF.js";
|
|
3
|
-
import { useRoute as h } from "vue-router";
|
|
4
|
-
const y = /* @__PURE__ */ a({
|
|
5
|
-
name: "TopThinMode",
|
|
6
|
-
__name: "TopThinMode",
|
|
7
|
-
setup(v) {
|
|
8
|
-
const o = h(), { settingsStore: n, menuStore: u } = p(), s = l();
|
|
9
|
-
function r(t) {
|
|
10
|
-
s.value.scrollBy({
|
|
11
|
-
left: (t.deltaY || t.detail) > 0 ? 50 : -50
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return (t, M) => (i(), m("div", {
|
|
15
|
-
ref_key: "menuRef",
|
|
16
|
-
ref: s,
|
|
17
|
-
class: "menu-container",
|
|
18
|
-
onWheel: c(r, ["prevent"])
|
|
19
|
-
}, [
|
|
20
|
-
d(_, {
|
|
21
|
-
menu: e(u).allMenus,
|
|
22
|
-
value: e(o).meta.activeMenu || e(o).path,
|
|
23
|
-
mode: "horizontal",
|
|
24
|
-
"show-collapse-name": "",
|
|
25
|
-
rounded: e(n).settings.menu.isRounded,
|
|
26
|
-
class: f(["menu", {
|
|
27
|
-
[`menu-active-${e(n).settings.menu.menuActiveStyle}`]: e(n).settings.menu.menuActiveStyle !== ""
|
|
28
|
-
}])
|
|
29
|
-
}, null, 8, ["menu", "value", "rounded", "class"])
|
|
30
|
-
], 544));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
export {
|
|
34
|
-
y as default
|
|
35
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getEncryptedData(str: string): Promise<string>;
|