|
|
@@ -1,29 +1,99 @@
|
|
|
-# jiusehng
|
|
|
+# webCRM
|
|
|
|
|
|
-## Project setup
|
|
|
-```
|
|
|
+基于 Vue 2 + Element UI + Vue CLI 5 的企业 CRM 管理系统。
|
|
|
+
|
|
|
+## 环境要求
|
|
|
+
|
|
|
+| 依赖 | 最低版本 |
|
|
|
+| ---- | -------- |
|
|
|
+| Node.js | >= 12 (低于 v12 自动跳过 postbuild) |
|
|
|
+| npm | >= 6 |
|
|
|
+
|
|
|
+## 快速开始
|
|
|
+
|
|
|
+```bash
|
|
|
+# 安装依赖
|
|
|
npm install
|
|
|
-```
|
|
|
|
|
|
-### Compiles and hot-reloads for development
|
|
|
-```
|
|
|
+# 启动开发服务器 (localhost:8000)
|
|
|
npm run serve
|
|
|
+
|
|
|
+# 生产构建
|
|
|
+npm run build
|
|
|
```
|
|
|
|
|
|
-### Compiles and minifies for production
|
|
|
+## 打包流程
|
|
|
+
|
|
|
+执行 `npm run build` 依次完成:
|
|
|
+
|
|
|
```
|
|
|
-npm run build
|
|
|
+vue-cli-service build → 编译 Vue 源码,输出到 yos/ 目录
|
|
|
+ ↓
|
|
|
+node scripts/copy-annexation → postbuild 钩子自动执行:
|
|
|
+ 1. 将 buildAnnexation/ 下的 BGJ/、ZB/ 静态站点复制到 yos/
|
|
|
+ 2. 将 yos/ 内全部文件压缩为 yos.zip(不含 yos 父目录)
|
|
|
```
|
|
|
|
|
|
-### Run your tests
|
|
|
+### yos.zip 结构
|
|
|
+
|
|
|
```
|
|
|
-npm run test
|
|
|
+yos.zip
|
|
|
+├── BGJ/ # 报管家静态站点
|
|
|
+├── ZB/ # 招帮静态站点
|
|
|
+├── css/ # webpack 编译的 CSS 产物
|
|
|
+├── js/ # webpack 编译的 JS 产物(含 chunk-vendors/chunk-element-ui/chunk-antv 等独立缓存块)
|
|
|
+├── fonts/
|
|
|
+├── img/
|
|
|
+└── index.html # SPA 入口
|
|
|
```
|
|
|
|
|
|
-### Lints and fixes files
|
|
|
+### 兼容性保障
|
|
|
+
|
|
|
+- `scripts/copy-annexation.js` 启动时检测 Node 版本,低于 v12 自动跳过复制和压缩步骤,不影响原有构建
|
|
|
+- `archiver` 包加载失败时跳过 zip 步骤,复制步骤仍正常执行
|
|
|
+- 使用纯 Node.js 文件操作(`path.join`、`fs`递归复制),Windows/macOS 行为一致
|
|
|
+
|
|
|
+### buildAnnexation 目录
|
|
|
+
|
|
|
+存放不参与 webpack 编译的静态资源(BGJ/ZB 独立站点文件),每次构建后自动复制到 `yos/` 输出目录。如需新增静态页面或资源,放入对应的 `buildAnnexation/BGJ/` 或 `buildAnnexation/ZB/` 子目录即可。
|
|
|
+
|
|
|
+## 构建优化
|
|
|
+
|
|
|
+`vue.config.js` 中配置了以下优化:
|
|
|
+
|
|
|
+- **webpack 5 文件系统缓存** — 二次构建利用缓存大幅提速(`node_modules/.cache/webpack`)
|
|
|
+- **splitChunks 分包** — element-ui / antv / ant-design-vue 拆分为独立 chunk,浏览器长期缓存
|
|
|
+- **productionSourceMap: false** — 生产环境不生成 source map,减少构建时间和产物体积
|
|
|
+- **browserslist 收紧** — `chrome/edge/firefox >= 80, safari >= 13`,减少 polyfill 转换开销
|
|
|
+
|
|
|
+## 开发规范
|
|
|
+
|
|
|
+- 所有提交类按钮(新建/编辑/删除)必须添加 `:loading` 状态,成功后延时 0.5s 关闭
|
|
|
+- 状态变更操作(启用/停用)需先弹 `$confirm` 确认框
|
|
|
+- 新增模块页面放在 `src/bgj/<moduleName>/`,表单组件放在 `modules/` 子目录
|
|
|
+- 列表页优先使用全局 `<basicLayout>` 组件,对接后台表格元数据配置
|
|
|
+
|
|
|
+## 目录结构
|
|
|
+
|
|
|
```
|
|
|
-npm run lint
|
|
|
+src/
|
|
|
+├── api/ # API 封装 (request.js, http.js, api.js)
|
|
|
+├── assets/ # 静态资源
|
|
|
+├── bgj/ # BGJ 业务模块
|
|
|
+├── components/ # 全局组件 (basicLayout, delete_btn 等)
|
|
|
+├── Form/ # 各模块新建/编辑表单组件
|
|
|
+├── HManagement/ # H管理模块
|
|
|
+├── router/ # 路由配置
|
|
|
+├── store/ # Vuex 状态管理
|
|
|
+├── style/ # 全局样式
|
|
|
+├── utils/ # 工具函数 (tool.js, basic-data.js)
|
|
|
+└── views/ # 登录等页面
|
|
|
+buildAnnexation/ # 不参与编译的静态资源,构建时复制到 yos/
|
|
|
+scripts/ # 构建脚本
|
|
|
```
|
|
|
|
|
|
-### Customize configuration
|
|
|
-See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
|
+## 部署
|
|
|
+
|
|
|
+1. 执行 `npm run build`
|
|
|
+2. 将 `yos/` 目录部署到 Web 服务器(Nginx/Apache/IIS)
|
|
|
+3. 或直接上传 `yos.zip` 解压部署
|