# feiniao-be-data 飞鸟后台数据平台前端脚手架(基于 feiniao-farm-h5 精简抽取)。 ## 技术栈 - Vue 3 + Vue Router 4 + Axios - Element Plus - OpenLayers(`src/common/ol_common.js`) ## 快速开始 ```bash npm install npm run dev ``` | 命令 | 说明 | |------|------| | `npm run dev` | 开发环境(Vite) | | `npm run local` | 本地环境 | | `npm run pro` | 生产接口联调 | | `npm run build` | 生产构建 | | `npm run preview` | 预览构建产物 | ## 目录结构 ``` src/ ├── layout/ # 后台框架(侧栏 + 顶栏) │ ├── index.vue │ ├── menu.js # 左侧菜单配置 │ └── MenuIcon.vue ├── api/ │ ├── config.js │ └── modules/ ├── router/ │ ├── helper.js │ ├── routes.js # Layout + children 业务路由 │ └── index.js ├── views/ │ ├── device/ # 设备管理 │ ├── planting/ # 种植方案 │ └── personnel/ # 人员管理 └── ... ``` ## 新增页面 1. 新建 `src/views/xxx/index.vue` 2. 在 `src/router/routes.js` 的 `children` 中追加: ```js createPage({ path: "xxx", name: "Xxx", component: () => import("@/views/xxx/index.vue"), title: "页面标题", }), ``` 3. 在 `src/layout/menu.js` 追加菜单项(图标可选): ```js { path: "/xxx", title: "页面标题", icon: "device" } ``` ## 新增接口 在 `src/api/modules/` 新建文件,例如 `farm.js`: ```js const config = require("../config"); module.exports = { list: { url: config.base_dev_url + "v2/farm/list", type: "get", }, }; ``` 页面调用:`this.VE_API.farm.list(params)` 或 `proxy.VE_API.farm.list(params)`。 ## 环境变量 环境配置在 `env.config.js`,由 Vite `define` 注入为 `VE_ENV`: - `SERVER` → `base_dev_url` - `PYSERVER` → `base_py_url` - `NEW_SERVER` → `base_new_url`