How yudaocode/yudao-mall-uniapp works
Project type and purpose
• This is a full-stack e-commerce “mall” system, but the repository you have is the mobile/front-end client built with uni-app + Vue3.
• It targets multiple front-end channels (WeChat Mini Program, H5, App, Official Accounts) and communicates with a Java/Spring Boot or Spring Cloud backend via REST API.
Key architectural layers
a. Presentation Layer (uni-app cross-platform UI)
• Entry files: main.js, App.vue, pages.json, manifest.json, uni.scss, vite.config.js.
• Pages folder: organizes feature modules (activity, chat, commission, coupon, goods, index, order, pay, public, user).
• uni_modules/: external uni-app component libraries.
b. Business Logic Layer (sheep)
• sheep/api: service functions wrapping HTTP calls to backend modules (member, pay, product, promotion, system, trade, migration).
• sheep/store: Vuex-style state management (app, user, cart, modal, sys).
• sheep/hooks: composition-api hooks for features (useApp, useGoods, useWebSocket, useModal).
• sheep/components / sheep/ui / sheep/helper / sheep/util / sheep/validate: common UI components, styling, helpers, validators.
• sheep/config / sheep/request / sheep/router / sheep/platform: request pipelines, routing utils, platform (WeChat/AppStore) integrations.
c. Build & Deployment
• Vite-based build (vite.config.js), uni-app CLI generates platform-specific code.
• Outputs multiple bundles for each target (mini-program, H5, native).
d. External Services
• Backend REST endpoints (exposed via sheep/api).
• Third-party providers: payment channels (WeChat Pay, Apple Pay), social login, push notifications (via sheep/platform/provider).
a. Components
• User Device (WeChat Mini Program, H5 browser, native App).
• Front-end Application:
• Presentation: pages & uni_modules
• Business Logic: sheep modules (api, store, hooks, components)
• Build toolchain: vite, uni-app CLI.
• Backend API Layer: Spring Boot / Spring Cloud microservices.
• External Services: Payment Gateways, Third-Party Auth, CDN for static assets.
b. Relationships & data flows
• State management interactions (components → store → components).
c. Architectural patterns & design principles
• Modular feature segregation (pages folder per business domain).
• DRY reusability via sheep shared library (common components, hooks, utils).
• Uni-app cross-platform abstraction.
• Flux-style state management.
d. Key technologies
• Vue3 + Composition API; uni-app framework; Vite; Sass (sheep/scss); Vuex-style store; Axios or uni.request abstraction; Spring Boot / Spring Cloud.
Detailed capture
• Call out the store modules (user.js, cart.js).
• Uni_modules as external dependencies.
• Build toolchain block (Vite + uni-app).
• Don’t overthink: more components = clearer understanding of how the codebase maps to runtime architecture.