From cf54ea2352fcdbefd50f74ae0cbc64c668927f92 Mon Sep 17 00:00:00 2001 From: liuyun Date: Sun, 11 Oct 2026 16:57:55 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20P3=20=E6=B8=85=E7=90=86=EF=BC=88rolldo?= =?UTF-8?q?wn=20=E6=8B=BC=E5=86=99/.env=20=E5=85=A5=E5=BA=93/=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=AE=8B=E7=95=99/=E6=AD=BB=E4=BB=A3=E7=A0=81/?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8F=96=E6=B6=88/console=20=E5=99=AA?= =?UTF-8?q?=E9=9F=B3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - vite rolldownOptions 拼写修正 - .env 入库 → gitignore + .env.example - package.json 移除模板 author/description、补 MIT - 删除死代码 config/menu.ts、untrack stats.html - ty-crud 删除确认取消不报 rejection、main.ts 移除 console 噪音 Co-Authored-By: Claude Opus 4.8 --- .env | 5 - .env.dev | 1 - .env.example | 2 + .gitignore | 6 + package.json | 7 +- src/components/ty-crud.vue | 10 +- src/config/menu.ts | 133 - src/main.ts | 11 - stats.html | 4950 ------------------------------------ vite.config.ts | 2 +- 10 files changed, 18 insertions(+), 5109 deletions(-) delete mode 100644 .env delete mode 100644 .env.dev create mode 100644 .env.example delete mode 100644 src/config/menu.ts delete mode 100644 stats.html diff --git a/.env b/.env deleted file mode 100644 index 12a4e78..0000000 --- a/.env +++ /dev/null @@ -1,5 +0,0 @@ -VITE_APP_NAME=demo_default -VITE_NUMBER_DEMO=3000 -VITE_BOOLEAN_DEMO=true - -VITE_API_BASE_URL=http://localhost:3000/api/v1 diff --git a/.env.dev b/.env.dev deleted file mode 100644 index 9a1baf8..0000000 --- a/.env.dev +++ /dev/null @@ -1 +0,0 @@ -VITE_APP_NAME=demo_dev diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..04fc20d --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +# 后端 API 基地址 +VITE_API_BASE_URL=http://localhost:3000/api/v1 diff --git a/.gitignore b/.gitignore index cd68f14..3ba5f08 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,9 @@ __screenshots__/ # Vite *.timestamp-*-*.mjs + +# Env +.env +.env.* +!.env.example +stats.html diff --git a/package.json b/package.json index 1e6076a..531b86a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "sysmgr-admin", "version": "0.0.0", "packageManager": "pnpm@12.10.1", - "description": "程序员优雅哥 agarwood 系列 vue3 模板项目", + "description": "通用系统管理脚手架 - 管理后台前端", "private": true, "type": "module", "scripts": { @@ -71,8 +71,5 @@ "keywords": [ "vue3" ], - "author": { - "name": "程序员优雅哥 youyacoder", - "email": "hero_cloudy@126.com" - } + "license": "MIT" } diff --git a/src/components/ty-crud.vue b/src/components/ty-crud.vue index ac9ef93..b5df406 100644 --- a/src/components/ty-crud.vue +++ b/src/components/ty-crud.vue @@ -225,9 +225,13 @@ async function openEdit(row: Record): Promise { async function handleDelete(row: Record): Promise { const name = row[props.nameKey] ?? '' - await ElMessageBox.confirm(`确认删除${props.entityName}「${name}」?`, '提示', { - type: 'warning', - }) + try { + await ElMessageBox.confirm(`确认删除${props.entityName}「${name}」?`, '提示', { + type: 'warning', + }) + } catch { + return // 用户取消 + } await props.remove(String(row[props.idKey])) ElMessage.success('删除成功') fetchList() diff --git a/src/config/menu.ts b/src/config/menu.ts deleted file mode 100644 index 266f03c..0000000 --- a/src/config/menu.ts +++ /dev/null @@ -1,133 +0,0 @@ -import type { ResourceNode } from '@/types/resource' - -/** - * 占位菜单树(字段严格对齐后端 resource,children 已按 parentCode 组装)。 - * 后续替换为后端「当前用户菜单树」接口返回,数据结构不变。 - */ -export const placeholderMenus: ResourceNode[] = [ - { - id: 'menu-dashboard', - code: 'dashboard', - name: '工作台', - parentCode: null, - type: 'menu', - path: '/', - component: 'dashboard/index', - icon: 'mdi:view-dashboard', - sort: 1, - }, - { - id: 'menu-system', - code: 'system', - name: '系统管理', - parentCode: null, - type: 'menu', - path: '/system', - component: 'Layout', - icon: 'mdi:cog', - sort: 2, - children: [ - { - id: 'menu-user', - code: 'user', - name: '用户管理', - parentCode: 'system', - type: 'menu', - path: '/system/user', - component: 'system/user/index', - icon: 'mdi:account-group', - sort: 1, - }, - { - id: 'menu-role', - code: 'role', - name: '角色管理', - parentCode: 'system', - type: 'menu', - path: '/system/role', - component: 'system/role/index', - icon: 'mdi:account-key', - sort: 2, - }, - { - id: 'menu-resource', - code: 'resource', - name: '资源管理', - parentCode: 'system', - type: 'menu', - path: '/system/resource', - component: 'system/resource/index', - icon: 'mdi:view-list', - sort: 3, - }, - { - id: 'menu-org', - code: 'org', - name: '组织管理', - parentCode: 'system', - type: 'menu', - path: '/system/org', - component: 'system/org/index', - icon: 'mdi:sitemap', - sort: 4, - }, - { - id: 'menu-dict', - code: 'dict', - name: '字典管理', - parentCode: 'system', - type: 'menu', - path: '/system/dict', - component: 'system/dict/index', - icon: 'mdi:book-open-variant', - sort: 5, - }, - { - id: 'menu-config', - code: 'config', - name: '参数配置', - parentCode: 'system', - type: 'menu', - path: '/system/config', - component: 'system/config/index', - icon: 'mdi:tune', - sort: 6, - }, - ], - }, - { - id: 'menu-monitor', - code: 'monitor', - name: '系统监控', - parentCode: null, - type: 'menu', - path: '/monitor', - component: 'Layout', - icon: 'mdi:monitor-dashboard', - sort: 3, - children: [ - { - id: 'menu-audit', - code: 'audit', - name: '操作日志', - parentCode: 'monitor', - type: 'menu', - path: '/monitor/audit', - component: 'monitor/audit/index', - icon: 'mdi:clipboard-text', - sort: 1, - }, - { - id: 'menu-login-log', - code: 'login-log', - name: '登录日志', - parentCode: 'monitor', - type: 'menu', - path: '/monitor/login-log', - component: 'monitor/login-log/index', - icon: 'mdi:login', - sort: 2, - }, - ], - }, -] diff --git a/src/main.ts b/src/main.ts index 00719bf..1b200ba 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,7 +5,6 @@ import App from './App.vue' import router, { installRouter } from './router' import pinia, { installStore } from '@/stores' import { installAssets } from '@/plugins/assets' -import { Env } from '@/utils/env.ts' import { installI18n } from '@/i18n' import { setAuthExpiredHandler } from '@/api/http' import { useAuthStore } from '@/stores/modules/auth' @@ -37,14 +36,4 @@ setAuthExpiredHandler(() => { installI18n(app) installAssets() -// 获取当前模式 -const currentMode = import.meta.env.MODE -console.log('当前模式:', currentMode) // 输出: development, uat 或 production -console.log('VITE_APP_NAME: ', Env.get('VITE_APP_NAME')) -console.log('VITE_NUMBER_DEMO: ', Env.getNumber('VITE_NUMBER_DEMO')) -console.log('VITE_BOOLEAN_DEMO: ', Env.getBoolean('VITE_BOOLEAN_DEMO')) -console.log('isDev', Env.isDev) -console.log('isUat', Env.isUat) -console.log('isProd', Env.isProd) - app.mount('#app') diff --git a/stats.html b/stats.html deleted file mode 100644 index e0cd718..0000000 --- a/stats.html +++ /dev/null @@ -1,4950 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/vite.config.ts b/vite.config.ts index 531d0b6..fa7758b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -52,7 +52,7 @@ export default defineConfig(({ mode }) => { }, } : {}, - olldownOptions: { + rolldownOptions: { output: { codeSplitting: { groups: [