xiaozhi-esp32-server/main/manager-mobile
lapy 2cbc525114 fix(manager-mobile): track wot-design-uni typings despite src/types gitignore
Type stubs must be force-added; plain git add manager-mobile/ skipped this path.
2026-04-25 17:06:19 +01:00
..
env feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
patches update:调整文件夹 2025-08-11 15:48:28 +08:00
scripts feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
src fix(manager-mobile): track wot-design-uni typings despite src/types gitignore 2026-04-25 17:06:19 +01:00
unpackage/res/icons update:调整文件夹 2025-08-11 15:48:28 +08:00
.commitlintrc.cjs update:调整文件夹 2025-08-11 15:48:28 +08:00
.editorconfig update:调整文件夹 2025-08-11 15:48:28 +08:00
.gitignore update:调整文件夹 2025-08-11 15:48:28 +08:00
.npmrc update:调整文件夹 2025-08-11 15:48:28 +08:00
eslint.config.mjs feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
favicon.ico fix:增加检测到手机浏览器跳转h5页面,修改h5页面图标 2025-09-04 09:32:53 +08:00
index.html update:调整文件夹 2025-08-11 15:48:28 +08:00
LICENSE chore: 更新.gitignore以允许跟踪manager-mobile中的env和json文件;修改LICENSE版权信息;添加环境配置文件;新增manifest.json和pages.json以支持移动应用结构 2025-08-11 16:39:53 +08:00
manifest.config.ts feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
package.json feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
pages.config.ts feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
pnpm-lock.yaml feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
pnpm-workspace.yaml update:调整文件夹 2025-08-11 15:48:28 +08:00
README.md feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
tsconfig.json feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
uno.config.ts feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00
vite.config.ts feat(manager-mobile): westernize H5 app, copy, and shared crypto 2026-04-25 17:05:15 +01:00

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.x declared in the project)
  • Optional: HBuilderX (App debugging/packaging), WeChat Developer Tools (WeChat Mini Program)

Quick Start

  1. Configure environment variables

    • Copy env/.env.example to env/.env.development
    • Modify configuration items according to actual situation (especially VITE_SERVER_BASEURL, VITE_UNI_APPID, VITE_WX_APPID)
  2. Install dependencies

pnpm i
  1. Local development (hot reload)
  • h5: pnpm dev:h5, then observe the ip port number displayed in the startup log
  • WeChat Mini Program: pnpm dev:mp or pnpm dev:mp-weixin, then import dist/dev/mp-weixin with WeChat Developer Tools
  • App: Import manager-mobile with 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.ts will read title, appid, language and other configurations from env.

Important Notes

⚠️ Configuration items that must be modified before deployment:

  1. Application ID Configuration

  2. Server Address

    • VITE_SERVER_BASEURL: Modify to your actual server address
  3. Application Information

    • VITE_APP_TITLE: Modify to your application name
    • Update icon resources such as src/static/logo.png
  4. Other Configuration

    • Check application configuration information in manifest.config.ts
    • Modify tabbar configuration in src/layouts/fg-tabbar/tabbarList.ts as needed

Detailed Operation Guide

1. Get uni-app AppID

Generate AppID

  • Copy the generated AppID to environment variable VITE_UNI_APPID

2. Local Running Steps

Local Running

App Local Debugging:

  1. Import manager-mobile directory with HBuilderX
  2. Re-identify the project
  3. Connect phone or use simulator for real device debugging

Project Recognition Issue Resolution: Re-identify Project

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 routeInterceptor is registered in src/main.ts.
  • Blacklist interception: Only validates pages configured to require login (from getNeedLoginPages in @/utils).
  • Login determination: Based on user information (useUserStore from pinia), unauthenticated users will be redirected to VITE_LOGIN_URL with parameters to redirect back to the original page.

Network Requests

  • Based on alova + @alova/adapter-uniapp, unified instance creation in src/http/request/alova.ts.
  • baseURL reads environment configuration (getEnvBaseUrl), can dynamically switch domains through method.config.meta.domain.
  • Authentication: Default injection of Authorization header from local token (uni.getStorageSync('token')), redirect to login if missing.
  • Response: Unified handling of HTTP errors with statusCode !== 200 and business errors with code !== 0; 401 will clear token and redirect to login.

Build and Release

WeChat Mini Program:

  1. Ensure correct VITE_WX_APPID is configured
  2. Run pnpm build:mp, output in dist/build/mp-weixin
  3. Import project directory with WeChat Developer Tools and upload code
  4. Submit for review in WeChat Public Platform

Android & iOS App:

3. App Packaging and Release Steps

Step 1: Prepare Packaging Packaging Release Step 1

  1. Ensure correct VITE_UNI_APPID is configured
  2. Run pnpm build:app, output in dist/build/app
  3. Import project directory with HBuilderX
  4. Click "Release" → "Native App-Cloud Packaging" in HBuilderX

Step 2: Configure Packaging Parameters Packaging Release Step 2

  1. App Icon and Launch Screen: Upload app icon and launch screen images
  2. App Version Number: Set version number and version name
  3. Signature Certificate:
    • Android: Upload keystore certificate file
    • iOS: Configure developer certificate and provisioning profile
  4. Package Name Configuration: Set app package name (Bundle ID)
  5. Packaging Type: Choose test package or release package
  6. 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-pages and pages.config.ts; tabbar configuration in src/layouts/fg-tabbar/tabbarList.ts.
  • Component and hooks auto-import: See unplugin-auto-import and @uni-helper/vite-plugin-uni-components in vite.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