Browse Source

cursor 优化 文档更新

master
whyzxhnd 2 days ago
parent
commit
a9b0dcefae
  1. 3
      .gitignore
  2. 9
      .idea/ElectronicLock.iml
  3. 7
      .idea/inspectionProfiles/Project_Default.xml
  4. 6
      .idea/misc.xml
  5. 8
      .idea/modules.xml
  6. 6
      .idea/vcs.xml
  7. 47
      .idea/workspace.xml
  8. 11
      readme.md
  9. 13744
      server/sql/20250820.prod.sql
  10. 101
      web/.cursorignore
  11. 131
      web/.cursorrules
  12. 4
      web/package.json

3
.gitignore

@ -0,0 +1,3 @@
.vscode
.idea
.vite

9
.idea/ElectronicLock.iml

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

7
.idea/inspectionProfiles/Project_Default.xml

@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>

6
.idea/misc.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ElectronicLock.iml" filepath="$PROJECT_DIR$/.idea/ElectronicLock.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

47
.idea/workspace.xml

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="211851b0-9ab0-4e5f-aa9e-26a8bc90bd1a" name="Changes" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 0
}]]></component>
<component name="ProjectId" id="31XXEBRCJdorsK3ASEM8ZJM1UA5" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
<option name="showMembers" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "master",
"last_opened_file_path": "C:/Users/admin/Desktop/xiangmu",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="211851b0-9ab0-4e5f-aa9e-26a8bc90bd1a" name="Changes" comment="" />
<created>1755671276644</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1755671276644</updated>
<workItem from="1755671278263" duration="46000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>

11
readme.md

@ -0,0 +1,11 @@
# 电子锁
## 文档
【腾讯文档】电子锁
<https://docs.qq.com/doc/DUW5TVWVLdmx6Zm9H>
## 流程图
【腾讯文档】电子锁-流程图
<https://docs.qq.com/flowchart/DUWdtVXBhZmtXR25F>

13744
server/sql/20250820.prod.sql

File diff suppressed because one or more lines are too long

101
web/.cursorignore

@ -0,0 +1,101 @@
# 依赖目录
node_modules/
.pnpm-store/
# 构建输出
dist/
dist-ssr/
build/
*.local
# 缓存文件
.cache/
.parcel-cache/
.vite/
.eslintcache
.stylelintcache
# 日志文件
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# 运行时数据
pids
*.pid
*.seed
*.pid.lock
# 覆盖率目录
coverage/
*.lcov
.nyc_output
# 依赖锁定文件
package-lock.json
yarn.lock
pnpm-lock.yaml
# 环境变量文件
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# IDE和编辑器
.vscode/
.idea/
*.swp
*.swo
*~
# 操作系统生成的文件
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# 临时文件
*.tmp
*.temp
.tmp/
.temp/
# 测试相关
.nyc_output/
coverage/
*.test.js
*.spec.js
# 自动生成的文件
auto-*.d.ts
components.d.ts
auto-imports.d.ts
# 历史记录
.history/
# 调试文件
.vscode/
*.code-workspace
# 本地配置文件
.vscode/settings.json
.vscode/launch.json
.vscode/extensions.json
# 包管理器文件
.npmrc
.yarnrc
.yarnrc.yml
# 其他
*.tgz
*.tar.gz

131
web/.cursorrules

