plus-ui Frontend Management Platform

repository·6.X-Vue·Indexed 42 days ago

https://github.com/crazylioncat/plus-ui

A modern frontend management platform built with Vue 3, TypeScript, Element Plus, and Vite. It serves as the user interface for the RuoYi-Vue-Plus (distributed) and RuoYi-Cloud-Plus (microservices) backend ecosystems. Key features include advanced task management, multi-datasource code generation, cluster-wide service monitoring, and comprehensive file management.

Tokens
24.5K
Snippets
144
Records
152
Agent score
54%

What's inside plus-ui

  1. Overview of plus-ui technology stack

    6.X-Vue

    The plus-ui frontend repository is built using the following modern web technologies:

    • Vue 3: Core progressive JavaScript framework.
    • TypeScript: For static typing and improved developer experience.
    • Element Plus: UI component library.
    • Vite: Next-generation frontend tooling for fast builds and HMR.
  2. Identify compatible backend repositories

    6.X-Vue

    The plus-ui frontend is designed to work with specific backend frameworks. Choose the one that matches your architectural needs:

    • RuoYi-Vue-Plus: A distributed cluster framework.
    • RuoYi-Cloud-Plus: A microservices-based framework.
  3. Install and run plus-ui locally

    6.X-Vue

    Follow these steps to set up your local development environment. This project uses pnpm as the package manager.

    1. Install dependencies

    Use the following command to install dependencies, utilizing the npmmirror registry for faster access in certain regions:

    2. Start the development server

    Run the development server to begin working on the project.

    3. Build for production

    Generate the production-ready build files.

    Default Access URL: http://localhost:80

    # Install dependencies
    pnpm install --registry=https://registry.npmmirror.com
    
    # Start development server
    pnpm dev
    
    # Build production environment
    pnpm build:prod
  4. Define constant and dynamic routes

    6.X-Vue

    The application routing is split into two main arrays exported from the router configuration:

    1. constantRoutes: Contains static routes that are always available, such as login, register, 404, and the main Layout structure. These are typically not permission-dependent.
    2. dynamicRoutes: An empty array by default, intended to be populated with routes loaded dynamically based on the user's permissions and roles at runtime.

    Routes are defined using the RouteRecordRaw type from vue-router.

    import { constantRoutes, dynamicRoutes } from '@/router';
    
    // constantRoutes contains static routes like /login, /404
    // dynamicRoutes is used for permission-based routes
  5. Configure UnoCSS in plus-ui

    6.X-Vue

    The project uses UnoCSS for utility-first CSS. The configuration defines custom shortcuts, theme colors mapped to Element Plus CSS variables, and several presets and transformers to enhance developer experience.

    Custom Shortcuts

    You can use predefined utility shortcuts in your components. For example, the panel-title shortcut is available for consistent panel heading styling:

    • panel-title: Applies specific padding, font weight, leading, color (#6379bb), and border styles.

    Theme Configuration

    The theme is integrated with Element Plus via CSS variables. The following color keys are available:

    • primary: Maps to var(--el-color-primary)
    • primary_dark: Maps to var(--el-color-primary-light-5)

    Presets and Transformers

    The configuration includes:

    • Presets:
      • presetWind3(): Wind CSS compatible preset.
      • presetAttributify(): Enables attribute-based styling.
      • presetTypography(): Provides typography styles.
      • presetWebFonts(): Configures web fonts.
    • Transformers:
      • transformerDirectives(): Enables @apply and other CSS directives.
      • transformerVariantGroup(): Enables grouping of variants (e.g., hover:(bg-gray-100 text-red-500)).
    import {
      defineConfig,
      presetAttributify,
      presetWind3,
      presetTypography,
      presetWebFonts,
      transformerDirectives,
      transformerVariantGroup
    } from 'unocss';
    
    export default defineConfig({
      shortcuts: {
        'panel-title':
          'pb-[5px] font-sans leading-[1.1] font-medium text-base text-[#6379bb] border-b border-b-solid border-[var(--el-border-color-light)] mb-5 mt-0'
      },
      theme: {
        colors: {
          primary: 'var(--el-color-primary)',
          primary_dark: 'var(--el-color-primary-light-5)'
        }
      },
      presets: [
        presetWind3(),
        presetAttributify(),
        presetTypography(),
        presetWebFonts({
          fonts: {}
        })
      ],
      transformers: [transformerDirectives(), transformerVariantGroup()]
    });
  6. Compare plus-ui features with standard RuoYi

    6.X-Vue

    Compared to the standard RuoYi, plus-ui includes several additional business capabilities and enhanced monitoring features:

    Enhanced Features in plus-ui

    • File Management: Full support for file display, upload, download, and deletion.
    • File Configuration Management: Dynamic management of upload/download configuration.
    • Advanced Task Management: Supports task management, log management, and executor management (standard RuoYi only supports tasks and logs).
    • Multi-DataSource Code Generation: Supports generating Java, HTML, XML, and SQL for multiple data sources (standard RuoYi is limited to single data source).
    • Advanced Service Monitoring: Monitors cluster-wide CPU, memory, disk, stack, online logs, and Spring configurations (standard RuoYi only monitors single-machine metrics).
    • Use Case Demonstrations: Includes built-in functional case studies.

    Shared Features

    Both plus-ui and RuoYi support core management functions including User, Department, Post, Menu, Role, Dictionary, Parameter, Notice, Operation Logs, Login Logs, Online User Management, Scheduled Tasks, Code Generation, System API Documentation, Cache Monitoring, and Online Builders.

  7. Register a snail user with registerCurrentSnailUser()

    6.X-Vue

    Use the registerCurrentSnailUser function to perform a POST request to the /snail-ai/user/register endpoint. This function returns an AxiosPromise containing a SnailOpenApiUser object, which represents the newly registered snail user.

    import { registerCurrentSnailUser } from '@/api/ai/agent';
    
    async function handleRegistration() {
      try {
        const user = await registerCurrentSnailUser();
        console.log('Registered user:', user);
      } catch (error) {
        console.error('Registration failed:', error);
      }
    }