本次优化在不改变业务行为的前提下,修复了多处会导致数据丢失或
功能失效的缺陷,并把此前从未跑过的类型检查与生产构建接通。
== 修复的严重缺陷 ==
服务端:
- dynamic/notice 路由在目标表缺失时用 `db.data = { dynamic: [] }`
整体替换数据库对象后落盘,会把 employee/Notice/qa 等全部业务表清空。
改为只创建缺失的那一张表。
- 列表接口在空表时访问 undefined.length 直接 500,统一补默认空数组。
- /api/employee/list 与 /login 明文返回 pwd 字段,且把含密码的
请求体写进日志。改为统一剔除敏感字段、移除参数日志。
- upd 允许请求体覆盖主键 id / createTime;改为服务端维护。
- upload 未限制扩展名与大小,且用原始扩展名拼路径。
前端:
- src/common/axios.ts 的拦截器注册在全局默认 axios 实例上,而业务
走 funjia-axios,导致拦截器全程失效;同时 funjia-axios 内部
`axios.prototype.error = () => {}` + `axios.prototype(msg)` 会抛
TypeError,使所有接口错误(含 401)被静默吞掉。现在本文件是唯一
的拦截器注册点。
- 修改密码功能形同虚设: PwdForm.onUpdate 只做 setTimeout 后 emit
成功,从不调接口;PwdDialog 又用已被拦截器解包掉的 status 判断
成败,无论结果都提示失败。
- Notice/Plugin 新增时 userId 静默丢失 (UmByClassEnhance 的
otherParams 只进 getList,不传 onAdd/onEdit),改用会话级
setCurrentUserId/getCurrentUserId。
- 修复 Login 模板绑定了从未定义的 loading、跳转到路由表里不存在
的路径;DynamicTable 里每次路由切换都触发的 debugger。
- 修复 Record/RecordUser 引用不存在的 marsLib/*、@/components/UmTable;
CodeMirror 使用 ref 却未 import; ImageCell 调用不存在的
getObjectTypeName。
== 结构优化 ==
- 新增 src/common/response.ts 与 BaseViewModel,收敛 7 个 viewModel
中重复 20+ 次的响应码判断与 CRUD 样板。
- 新增 server/routers/helpers.mjs,统一服务端取表/过滤/分页/脱敏。
- 新增 server/smoke-test.mjs,16 个用例覆盖上述修复(含整库清空回归)。
- 删除 0 引用的死文件: ImageList.vue、autoresponsive.vue、
animation.js、PwdDialog/PwdForm.vue。
== 工程配置 ==
- 修复阻塞安装与构建的三处错误:
funjiaui 指向不存在的仓库 FunjiaUI_Vue(#v1.1.3),实为
FunJiaUI_Vue_Package(#v1.3.1); pinia 锁 ~2.0.36 (vue 固定 3.2.33,
2.1+ 要求 vue ^3.3.0); App.vue 引用不存在的 funjiaui/dist/style.css,
实为包根目录 style.css。
- 新增 build/typecheck/build:only 脚本; 此前项目没有类型检查步骤。
- 移除 8 个未使用依赖,补齐 terser 与缺失的类型包。
- vite.config.ts 代理目标改由 .env 配置,移除硬编码内网地址;
增加 manualChunks 拆包。
- 服务端数据库改为不进版本库,提供 *.example.json 初始化模板。
== 验证 ==
- npx vue-tsc --noEmit : 0 错误
- npm run build : 成功 (1759 模块)
- cd server && npm run smoke : 16/16 通过
优化前的代码保留在 legacy 分支。
55 lines
2.8 KiB
TypeScript
55 lines
2.8 KiB
TypeScript
// Generated by 'unplugin-auto-import'
|
|
// We suggest you to commit this file into source control
|
|
declare global {
|
|
const computed: typeof import('vue')['computed']
|
|
const createApp: typeof import('vue')['createApp']
|
|
const customRef: typeof import('vue')['customRef']
|
|
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
|
const defineComponent: typeof import('vue')['defineComponent']
|
|
const effectScope: typeof import('vue')['effectScope']
|
|
const EffectScope: typeof import('vue')['EffectScope']
|
|
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
|
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
|
const h: typeof import('vue')['h']
|
|
const inject: typeof import('vue')['inject']
|
|
const isReadonly: typeof import('vue')['isReadonly']
|
|
const isRef: typeof import('vue')['isRef']
|
|
const markRaw: typeof import('vue')['markRaw']
|
|
const nextTick: typeof import('vue')['nextTick']
|
|
const onActivated: typeof import('vue')['onActivated']
|
|
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
|
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
|
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
|
const onDeactivated: typeof import('vue')['onDeactivated']
|
|
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
|
const onMounted: typeof import('vue')['onMounted']
|
|
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
|
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
|
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
|
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
|
const onUnmounted: typeof import('vue')['onUnmounted']
|
|
const onUpdated: typeof import('vue')['onUpdated']
|
|
const provide: typeof import('vue')['provide']
|
|
const reactive: typeof import('vue')['reactive']
|
|
const readonly: typeof import('vue')['readonly']
|
|
const ref: typeof import('vue')['ref']
|
|
const resolveComponent: typeof import('vue')['resolveComponent']
|
|
const shallowReactive: typeof import('vue')['shallowReactive']
|
|
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
|
const shallowRef: typeof import('vue')['shallowRef']
|
|
const toRaw: typeof import('vue')['toRaw']
|
|
const toRef: typeof import('vue')['toRef']
|
|
const toRefs: typeof import('vue')['toRefs']
|
|
const triggerRef: typeof import('vue')['triggerRef']
|
|
const unref: typeof import('vue')['unref']
|
|
const useAttrs: typeof import('vue')['useAttrs']
|
|
const useCssModule: typeof import('vue')['useCssModule']
|
|
const useCssVars: typeof import('vue')['useCssVars']
|
|
const useRoute: typeof import('vue-router')['useRoute']
|
|
const useRouter: typeof import('vue-router')['useRouter']
|
|
const useSlots: typeof import('vue')['useSlots']
|
|
const watch: typeof import('vue')['watch']
|
|
const watchEffect: typeof import('vue')['watchEffect']
|
|
}
|
|
export {}
|