create-young-proj 0.10.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -0
- package/dist/index.mjs +9 -9
- package/package.json +1 -1
- package/template-nuxt-admin/README.md +42 -1
- package/template-nuxt-admin/components/TopUser.vue +4 -4
- package/template-nuxt-admin/components/YoungChangePassword.vue +5 -5
- package/template-nuxt-admin/components/layout/Main.vue +2 -2
- package/template-nuxt-admin/components/layout/NavBar.vue +11 -2
- package/template-nuxt-admin/components/layout/SideBar.vue +7 -2
- package/template-nuxt-admin/components/layout/SubMenu.vue +9 -2
- package/template-nuxt-admin/components/layout/TabsBar.vue +4 -5
- package/template-nuxt-admin/composables/api.ts +20 -21
- package/template-nuxt-admin/composables/nav.ts +20 -3
- package/template-nuxt-admin/composables/tags.ts +29 -1
- package/template-nuxt-admin/composables/user.ts +21 -3
- package/template-nuxt-admin/middleware/auth.global.ts +26 -7
- package/template-nuxt-admin/nuxt.config.ts +5 -1
- package/template-nuxt-admin/package.json +1 -1
- package/template-nuxt-admin/pages/home/[id].vue +2 -2
- package/template-nuxt-admin/pages/index.vue +2 -7
- package/template-nuxt-admin/pages/login.vue +5 -3
- package/template-nuxt-admin/pages/system/menuList.vue +0 -1
- package/template-nuxt-admin/public/bg.webp +0 -0
- package/template-nuxt-admin/public/favicon.svg +2 -0
- package/template-nuxt-admin/public/logo.svg +2 -0
- package/template-nuxt-admin/server/plugins/env.ts +3 -4
- package/template-nuxt-admin/utils/tool.ts +62 -70
- package/template-nuxt-admin/public/favicon.ico +0 -0
- package/template-vue-admin/.vscode/extensions.json +0 -10
- package/template-vue-admin/.vscode/list-add.code-snippets +0 -108
- package/template-vue-admin/.vscode/list-export.code-snippets +0 -72
- package/template-vue-admin/.vscode/list.code-snippets +0 -61
- package/template-vue-admin/.vscode/settings.json +0 -7
- package/template-vue-admin/Dockerfile +0 -42
- package/template-vue-admin/README.md +0 -75
- package/template-vue-admin/_env +0 -8
- package/template-vue-admin/_gitignore +0 -30
- package/template-vue-admin/boot.mjs +0 -16
- package/template-vue-admin/build/custom-plugin.ts +0 -57
- package/template-vue-admin/build/index.ts +0 -7
- package/template-vue-admin/build/plugins.ts +0 -59
- package/template-vue-admin/config/.devrc +0 -2
- package/template-vue-admin/config/.onlinerc +0 -2
- package/template-vue-admin/config/.testrc +0 -2
- package/template-vue-admin/index.html +0 -21
- package/template-vue-admin/nitro.config.ts +0 -19
- package/template-vue-admin/package.json +0 -51
- package/template-vue-admin/plugins/init.ts +0 -31
- package/template-vue-admin/public/vite.svg +0 -1
- package/template-vue-admin/rome.json +0 -26
- package/template-vue-admin/routes/api/[...all].ts +0 -49
- package/template-vue-admin/routes/get/env.ts +0 -18
- package/template-vue-admin/src/App.vue +0 -14
- package/template-vue-admin/src/apis/delete.ts +0 -36
- package/template-vue-admin/src/apis/get.ts +0 -83
- package/template-vue-admin/src/apis/index.ts +0 -10
- package/template-vue-admin/src/apis/patch.ts +0 -78
- package/template-vue-admin/src/apis/post.ts +0 -76
- package/template-vue-admin/src/assets/img/login_background.jpg +0 -0
- package/template-vue-admin/src/auto-components.d.ts +0 -38
- package/template-vue-admin/src/auto-imports.d.ts +0 -302
- package/template-vue-admin/src/layouts/blank.vue +0 -9
- package/template-vue-admin/src/layouts/default/components/Link.vue +0 -23
- package/template-vue-admin/src/layouts/default/components/Logo.vue +0 -20
- package/template-vue-admin/src/layouts/default/components/Menu.vue +0 -54
- package/template-vue-admin/src/layouts/default/components/NavSearch.vue +0 -52
- package/template-vue-admin/src/layouts/default/components/ScrollPane.vue +0 -79
- package/template-vue-admin/src/layouts/default/components/TagsView.vue +0 -137
- package/template-vue-admin/src/layouts/default/components/TopMenu.vue +0 -21
- package/template-vue-admin/src/layouts/default/components/UserCenter.vue +0 -50
- package/template-vue-admin/src/layouts/default/index.vue +0 -95
- package/template-vue-admin/src/main.ts +0 -46
- package/template-vue-admin/src/modules/1-router.ts +0 -48
- package/template-vue-admin/src/modules/2-pinia.ts +0 -10
- package/template-vue-admin/src/modules/3-net.ts +0 -79
- package/template-vue-admin/src/modules/4-auth.ts +0 -124
- package/template-vue-admin/src/modules/5-checkupdate.ts +0 -38
- package/template-vue-admin/src/shims.d.ts +0 -12
- package/template-vue-admin/src/stores/index.ts +0 -9
- package/template-vue-admin/src/stores/local/index.ts +0 -31
- package/template-vue-admin/src/stores/session/index.ts +0 -63
- package/template-vue-admin/src/stores/tags.ts +0 -109
- package/template-vue-admin/src/typings/global.d.ts +0 -70
- package/template-vue-admin/src/typings/index.ts +0 -13
- package/template-vue-admin/src/typings/system.d.ts +0 -46
- package/template-vue-admin/src/views/403.vue +0 -33
- package/template-vue-admin/src/views/[...all_404].vue +0 -557
- package/template-vue-admin/src/views/base/login.vue +0 -194
- package/template-vue-admin/src/views/dashboard/[name].vue +0 -28
- package/template-vue-admin/src/views/index.vue +0 -25
- package/template-vue-admin/src/views/system/api.vue +0 -160
- package/template-vue-admin/src/views/system/hooks/useRole.ts +0 -286
- package/template-vue-admin/src/views/system/menuList.vue +0 -194
- package/template-vue-admin/src/views/system/role.vue +0 -131
- package/template-vue-admin/src/views/system/user.vue +0 -192
- package/template-vue-admin/src/vite-env.d.ts +0 -52
- package/template-vue-admin/tsconfig.json +0 -21
- package/template-vue-admin/tsconfig.node.json +0 -9
- package/template-vue-admin/unocss.config.ts +0 -47
- package/template-vue-admin/vite.config.ts +0 -32
@@ -1,124 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-03-01 19:40:13
|
4
|
-
* @LastEditTime: 2023-05-18 16:17:02
|
5
|
-
* @Description: 权限校验
|
6
|
-
*/
|
7
|
-
import { router } from './1-router';
|
8
|
-
import type { RouteLocationNormalized } from 'vue-router';
|
9
|
-
import { useNavStore, useTagsStore, useUserStore, getToken, getLoginInfo } from '@/stores';
|
10
|
-
import { apis } from './3-net';
|
11
|
-
|
12
|
-
const changeTitle = (route: RouteLocationNormalized) => {
|
13
|
-
document.title =
|
14
|
-
(route.meta.title as string) || window.__YOUNG_VITE_ENV__.VITE_TITLE || '管理后台';
|
15
|
-
};
|
16
|
-
|
17
|
-
const { CurrUserInfo } = useUserStore();
|
18
|
-
const { NavArrAll, RoleRoute, FlatNavArr, RawNav } = useNavStore();
|
19
|
-
|
20
|
-
let role_route: string[] = [];
|
21
|
-
const generateRoleRoute = (arr: NavArrItem[], num?: number): string[] => {
|
22
|
-
if (num === 1) {
|
23
|
-
role_route = [];
|
24
|
-
FlatNavArr.value = [];
|
25
|
-
}
|
26
|
-
for (const item of arr) {
|
27
|
-
if (item.component) {
|
28
|
-
role_route.push(item.component);
|
29
|
-
+item.visible === 1 && FlatNavArr.value.push(item);
|
30
|
-
}
|
31
|
-
// 子节点递归遍历
|
32
|
-
if (Array.isArray(item.children) && item.children.length > 0) {
|
33
|
-
const part = JSON.parse(JSON.stringify(item.children));
|
34
|
-
// 尾递归优化
|
35
|
-
generateRoleRoute(part);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
return role_route;
|
39
|
-
};
|
40
|
-
// 清除没有子元素的children
|
41
|
-
export const clearChildren = <T extends Record<string, any>>(arr: T[]) => {
|
42
|
-
for (const item of arr) {
|
43
|
-
if (item?.children.length === 0) {
|
44
|
-
delete item.children;
|
45
|
-
} else if (item.children) {
|
46
|
-
clearChildren(item.children);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
return arr;
|
50
|
-
};
|
51
|
-
|
52
|
-
export const generateNavData = async (force = false) => {
|
53
|
-
const info = getLoginInfo();
|
54
|
-
|
55
|
-
if (!info) {
|
56
|
-
// 登录过期
|
57
|
-
ElMessage.error('登录过期,请重新登录!');
|
58
|
-
router.replace('/base/login');
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
|
62
|
-
const menu = Object.values(await apis.get.getMenuTree(force)) as any[];
|
63
|
-
RawNav.value = menu;
|
64
|
-
|
65
|
-
// 刷新右上角角色信息
|
66
|
-
apis.post.getCurrUserInfo().then((res) => {
|
67
|
-
CurrUserInfo.value = res;
|
68
|
-
});
|
69
|
-
|
70
|
-
// 后端获取用户可见节点
|
71
|
-
const navArr: NavArrItem[] = menu;
|
72
|
-
const routes: string[] = generateRoleRoute(menu, 1);
|
73
|
-
|
74
|
-
// 导航数组
|
75
|
-
NavArrAll.value = navArr.filter((item) => +item.visible === 1);
|
76
|
-
// 生成角色有权访问的路由
|
77
|
-
RoleRoute.value = routes.slice();
|
78
|
-
};
|
79
|
-
|
80
|
-
export const hasPermission = (path: string) => {
|
81
|
-
const { RoleRoute } = useNavStore();
|
82
|
-
const roleRoute = RoleRoute.value;
|
83
|
-
return roleRoute.includes(path);
|
84
|
-
};
|
85
|
-
|
86
|
-
export const install: UserModule = (app) => {
|
87
|
-
router.beforeEach(async (to, from) => {
|
88
|
-
if (to.path !== '/base/login') {
|
89
|
-
// 页面无需权限
|
90
|
-
if (to.meta.auth === false) {
|
91
|
-
return true;
|
92
|
-
}
|
93
|
-
// 已登录
|
94
|
-
if (getToken()) {
|
95
|
-
// 生成权限树
|
96
|
-
await generateNavData();
|
97
|
-
if (hasPermission(to.path)) {
|
98
|
-
// 拥有对应页面的权限
|
99
|
-
return true;
|
100
|
-
}
|
101
|
-
if (!hasPermission(to.path)) {
|
102
|
-
// 已登录,并且无权限
|
103
|
-
return '/403';
|
104
|
-
}
|
105
|
-
} else {
|
106
|
-
return '/base/login';
|
107
|
-
}
|
108
|
-
} else {
|
109
|
-
return true;
|
110
|
-
}
|
111
|
-
});
|
112
|
-
|
113
|
-
router.afterEach((to) => {
|
114
|
-
const { addView } = useTagsStore();
|
115
|
-
const nav = FlatNavArr.value.find((item) => item.component === to.path);
|
116
|
-
if (nav && nav.title) {
|
117
|
-
// console.log('before: ', to.meta);
|
118
|
-
to.meta.title = nav.title as string;
|
119
|
-
// console.log('after: ', to.meta);
|
120
|
-
}
|
121
|
-
addView(to);
|
122
|
-
changeTitle(to);
|
123
|
-
});
|
124
|
-
};
|
@@ -1,38 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-03-02 16:50:48
|
4
|
-
* @LastEditTime: 2023-03-24 10:35:36
|
5
|
-
* @Description: 检查更新
|
6
|
-
*/
|
7
|
-
import { CurrentVersion } from '@/stores';
|
8
|
-
import { sleep } from '@bluesyoung/utils';
|
9
|
-
import { server } from 'virtual:local-server';
|
10
|
-
import { generateNavData } from './4-auth';
|
11
|
-
|
12
|
-
export const install: UserModule = (app) => {
|
13
|
-
let viteEnv: ImportMetaEnv;
|
14
|
-
// 每分钟一次,检查更新
|
15
|
-
setInterval(async () => {
|
16
|
-
if (import.meta.env.DEV) {
|
17
|
-
// 开发环境,局域网 ip
|
18
|
-
viteEnv = await (await fetch(server + '/get/env')).json(); // console.log('🚀 ~ file: 5-checkupdate.ts:187~ setInterval ~ viteEnv:"' viteEnv)
|
19
|
-
} else {
|
20
|
-
// 部署环境
|
21
|
-
viteEnv = await (await fetch(location.origin + location.pathname + `get/env`)).json();
|
22
|
-
// console.log('🚀 ~ file: 5-checkupdate.ts:231~ setInterval ~ viteEnv:', viteEnv);
|
23
|
-
}
|
24
|
-
|
25
|
-
const refresh = async () => {
|
26
|
-
await generateNavData(true);
|
27
|
-
await sleep(0.5);
|
28
|
-
location.reload();
|
29
|
-
};
|
30
|
-
|
31
|
-
if (viteEnv.VITE_CURRENT_VERSION !== CurrentVersion.value) {
|
32
|
-
setTimeout(refresh, 3e4);
|
33
|
-
ElMessageBox.alert('新版本已发布,点击立即重新加载(30s后自动刷新)', '温馨提示', {
|
34
|
-
type: 'warning',
|
35
|
-
}).then(() => refresh());
|
36
|
-
}
|
37
|
-
}, 6e4);
|
38
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-10-20 08:52:37
|
4
|
-
* @LastEditTime: 2023-05-18 16:00:10
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { YoungLocalStorage } from '@bluesyoung/utils';
|
8
|
-
|
9
|
-
export const YoungStorage = new YoungLocalStorage();
|
10
|
-
|
11
|
-
const TOKEN_KEY = 'bluesyoung-web.com/music/admin';
|
12
|
-
|
13
|
-
export const SaveFlag = useLocalStorage('n天免登', true);
|
14
|
-
|
15
|
-
export const CurrentVersion = useLocalStorage('当前版本', '');
|
16
|
-
|
17
|
-
export const getToken = () => {
|
18
|
-
return YoungStorage.get<UserKey>(TOKEN_KEY)?.token;
|
19
|
-
};
|
20
|
-
|
21
|
-
export const setToken = (data: UserKey) => {
|
22
|
-
return YoungStorage.set(TOKEN_KEY, data);
|
23
|
-
};
|
24
|
-
|
25
|
-
export const removeToken = () => {
|
26
|
-
return YoungStorage.remove(TOKEN_KEY);
|
27
|
-
};
|
28
|
-
|
29
|
-
export const getLoginInfo = () => {
|
30
|
-
return YoungStorage.get<UserKey>(TOKEN_KEY);
|
31
|
-
};
|
@@ -1,63 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-03-02 18:42:56
|
4
|
-
* @LastEditTime: 2023-01-04 15:14:46
|
5
|
-
* @Description: 存储界面相关的数据
|
6
|
-
*/
|
7
|
-
const SESSION_PREFIX = '__young_admin_';
|
8
|
-
|
9
|
-
export const SESSION_KEYS = {
|
10
|
-
collapsed: `${SESSION_PREFIX}collapsed`,
|
11
|
-
topIndex: `${SESSION_PREFIX}topIndex`,
|
12
|
-
expandNodeKeys: `${SESSION_PREFIX}expandNodeKeys`,
|
13
|
-
userInfo: `${SESSION_PREFIX}userInfo`,
|
14
|
-
rawNavArr: `${SESSION_PREFIX}rawNavArr`,
|
15
|
-
navArr: `${SESSION_PREFIX}navArr`,
|
16
|
-
flatNavArr: `${SESSION_PREFIX}flatNavArr`,
|
17
|
-
roleRoute: `${SESSION_PREFIX}roleRoute`,
|
18
|
-
};
|
19
|
-
|
20
|
-
export const isCollapse = useSessionStorage(SESSION_KEYS.collapsed, false);
|
21
|
-
|
22
|
-
export const TopIndex = useSessionStorage(SESSION_KEYS.topIndex, '0');
|
23
|
-
|
24
|
-
export const expandNodeKeys = useSessionStorage<number[]>(SESSION_KEYS.expandNodeKeys, []);
|
25
|
-
|
26
|
-
export const useUserStore = () => {
|
27
|
-
const CurrUserInfo = useSessionStorage<CurrUserInfo>(
|
28
|
-
SESSION_KEYS.userInfo,
|
29
|
-
{} as unknown as CurrUserInfo,
|
30
|
-
);
|
31
|
-
const reset = () => (CurrUserInfo.value = {} as unknown as CurrUserInfo);
|
32
|
-
return {
|
33
|
-
CurrUserInfo,
|
34
|
-
reset,
|
35
|
-
};
|
36
|
-
};
|
37
|
-
|
38
|
-
export const useNavStore = () => {
|
39
|
-
const RawNav = useSessionStorage<NavArrItem[]>(SESSION_KEYS.rawNavArr, []);
|
40
|
-
const NavArrAll = useSessionStorage<NavArrItem[]>(SESSION_KEYS.navArr, []);
|
41
|
-
const FlatNavArr = useSessionStorage<NavArrItem[]>(SESSION_KEYS.flatNavArr, []);
|
42
|
-
const RoleRoute = useSessionStorage<string[]>(SESSION_KEYS.roleRoute, []);
|
43
|
-
const TopMenu = computed(() => RawNav.value.filter((nav) => nav.visible === 1));
|
44
|
-
const NavArr = computed(() =>
|
45
|
-
TopIndex.value ? NavArrAll.value[+TopIndex.value]?.children || [] : [],
|
46
|
-
);
|
47
|
-
|
48
|
-
const reset = () => {
|
49
|
-
NavArrAll.value = [];
|
50
|
-
FlatNavArr.value = [];
|
51
|
-
RoleRoute.value = [];
|
52
|
-
RawNav.value = [];
|
53
|
-
};
|
54
|
-
return {
|
55
|
-
RawNav,
|
56
|
-
NavArrAll,
|
57
|
-
NavArr,
|
58
|
-
FlatNavArr,
|
59
|
-
RoleRoute,
|
60
|
-
TopMenu,
|
61
|
-
reset,
|
62
|
-
};
|
63
|
-
};
|
@@ -1,109 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-02-24 15:55:05
|
4
|
-
* @LastEditTime: 2023-01-04 19:47:49
|
5
|
-
* @Description: 存储标签页的状态
|
6
|
-
*/
|
7
|
-
import { defineStore, acceptHMRUpdate } from 'pinia';
|
8
|
-
import type { RouteLocationNormalized } from 'vue-router';
|
9
|
-
|
10
|
-
type CachedView = string | symbol | null | undefined;
|
11
|
-
|
12
|
-
interface TagsViewState {
|
13
|
-
/**
|
14
|
-
* 访问过的页面,路由对象
|
15
|
-
*/
|
16
|
-
visitedViews: RouteLocationNormalized[];
|
17
|
-
/**
|
18
|
-
* 已缓存的页面名称
|
19
|
-
*/
|
20
|
-
cachedViews: CachedView[];
|
21
|
-
}
|
22
|
-
// @ts-ignore
|
23
|
-
export const useTagsStore = defineStore('useTagsStore', {
|
24
|
-
state: () => {
|
25
|
-
const state = reactive<TagsViewState>({
|
26
|
-
visitedViews: [],
|
27
|
-
cachedViews: [],
|
28
|
-
});
|
29
|
-
return state;
|
30
|
-
},
|
31
|
-
actions: {
|
32
|
-
/**
|
33
|
-
* 打开某个页面
|
34
|
-
*/
|
35
|
-
addView(view: RouteLocationNormalized) {
|
36
|
-
if (view.path === '/') {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
|
40
|
-
// 非我族类其心必异,布局不是默认布局的页面,不缓存
|
41
|
-
if ((view.meta?.layout ?? 'default') !== 'default') {
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
// 查询是否已经访问过
|
45
|
-
if (!this.visitedViews.some((v) => v.path === view.path)) {
|
46
|
-
// 添加到已访问
|
47
|
-
const { name, path, fullPath, meta } = view;
|
48
|
-
this.visitedViews.push({ name, path, fullPath, meta } as RouteLocationNormalized);
|
49
|
-
// 添加到缓存
|
50
|
-
this.addToCache(view);
|
51
|
-
}
|
52
|
-
},
|
53
|
-
/**
|
54
|
-
* 添加页面到缓存
|
55
|
-
*/
|
56
|
-
addToCache(view: RouteLocationNormalized) {
|
57
|
-
// 查询该标签是否已缓存
|
58
|
-
if (this.cachedViews.includes(view.name)) {
|
59
|
-
null;
|
60
|
-
} else if (!view.meta?.noCache) {
|
61
|
-
this.cachedViews.push(view.name);
|
62
|
-
}
|
63
|
-
},
|
64
|
-
/**
|
65
|
-
* 关闭某个页面
|
66
|
-
*/
|
67
|
-
delView(view: RouteLocationNormalized) {
|
68
|
-
// 固定页不能关闭
|
69
|
-
if (view.meta.affix) {
|
70
|
-
ElMessage.warning('固定页无法关闭!');
|
71
|
-
return false;
|
72
|
-
}
|
73
|
-
// 删除访问记录
|
74
|
-
const index = this.visitedViews.findIndex((r) => r.path === view.path);
|
75
|
-
index > -1 && this.visitedViews.splice(index, 1);
|
76
|
-
// 删除缓存
|
77
|
-
this.delCachedView(view);
|
78
|
-
return true;
|
79
|
-
},
|
80
|
-
/**
|
81
|
-
* 删除页面缓存
|
82
|
-
*/
|
83
|
-
delCachedView(view: RouteLocationNormalized) {
|
84
|
-
const index = this.cachedViews.indexOf(view.name);
|
85
|
-
index > -1 && this.cachedViews.splice(index, 1);
|
86
|
-
},
|
87
|
-
/**
|
88
|
-
* 关闭其他页面
|
89
|
-
*/
|
90
|
-
delOtherViews(view: RouteLocationNormalized) {
|
91
|
-
this.visitedViews = this.visitedViews.filter((v) => {
|
92
|
-
return v?.meta?.affix || v.path === view.path;
|
93
|
-
});
|
94
|
-
this.cachedViews = this.cachedViews.filter((v) => {
|
95
|
-
return v === view.name;
|
96
|
-
});
|
97
|
-
},
|
98
|
-
/**
|
99
|
-
* 关闭所有页面
|
100
|
-
*/
|
101
|
-
delAllViews() {
|
102
|
-
const affixTags = this.visitedViews.filter((tag) => tag?.meta?.affix);
|
103
|
-
this.visitedViews = affixTags;
|
104
|
-
this.cachedViews.length = 0;
|
105
|
-
},
|
106
|
-
},
|
107
|
-
});
|
108
|
-
|
109
|
-
import.meta.hot && import.meta.hot.accept(acceptHMRUpdate(useTagsStore, import.meta.hot));
|
@@ -1,70 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-03-09 17:55:56
|
4
|
-
* @LastEditTime: 2023-01-09 10:05:44
|
5
|
-
* @Description: 自定义表格组件相关
|
6
|
-
*/
|
7
|
-
import type { App, VNode } from 'vue';
|
8
|
-
|
9
|
-
declare global {
|
10
|
-
interface BaseQuery {
|
11
|
-
pageNum: number;
|
12
|
-
pageSize: number;
|
13
|
-
total: number;
|
14
|
-
noPagination?: boolean;
|
15
|
-
}
|
16
|
-
|
17
|
-
type PagesData = {
|
18
|
-
list: any[];
|
19
|
-
} & BaseQuery;
|
20
|
-
|
21
|
-
type EnableWrite<T extends any> = {
|
22
|
-
-readonly [p in keyof T]: T[p];
|
23
|
-
};
|
24
|
-
|
25
|
-
type UserModule = (ctx: App<Element>, ...args: any[]) => void;
|
26
|
-
type Cbk = () => void;
|
27
|
-
|
28
|
-
type ResponseMsg = {
|
29
|
-
code: number;
|
30
|
-
msg: string;
|
31
|
-
data: any;
|
32
|
-
};
|
33
|
-
|
34
|
-
type UserKey = {
|
35
|
-
expires: string;
|
36
|
-
token: string;
|
37
|
-
};
|
38
|
-
|
39
|
-
type NavArrItem = {
|
40
|
-
breadcrumb: number;
|
41
|
-
component: string;
|
42
|
-
createdAt: string;
|
43
|
-
creator: string;
|
44
|
-
icon?: any;
|
45
|
-
id: number;
|
46
|
-
name: string;
|
47
|
-
not_dev: number;
|
48
|
-
parentId: number;
|
49
|
-
path: string;
|
50
|
-
permission: string;
|
51
|
-
redirect: string;
|
52
|
-
sort: number;
|
53
|
-
status: number;
|
54
|
-
title?: string;
|
55
|
-
updatedAt: string;
|
56
|
-
visible: number;
|
57
|
-
children?: NavArrItem[] | [];
|
58
|
-
} & Record<string, any>;
|
59
|
-
|
60
|
-
type CurrUserInfo = {
|
61
|
-
avatar: string;
|
62
|
-
id: number;
|
63
|
-
introduction: string;
|
64
|
-
mobile: string;
|
65
|
-
nickname: string;
|
66
|
-
roles: string[];
|
67
|
-
roleSort: number;
|
68
|
-
username: string;
|
69
|
-
};
|
70
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-03-01 14:03:04
|
4
|
-
* @LastEditTime: 2023-05-18 16:05:43
|
5
|
-
* @Description: 部分类型定义
|
6
|
-
*/
|
7
|
-
export const MethodObj = {
|
8
|
-
GET: 'info',
|
9
|
-
POST: 'success',
|
10
|
-
PATCH: 'warning',
|
11
|
-
PUT: '',
|
12
|
-
DELETE: 'danger',
|
13
|
-
} as const;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-05-18 16:06:06
|
4
|
-
* @LastEditTime: 2023-05-18 16:06:07
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { MethodObj } from '.';
|
8
|
-
|
9
|
-
declare global {
|
10
|
-
type UserItem = {
|
11
|
-
id: number;
|
12
|
-
username: string;
|
13
|
-
nickname: string;
|
14
|
-
mobile: string;
|
15
|
-
roleId: number;
|
16
|
-
status: number;
|
17
|
-
role_name?: string;
|
18
|
-
creator?: string;
|
19
|
-
newPassword?: string;
|
20
|
-
initPassword?: string;
|
21
|
-
};
|
22
|
-
|
23
|
-
type RoleItem = {
|
24
|
-
createdAt?: string;
|
25
|
-
creator?: string;
|
26
|
-
desc: string;
|
27
|
-
id: number;
|
28
|
-
keyword: string;
|
29
|
-
name: string;
|
30
|
-
not_dev?: number;
|
31
|
-
sort?: number;
|
32
|
-
status: number;
|
33
|
-
updatedAt?: string;
|
34
|
-
};
|
35
|
-
|
36
|
-
type ApiItem = {
|
37
|
-
id: number;
|
38
|
-
path: string;
|
39
|
-
desc: string;
|
40
|
-
category: string;
|
41
|
-
method: keyof typeof MethodObj;
|
42
|
-
roleIds: number[];
|
43
|
-
creator?: string;
|
44
|
-
title?: string;
|
45
|
-
};
|
46
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-10-27 11:32:57
|
4
|
-
* @LastEditTime: 2023-05-18 15:49:39
|
5
|
-
* @Description:
|
6
|
-
-->
|
7
|
-
<route lang="yaml">
|
8
|
-
meta:
|
9
|
-
title: 403
|
10
|
-
auth: false
|
11
|
-
</route>
|
12
|
-
|
13
|
-
<script lang="ts" setup>
|
14
|
-
import { router } from '@/modules/1-router';
|
15
|
-
import { useUserStore, useNavStore, removeToken } from '@/stores';
|
16
|
-
|
17
|
-
const loginOut = async () => {
|
18
|
-
removeToken();
|
19
|
-
useUserStore().reset();
|
20
|
-
useNavStore().reset();
|
21
|
-
router.replace('/base/login');
|
22
|
-
};
|
23
|
-
</script>
|
24
|
-
|
25
|
-
<template>
|
26
|
-
<div class="mt-20">
|
27
|
-
<ElResult icon="error" title="403 禁止访问" sub-title="总有些门是对你关闭的" />
|
28
|
-
|
29
|
-
<div class="text-center">
|
30
|
-
<ElButton type="primary" @click="loginOut">重新登录</ElButton>
|
31
|
-
</div>
|
32
|
-
</div>
|
33
|
-
</template>
|