SEC_Warehouse/.claude/rules/frontend.md

68 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Project Overview
This is a uni-app Vue3 smart home (智慧养老) application using uview-plus component library.
- Use the new features of es6
- Use the uniapp framework for small program development
- Added uview-plus component as UI component
# Build & Run Commands
Install dependencies with `npm install`.
This repository does not define npm scripts; builds and previews are normally run through HBuilderX. Use HBuilderX for the active target platform:
```bash
npm install
```
Typical local workflow:
- Open the project in HBuilderX and run to WeChat Mini Program or Android emulator/device.
- Use the built-in packaging flow for release builds.
# Architecture
## Module Organization
App entry files live at the repository root: `main.js`, `App.vue`, `pages.json`, and `manifest.json`. Feature pages are under `pages/` (`login`, `index`, `event`, `mine`, `device`). Shared business code is split across `api/`, `constants/`, `hooks/`, and `utils/`. Bluetooth logic is centralized in `utils/ble/`, with subfolders for `core/`, `modules/`, `parsers/`, `protocols/`, and `utils/`. Static assets go in `static/`; design and protocol notes live in `docs/`.
## BLE Module (`utils/ble/`)
If you are unclear about the functions of the BLE Module, please refer to the `docs/unified-ble-flow.md` file.
Unified Bluetooth Low Energy module for ED713/ED719 devices. Key files:
- `core/bleCore.js` - Bluetooth core capabilities (connect/discover/read/write/notify/reconnect)
- `core/controller.js` - Standard flow orchestration (scan→connect→discover→auth)
- `core/packet.js` - A7 packet fragmentation
- `modules/auth.js` - Authentication flow (read MSG + write KEY)
- `modules/wifi.js` - WiFi configuration
- `modules/radar.js` - Radar control (start/stop/params)
- `protocols/profiles.js` - ED713/ED719 device profile differences
The unified flow: `standardConnectFlow({ deviceId, key })``wifi.configureWifi(ssid, password)``radar.startRadarStream()`
Profile differences:
- ED713: radar signature `0x7C`, supports narrow mode
- ED719: radar signature `0x67`, supports fall param 67
If modifications are made to the BLE Module, they shall be added to the `docs/unified-ble-flow.md` file
## Authentication (`utils/auth.js`)
Route guard system with `setupAuthInterceptors()`. Currently `AUTH_ENABLED = false` for development. Routes are defined in `constants/routes.js`.
## Pages
- `pages/login/index.vue` - Login page
- `pages/index/index.vue` - Home (tab)
- `pages/event/index.vue` - Events (tab)
- `pages/mine/index.vue` - Profile (tab)
- `pages/device/add.vue` - Add device
- `pages/device/config.vue` - Device config with BLE search + WiFi panel
## Component Auto-import
uview-plus components auto-imported via `pages.json` easycom config: `^u-(.*)``uview-plus/components/u-$1/u-$1.vue`
## Coding Style & Naming Conventions
Follow the existing Vue SFC structure: `<template>`, `<script>`, `<style>`. JavaScript and Vue blocks use 2-space indentation; keep generated JSON files (`pages.json`, `manifest.json`) consistent with the existing HBuilderX formatting. Use `camelCase` for variables and functions, `UPPER_SNAKE_CASE` for constants, and keep page paths aligned with route names such as `pages/device/config.vue`. Prefer small reusable utilities in `utils/` or `hooks/` over duplicating BLE or navigation logic.