RuoYi-Cloud-Vue3 Documentation

repository·master·Indexed 20 days ago

https://github.com/yangzongzhuan/ruoyi-cloud-vue3

A distributed microservices architecture based on Spring Boot, Spring Cloud, and Alibaba, featuring a frontend stack with Vue 3, Element Plus, Vite, Pinia, and Vue Router 4. It provides enterprise-level features including user management, code generation, system monitoring, and a suite of reusable UI components such as Breadcrumb, Crontab, DictTag, Editor, and ExcelImportDialog.

Tokens
26.8K
Snippets
84
Records
117
Agent score
72%

What's inside RuoYi-Cloud-Vue3

  1. Built-in features of RuoYi

    master

    The system includes several out-of-the-box management modules:

    • User & Access Management: User management, Department management (tree structure), Post management, Menu management, Role management, and Online user monitoring.
    • System Configuration: Dictionary management, Parameter management, and Notification/Announcements.
    • Logging & Auditing: Operation logs, Login logs, and Scheduled task execution logs.
    • Development Tools: Code generation (Java, HTML, XML, SQL), System API documentation (Swagger), and an Online Builder for HTML form generation.
    • Monitoring: Service monitoring (CPU, Memory, Disk, Stack) and Connection pool monitoring (SQL performance analysis).
  2. Run the RuoYi-Cloud-Vue3 frontend

    master

    To run the frontend development environment, follow these steps:

    1. Clone the project: Use git to clone the repository.
    2. Enter the directory: Navigate into the RuoYi-Cloud-Vue3 folder.
    3. Install dependencies: Use yarn with the specified registry to ensure correct package retrieval.
    4. Start the service: Run the development server.

    The frontend will be accessible at http://localhost:80 after starting.

    # 克隆项目
    git clone https://gitcode.com/yangzongzhuan/RuoYi-Cloud-Vue3.git
    
    # 进入项目目录
    cd RuoYi-Cloud-Vue3
    
    # 安装依赖
    yarn --registry=https://registry.npmmirror.com
    
    # 启动服务
    yarn dev
  3. TopBar component overview

    master

    The TopBar component is a horizontal navigation menu used in the application layout. It automatically renders visible menu items from the user's permission-based router list (permissionStore.sidebarRouters).

    Key features include:

    • Dynamic Visibility: It displays a limited number of menu items based on the window width.
    • 'More' Menu: Items that exceed the calculated visible limit are automatically moved into a '更多菜单' (More Menus) sub-menu.
    • Active State Management: It determines the active menu item using the current route's path or the meta.activeMenu property if defined.
    • Responsive Design: It listens to window resize events to recalculate how many menu items can fit horizontally.
  4. How TopBar determines active menu items

    master

    The TopBar component uses a computed property activeMenu to highlight the current navigation state. It follows this priority logic:

    1. If the current route's meta object contains an activeMenu property, that value is used.
    2. Otherwise, it defaults to the current route's path.

    This allows developers to specify a different menu item to remain highlighted even when the user is on a sub-route or a related page.

  5. Configure the Copyright footer visibility and content

    master

    The Copyright component is a footer element that displays copyright information at the bottom of the layout. Its visibility and the text it displays are controlled via the useSettingsStore from the settings module.

    To change the footer behavior, you must interact with the settingsStore properties:

    • footerVisible: A boolean that determines if the footer is rendered.
    • footerContent: A string containing the text to be displayed in the footer.

    Note: This component is part of the standard layout and is automatically driven by the application settings.

    // To control the Copyright component, you must use the settings store
    import useSettingsStore from '@/store/modules/settings'
    
    const settingsStore = useSettingsStore()
    
    // Example: Show the footer with custom text
    settingsStore.footerVisible = true
    settingsStore.footerContent = '© 2023 My Company. All rights reserved.'
  6. Responsive Behavior and Device Switching

    master

    The layout automatically switches between mobile and desktop modes based on the window width.

    • Threshold: The breakpoint is set at 992px (consistent with Bootstrap's responsive design).
    • Mobile Mode: When the width is less than 992px, the system calls useAppStore().toggleDevice('mobile') and automatically closes the sidebar with an animation.
    • Desktop Mode: When the width is 992px or greater, it calls useAppStore().toggleDevice('desktop').
    • Mobile Sidebar: In mobile mode, if the sidebar is opened, a drawer-bg overlay is rendered. Clicking this overlay triggers handleClickOutside(), which closes the sidebar.
  7. Configure route metadata and properties

    master

    When defining routes in the Ruoyi-Cloud-Vue3 project, you can use specific properties to control how the route behaves in the sidebar, breadcrumbs, and cache system.

    Route Properties

    • hidden: If true, the route will not appear in the sidebar (e.g., for 401, login, or specific edit pages).
    • alwaysShow: If true, the parent route will always be displayed in the sidebar, even if it only has one child. This overrides the default behavior where a parent with a single child is treated as the child itself.
    • redirect: Set to noRedirect to prevent the route from being clickable in the breadcrumb navigation.
    • name: Required for routes using <keep-alive>. Omitting this can cause issues with component caching.
    • query: Default parameters passed when accessing the route.
    • roles: Array of roles allowed to access the route.
    • permissions: Array of menu permissions required to access the route.

    Meta Object Properties

    The meta object contains UI-specific configurations:

    • meta.noCache: If true, the route will not be cached by <keep-alive> (defaults to false).
    • meta.title: The name displayed in the sidebar and breadcrumbs.
    • meta.icon: The icon name (corresponds to an SVG in src/assets/icons/svg).
    • meta.breadcrumb: If false, the route will not appear in the breadcrumb navigation.
    • meta.activeMenu: Specifies which sidebar menu item should be highlighted when this route is active.
  8. Configure Top Navigation Menu Items

    master

    The TopNav component derives its items from the permissionStore.topbarRouters. To control what appears in the top navigation, you should configure your route objects with the following properties:

    • path: The URL path. If it starts with http, it is treated as an external link.
    • meta.title: The text displayed in the menu.
    • meta.icon: The icon class used (via svg-icon). Use '#' to skip icon rendering.
    • hidden: Set to true to prevent the route from appearing in the top menu.
    • children: If a route has path: '/' and contains children, the component will automatically use the first child as the menu entry to support internal jumps.
    • query: A JSON string containing query parameters for internal routes.
  9. Search logic and data structure in HeaderSearch

    master

    The search functionality relies on a searchPool generated from the application's route configuration.

    Search Pool Item Structure: Each item in the search pool is an object containing:

    • path: The normalized route path or a full URL.
    • title: An array of strings representing the breadcrumb/title hierarchy (e.g., ['System', 'User Management']).
    • icon: The icon class for the menu item.
    • query: (Optional) Any query parameters associated with the route.

    Search Algorithm: The component performs a dual-layer search:

    1. Exact Path Match: Filters items where the path includes the search query.
    2. Fuzzy Match: Uses Fuse.js to find items based on title (weighted 0.7) and path (weighted 0.3).

    The results are merged to ensure no duplicates are shown.

  10. Configure password complexity via pwdChrType

    master

    Password complexity is determined by the pwdChrType value, which is retrieved from the session cache (cache.session.get('pwrChrtype')). You can control the required character sets by setting this value to one of the following types:

    TypeRequirementError Message
    0Any characters (Default)密码不能包含非法字符:< > " ' \
    1Purely numeric (0-9)密码只能为数字(0-9)
    2Purely alphabetic (a-z, A-Z)密码只能为英文字母(a-z、A-Z)
    3Letters + Numbers (Both required)密码必须同时包含字母和数字
    4Letters + Numbers + Special Characters (All required)密码必须同时包含字母、数字和特殊字符(~!@#$%^&*()-=_+)