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,59 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-01-10 14:26:01
|
4
|
-
* @LastEditTime: 2023-01-10 15:18:31
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import type { PluginOption } from 'vite';
|
8
|
-
import { serverPlugin } from './custom-plugin';
|
9
|
-
import vue from '@vitejs/plugin-vue';
|
10
|
-
import vueJsx from '@vitejs/plugin-vue-jsx';
|
11
|
-
import legacy from '@vitejs/plugin-legacy';
|
12
|
-
import Unocss from 'unocss/vite';
|
13
|
-
// 自动导入
|
14
|
-
import AutoImport from 'unplugin-auto-import/vite';
|
15
|
-
import AutoComopnents from 'unplugin-vue-components/vite';
|
16
|
-
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
17
|
-
// 自动路由及布局
|
18
|
-
import Pages from 'vite-plugin-pages';
|
19
|
-
import Layouts from 'vite-plugin-vue-layouts';
|
20
|
-
|
21
|
-
export { localServer } from './custom-plugin';
|
22
|
-
|
23
|
-
export const usePlugins = () => {
|
24
|
-
return [
|
25
|
-
serverPlugin(),
|
26
|
-
vue(),
|
27
|
-
vueJsx(),
|
28
|
-
Pages({
|
29
|
-
extensions: ['vue', 'tsx'],
|
30
|
-
dirs: 'src/views',
|
31
|
-
exclude: ['**/components/*.{vue,tsx}', '_*'],
|
32
|
-
}),
|
33
|
-
Layouts({ defaultLayout: 'default/index' }),
|
34
|
-
AutoComopnents({
|
35
|
-
dirs: ['src/components'],
|
36
|
-
dts: './src/auto-components.d.ts',
|
37
|
-
extensions: ['vue', 'tsx'],
|
38
|
-
resolvers: [ElementPlusResolver()],
|
39
|
-
}),
|
40
|
-
AutoImport({
|
41
|
-
dts: './src/auto-imports.d.ts',
|
42
|
-
imports: [
|
43
|
-
'vue',
|
44
|
-
'vue-router',
|
45
|
-
'@vueuse/core',
|
46
|
-
'pinia',
|
47
|
-
{
|
48
|
-
'element-plus': ['ElMessage', 'ElMessageBox', 'ElLoadingService'],
|
49
|
-
},
|
50
|
-
],
|
51
|
-
}),
|
52
|
-
Unocss(),
|
53
|
-
// 不生成同名 polyfill 文件,打包速度翻倍
|
54
|
-
// 如果出现兼容问题,可以删除此配置
|
55
|
-
legacy({
|
56
|
-
// renderLegacyChunks: false
|
57
|
-
}),
|
58
|
-
] as PluginOption[];
|
59
|
-
};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="zh-CN">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8" />
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
-
<title>Vite + Vue + TS</title>
|
8
|
-
<script>
|
9
|
-
// hack globalThis
|
10
|
-
this.globalThis || (this.globalThis = this);
|
11
|
-
// window.onerror = function(e) {
|
12
|
-
// console.log(e)
|
13
|
-
// window.alert('您的浏览器版本过低,请尝试使用其他浏览器或将浏览器升级至最新版本后重试!');
|
14
|
-
// }
|
15
|
-
</script>
|
16
|
-
</head>
|
17
|
-
<body>
|
18
|
-
<div id="app"></div>
|
19
|
-
<script type="module" src="/src/main.ts"></script>
|
20
|
-
</body>
|
21
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-12-28 11:59:56
|
4
|
-
* @LastEditTime: 2023-01-04 19:01:20
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { defineNitroConfig } from 'nitropack';
|
8
|
-
|
9
|
-
export default defineNitroConfig({
|
10
|
-
/**
|
11
|
-
* 托管前端静态资源
|
12
|
-
*/
|
13
|
-
serveStatic: 'node',
|
14
|
-
publicAssets: [
|
15
|
-
{
|
16
|
-
dir: 'dist',
|
17
|
-
},
|
18
|
-
],
|
19
|
-
});
|
@@ -1,51 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "music_admin",
|
3
|
-
"private": true,
|
4
|
-
"version": "0.0.0",
|
5
|
-
"type": "module",
|
6
|
-
"scripts": {
|
7
|
-
"dev": "vite --host",
|
8
|
-
"dev:server": "nitropack dev",
|
9
|
-
"build": "vite build && nitropack build",
|
10
|
-
"preview": "vite preview --host",
|
11
|
-
"format": "rome format .* --write",
|
12
|
-
"release": "changelogen && bumpp --commit --tag --no-push"
|
13
|
-
},
|
14
|
-
"dependencies": {
|
15
|
-
"@bluesyoung/http": "0.2.1",
|
16
|
-
"@bluesyoung/ui-vue3": "0.1.0",
|
17
|
-
"@bluesyoung/ui-vue3-element-plus": "0.9.2",
|
18
|
-
"@bluesyoung/utils": "0.1.0",
|
19
|
-
"@vueuse/core": "^10.1.2",
|
20
|
-
"core-js": "^3.30.2",
|
21
|
-
"element-plus": "^2.2.28",
|
22
|
-
"pinia": "^2.0.23",
|
23
|
-
"regenerator-runtime": "^0.13.10",
|
24
|
-
"sortablejs": "^1.15.0",
|
25
|
-
"vue": "^3.2.41",
|
26
|
-
"vue-router": "^4.1.6"
|
27
|
-
},
|
28
|
-
"devDependencies": {
|
29
|
-
"@iconify/json": "^2.2.66",
|
30
|
-
"@types/node": "16",
|
31
|
-
"@unocss/reset": "^0.51.13",
|
32
|
-
"@vitejs/plugin-legacy": "^4.0.3",
|
33
|
-
"@vitejs/plugin-vue": "^4.2.3",
|
34
|
-
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
35
|
-
"bumpp": "^9.1.0",
|
36
|
-
"c12": "^1.4.1",
|
37
|
-
"changelogen": "^0.5.3",
|
38
|
-
"less": "^4.1.3",
|
39
|
-
"nitropack": "^2.4.1",
|
40
|
-
"rome": "^12.1.1",
|
41
|
-
"sass": "^1.62.1",
|
42
|
-
"terser": "^5.17.4",
|
43
|
-
"typescript": "^5.0.4",
|
44
|
-
"unocss": "^0.51.13",
|
45
|
-
"unplugin-auto-import": "^0.16.0",
|
46
|
-
"unplugin-vue-components": "^0.24.1",
|
47
|
-
"vite": "^4.3.7",
|
48
|
-
"vite-plugin-pages": "^0.29.1",
|
49
|
-
"vite-plugin-vue-layouts": "^0.8.0"
|
50
|
-
}
|
51
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-01-04 18:53:23
|
4
|
-
* @LastEditTime: 2023-05-18 16:10:14
|
5
|
-
* @Description: 在插件中读取环境变量,避免重复的文件 io
|
6
|
-
*/
|
7
|
-
import { resolve } from 'node:path';
|
8
|
-
import { loadConfig } from 'c12';
|
9
|
-
// @ts-ignore
|
10
|
-
export default defineNitroPlugin(async (app) => {
|
11
|
-
const env = (process.env.DEPLOY_ENV as 'dev' | 'test' | 'online') || 'dev';
|
12
|
-
const { config } = await loadConfig({
|
13
|
-
name: env,
|
14
|
-
cwd: resolve(process.cwd(), 'config'),
|
15
|
-
defaultConfig: {
|
16
|
-
// 由于频繁修改 package.json 会浪费 docker 性能,故将版本信息放于此处
|
17
|
-
// 优先读取环境变量中的版本信息(自己打的 Tag)
|
18
|
-
VITE_CURRENT_VERSION: process.env.PROJECT_VERSION || '0.5.5',
|
19
|
-
},
|
20
|
-
});
|
21
|
-
|
22
|
-
for (const key in config) {
|
23
|
-
if (Object.prototype.hasOwnProperty.call(config, key)) {
|
24
|
-
process.env[key] = config[key];
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
console.log('------------------------读取配置文件------------------------');
|
29
|
-
console.log(config);
|
30
|
-
console.log('------------------------------------------------------------');
|
31
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"formatter": {
|
3
|
-
"ignore": [
|
4
|
-
"node_modules/**/*",
|
5
|
-
"src/utils/**/*.js",
|
6
|
-
"src/utils/**/*.map",
|
7
|
-
"*.d.ts",
|
8
|
-
"index.html",
|
9
|
-
"yarn.lock",
|
10
|
-
"*.json",
|
11
|
-
"README.md",
|
12
|
-
"dist/**/*"
|
13
|
-
],
|
14
|
-
"indentStyle": "space",
|
15
|
-
"indentSize": 2,
|
16
|
-
"lineWidth": 100
|
17
|
-
},
|
18
|
-
"javascript": {
|
19
|
-
"formatter": {
|
20
|
-
"quoteStyle": "single"
|
21
|
-
}
|
22
|
-
},
|
23
|
-
"linter": {
|
24
|
-
"enabled": false
|
25
|
-
}
|
26
|
-
}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-01-04 15:16:30
|
4
|
-
* @LastEditTime: 2023-01-05 09:10:47
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
export default eventHandler(async (event) => {
|
8
|
-
const method = event.node.req.method;
|
9
|
-
const url = event.node.req.url;
|
10
|
-
let body;
|
11
|
-
|
12
|
-
if (!(method && method.toLowerCase() === 'get')) {
|
13
|
-
try {
|
14
|
-
body = await readBody(event);
|
15
|
-
console.log('🚀 ~ file: [...all].ts:16 ~ eventHandler ~ body', body);
|
16
|
-
} catch (error) {
|
17
|
-
console.log('🚀 ~ file: [...all].ts:18 ~ eventHandler ~ error', error);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
// 开发服使用 http + 主机名,其他环境直接读取完整配置
|
22
|
-
const api_server_url = process.env.VITE_BASE_HTTP;
|
23
|
-
// 如果正式服报错,则设置一个请求头白名单,只传递对应的请求头
|
24
|
-
// console.log("🚀 ~ file: [...].post.ts:11 ~ defineEventHandler ~ api_server_url", api_server_url);
|
25
|
-
const headers = event.node.req.headers as Record<string, string>;
|
26
|
-
|
27
|
-
try {
|
28
|
-
const res = await $fetch(`${api_server_url}${url}`, {
|
29
|
-
method: event.node.req.method,
|
30
|
-
headers: {
|
31
|
-
time: headers['time'],
|
32
|
-
authorization: headers['authorization'],
|
33
|
-
sign: headers['sign'],
|
34
|
-
'content-type': headers['content-type'],
|
35
|
-
'x-forwarded-for': headers['x-forwarded-for'],
|
36
|
-
},
|
37
|
-
body,
|
38
|
-
});
|
39
|
-
|
40
|
-
return res;
|
41
|
-
} catch (error: any) {
|
42
|
-
if (error.toString().includes('401')) {
|
43
|
-
event.node.res.statusCode = 401;
|
44
|
-
return error.data;
|
45
|
-
} else {
|
46
|
-
return error;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-11-18 10:55:50
|
4
|
-
* @LastEditTime: 2023-01-04 19:06:46
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
export default defineEventHandler(async (event) => {
|
8
|
-
const envObj: any = {};
|
9
|
-
for (const key in process.env) {
|
10
|
-
if (Object.prototype.hasOwnProperty.call(process.env, key) && key.startsWith('VITE_')) {
|
11
|
-
envObj[key] = process.env[key];
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
event.node.res.setHeader('Access-Control-Allow-Origin', '*');
|
16
|
-
|
17
|
-
return envObj as ImportMetaEnv;
|
18
|
-
});
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2022-12-03 15:57:40
|
4
|
-
* @LastEditTime: 2023-01-05 14:07:02
|
5
|
-
* @Description:
|
6
|
-
-->
|
7
|
-
<script lang="ts" setup>
|
8
|
-
import locale from 'element-plus/lib/locale/lang/zh-cn';
|
9
|
-
</script>
|
10
|
-
<template>
|
11
|
-
<ElConfigProvider :locale="locale">
|
12
|
-
<RouterView />
|
13
|
-
</ElConfigProvider>
|
14
|
-
</template>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-01-06 10:50:53
|
4
|
-
* @LastEditTime: 2023-01-06 14:08:45
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { http } from '@/modules/3-net';
|
8
|
-
|
9
|
-
const method = 'DELETE';
|
10
|
-
|
11
|
-
const del = async (url: string, ids: string) => {
|
12
|
-
await http.authReq({
|
13
|
-
url,
|
14
|
-
method,
|
15
|
-
data: { ids },
|
16
|
-
});
|
17
|
-
};
|
18
|
-
|
19
|
-
export const useDeleteReq = () => ({
|
20
|
-
/**
|
21
|
-
* 删除用户
|
22
|
-
*/
|
23
|
-
deleteUser: async (ids: string) => del('/user/delete/batch', ids),
|
24
|
-
/**
|
25
|
-
* 删除菜单
|
26
|
-
*/
|
27
|
-
deleteMenu: async (ids: string) => del('/menu/delete/batch', ids),
|
28
|
-
/**
|
29
|
-
* 删除接口
|
30
|
-
*/
|
31
|
-
deleteApi: async (ids: string) => del('/api/delete/batch', ids),
|
32
|
-
/**
|
33
|
-
* 删除角色
|
34
|
-
*/
|
35
|
-
deleteRole: async (ids: string) => del('/role/delete/batch', ids),
|
36
|
-
});
|
@@ -1,83 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-01-04 19:31:22
|
4
|
-
* @LastEditTime: 2023-05-18 16:07:52
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { http } from '@/modules/3-net';
|
8
|
-
import { useNavStore } from '@/stores';
|
9
|
-
|
10
|
-
const method = 'GET';
|
11
|
-
|
12
|
-
export const useGetReq = () => ({
|
13
|
-
/**
|
14
|
-
* 获取当前用户的菜单树
|
15
|
-
*/
|
16
|
-
getMenuTree: async (force = false) => {
|
17
|
-
const { RawNav } = useNavStore();
|
18
|
-
if (!force && RawNav.value.length > 0) {
|
19
|
-
return Promise.resolve(RawNav.value);
|
20
|
-
}
|
21
|
-
return http.authReq<Record<number, NavArrItem>>({
|
22
|
-
url: '/menu/tree',
|
23
|
-
method,
|
24
|
-
});
|
25
|
-
},
|
26
|
-
/**
|
27
|
-
* 获取角色列表
|
28
|
-
*/
|
29
|
-
getRoleList: async (params: Partial<BaseQuery> = {}) =>
|
30
|
-
http.authReq<PagesData>({
|
31
|
-
url: `/role/list`,
|
32
|
-
params,
|
33
|
-
method,
|
34
|
-
}),
|
35
|
-
/**
|
36
|
-
* 获取用户列表
|
37
|
-
*/
|
38
|
-
getUserList: async (params: Partial<BaseQuery> = {}) =>
|
39
|
-
http.authReq<PagesData>({
|
40
|
-
url: '/user/list',
|
41
|
-
method,
|
42
|
-
params,
|
43
|
-
}),
|
44
|
-
/**
|
45
|
-
* 获取菜单列表
|
46
|
-
*/
|
47
|
-
getMenuList: async () =>
|
48
|
-
http.authReq<Record<string, NavArrItem>>({
|
49
|
-
url: '/menu/list',
|
50
|
-
method,
|
51
|
-
}),
|
52
|
-
/**
|
53
|
-
* 获取接口列表
|
54
|
-
*/
|
55
|
-
getApiList: async (params: Partial<BaseQuery> = {}) =>
|
56
|
-
http.authReq<PagesData>({
|
57
|
-
url: '/api/list',
|
58
|
-
method,
|
59
|
-
params,
|
60
|
-
}),
|
61
|
-
/**
|
62
|
-
* 获取角色拥有权限的菜单
|
63
|
-
*/
|
64
|
-
getRoleMenuTree: async (id: number) =>
|
65
|
-
http.authReq<{
|
66
|
-
list: NavArrItem[];
|
67
|
-
accessIds: number[];
|
68
|
-
}>({
|
69
|
-
url: `/menu/all/${id}`,
|
70
|
-
method,
|
71
|
-
}),
|
72
|
-
/**
|
73
|
-
* 获取角色拥有的接口权限
|
74
|
-
*/
|
75
|
-
getRoleApis: async (id: number) =>
|
76
|
-
http.authReq<{
|
77
|
-
list: ApiItem[];
|
78
|
-
accessIds: number[];
|
79
|
-
}>({
|
80
|
-
url: `/api/all/category/${id}`,
|
81
|
-
method,
|
82
|
-
}),
|
83
|
-
});
|
@@ -1,78 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-01-04 19:31:22
|
4
|
-
* @LastEditTime: 2023-01-06 16:50:47
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { http } from '@/modules/3-net';
|
8
|
-
|
9
|
-
const method = 'PATCH';
|
10
|
-
|
11
|
-
export const usePatchReq = () => ({
|
12
|
-
/**
|
13
|
-
* 更新用户信息
|
14
|
-
*/
|
15
|
-
changeUserItem: async ({ id, ...data }: Partial<UserItem>) => {
|
16
|
-
await http.authReq({
|
17
|
-
url: `/user/update/${id}`,
|
18
|
-
method,
|
19
|
-
data,
|
20
|
-
});
|
21
|
-
},
|
22
|
-
/**
|
23
|
-
* 更新菜单信息
|
24
|
-
*/
|
25
|
-
changeMenuItem: async ({ id, ...data }: Partial<NavArrItem>) => {
|
26
|
-
await http.authReq({
|
27
|
-
url: `/menu/update/${id}`,
|
28
|
-
method,
|
29
|
-
data,
|
30
|
-
});
|
31
|
-
},
|
32
|
-
/**
|
33
|
-
* 更新接口
|
34
|
-
*/
|
35
|
-
changeApiItem: async ({ id, ...data }: Partial<ApiItem>) => {
|
36
|
-
await http.authReq({
|
37
|
-
url: `/api/update/${id}`,
|
38
|
-
method,
|
39
|
-
data,
|
40
|
-
});
|
41
|
-
},
|
42
|
-
/**
|
43
|
-
* 更新角色
|
44
|
-
*/
|
45
|
-
changeRoleItem: async ({ id, ...data }: Partial<RoleItem>) => {
|
46
|
-
await http.authReq({
|
47
|
-
url: `/role/update/${id}`,
|
48
|
-
method,
|
49
|
-
data,
|
50
|
-
});
|
51
|
-
},
|
52
|
-
/**
|
53
|
-
* 更新角色菜单权限
|
54
|
-
*/
|
55
|
-
changeRoleMenu: async (roleId: number, add: number[], del: number[]) => {
|
56
|
-
await http.authReq({
|
57
|
-
url: `role/menus/update/${roleId}`,
|
58
|
-
method,
|
59
|
-
data: {
|
60
|
-
create: add,
|
61
|
-
delete: del,
|
62
|
-
},
|
63
|
-
});
|
64
|
-
},
|
65
|
-
/**
|
66
|
-
* 更新角色接口权限
|
67
|
-
*/
|
68
|
-
changeRoleApi: async (roleId: number, add: number[], del: number[]) => {
|
69
|
-
await http.authReq({
|
70
|
-
url: `role/apis/update/${roleId}`,
|
71
|
-
method,
|
72
|
-
data: {
|
73
|
-
create: add,
|
74
|
-
delete: del,
|
75
|
-
},
|
76
|
-
});
|
77
|
-
},
|
78
|
-
});
|
@@ -1,76 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-01-04 11:33:12
|
4
|
-
* @LastEditTime: 2023-05-18 16:14:20
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { http } from '@/modules/3-net';
|
8
|
-
import { useUserStore } from '@/stores';
|
9
|
-
|
10
|
-
export const usePostReq = () => ({
|
11
|
-
/**
|
12
|
-
* 登录
|
13
|
-
*/
|
14
|
-
login: async (data: {
|
15
|
-
/**
|
16
|
-
* 用户名
|
17
|
-
*/
|
18
|
-
username: string;
|
19
|
-
/**
|
20
|
-
* 密码
|
21
|
-
*/
|
22
|
-
password: string;
|
23
|
-
}) =>
|
24
|
-
http.freeReq<UserKey>({
|
25
|
-
url: '/base/login',
|
26
|
-
data,
|
27
|
-
}),
|
28
|
-
/**
|
29
|
-
* 获取当前用户的信息
|
30
|
-
*/
|
31
|
-
getCurrUserInfo: async () => {
|
32
|
-
const { CurrUserInfo } = useUserStore();
|
33
|
-
if (CurrUserInfo.value.id) {
|
34
|
-
return Promise.resolve(CurrUserInfo.value);
|
35
|
-
}
|
36
|
-
return http.authReq<CurrUserInfo>({
|
37
|
-
url: '/user/info',
|
38
|
-
});
|
39
|
-
},
|
40
|
-
/**
|
41
|
-
* 创建用户
|
42
|
-
*/
|
43
|
-
addUserItem: async (data: UserItem) => {
|
44
|
-
await http.authReq({
|
45
|
-
url: '/user/create',
|
46
|
-
data,
|
47
|
-
});
|
48
|
-
},
|
49
|
-
/**
|
50
|
-
* 创建菜单
|
51
|
-
*/
|
52
|
-
addMenuItem: async (data: NavArrItem) => {
|
53
|
-
await http.authReq({
|
54
|
-
url: '/menu/create',
|
55
|
-
data,
|
56
|
-
});
|
57
|
-
},
|
58
|
-
/**
|
59
|
-
* 创建接口
|
60
|
-
*/
|
61
|
-
addApiItem: async (data: ApiItem) => {
|
62
|
-
await http.authReq({
|
63
|
-
url: '/api/create',
|
64
|
-
data,
|
65
|
-
});
|
66
|
-
},
|
67
|
-
/**
|
68
|
-
* 创建角色
|
69
|
-
*/
|
70
|
-
addRoleItem: async (data: RoleItem) => {
|
71
|
-
await http.authReq({
|
72
|
-
url: '/role/create',
|
73
|
-
data,
|
74
|
-
});
|
75
|
-
},
|
76
|
-
});
|
Binary file
|
@@ -1,38 +0,0 @@
|
|
1
|
-
/* eslint-disable */
|
2
|
-
/* prettier-ignore */
|
3
|
-
// @ts-nocheck
|
4
|
-
// Generated by unplugin-vue-components
|
5
|
-
// Read more: https://github.com/vuejs/core/pull/3399
|
6
|
-
import '@vue/runtime-core'
|
7
|
-
|
8
|
-
export {}
|
9
|
-
|
10
|
-
declare module '@vue/runtime-core' {
|
11
|
-
export interface GlobalComponents {
|
12
|
-
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
13
|
-
ElButton: typeof import('element-plus/es')['ElButton']
|
14
|
-
ElCard: typeof import('element-plus/es')['ElCard']
|
15
|
-
ElCascader: typeof import('element-plus/es')['ElCascader']
|
16
|
-
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
17
|
-
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
18
|
-
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
19
|
-
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
20
|
-
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
21
|
-
ElForm: typeof import('element-plus/es')['ElForm']
|
22
|
-
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
23
|
-
ElInput: typeof import('element-plus/es')['ElInput']
|
24
|
-
ElMenu: typeof import('element-plus/es')['ElMenu']
|
25
|
-
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
26
|
-
ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup']
|
27
|
-
ElOption: typeof import('element-plus/es')['ElOption']
|
28
|
-
ElResult: typeof import('element-plus/es')['ElResult']
|
29
|
-
ElSelect: typeof import('element-plus/es')['ElSelect']
|
30
|
-
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
31
|
-
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
32
|
-
ElTable: typeof import('element-plus/es')['ElTable']
|
33
|
-
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
34
|
-
ElTag: typeof import('element-plus/es')['ElTag']
|
35
|
-
RouterLink: typeof import('vue-router')['RouterLink']
|
36
|
-
RouterView: typeof import('vue-router')['RouterView']
|
37
|
-
}
|
38
|
-
}
|