chore: P3 清理(rolldown 拼写/.env 入库/模板残留/死代码/确认取消/console 噪音)

- 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 <noreply@anthropic.com>
This commit is contained in:
liuyun 2026-10-11 16:57:55 +08:00
parent 0a1fbf3df2
commit cf54ea2352
10 changed files with 18 additions and 5109 deletions

5
.env
View File

@ -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

View File

@ -1 +0,0 @@
VITE_APP_NAME=demo_dev

2
.env.example Normal file
View File

@ -0,0 +1,2 @@
# 后端 API 基地址
VITE_API_BASE_URL=http://localhost:3000/api/v1

6
.gitignore vendored
View File

@ -37,3 +37,9 @@ __screenshots__/
# Vite # Vite
*.timestamp-*-*.mjs *.timestamp-*-*.mjs
# Env
.env
.env.*
!.env.example
stats.html

View File

@ -2,7 +2,7 @@
"name": "sysmgr-admin", "name": "sysmgr-admin",
"version": "0.0.0", "version": "0.0.0",
"packageManager": "pnpm@12.10.1", "packageManager": "pnpm@12.10.1",
"description": "程序员优雅哥 agarwood 系列 vue3 模板项目", "description": "通用系统管理脚手架 - 管理后台前端",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
@ -71,8 +71,5 @@
"keywords": [ "keywords": [
"vue3" "vue3"
], ],
"author": { "license": "MIT"
"name": "程序员优雅哥 youyacoder",
"email": "hero_cloudy@126.com"
}
} }

View File

@ -225,9 +225,13 @@ async function openEdit(row: Record<string, any>): Promise<void> {
async function handleDelete(row: Record<string, any>): Promise<void> { async function handleDelete(row: Record<string, any>): Promise<void> {
const name = row[props.nameKey] ?? '' const name = row[props.nameKey] ?? ''
try {
await ElMessageBox.confirm(`确认删除${props.entityName}「${name}」?`, '提示', { await ElMessageBox.confirm(`确认删除${props.entityName}「${name}」?`, '提示', {
type: 'warning', type: 'warning',
}) })
} catch {
return // 用户取消
}
await props.remove(String(row[props.idKey])) await props.remove(String(row[props.idKey]))
ElMessage.success('删除成功') ElMessage.success('删除成功')
fetchList() fetchList()

View File

@ -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,
},
],
},
]

View File

@ -5,7 +5,6 @@ import App from './App.vue'
import router, { installRouter } from './router' import router, { installRouter } from './router'
import pinia, { installStore } from '@/stores' import pinia, { installStore } from '@/stores'
import { installAssets } from '@/plugins/assets' import { installAssets } from '@/plugins/assets'
import { Env } from '@/utils/env.ts'
import { installI18n } from '@/i18n' import { installI18n } from '@/i18n'
import { setAuthExpiredHandler } from '@/api/http' import { setAuthExpiredHandler } from '@/api/http'
import { useAuthStore } from '@/stores/modules/auth' import { useAuthStore } from '@/stores/modules/auth'
@ -37,14 +36,4 @@ setAuthExpiredHandler(() => {
installI18n(app) installI18n(app)
installAssets() 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') app.mount('#app')

4950
stats.html

File diff suppressed because one or more lines are too long

View File

@ -52,7 +52,7 @@ export default defineConfig(({ mode }) => {
}, },
} }
: {}, : {},
olldownOptions: { rolldownOptions: {
output: { output: {
codeSplitting: { codeSplitting: {
groups: [ groups: [