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.
Files changed (100) hide show
  1. package/README.md +6 -0
  2. package/dist/index.mjs +9 -9
  3. package/package.json +1 -1
  4. package/template-nuxt-admin/README.md +42 -1
  5. package/template-nuxt-admin/components/TopUser.vue +4 -4
  6. package/template-nuxt-admin/components/YoungChangePassword.vue +5 -5
  7. package/template-nuxt-admin/components/layout/Main.vue +2 -2
  8. package/template-nuxt-admin/components/layout/NavBar.vue +11 -2
  9. package/template-nuxt-admin/components/layout/SideBar.vue +7 -2
  10. package/template-nuxt-admin/components/layout/SubMenu.vue +9 -2
  11. package/template-nuxt-admin/components/layout/TabsBar.vue +4 -5
  12. package/template-nuxt-admin/composables/api.ts +20 -21
  13. package/template-nuxt-admin/composables/nav.ts +20 -3
  14. package/template-nuxt-admin/composables/tags.ts +29 -1
  15. package/template-nuxt-admin/composables/user.ts +21 -3
  16. package/template-nuxt-admin/middleware/auth.global.ts +26 -7
  17. package/template-nuxt-admin/nuxt.config.ts +5 -1
  18. package/template-nuxt-admin/package.json +1 -1
  19. package/template-nuxt-admin/pages/home/[id].vue +2 -2
  20. package/template-nuxt-admin/pages/index.vue +2 -7
  21. package/template-nuxt-admin/pages/login.vue +5 -3
  22. package/template-nuxt-admin/pages/system/menuList.vue +0 -1
  23. package/template-nuxt-admin/public/bg.webp +0 -0
  24. package/template-nuxt-admin/public/favicon.svg +2 -0
  25. package/template-nuxt-admin/public/logo.svg +2 -0
  26. package/template-nuxt-admin/server/plugins/env.ts +3 -4
  27. package/template-nuxt-admin/utils/tool.ts +62 -70
  28. package/template-nuxt-admin/public/favicon.ico +0 -0
  29. package/template-vue-admin/.vscode/extensions.json +0 -10
  30. package/template-vue-admin/.vscode/list-add.code-snippets +0 -108
  31. package/template-vue-admin/.vscode/list-export.code-snippets +0 -72
  32. package/template-vue-admin/.vscode/list.code-snippets +0 -61
  33. package/template-vue-admin/.vscode/settings.json +0 -7
  34. package/template-vue-admin/Dockerfile +0 -42
  35. package/template-vue-admin/README.md +0 -75
  36. package/template-vue-admin/_env +0 -8
  37. package/template-vue-admin/_gitignore +0 -30
  38. package/template-vue-admin/boot.mjs +0 -16
  39. package/template-vue-admin/build/custom-plugin.ts +0 -57
  40. package/template-vue-admin/build/index.ts +0 -7
  41. package/template-vue-admin/build/plugins.ts +0 -59
  42. package/template-vue-admin/config/.devrc +0 -2
  43. package/template-vue-admin/config/.onlinerc +0 -2
  44. package/template-vue-admin/config/.testrc +0 -2
  45. package/template-vue-admin/index.html +0 -21
  46. package/template-vue-admin/nitro.config.ts +0 -19
  47. package/template-vue-admin/package.json +0 -51
  48. package/template-vue-admin/plugins/init.ts +0 -31
  49. package/template-vue-admin/public/vite.svg +0 -1
  50. package/template-vue-admin/rome.json +0 -26
  51. package/template-vue-admin/routes/api/[...all].ts +0 -49
  52. package/template-vue-admin/routes/get/env.ts +0 -18
  53. package/template-vue-admin/src/App.vue +0 -14
  54. package/template-vue-admin/src/apis/delete.ts +0 -36
  55. package/template-vue-admin/src/apis/get.ts +0 -83
  56. package/template-vue-admin/src/apis/index.ts +0 -10
  57. package/template-vue-admin/src/apis/patch.ts +0 -78
  58. package/template-vue-admin/src/apis/post.ts +0 -76
  59. package/template-vue-admin/src/assets/img/login_background.jpg +0 -0
  60. package/template-vue-admin/src/auto-components.d.ts +0 -38
  61. package/template-vue-admin/src/auto-imports.d.ts +0 -302
  62. package/template-vue-admin/src/layouts/blank.vue +0 -9
  63. package/template-vue-admin/src/layouts/default/components/Link.vue +0 -23
  64. package/template-vue-admin/src/layouts/default/components/Logo.vue +0 -20
  65. package/template-vue-admin/src/layouts/default/components/Menu.vue +0 -54
  66. package/template-vue-admin/src/layouts/default/components/NavSearch.vue +0 -52
  67. package/template-vue-admin/src/layouts/default/components/ScrollPane.vue +0 -79
  68. package/template-vue-admin/src/layouts/default/components/TagsView.vue +0 -137
  69. package/template-vue-admin/src/layouts/default/components/TopMenu.vue +0 -21
  70. package/template-vue-admin/src/layouts/default/components/UserCenter.vue +0 -50
  71. package/template-vue-admin/src/layouts/default/index.vue +0 -95
  72. package/template-vue-admin/src/main.ts +0 -46
  73. package/template-vue-admin/src/modules/1-router.ts +0 -48
  74. package/template-vue-admin/src/modules/2-pinia.ts +0 -10
  75. package/template-vue-admin/src/modules/3-net.ts +0 -79
  76. package/template-vue-admin/src/modules/4-auth.ts +0 -124
  77. package/template-vue-admin/src/modules/5-checkupdate.ts +0 -38
  78. package/template-vue-admin/src/shims.d.ts +0 -12
  79. package/template-vue-admin/src/stores/index.ts +0 -9
  80. package/template-vue-admin/src/stores/local/index.ts +0 -31
  81. package/template-vue-admin/src/stores/session/index.ts +0 -63
  82. package/template-vue-admin/src/stores/tags.ts +0 -109
  83. package/template-vue-admin/src/typings/global.d.ts +0 -70
  84. package/template-vue-admin/src/typings/index.ts +0 -13
  85. package/template-vue-admin/src/typings/system.d.ts +0 -46
  86. package/template-vue-admin/src/views/403.vue +0 -33
  87. package/template-vue-admin/src/views/[...all_404].vue +0 -557
  88. package/template-vue-admin/src/views/base/login.vue +0 -194
  89. package/template-vue-admin/src/views/dashboard/[name].vue +0 -28
  90. package/template-vue-admin/src/views/index.vue +0 -25
  91. package/template-vue-admin/src/views/system/api.vue +0 -160
  92. package/template-vue-admin/src/views/system/hooks/useRole.ts +0 -286
  93. package/template-vue-admin/src/views/system/menuList.vue +0 -194
  94. package/template-vue-admin/src/views/system/role.vue +0 -131
  95. package/template-vue-admin/src/views/system/user.vue +0 -192
  96. package/template-vue-admin/src/vite-env.d.ts +0 -52
  97. package/template-vue-admin/tsconfig.json +0 -21
  98. package/template-vue-admin/tsconfig.node.json +0 -9
  99. package/template-vue-admin/unocss.config.ts +0 -47
  100. package/template-vue-admin/vite.config.ts +0 -32
