编辑 | blame | 历史 | 原始文档

Repository Guidelines

Project Structure & Module Organization

  • pages/ hosts the multi-tab MES screens; treat each subdirectory as a self-contained feature view.
  • components/ collects reusable modules such as WorkOrder.vue, PrintInit.vue, and Bluetooth helpers—prefer extending these before creating new ones.
  • common/ exposes global mixins and permission utilities loaded in main.js; align new cross-cutting logic here.
  • utils/ provides device integrations (Bluetooth, printing, scanning). Reuse these helpers instead of duplicating platform calls.
  • store/index.js defines runtime server endpoints; keep environment toggles (serverInfo) in sync with deployment plans.
  • static/ and unpackage/ store shared assets and build outputs—never edit generated files in unpackage/.

Build, Test, and Development Commands

  • Day-to-day development: open the project in HBuilderX → Run > Run to Mobile Device for live debugging on an Android tablet.
  • Packaging: HBuilderX → Build > Native App-Cloud Packaging (select App-Plus).
  • CLI fallback: npx @dcloudio/uni-cli-service dev -p app-plus for local preview, npx @dcloudio/uni-cli-service build -p app-plus for production bundles.
  • Update API targets by editing store/index.js (serverURL, serverAPI) before each build.

Coding Style & Naming Conventions

  • Vue 2 single-file components with <template>, <script>, <style lang="scss">; keep component names in PascalCase.
  • Use tabs (width 4) to mirror existing templates and scripts; SCSS files prefer two-space indentation.
  • Follow camelCase for data keys and methods, UPPER_SNAKE_CASE only for immutable constants.
  • Keep inline comments concise and in Chinese when matching existing context.

Testing Guidelines

  • No automated test suite is tracked; document manual verification covering work-order flow, barcode printing, and Bluetooth pairing.
  • Validate builds on actual industrial tablets (1280×800 or 1920×1080) via HBuilderX device preview.
  • Capture console output (HBuilderX > Debug > View Log) when reporting regressions.

Commit & Pull Request Guidelines

  • Git history shows terse messages (1111, 优化); prefer descriptive imperative titles such as feat: improve WorkOrder polling.
  • Group related changes per commit and reference affected modules (components/WorkOrder.vue).
  • Pull requests should list environment used, manual test steps, and screenshots for UI adjustments; link tracker items when available.

Configuration & Security Notes

  • Never hard-code credentials; rely on uni.getStorageSync and backend-issued tokens.
  • Reset device bindings (pdaMac, machineNo) in store/index.js before shipping shared builds.
  • Clean unpackage/ artifacts prior to committing to avoid bloating the repository.