Skip to content
  • Promote Your Product

Project Structure ​

Directory Overview ​

zhontai-ui-admin-app/
├── src/                          # Source directory
│   ├── api/                      # API interfaces (auto-generated)
│   │   ├── admin/                # Admin module APIs
│   │   ├── dev/                  # Dev module APIs
│   │   └── demo/                 # Demo module APIs
│   │
│   ├── components/               # Global components
│   │   ├── DemoBlock.vue         # Demo display block (used in Demo pages)
│   │   ├── GlobalDialog.vue      # Global dialog
│   │   ├── GlobalLoading.vue     # Global loading indicator
│   │   ├── GlobalToast.vue       # Global toast notification
│   │   ├── LoginForm.vue         # Login form
│   │   ├── LoginPopup.vue        # Login popup
│   │   ├── MyNavbar.vue          # Custom navbar
│   │   ├── PrivacyPopup.vue      # Privacy policy popup
│   │   ├── SliderCaptcha.vue     # Slider captcha
│   │   └── SliderCaptchaPopup.vue # Slider captcha popup
│   │
│   ├── composables/              # Composables (exportable)
│   │   ├── types/                # Composable types
│   │   ├── useGlobalDialog.ts    # Global dialog
│   │   ├── useGlobalLoading.ts   # Global loading
│   │   ├── useGlobalToast.ts     # Global toast
│   │   ├── useLoginPopup.ts      # Login popup
│   │   ├── useManualTheme.ts     # Manual theme toggle
│   │   ├── useTabbar.ts          # Tabbar control
│   │   ├── useTeam.ts            # Team related
│   │   └── useTheme.ts           # Theme control
│   │
│   ├── hooks/                    # Custom Hooks
│   │   ├── useAuth.ts            # Permission control (for page element/feature control)
│   │   └── useI18nSync.ts        # i18n language sync (follow system / manual switch)
│   │
│   ├── layouts/                  # Layout components
│   │   ├── default.vue           # Default layout
│   │   └── tabbar.vue            # TabBar layout
│   │
│   ├── locale/                   # i18n language packs
│   │   ├── index.ts              # i18n instance creation and export
│   │   ├── zh-Hans.json          # Simplified Chinese language pack
│   │   └── en.json               # English language pack
│   │
│   ├── pages/                    # Main business pages
│   │   ├── workbench/            # Workbench
│   │   ├── msg/                  # Messages
│   │   └── mine/                 # Me
│   │
│   ├── pages-core/               # Core pages (subpackage)
│   │   ├── login/                # Login page
│   │   ├── change-password/      # Change password page
│   │   ├── profile/              # Profile page
│   │   └── set/                  # Settings page
│   │
│   ├── pages-demo/               # Demo pages
│   │
│   ├── pages-system/             # System pages (subpackage)
│   │   └── pkg/                  # Package management
│   │       └── form/             # Package form page
│   │
│   ├── resolver/                 # Component resolvers
│   │
│   ├── router/                   # Router configuration
│   │   └── index.ts              # Router instance and guards
│   │
│   ├── static/                   # Static assets
│   │
│   ├── store/                    # Pinia state management
│   │   ├── userStore.ts          # User state
│   │   ├── themeStore.ts         # Theme state
│   │   ├── manualThemeStore.ts   # Manual theme state
│   │   └── persist.ts            # Persistence plugin
│   │
│   ├── theme/                    # Theme styles
│   │   ├── index.scss            # Theme entry (imports base variables)
│   │   └── app.scss              # App-level theme style overrides
│   │
│   ├── uni_modules/              # UniApp modules
│   │
│   ├── utils/                    # Utility functions
│   │   ├── date.ts               # Date utilities
│   │   ├── enum.ts               # Enum definitions
│   │   └── index.ts              # Utils entry point
│   │
│   ├── customize-tab-bar/        # Custom TabBar
│   │
│   ├── App.ku.vue                # UniKu App entry
│   ├── App.vue                   # Application root component
│   ├── auto-imports.d.ts         # Auto-import type declarations
│   ├── components.d.ts           # Component type declarations
│   ├── env.d.ts                  # Environment variable types
│   ├── main.ts                   # Application entry
│   ├── manifest.json             # UniApp configuration
│   ├── pages.json                # Page routes config (auto-generated)
│   ├── shims.d.ts                # Type declaration supplements
│   ├── theme.json                # Theme variables
│   ├── uni.scss                  # Global style variables
│   └── uni-pages.d.ts            # Page type declarations
│
├── .env.development              # Development environment variables
├── .env.production               # Production environment variables
├── .env.staging                  # Staging environment variables
├── alova.config.ts               # Alova API code generation config
├── commitlint.config.js          # Commitlint configuration
├── eslint.config.mjs             # ESLint configuration
├── index.html                    # Entry HTML
├── manifest.config.ts            # UniApp Manifest configuration
├── package.json                  # Project dependencies config
├── pages.config.ts               # Global page configuration
├── pnpm-lock.yaml                # Lock file
├── pnpm-workspace.yaml           # Pnpm workspace config
├── tsconfig.base.json            # TypeScript base config
├── tsconfig.json                 # TypeScript main config
├── uno.config.ts                 # UnoCSS configuration
└── vite.config.ts                # Vite build config