@@ -1,61 +0,0 @@
1
- {
2
- "list-admin": {
3
- "prefix": "list",
4
- "body": [
5
- "<route lang=\"yaml\">",
6
- "meta:",
7
- " title: $1",
8
- " authPath: $2",
9
- "</route>",
10
- "",
11
- "<script lang=\"ts\" setup>",
12
- "import { YoungPagination, YoungTable } from '@bluesyoung/ui-vue3-element-plus';",
13
- "import type { TableHeadItem, TableDataItem } from '@bluesyoung/ui-vue3-element-plus';",
14
- "import { deepClone } from '@bluesyoung/utils';",
15
- "import { $3 } from '@/typings';",
16
- "import { apis } from '@/modules/3-net';",
17
- "",
18
- "interface Form extends $3 { };",
19
- "",
20
- "const tableHead: TableHeadItem<Form>[] = [",
21
- " { prop: '', label: '' },",
22
- "];",
23
- "interface Query extends BaseQuery {};",
24
- "const query = reactive<Query>({",
25
- " pageNum: 1,",
26
- " pageSize: 50,",
27
- " total: 0,",
28
- "});",
29
- "",
30
- "const tableData = ref<TableDataItem<Form>[]>([]);",
31
- "const roleList = ref<SelectOptionItem[]>([]);",
32
- "const getList = async () => {",
33
- " // const { list, pageNum, pageSize, total } = await apis.get.getUserList(query);",
34
- " // tableData.value = deepClone(list || []);",
35
- " // query.pageNum = +pageNum || 1;",
36
- " // query.pageSize = +pageSize || 50;",
37
- " // query.total = +total || 0;",
38
- "};",
39
- "",
40
- "getList();",
41
- "</script>",
42
- "",
43
- "<template>",
44
- " <div class=\"flex\">",
45
- " <div class=\"m-2\">",
46
- " <ElInput v-model=\"query.\" placeholder=\"请输入\" />",
47
- " </div>",
48
- " <div class=\"m-2\">",
49
- " <ElButton type=\"primary\" @click=\"getList\">搜索</ElButton>",
50
- " </div>",
51
- " </div>",
52
- " <div class=\"m-2\">",
53
- " <YoungTable :table-data=\"tableData\" :table-head=\"tableHead\" :table-height=\"680\" />",
54
- " <YoungPagination v-show=\"query.total > 0\" v-model:page=\"query.pageNum\" v-model:limit=\"query.pageSize\" :total=\"query.total\"",
55
- " @page-change=\"getList\" />",
56
- " </div>",
57
- "</template>",
58
- ],
59
- "description": "list-admin"
60
- }
61
- }
@@ -1,7 +0,0 @@
1
- {
2
- "editor.formatOnSave": true,
3
- "editor.defaultFormatter": "rome.rome",
4
- "[vue]": {
5
- "editor.defaultFormatter": "Vue.volar"
6
- }
7
- }
@@ -1,42 +0,0 @@
1
- # 拉取基础镜像
2
- FROM node:18-alpine as builder
3
-
4
- # 维护者
5
- MAINTAINER BluesYoung "bluesyoung_web@163.com"
6
-
7
- # 工作目录
8
- WORKDIR /app
9
-
10
- # 没有压缩包,首选 COPY,如果需要自动解包或下载,则使用 ADD
11
-
12
- # 对比依赖是否变更
13
- COPY package.json yarn.lock /app/
14
-
15
- # 设置npm仓库 + 下载依赖,上面的文件如果没有变化则跳过下载,直接使用缓存
16
- RUN npm config set registry https://registry.npmmirror.com && \
17
- yarn config set registry https://registry.npmmirror.com && \
18
- yarn
19
-
20
- # 加入代码
21
- COPY . /app
22
- # 打包
23
- RUN yarn build
24
-
25
- # 打包完成,构建最终的极简镜像
26
- FROM node:18-alpine
27
-
28
- # 工作目录
29
- WORKDIR /app
30
-
31
- # 复制运行需要的文件[及依赖]
32
- # 直接复制源代码
33
- COPY boot.mjs /app/
34
- COPY config /app/config
35
- # 复制上一步的打包产物
36
- COPY --from=builder /app/.output /app/.output
37
-
38
- # 暴露指定的端口号,暂不需要
39
- # EXPOSE 3001
40
-
41
- # 启动容器时运行的命令
42
- ENTRYPOINT ["node", "boot.mjs"]
@@ -1,75 +0,0 @@
1
- # 后台模板
2
-
3
- ## 用户代码片段(页面模板)
4
-
5
- 模板 | 触发关键字
6
- --- | ---
7
- 基础列表 | `list`
8
- 列表 + `Excel` 导出 | `list-export`
9
- 列表 + 弹出层 | `list-add`
10
-
11
- ## **Docker 部署**
12
-
13
- - 同一份代码,可以根据运行时的环境变量决定具体表现
14
- - `node` 服务:
15
- - 托管前端静态资源
16
- - 根据环境变量读取对应的配置文件,并以接口的形式暴露给前端
17
- - 跨域接口代理
18
-
19
- 环境变量
20
-
21
- ```sh
22
- # 部署环境 dev | test | online
23
- DEPLOY_ENV=dev
24
- # DEPLOY_ENV=test
25
- # DEPLOY_ENV=online
26
- # node 服务监听的端口号
27
- LISTEN_PORT=3000
28
- # 网关主机地址
29
- # APIGATEHOST='apisix.intranet.cn'
30
- ```
31
-
32
- ### 本地开发
33
-
34
- **确保上述的环境变量存在**
35
-
36
- 启动服务端程序 `yarn dev:server`
37
-
38
- 启动客户端程序 `yarn dev`
39
-
40
- ### 打包预览
41
-
42
- `yarn build`
43
-
44
- 确保上述的环境变量存在
45
-
46
- `node boot.mjs`
47
-
48
- ### 配置文件
49
-
50
- 存放于 `config` 目录下的 `.${env}rc` 文件,`env` 为对应的环境标识
51
-
52
- ## 常规部署
53
-
54
- - `nginx` 托管前端静态资源
55
- - 每次打包时读取环境变量,打包完成之后不可变
56
- - 使用 `nginx` 代理跨域
57
-
58
- 环境变量
59
-
60
- ```sh
61
- # 设置静态部署
62
- VITE_USE_DEFAULT_DEPLOY_METHOD=true
63
- # 其他的环境变量,根据环境区分
64
- VITE_TITLE=管理后台
65
- ```
66
-
67
- ### 本地开发
68
-
69
- 确保上述的环境变量存在,然后 `yarn dev` 即可
70
-
71
- ### 打包预览
72
-
73
- `yarn build`
74
-
75
- `yarn preview`
@@ -1,8 +0,0 @@
1
- # 部署环境 dev | test | online
2
- DEPLOY_ENV=dev
3
- # DEPLOY_ENV=test
4
- # DEPLOY_ENV=online
5
- # node 服务监听的端口号
6
- LISTEN_PORT=3000
7
- # 网关主机地址
8
- # APIGATEHOST='apisix.intranet.cn'
@@ -1,30 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- dist
12
- dist-ssr
13
- *.local
14
- .env
15
-
16
- # Editor directories and files
17
- .vscode/*
18
- !.vscode/extensions.json
19
- !.vscode/settings.json
20
- !.vscode/*.code-snippets
21
- .idea
22
- .DS_Store
23
- *.suo
24
- *.ntvs*
25
- *.njsproj
26
- *.sln
27
- *.sw?
28
-
29
- .nitro
30
- .output
@@ -1,16 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2022-09-16 11:48:05
4
- * @LastEditTime: 2022-12-29 16:21:59
5
- * @Description:
6
- */
7
- (async () => {
8
- const env = process.env.DEPLOY_ENV;
9
- const listenPort = process.env.LISTEN_PORT || 3003;
10
- console.log('当前环境:', env);
11
- console.log('服务监听端口:', listenPort);
12
-
13
- process.env.NITRO_PORT = listenPort;
14
-
15
- await import('./.output/server/index.mjs');
16
- })();
@@ -1,57 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2023-01-10 14:43:13
4
- * @LastEditTime: 2023-05-18 15:55:37
5
- * @Description:
6
- */
7
- import { networkInterfaces } from 'node:os';
8
-
9
- function getLocalIP(): string | undefined {
10
- const ips = networkInterfaces();
11
-
12
- function isPrivateIP(ip: string) {
13
- return (
14
- /^192\.168\.\d{1,3}\.\d{1,3}$/.test(ip) ||
15
- /^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(ip) ||
16
- /^172\.(1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}$/.test(ip)
17
- );
18
- }
19
-
20
- for (const name of Object.keys(ips)) {
21
- const networkInterface = ips[name];
22
-
23
- for (const interfaceInfo of networkInterface) {
24
- if (
25
- interfaceInfo.family === 'IPv4' &&
26
- !interfaceInfo.internal &&
27
- isPrivateIP(interfaceInfo.address)
28
- ) {
29
- return interfaceInfo.address;
30
- }
31
- }
32
- }
33
-
34
- return '127.0.0.1';
35
- }
36
-
37
- const virtualModuleId = 'virtual:local-server';
38
- export const localServer = `http://${getLocalIP()}:3000`;
39
-
40
- /**
41
- * 获取本机 ip 地址,拼接开发时的服务地址
42
- */
43
- export const serverPlugin = () => {
44
- return {
45
- name: 'local-server',
46
- resolveId(id) {
47
- if (id === virtualModuleId) {
48
- return virtualModuleId;
49
- }
50
- },
51
- load(id) {
52
- if (id === virtualModuleId) {
53
- return `export const server = '${localServer}';`;
54
- }
55
- },
56
- };
57
- };
@@ -1,7 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2023-01-10 14:46:42
4
- * @LastEditTime: 2023-01-10 14:46:43
5
- * @Description:
6
- */
7
- export * from './plugins';
@@ -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,2 +0,0 @@
1
- VITE_TITLE = 管理后台-dev
2
- VITE_BASE_HTTP = http://localhost:7001
@@ -1,2 +0,0 @@
1
- VITE_TITLE = 管理后台-online
2
- VITE_BASE_HTTP = http://localhost:7001
@@ -1,2 +0,0 @@
1
- VITE_TITLE = 管理后台-test
2
- VITE_BASE_HTTP = http://localhost:7001
@@ -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
- });