后台数据平台

lxf 655b057b7b feat: 脚手架 il y a 1 semaine
public 655b057b7b feat: 脚手架 il y a 1 semaine
src 655b057b7b feat: 脚手架 il y a 1 semaine
.env 655b057b7b feat: 脚手架 il y a 1 semaine
.env.dev 655b057b7b feat: 脚手架 il y a 1 semaine
.env.pro 655b057b7b feat: 脚手架 il y a 1 semaine
.gitignore 655b057b7b feat: 脚手架 il y a 1 semaine
README.md 655b057b7b feat: 脚手架 il y a 1 semaine
env.config.js 655b057b7b feat: 脚手架 il y a 1 semaine
index.html 655b057b7b feat: 脚手架 il y a 1 semaine
jsconfig.json 655b057b7b feat: 脚手架 il y a 1 semaine
package.json 655b057b7b feat: 脚手架 il y a 1 semaine
vite.config.js 655b057b7b feat: 脚手架 il y a 1 semaine

README.md

feiniao-be-data

飞鸟后台数据平台前端脚手架(基于 feiniao-farm-h5 精简抽取)。

技术栈

  • Vue 3 + Vue Router 4 + Axios
  • Element Plus
  • OpenLayers(src/common/ol_common.js

快速开始

npm install
npm run dev
命令 说明
npm run dev 开发环境(Vite)
npm run local 本地环境
npm run pro 生产接口联调
npm run build 生产构建
npm run preview 预览构建产物

目录结构

src/
├── api/
│   ├── config.js          # 接口域名 / CDN / 忽略提示关键字
│   └── modules/           # 接口模块(自动挂载为 VE_API.xxx)
├── common/
│   └── ol_common.js       # 地图公共方法(WMTS / WKT / fit)
├── plugins/
│   ├── axios.js           # 请求封装(token 走 localStorage)
│   ├── element.js
│   └── permission.js      # 路由守卫(title / token)
├── router/
│   ├── helper.js          # createPage(默认 keepAlive: true)
│   ├── routes.js          # 路由表
│   └── index.js
├── utils/auth.js          # token 读写
├── views/home/            # 脚手架占位页(可替换)
├── styles/
├── App.vue                # 全局 keep-alive
└── main.js

新增页面(推荐写法)

  1. 新建 src/views/xxx/index.vue(纯 <script setup>
  2. src/router/routes.js 注册:
import { createPage } from "./helper";

export default [
  createPage({
    path: "/xxx",
    name: "Xxx",
    component: () => import("@/views/xxx/index.vue"),
    title: "页面标题",
    // keepAlive: false, // 默认 true,不需要缓存时关闭
  }),
];

新增接口

src/api/modules/ 新建文件,例如 farm.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

  • SERVERbase_dev_url
  • PYSERVERbase_py_url
  • NEW_SERVERbase_new_url