create-young-proj 0.10.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.mjs +9 -9
- package/package.json +1 -1
- package/template-nuxt-admin/README.md +42 -1
- 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 +6 -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 +17 -3
- package/template-nuxt-admin/composables/nav.ts +20 -3
- package/template-nuxt-admin/composables/tags.ts +29 -1
- package/template-nuxt-admin/middleware/auth.global.ts +16 -4
- package/template-nuxt-admin/nuxt.config.ts +5 -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 +2 -2
- 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 +17 -1
- 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,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>
|