- API 路由统一: 移除 /api/h5/,统一 /api/pms/ 入口 - 二进制改名: api-server -> pms-api(与服务名一致) - nginx: 合并 /api/ + /pms/api/ 为 /api/pms/ - 新增 docs/API.md 接口文档 - 后端: CabinetDetail 增加 rssi/pow_fail/address/soc 等字段 - Redis 管道批量读取仓体实时数据(SOC/电压/电流/功率) - DB: 所有 TIMESTAMP 列改为 DATETIME(修复类型不匹配) - 用户管理: 新增创建时间/修改时间列,状态改用 Switch - 角色管理/用户管理: 操作按钮改为图标 - PC 设备详情: 基本信息补全 RSSI/ICCID/电源/地址 - PC 卡片: 通道统计改用 Lucide 图标,颜色统一 - PC 二维码: canvas 渲染,含编号文字,支持右键下载 - H5: 按 uni-app 规范修正导航(navigateTo 替代 reLaunch) - H5: 详情页加返回导航条 - H5: 扫码支持摄像头(jsQR)+ ?id= 参数 - H5: 底部 tabBar 在所有页面常显 - H5: 首页统计改为 6 项(设备/通道/空闲/充电/充满/故障) - H5: 下拉刷新 / 上拉加载 - 产品首页: 添加业务联系 - 文档: 清理过时文件,补充缺失规范章节
4.8 KiB
4.8 KiB
name, description
| name | description |
|---|---|
| vitesse-uni-app | Vite-powered opinionated uni-app starter template with best practices |
vitesse-uni-app
Opinionated uni-app starter template powered by Vite. Includes best practices, pre-configured tooling, and modern development experience.
Features
- ⚡️ Vite - Fast development and building
- 🌍 uni-app - Cross-platform development
- 🖖 Vue 3 - Composition API,
<script setup> - 🔷 TypeScript - Type safety
- 🎨 UnoCSS - Atomic CSS
- 📦 Auto Import - Components and composables
- 🗂 File-based Routing - vite-plugin-uni-pages
- 📐 Layout System - Nuxt-like layouts
- 🔧 ESLint - Code linting
Quick Start
# Create with create-uni
npm create uni@latest my-app --template vitesse
# Or clone directly
git clone https://github.com/uni-helper/vitesse-uni-app.git my-app
Project Structure
vitesse-uni-app/
├── src/
│ ├── components/ # Auto-imported components
│ ├── composables/ # Auto-imported composables
│ ├── layouts/ # Layout components
│ │ ├── default.vue
│ │ └── home.vue
│ ├── pages/ # File-based routing
│ │ ├── index.vue
│ │ └── about/
│ │ └── index.vue
│ ├── static/ # Static assets
│ ├── stores/ # Pinia stores
│ ├── styles/ # Global styles
│ ├── App.vue
│ ├── main.ts
│ ├── manifest.config.ts # TypeScript manifest
│ └── pages.config.ts # Global pages config
├── types/ # Type definitions
├── index.html
├── package.json
├── tsconfig.json
├── vite.config.ts
├── uno.config.ts
└── eslint.config.js
Pre-configured Plugins
The template includes these pre-configured plugins:
// vite.config.ts
export default defineConfig({
plugins: [
UniComponents({
resolvers: [AnoUIResolver()],
}),
UniPages(),
UniLayouts(),
UniManifest(),
Uni(),
],
})
Auto Imports
Components
Components in src/components/ are auto-imported:
<template>
<!-- No import needed -->
<MyButton />
</template>
Composables
Files in src/composables/ are auto-imported:
// src/composables/useCounter.ts
export function useCounter() {
const count = ref(0)
const inc = () => count.value++
return { count, inc }
}
<script setup>
// No import needed
const { count, inc } = useCounter()
</script>
Vue APIs
Vue APIs are auto-imported:
<script setup>
// No need to import ref, computed, etc.
const count = ref(0)
const doubled = computed(() => count.value * 2)
</script>
Routing
File-based routing with pages in src/pages/:
pages/
├── index.vue # /pages/index/index
├── about.vue # /pages/about/index
└── user/
├── index.vue # /pages/user/index
└── [id].vue # /pages/user/:id
Page Configuration
<script setup>
definePage({
style: {
navigationBarTitleText: 'About',
},
layout: 'default',
})
</script>
Layouts
Create layouts in src/layouts/:
<!-- src/layouts/default.vue -->
<template>
<view class="layout">
<slot name="header" />
<slot />
<slot name="footer" />
</view>
</template>
Apply in pages:
<script setup>
definePage({
layout: 'default',
})
</script>
<template>
<template #header>
<NavBar />
</template>
<div>Content</div>
</template>
Styling with UnoCSS
<template>
<view class="p-32 bg-gray-100">
<text class="text-32 font-bold text-primary">
Styled with UnoCSS
</text>
</view>
</template>
State Management with Pinia
// src/stores/user.ts
import { defineStore } from 'pinia'
export const useUserStore = defineStore('user', () => {
const name = ref('')
const isLoggedIn = computed(() => !!name.value)
function login(userName: string) {
name.value = userName
}
return { name, isLoggedIn, login }
})
<script setup>
const user = useUserStore()
</script>
Data Fetching
<script setup>
const { data: users, pending, error } = useFetch('/api/users')
</script>
<template>
<view v-if="pending">Loading...</view>
<view v-else-if="error">Error: {{ error.message }}</view>
<view v-else>
<view v-for="user in users" :key="user.id">
{{ user.name }}
</view>
</view>
</template>
Deployment
Build for production
npm run build
Platform-specific builds
# H5
npm run build:h5
# WeChat Mini Program
npm run build:mp-weixin
# App
npm run build:app