@ -0,0 +1,131 @@
# 项目代码规范与最佳实践
## 技术栈
- Vue 3 + Composition API
- TypeScript
- UnoCSS
- Element Plus
- Vite
- Pinia (状态管理)
- Vue Router
## 代码规范
### Vue 组件规范
- 使用 Composition API 和 `<script setup>` 语法
- 组件名使用 PascalCase 命名
- Props 必须定义类型,使用 `defineProps<T>()` 语法
- Emits 必须定义类型,使用 `defineEmits<T>()` 语法
- 组件文件使用 `.vue` 扩展名
- 单文件组件结构:`<template>` -> `<script setup>` -> `<style>`
### TypeScript 规范
- 严格模式:启用 `strict: true`
- 类型定义完整,避免使用 `any`
- 接口命名使用 PascalCase,以 `I` 开头(如 `IUserInfo`)
- 类型别名使用 PascalCase
- 枚举使用 PascalCase
- 函数参数和返回值必须定义类型
### UnoCSS 使用规范
- 优先使用 UnoCSS 原子类
- 自定义规则在 `uno.config.ts` 中定义
- 使用语义化的类名(如 `custom-hover`、`layout-border__left`)
- 响应式设计使用 UnoCSS 断点前缀
### 样式规范
- 使用 SCSS 预处理器
- 全局变量在 `@/styles/variables.scss` 中定义
- 组件样式使用 scoped 或 CSS Modules
- 遵循 BEM 命名规范
- 使用 CSS 变量(CSS Custom Properties)
### 文件组织
- 组件放在 `src/components/` 目录
- 页面放在 `src/views/` 目录
- 工具函数放在 `src/utils/` 目录
- 类型定义放在 `src/types/` 目录
- API 接口放在 `src/api/` 目录
- 状态管理放在 `src/stores/` 目录
### 命名规范
- 文件名使用 kebab-case
- 组件名使用 PascalCase
- 变量和函数使用 camelCase
- 常量使用 UPPER_SNAKE_CASE
- 私有属性使用下划线前缀
### 代码质量
- 使用 ESLint + Prettier 进行代码格式化
- 遵循 Vue 3 官方风格指南
- 组件职责单一,避免过度复杂
- 合理使用注释,复杂逻辑必须注释
- 错误处理完善,使用 try-catch 和错误边界
### 性能优化
- 合理使用 `v-memo` 和 `v-once`
- 避免在模板中使用复杂表达式
- 使用 `shallowRef` 和 `shallowReactive` 优化大对象
- 合理使用 `computed` 和 `watch`
- 图片懒加载和资源预加载
### 国际化
- 使用 vue-i18n 进行国际化
- 文本内容使用 `$t()` 函数
- 语言包文件放在 `src/locales/` 目录
### 状态管理
- 使用 Pinia 进行状态管理
- Store 文件放在 `src/stores/` 目录
- 使用 `defineStore` 定义 store
- 合理使用 `persist` 插件进行状态持久化
### 路由管理
- 路由配置放在 `src/router/` 目录
- 使用路由懒加载
- 路由守卫统一管理
- 动态路由权限控制
### API 接口
- 使用 axios 进行 HTTP 请求
- API 接口统一管理在 `src/api/` 目录
- 请求和响应拦截器统一处理
- 错误处理和重试机制
### 构建和部署
- 使用 Vite 作为构建工具
- 环境变量配置在 `.env.*` 文件中
- 构建产物优化(代码分割、压缩等)
- 支持多环境部署(dev/test/prod)
### 安全规范
- 输入验证和 XSS 防护
- CSRF 防护
- 敏感信息不暴露在前端
- 使用 HTTPS 协议
### 可访问性
- 语义化 HTML 标签
- ARIA 属性支持
- 键盘导航支持
- 屏幕阅读器友好
## 开发工具配置
- 使用 VS Code 作为主要开发工具
- 安装 Vue 3 相关插件
- 配置 TypeScript 智能提示
- 启用 ESLint 和 Prettier 自动格式化
- 使用 Git 进行版本控制
## 提交规范
- 使用 Conventional Commits 规范
- 提交信息格式:`type(scope): description`
- 类型:feat, fix, docs, style, refactor, test, chore
- 每次提交前运行 lint 检查
## 注意事项
- 遵循项目现有架构设计
- 不破坏现有功能和组件复用性
- 新功能开发前先了解相关代码结构
- 遇到问题先查看文档和现有代码
- 定期进行代码审查和重构

4
web/package.json

@ -11,7 +11,6 @@
"build:local": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build", "build:local": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build",
"build:dev": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode dev", "build:dev": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode dev",
"build:test": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode test", "build:test": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode test",
"build:stage": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode stage",
"build:prod": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode prod", "build:prod": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode prod",
"serve:dev": "vite preview --mode dev", "serve:dev": "vite preview --mode dev",
"serve:prod": "vite preview --mode prod", "serve:prod": "vite preview --mode prod",
@ -21,8 +20,7 @@
"lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src", "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
"lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"", "lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
"lint:style": "stylelint --fix \"./src/**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", "lint:style": "stylelint --fix \"./src/**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged -c ",
"gen:ww": "npx wwutil ticket ww6e1eee0a8ae45397 ITbfuoZkmUifGoDL5ZB8SyuMzVM8VXZNkfZJzYn5sGo"
"lint:lint-staged": "lint-staged -c "
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.1.0", "@element-plus/icons-vue": "^2.1.0",

Loading…
Cancel
Save