- English locale defaults; remove duplicate zh-only locale files - SM2 utility sharing with the web client where applicable |
||
|---|---|---|
| .. | ||
| env | ||
| patches | ||
| scripts | ||
| src | ||
| unpackage/res/icons | ||
| .commitlintrc.cjs | ||
| .editorconfig | ||
| .gitignore | ||
| .npmrc | ||
| eslint.config.mjs | ||
| favicon.ico | ||
| index.html | ||
| LICENSE | ||
| manifest.config.ts | ||
| package.json | ||
| pages.config.ts | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| tsconfig.json | ||
| uno.config.ts | ||
| vite.config.ts | ||
Xiaozhi Control Panel Mobile Version (manager-mobile)
Cross-platform mobile management client based on uni-app v3 + Vue 3 + Vite, supporting App (Android & iOS) and WeChat Mini Program.
Platform Compatibility
| H5 | iOS | Android | WeChat Mini Program |
|---|---|---|---|
| √ | √ | √ | √ |
Note: Different UI components have slight differences in adaptation across platforms, please refer to the corresponding component library documentation.
Development Environment Requirements
- Node >= 18
- pnpm >= 7.30 (recommended to use
pnpm@10.xdeclared in the project) - Optional: HBuilderX (App debugging/packaging), WeChat Developer Tools (WeChat Mini Program)
Quick Start
-
Configure environment variables
- Copy
env/.env.exampletoenv/.env.development - Modify configuration items according to actual situation (especially
VITE_SERVER_BASEURL,VITE_UNI_APPID,VITE_WX_APPID)
- Copy
-
Install dependencies
pnpm i
- Local development (hot reload)
- h5:
pnpm dev:h5, then observe the ip port number displayed in the startup log - WeChat Mini Program:
pnpm dev:mporpnpm dev:mp-weixin, then importdist/dev/mp-weixinwith WeChat Developer Tools - App: Import
manager-mobilewith HBuilderX, then follow the tutorial below to run
Environment Variables and Configuration
The project uses a custom env directory to store environment files, named according to Vite specifications: .env.development, .env.production, etc.
Key variables (partial):
- VITE_APP_TITLE: Application name (written to
manifest.config.ts) - VITE_UNI_APPID: uni-app application appid (App)
- VITE_WX_APPID: WeChat Mini Program appid (mp-weixin)
- VITE_FALLBACK_LOCALE: Default language, such as
zh-Hans - VITE_SERVER_BASEURL: Server base address (HTTP request baseURL)
- VITE_DELETE_CONSOLE: Whether to remove console during build (
true/false) - VITE_SHOW_SOURCEMAP: Whether to generate sourcemap (default off)
- VITE_LOGIN_URL: Login page path for unauthenticated redirect (used by route interceptor)
Example (env/.env.development):
VITE_APP_TITLE=Xiaozhi
VITE_FALLBACK_LOCALE=zh-Hans
VITE_UNI_APPID=
VITE_WX_APPID=
VITE_SERVER_BASEURL=http://localhost:8080
VITE_DELETE_CONSOLE=false
VITE_SHOW_SOURCEMAP=false
VITE_LOGIN_URL=/pages/login/index
Note:
manifest.config.tswill read title, appid, language and other configurations fromenv.
Important Notes
⚠️ Configuration items that must be modified before deployment:
-
Application ID Configuration
VITE_UNI_APPID: Need to create an application in DCloud Developer Center and get AppIDVITE_WX_APPID: Need to register a mini program in WeChat Public Platform and get AppID
-
Server Address
VITE_SERVER_BASEURL: Modify to your actual server address
-
Application Information
VITE_APP_TITLE: Modify to your application name- Update icon resources such as
src/static/logo.png
-
Other Configuration
- Check application configuration information in
manifest.config.ts - Modify tabbar configuration in
src/layouts/fg-tabbar/tabbarList.tsas needed
- Check application configuration information in
Detailed Operation Guide
1. Get uni-app AppID
- Copy the generated AppID to environment variable
VITE_UNI_APPID
2. Local Running Steps
App Local Debugging:
- Import
manager-mobiledirectory with HBuilderX - Re-identify the project
- Connect phone or use simulator for real device debugging
Project Recognition Issue Resolution:

If HBuilderX cannot correctly identify the project type:
- Right-click in the project root directory and select "Re-identify Project Type"
- Ensure the project is identified as a "uni-app" project
Routing and Authentication
- Route interceptor plugin
routeInterceptoris registered insrc/main.ts. - Blacklist interception: Only validates pages configured to require login (from
getNeedLoginPagesin@/utils). - Login determination: Based on user information (
useUserStorefrompinia), unauthenticated users will be redirected toVITE_LOGIN_URLwith parameters to redirect back to the original page.
Network Requests
- Based on
alova+@alova/adapter-uniapp, unified instance creation insrc/http/request/alova.ts. baseURLreads environment configuration (getEnvBaseUrl), can dynamically switch domains throughmethod.config.meta.domain.- Authentication: Default injection of
Authorizationheader from localtoken(uni.getStorageSync('token')), redirect to login if missing. - Response: Unified handling of HTTP errors with
statusCode !== 200and business errors withcode !== 0;401will clear token and redirect to login.
Build and Release
WeChat Mini Program:
- Ensure correct
VITE_WX_APPIDis configured - Run
pnpm build:mp, output indist/build/mp-weixin - Import project directory with WeChat Developer Tools and upload code
- Submit for review in WeChat Public Platform
Android & iOS App:
3. App Packaging and Release Steps
- Ensure correct
VITE_UNI_APPIDis configured - Run
pnpm build:app, output indist/build/app - Import project directory with HBuilderX
- Click "Release" → "Native App-Cloud Packaging" in HBuilderX
Step 2: Configure Packaging Parameters

- App Icon and Launch Screen: Upload app icon and launch screen images
- App Version Number: Set version number and version name
- Signature Certificate:
- Android: Upload keystore certificate file
- iOS: Configure developer certificate and provisioning profile
- Package Name Configuration: Set app package name (Bundle ID)
- Packaging Type: Choose test package or release package
- Click "Package" to start cloud packaging process
Release to App Stores:
- Android: Upload generated APK file to major Android app markets
- iOS: Upload generated IPA file to App Store through App Store Connect (requires Apple Developer account)
Conventions and Engineering
- Pages and sub-packages: Generated by
@uni-helper/vite-plugin-uni-pagesandpages.config.ts; tabbar configuration insrc/layouts/fg-tabbar/tabbarList.ts. - Component and hooks auto-import: See
unplugin-auto-importand@uni-helper/vite-plugin-uni-componentsinvite.config.ts. - Styling: Uses UnoCSS and
src/style/index.scss. - State management:
pinia+pinia-plugin-persistedstate. - Code standards: Built-in
eslint,husky,lint-staged, auto-format before commit (lint-staged).
Common Scripts
# Development
pnpm dev:mp # Equivalent to dev:mp-weixin
# Build
pnpm build:mp # Equivalent to build:mp-weixin
# Others
pnpm type-check
pnpm lint && pnpm lint:fix
License
MIT


