VLStream multi-platform application suite — a single Vue 3 H5 codebase packaged as native clients for Android, iOS, and HarmonyOS via Capacitor.
English | 简体中文
- Overview
- Repository Structure
- The Three Native Shells
- Features
- Tech Stack
- Getting Started
- Multi-Project Mechanism
- Backend Environment Switch
- Build & Deployment
- Code Conventions
- Related Documentation
- License
VLStream-APP is a multi-platform client repository. The core is a Vue 3 H5 mobile client (vue3-h5) hosting the sub-project VLStreamCloud (VLStream Cloud Platform). This single H5 codebase is packaged into native apps for three platforms — Android, iOS, and HarmonyOS — all built on Capacitor 8 and sharing one bridge contract (window.androidFunUtils + window.__VL_STATIC__), so the H5 business code has zero platform branches.
The remaining platform directories (Windows/, Mac OS/, Linux/, Kylin OS/) are .gitkeep placeholders for future native clients.
VLStream-APP/
├── vue3-h5/ # ✅ H5 mobile client (Vue 3 + Vite) — shared core & build entry
├── Android/ # ✅ Android shell (Capacitor 8) → Android/android
├── iOS/ # ✅ iOS shell (Capacitor 8) → iOS/ios
├── HarmonyOS/ # ✅ HarmonyOS shell (openHarmony-capacitor) → HarmonyOS
├── Windows/ # Windows client (planned)
├── Mac OS/ # macOS client (planned)
├── Linux/ # Linux client (planned)
├── Kylin OS/ # Kylin OS client (planned)
├── docs/vls/ # Brand logo & icon source assets
├── LICENSE
└── README.md
All three shells load the same vue3-h5/dist offline package and expose an identical set of native capabilities through one self-developed NativeBridge plugin (gateway / appInfo / tokenOverdue) plus official Capacitor plugins (camera / app-exit / geolocation). The H5 side (vue3-h5/public/androidFunUtils.js) keeps a stable signature across platforms.
| Platform | Base | Shell dir | Build toolchain | Docs |
|---|---|---|---|---|
| Android | Capacitor 8 (@capacitor/android) |
Android/android |
Android Studio / Gradle (JDK 21, AGP 8.13) | Android/README.md |
| iOS | Capacitor 8 (@capacitor/ios) |
iOS/ios |
Xcode 16+ / SPM (macOS only) | iOS/README.md |
| HarmonyOS | openHarmony-capacitor 8 | HarmonyOS |
DevEco Studio 6.1+ / hvigor | HarmonyOS/README.md |
The shell path for Android/iOS is configured via
vue3-h5/capacitor.config.json(android.path/ios.path); HarmonyOS usesentry/src/main/resources/rawfile/wwwand a manualdistsync (nocap copy).
H5 (window.androidFunUtils) |
Implementation (identical across all 3 platforms) |
|---|---|
getGateway() (sync) |
NativeBridge injects window.__VL_STATIC__.gateway at document-start |
getAppInfo() / tokenOverdue() |
Self-developed NativeBridge plugin |
appExit() |
Official @capacitor/app exitApp() |
takePhoto(params) |
Official @capacitor/camera |
FileTransfer upload |
H5 XHR + FormData polyfill (decoupled from native) |
is_native_shell flag |
NativeBridge injects window.global.is_native_shell = true |
- 🗺️ Map & Trajectory: Built on Leaflet, with trajectory playback (
leaflet-trackplayer), animated paths (leaflet-ant-path), and marker clustering (leaflet.markercluster). - 🎬 Video Playback: Built-in
OPlayervideo player component. - 📋 Event Management: Event Management business module.
- 📇 Contacts: Organization / contact tree component (
contactTree), often used together with the popup component. - 🖼️ Images & Upload: Image preview (both functional and component forms) and file uploader components.
- 📝 Dynamic Forms: Mobile form engine based on
vform3-mobile. - 🌍 Internationalization: Multi-language support via
vue-i18n. - 📱 Mobile Adaptation: Automatic px → vw conversion via
postcss-px-to-viewport(design width 360px).
| Category | Technology |
|---|---|
| Framework | Vue 3.5 (<script setup> + JSX) |
| Build Tool | Vite 4 |
| Language | TypeScript |
| UI Library | Vant 4 |
| State Management | Pinia 3 |
| Routing | Vue Router 4 |
| Maps | Leaflet + trackplayer + ant-path + markercluster |
| HTTP | axios |
| Forms | vform3-mobile-builds |
| i18n | vue-i18n 11 |
| Utilities | lodash-es, dayjs, moment, qs, mitt, jsencrypt, gcoord |
| Native Shell | Capacitor 8 (Android / iOS) + openHarmony-capacitor 8 (HarmonyOS) |
| Code Quality | ESLint + Husky + commitlint + lint-staged |
| Auto Import | unplugin-auto-import, unplugin-vue-components |
- Node.js ≥ 16
- Package manager: pnpm recommended (the project ships a
pnpm-lock.yaml; npm / yarn also work)
cd vue3-h5
# Install dependencies
pnpm install # or: npm install / yarn
# Start the dev server
pnpm start # equivalent to: viteThen open http://localhost:8080 (the dev server is bound to 0.0.0.0:8080, so you can debug on a real device over the same LAN).
The project launched by default is determined by
VITE_PROJECT_DIRinvue3-h5/.env— currentlyVLStreamCloud.
vue3-h5 is a single-page, multi-project collection codebase: switch the active project via .env, and compile a specific project via the package.json scripts + build.sh. A recompile is required after each switch.
- Switch in development: edit
vue3-h5/.envand setVITE_PROJECT_DIR=<project-name>(matching a directory undersrc/pages/). - Entry resolution: Vite uses
src/pages/<project-name>/main.tsas the entry for that project.
vue3-h5/src/
├── api/ # Network requests per project
├── assets/ # Assets (fonts / images / shared styles)
├── components/ # Shared components (contacts, map, popup, uploader, form, etc.)
├── config/ # Project config (AppConfig / env & network / UI config / pageConfig)
├── hooks/ # Composables
├── lang/ # i18n language packs
├── pages/ # Per-project code (currently: VLStreamCloud)
├── store/ # Pinia state management
├── types/ # TypeScript type definitions
└── utils/ # Utilities (http, bus, etc.)
For the full directory layout and component library docs, see vue3-h5/README.md.
One codebase serves two backend environments. Everything about them lives in one preset table, so a switch never touches business code:
| Environment | Name | Business services (apaas-vls-server / apaas-wvp-server) |
Login (authMode) |
CameraRTC signaling |
|---|---|---|---|---|
| Multi-tenant production | multi |
https://workup.oortcloudsmart.com:2443 |
platform — apaas-sso: RSA sso/v1/getLoginCode → tenant pick → sso/v1/login, then sso/v1/exchangeToken for the VLStream JWT |
wss://vlstream.oortcloudsmart.com:2443/bus/camera-rtc |
| Single-tenant | single |
https://vlstream.oortcloudsmart.com:2443 |
local — BladeX vls-server/blade-auth/token (query params account / password / grantType=password / tenantId=000000; the password is SM2 ciphertext, C1C2C3 hex via sm-crypto mode 0 with bladeAuthPublicKey), no captcha and no token exchange |
wss://vlstream.oortcloudsmart.com:2443/bus/camera-rtc |
- Presets:
vue3-h5/src/config/index.js(VL_ENV_PRESETS+applyVlEnv) — hosts and service/auth differences (authMode,authService,tenantId,bladeClientAuth,bladeAuthPublicKey). - Service names differ, not just hosts. The single-tenant cluster does not route any
apaas-*vhost (nginx 404); its login/auth lives insidevls-server(blade-auth/token,sso/v1/getUserInfo,blade-auth/logout,sso/v1/mode).GET {URL}bus/vls-server/sso/v1/modereports{"tenantType":"single","multiTenant":false}— the same probe the vendor PC console uses. - Single-tenant login is SM2, not plaintext.
BladePasswordDecoderdecryptspasswordwith the key pair behindvlstream.auth.public-key/private-key(the public key is the backend default, which is also what the vendor PC console ships) and only then compares against the stored BCrypt hash — sending plaintext or an MD5 always yields 「密码输入错误」. Each wrong answer incrementsLogin:pwd_err_cnt:<account>in Redis; the 5th locks the account for 10 minutes, and a request made while locked is rejected before the password check, so it costs nothing. Token headers are normalized with precedenceAuthorization>blade-auth>accesstoken(TokenHeaderResolver, which dropsBasicvalues), so any one of them works;sso/v1/getUserInfo,getUserTenantsandrefreshToken, however, read the RedisBladeTokenUserStoreentry written only by/blade-auth/token, so a flushed store breaks them even with an otherwise valid Sa-Token. - Where
authModeis consumed:api/login/localAuth.ts(local endpoints),store/modules/useraPaas.ts(getLoginbranches),components/commonpage/LoginDev.vue(one-step login, no captcha/tenant UI),utils/vlstreamAuth.ts(local token is the business token → skipexchangeToken),utils/service.ts(sends the local token in theblade-authheader, one of the three names the server accepts). - aPaaS platform services (captcha, tenants, dicts, regions, forms, fastdfs upload, map, app-info) are called on
config.platformURL. They exist only on the multi-tenant cluster; undersinglethat host has no such routes, so those features are unavailable there andApp.vuefalls back to the shell-injected__VL_STATIC__.appInfoinstead ofapaas-admin-platform. - Switch points, highest precedence first:
- Native shell:
window.__VL_STATIC__.vlEnvinjected at document start —VL_ENVinAndroid/android/app/build.gradle,AppConfig.vlEnviniOS/ios/App/App/AppConfig.swift,APP_VL_ENVinHarmonyOS/entry/src/main/ets/plugins/NativeBridgePlugin.ets. One built H5 bundle can therefore be shipped into either environment. - Build/dev:
VITE_VL_ENVinvue3-h5/.env, or per command —VITE_VL_ENV=multi pnpm start,VITE_VL_ENV=multi pnpm run build:VLStreamCloud. - Fallback default:
multi.
- Native shell:
- Each shell also has an optional raw gateway override (Android
DEFAULT_GATEWAY, iOSAppConfig.gateway, HarmonyOSAPP_GATEWAY). Leave it empty to use the preset; set it only for on-site deployments with a custom host. A raw override changes hosts only —authModestill comes from the environment name. - Unknown environment names are ignored — the current environment stays active instead of blanking the gateway.
Every native shell consumes the same vue3-h5/dist:
cd vue3-h5
pnpm install
pnpm run build:VLStreamCloud # runs build.sh → vite build → vue3-h5/distAndroid (JDK 21, Android SDK 36)
cd vue3-h5 && npx cap sync android # copy dist + register official plugins
cd ../Android/android
./gradlew :app:assembleDebug # → app/build/outputs/apk/debug/app-debug.apkRequires JDK 21 (the project uses a foojay toolchain resolver to auto-download it). See Android/README.md.
iOS (Xcode 16+, macOS only)
cd vue3-h5 && npx cap sync ios # copies dist to iOS/ios/App/App/public
# then open iOS/ios/App/App.xcodeproj in Xcode, set Signing, RunAfter cap sync you must re-add "NativeBridgePlugin" to packageClassList in iOS/ios/App/App/capacitor.config.json (the CLI drops self-developed plugins). See iOS/README.md.
HarmonyOS (DevEco Studio 6.1+, hvigor)
# manual dist sync (openHarmony-capacitor has no cap copy):
rm -rf HarmonyOS/entry/src/main/resources/rawfile/www
mkdir -p HarmonyOS/entry/src/main/resources/rawfile/www
cp -r vue3-h5/dist/. HarmonyOS/entry/src/main/resources/rawfile/www/
# command-line build (set DEVECO_SDK_HOME first):
cd HarmonyOS
hvigorw assembleHap -p product=default --mode module -p module=entry@default
# → entry/build/default/outputs/default/entry-default-unsigned.hap
hdc install entry/build/default/outputs/default/entry-default-unsigned.hapOr open the HarmonyOS/ folder in DevEco Studio and Run. See HarmonyOS/README.md.
vue3-h5/distalso feedsmoveTodepoly.shfor Git-based web auto-deployment.
- Create a new folder named after the project under
src/pages/(recommended: copy an existing project and modify it). - Add the project's config in
src/config/pageConfig.ts. - Configure the project's launch entry in
.env. - Add a corresponding
build:<project-name>entry to thescriptsinpackage.json.
⚠️ The project name must be identical across all of the above.
The project uses commitlint to enforce commit message format. Only the following types are allowed (the type must be followed by a colon and a space, e.g. fix: resolve login bug):
| Type | Description |
|---|---|
feat |
A new feature |
fix |
A bug fix |
upd |
An update (neither feat nor fix) |
docs |
Documentation changes |
style |
Formatting (no runtime impact) |
refactor |
Code refactoring |
revert |
Revert a previous commit |
test |
Adding tests |
chore |
Build process or auxiliary tooling changes |
v-formust have a bound:key.- Prefer strict equality
===when the value type is known. - Unused variables / imports / components must be removed or commented out.
- Declare arrays with
[]and objects with{}. - No trailing commas.
For details, see vue3-h5/.eslintrc.cjs and vue3-h5/REFRENCE.md.
- vue3-h5 detailed guide (directory layout / component library / workflow)
- Android shell (Capacitor)
- iOS shell (Capacitor)
- HarmonyOS shell (openHarmony-capacitor)
- Code style reference
- Commit convention config
- Vite build config
This project is licensed under the MIT License.