Core Directory Descriptions ​

src/api/ ​

API interface directory, auto-generated from Swagger via alova. Contains three modules:

  • admin/: Backend management APIs
  • dev/: Development tool APIs
  • demo/: Example APIs

src/components/ ​

Global common components supporting easycom auto-registration:

ComponentDescription
GlobalDialogGlobal modal dialog, used with useGlobalDialog
GlobalLoadingGlobal loading overlay, used with useGlobalLoading
GlobalToastGlobal toast notifications (Success/Error/Warning), used with useGlobalToast
LoginFormLogin form (username, password, captcha)
LoginPopupLogin popup wrapper for unauthenticated interception
MyNavbarCustom navigation bar replacing native navbar
PrivacyPopupPrivacy policy popup shown on first launch
SliderCaptchaSlider captcha for human verification
SliderCaptchaPopupSlider captcha popup wrapper
DemoBlockDemo page example display block container

src/composables/ ​

Vue 3 Composables for logic reuse. These functions are auto-imported by AutoImport, no manual import needed.

src/hooks/ ​

Custom hooks encapsulating core business logic:

HookDescription
useAuthPermission control: for controlling page elements and features
useI18nSynci18n language sync: follow system language, manual switch with persistence

src/locale/ ​

vue-i18n based internationalization configuration:

  • index.ts: Creates i18n instance, sets default language and fallback
  • zh-Hans.json: Simplified Chinese translations
  • en.json: English translations

src/store/ ​

Pinia state management, including:

  • userStore: User login status, user info
  • themeStore: Theme configuration
  • manualThemeStore: Manual theme toggle state
  • persist: Persistence storage plugin

src/pages/ ​

Main business pages using subpackage loading for performance optimization:

pages-core/ — Core Pages Subpackage (must be independent) ​

PageDescription
loginLogin page (username/password + captcha)
change-passwordChange password page
profileProfile view and edit
setSettings page (language, theme, etc.)

pages-system/ — System Pages Subpackage ​

PageDescription
pkgPackage management list
pkg/formPackage form (add/edit)

pages/ — Main Business Pages (main package) ​

  • workbench/: Workbench home
  • msg/: Message center
  • mine/: Profile center

src/theme/ ​

Theme style configuration, SCSS variable system:

  • index.scss: Imports wot-ui theme variables, defines project base variables
  • app.scss: Application-level style overrides, including global component customization

src/router/ ​

Based on @wot-ui/router route configuration, including:

  • Route instance creation
  • Global before guard (login authentication)
  • Whitelist mechanism

Subpackage Strategy ​

The project uses UniApp's subpage loading strategy, splitting pages into multiple packages:

typescript
// Configuration in vite.config.ts
UniHelperPages({
  subPackages: [
    'src/pages-core',    // Core pages subpackage
    'src/pages-system',  // System pages subpackage
  ],
})

Subpackage advantages:

  • Reduces main package size
  • On-demand loading, improves first screen speed
  • Complies with mini program subpackage limits