🎨 MBE生态系统统一UI设计系统方案
制定时间: 2026-02-02
目标: 建立统一、现代、可复用的设计系统
📊 当前UI问题分析
🔴 主要问题
1. 设计不统一:
❌ 4个应用各自为政
❌ 配色方案不一致
❌ 组件样式差异大
❌ 交互模式不同
2. 用户体验欠佳:
❌ 缺少流畅动画
❌ 响应式适配不完善
❌ 加载状态单调
❌ 错误提示不友好
3. 视觉吸引力不足:
❌ 缺少现代感
❌ 缺少品牌识别度
❌ 缺少视觉层次
❌ 缺少惊喜元素
4. 代码复用率低:
❌ 组件重复开发
❌ 样式代码冗余
❌ 主题配置分散
❌ 维护成本高
🎯 解决方案: MBE Design System
核心理念
统一性 (Unity):
✅ 统一的视觉语言
✅ 统一的交互模式
✅ 统一的组件库
现代感 (Modernity):
✅ 玻璃态设计 (Glassmorphism)
✅ 流畅动画 (Framer Motion)
✅ 深色优先 (Dark First)
✅ 渐变点缀 (Gradient Accents)
高性能 (Performance):
✅ 按需加载
✅ 懒加载组件
✅ 优化动画性能
✅ 减少重渲染
可访问性 (Accessibility):
✅ 键盘导航
✅ 屏幕阅读器支持
✅ 色彩对比度达标
✅ 语义化HTML
🏗️ 设计系统架构
1. 设计令牌 (Design Tokens)
// packages/mbe-design-tokens/index.ts
export const tokens = {
colors: {
// 品牌色
brand: {
primary: '#3B82F6', // 蓝色
secondary: '#8B5CF6', // 紫色
accent: '#06B6D4', // 青色
},
// 中性色
neutral: {
50: '#F9FAFB',
100: '#F3F4F6',
200: '#E5E7EB',
300: '#D1D5DB',
400: '#9CA3AF',
500: '#6B7280',
600: '#4B5563',
700: '#374151',
800: '#1F2937',
900: '#111827',
950: '#030712',
},
// 功能色
success: '#10B981',
warning: '#F59E0B',
error: '#EF4444',
info: '#3B82F6',
// 背景
background: {
primary: '#000000',
secondary: '#0A0A0A',
tertiary: '#1A1A1A',
},
},
spacing: {
0: '0',
1: '0.25rem', // 4px
2: '0.5rem', // 8px
3: '0.75rem', // 12px
4: '1rem', // 16px
6: '1.5rem', // 24px
8: '2rem', // 32px
12: '3rem', // 48px
16: '4rem', // 64px
24: '6rem', // 96px
},
typography: {
fontFamily: {
sans: ['Inter', 'SF Pro Display', 'system-ui', 'sans-serif'],
mono: ['JetBrains Mono', 'Consolas', 'monospace'],
},
fontSize: {
xs: ['0.75rem', { lineHeight: '1rem' }],
sm: ['0.875rem', { lineHeight: '1.25rem' }],
base: ['1rem', { lineHeight: '1.5rem' }],
lg: ['1.125rem', { lineHeight: '1.75rem' }],
xl: ['1.25rem', { lineHeight: '1.75rem' }],
'2xl': ['1.5rem', { lineHeight: '2rem' }],
'3xl': ['1.875rem', { lineHeight: '2.25rem' }],
'4xl': ['2.25rem', { lineHeight: '2.5rem' }],
'5xl': ['3rem', { lineHeight: '1' }],
'6xl': ['3.75rem', { lineHeight: '1' }],
'7xl': ['4.5rem', { lineHeight: '1' }],
'8xl': ['6rem', { lineHeight: '1' }],
},
fontWeight: {
light: 300,
normal: 400,
medium: 500,
semibold: 600,
bold: 700,
extrabold: 800,
},
},
borderRadius: {
none: '0',
sm: '0.375rem', // 6px
md: '0.5rem', // 8px
lg: '0.75rem', // 12px
xl: '1rem', // 16px
'2xl': '1.5rem', // 24px
'3xl': '2rem', // 32px
full: '9999px',
},
shadows: {
sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
md: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1)',
xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1)',
'2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
glow: '0 0 20px rgba(59, 130, 246, 0.5)',
},
animation: {
duration: {
fast: '150ms',
normal: '300ms',
slow: '500ms',
},
easing: {
ease: 'cubic-bezier(0.4, 0, 0.2, 1)',
easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
easeOut: 'cubic-bezier(0, 0, 0.2, 1)',
easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
},
},
};
2. 核心组件库
// packages/mbe-ui-components/
components/
├── Button/
│ ├── Button.tsx
│ ├── Button.test.tsx
│ └── Button.stories.tsx
├── Card/
│ ├── Card.tsx
│ ├── GlassCard.tsx
│ └── Card.stories.tsx
├── Input/
│ ├── Input.tsx
│ ├── TextArea.tsx
│ └── Input.stories.tsx
├── Modal/
│ ├── Modal.tsx
│ ├── Dialog.tsx
│ └── Modal.stories.tsx
├── Navigation/
│ ├── Navbar.tsx
│ ├── Sidebar.tsx
│ └── Breadcrumb.tsx
├── Feedback/
│ ├── Toast.tsx
│ ├── Alert.tsx
│ └── Skeleton.tsx
├── DataDisplay/
│ ├── Table.tsx
│ ├── Badge.tsx
│ └── Avatar.tsx
└── Layout/
├── Container.tsx
├── Grid.tsx
└── Stack.tsx
3. 动画库
// packages/mbe-animations/index.ts
export const animations = {
// 淡入淡出
fadeIn: {
initial: { opacity: 0 },
animate: { opacity: 1 },
exit: { opacity: 0 },
},
// 滑动
slideUp: {
initial: { y: 20, opacity: 0 },
animate: { y: 0, opacity: 1 },
exit: { y: -20, opacity: 0 },
},
// 缩放
scaleIn: {
initial: { scale: 0.9, opacity: 0 },
animate: { scale: 1, opacity: 1 },
exit: { scale: 0.9, opacity: 0 },
},
// 玻璃态悬停
glassHover: {
whileHover: {
scale: 1.02,
boxShadow: '0 0 30px rgba(59, 130, 246, 0.3)',
},
transition: { duration: 0.2 },
},
// 按钮点击
buttonTap: {
whileTap: { scale: 0.95 },
},
};
🎨 统一Tailwind配置
// packages/mbe-tailwind-config/index.js
const { tokens } = require('@mbe/design-tokens');
module.exports = {
content: [
'./app/**/*.{js,ts,jsx,tsx}',
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'../../packages/mbe-ui-components/**/*.{js,ts,jsx,tsx}',
],
darkMode: 'class',
theme: {
extend: {
colors: tokens.colors,
spacing: tokens.spacing,
fontFamily: tokens.typography.fontFamily,
fontSize: tokens.typography.fontSize,
fontWeight: tokens.typography.fontWeight,
borderRadius: tokens.borderRadius,
boxShadow: tokens.shadows,
animation: {
'fade-in': 'fadeIn 0.3s ease-in-out',
'slide-up': 'slideUp 0.3s ease-out',
'scale-in': 'scaleIn 0.2s ease-out',
'glow': 'glow 2s ease-in-out infinite',
},
keyframes: {
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
},
slideUp: {
'0%': { transform: 'translateY(20px)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
scaleIn: {
'0%': { transform: 'scale(0.9)', opacity: '0' },
'100%': { transform: 'scale(1)', opacity: '1' },
},
glow: {
'0%, 100%': { opacity: '0.5' },
'50%': { opacity: '1' },
},
},
backdropBlur: {
xs: '2px',
},
},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/typography'),
require('@tailwindcss/aspect-ratio'),
],
};
📦 项目结构
mises-behavior-engine/
├── packages/ # Monorepo包
│ ├── mbe-design-tokens/ # 设计令牌
│ │ ├── src/
│ │ │ ├── colors.ts
│ │ │ ├── typography.ts
│ │ │ ├── spacing.ts
│ │ │ └── index.ts
│ │ └── package.json
│ │
│ ├── mbe-ui-components/ # UI组件库
│ │ ├── src/
│ │ │ ├── components/
│ │ │ ├── hooks/
│ │ │ ├── utils/
│ │ │ └── index.ts
│ │ ├── .storybook/ # Storybook配置
│ │ └── package.json
│ │
│ ├── mbe-animations/ # 动画库
│ │ ├── src/
│ │ │ ├── presets.ts
│ │ │ ├── utils.ts
│ │ │ └── index.ts
│ │ └── package.json
│ │
│ └── mbe-tailwind-config/ # Tailwind配置
│ ├── index.js
│ └── package.json
│
└── opensource/ # 应用层
├── mbe-education/
│ └── frontend/
│ ├── app/
│ ├── components/ # 应用特定组件
│ ├── tailwind.config.js # 继承mbe-tailwind-config
│ └── package.json # 依赖@mbe/*包
│
├── mbe-civil-lawyer/
├── mbe-aigc-committee/
└── mbe-health-life/
🚀 实施计划
Phase 1: 基础建设 (2-3天)
Day 1: 设计系统基础
✓ 创建packages目录结构
✓ 建立Design Tokens
✓ 配置统一Tailwind
✓ 设置Monorepo (pnpm/turborepo)
Day 2: 核心组件开发
✓ Button组件 (5个变体)
✓ Card组件 (普通/玻璃态/渐变)
✓ Input组件系列
✓ Modal/Dialog组件
✓ Toast/Alert组件
Day 3: 高级组件
✓ Navigation组件
✓ Table组件
✓ Form组件
✓ Loading/Skeleton组件
✓ 配置Storybook
Phase 2: 应用迁移 (3-4天)
Week 1: MBE Education重构
✓ 安装设计系统依赖
✓ 迁移首页
✓ 迁移学生端
✓ 迁移教师端
✓ 迁移管理后台
Week 2: 其他应用迁移
✓ Civil Lawyer应用
✓ AIGC Committee应用
✓ Health Life应用
Phase 3: 优化提升 (2-3天)
优化项:
✓ 性能优化
✓ 响应式适配
✓ 动画细节打磨
✓ 可访问性改进
✓ 黑暗/明亮模式
✓ 文档完善
💎 核心组件示例
1. 玻璃态卡片组件
// packages/mbe-ui-components/src/components/Card/GlassCard.tsx
'use client';
import { motion, HTMLMotionProps } from 'framer-motion';
import { ReactNode } from 'react';
interface GlassCardProps extends HTMLMotionProps<'div'> {
children: ReactNode;
variant?: 'default' | 'gradient' | 'glow';
hover?: boolean;
}
export function GlassCard({
children,
variant = 'default',
hover = true,
className = '',
...props
}: GlassCardProps) {
const variants = {
default: 'bg-white/5 border-white/10',
gradient: 'bg-gradient-to-br from-blue-500/10 to-purple-500/10 border-blue-500/20',
glow: 'bg-white/5 border-white/10 shadow-glow',
};
return (
<motion.div
className={`
relative rounded-2xl border backdrop-blur-xl
${variants[variant]}
${hover ? 'transition-all duration-300 hover:border-white/20 hover:shadow-xl' : ''}
${className}
`}
whileHover={hover ? { y: -4, scale: 1.01 } : undefined}
{...props}
>
{children}
</motion.div>
);
}
2. 现代化按钮组件
// packages/mbe-ui-components/src/components/Button/Button.tsx
'use client';
import { motion, HTMLMotionProps } from 'framer-motion';
import { ReactNode } from 'react';
interface ButtonProps extends Omit<HTMLMotionProps<'button'>, 'size'> {
children: ReactNode;
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'gradient';
size?: 'sm' | 'md' | 'lg';
loading?: boolean;
icon?: ReactNode;
}
export function Button({
children,
variant = 'primary',
size = 'md',
loading = false,
icon,
className = '',
disabled,
...props
}: ButtonProps) {
const variants = {
primary: 'bg-blue-600 hover:bg-blue-700 text-white',
secondary: 'bg-gray-700 hover:bg-gray-600 text-white',
outline: 'border border-white/20 hover:border-white/40 bg-transparent',
ghost: 'hover:bg-white/10 text-gray-300',
gradient: 'bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white',
};
const sizes = {
sm: 'px-3 py-1.5 text-sm',
md: 'px-4 py-2 text-base',
lg: 'px-6 py-3 text-lg',
};
return (
<motion.button
className={`
relative inline-flex items-center justify-center gap-2
rounded-full font-semibold
transition-all duration-200
disabled:opacity-50 disabled:cursor-not-allowed
${variants[variant]}
${sizes[size]}
${className}
`}
whileTap={{ scale: disabled || loading ? 1 : 0.95 }}
disabled={disabled || loading}
{...props}
>
{loading && (
<motion.div
className="w-4 h-4 border-2 border-current border-t-transparent rounded-full"
animate={{ rotate: 360 }}
transition={{ duration: 1, repeat: Infinity, ease: 'linear' }}
/>
)}
{icon && <span>{icon}</span>}
{children}
</motion.button>
);
}
3. 输入框组件
// packages/mbe-ui-components/src/components/Input/Input.tsx
'use client';
import { motion } from 'framer-motion';
import { forwardRef, InputHTMLAttributes, ReactNode } from 'react';
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
label?: string;
error?: string;
helperText?: string;
leftIcon?: ReactNode;
rightIcon?: ReactNode;
}
export const Input = forwardRef<HTMLInputElement, InputProps>(
({ label, error, helperText, leftIcon, rightIcon, className = '', ...props }, ref) => {
return (
<div className="w-full">
{label && (
<label className="block text-sm font-medium text-gray-300 mb-2">
{label}
</label>
)}
<div className="relative">
{leftIcon && (
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400">
{leftIcon}
</div>
)}
<motion.input
ref={ref}
className={`
w-full px-4 py-3
${leftIcon ? 'pl-10' : ''}
${rightIcon ? 'pr-10' : ''}
bg-white/5 border rounded-xl
${error ? 'border-red-500' : 'border-white/10 focus:border-blue-500'}
text-white placeholder-gray-500
focus:outline-none focus:ring-2 focus:ring-blue-500/50
transition-all duration-200
${className}
`}
whileFocus={{ scale: 1.01 }}
{...props}
/>
{rightIcon && (
<div className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400">
{rightIcon}
</div>
)}
</div>
{error && (
<motion.p
initial={{ opacity: 0, y: -10 }}
animate={{ opacity: 1, y: 0 }}
className="mt-2 text-sm text-red-400"
>
{error}
</motion.p>
)}
{helperText && !error && (
<p className="mt-2 text-sm text-gray-500">{helperText}</p>
)}
</div>
);
}
);
Input.displayName = 'Input';
📐 响应式设计规范
// breakpoints
export const breakpoints = {
sm: '640px', // 手机横屏
md: '768px', // 平板竖屏
lg: '1024px', // 平板横屏
xl: '1280px', // 桌面
'2xl': '1536px', // 大屏
};
// 响应式工具类
export const responsive = {
mobile: '@media (max-width: 767px)',
tablet: '@media (min-width: 768px) and (max-width: 1023px)',
desktop: '@media (min-width: 1024px)',
};
🎯 成果预期
视觉效果提升
前:
❌ 各应用风格不统一
❌ 界面平淡无趣
❌ 交互生硬
后:
✅ 统一的品牌视觉
✅ 现代玻璃态设计
✅ 流畅的动画过渡
✅ 精致的细节打磨
开发效率提升
前:
❌ 组件重复开发
❌ 样式到处复制
❌ 维护成本高
后:
✅ 组件开箱即用
✅ 样式统一管理
✅ 一处修改,处处生效
✅ 开发速度提升 3-5倍
用户体验提升
性能:
✅ 首屏加载 < 1s
✅ 交互响应 < 100ms
✅ 动画流畅 60fps
体验:
✅ 视觉愉悦度 +80%
✅ 操作便捷度 +60%
✅ 品牌认知度 +100%
💰 投入产出比
投入
时间: 7-10天
- 基础建设: 3天
- 应用迁移: 4天
- 优化提升: 3天
人力: 1-2人
- 前端工程师 x1
- UI设计师 x1 (可选)
产出
短期:
✅ 4个应用UI统一
✅ 可复用组件库
✅ 开发效率提升 3-5倍
长期:
✅ 品牌形象建立
✅ 用户体验优化
✅ 维护成本降低 50%
✅ 新应用开发提速 5-10倍
🎊 总结
核心优势
1. 统一性:
✅ 一套设计语言
✅ 一套组件库
✅ 一套配置
2. 现代感:
✅ 玻璃态设计
✅ 流畅动画
✅ 渐变点缀
3. 高效性:
✅ 开发快
✅ 维护易
✅ 扩展强
4. 专业性:
✅ 符合行业标准
✅ 最佳实践
✅ 可访问性
立即行动
Step 1: 创建设计系统包 (1天)
- mbe-design-tokens
- mbe-ui-components
- mbe-tailwind-config
Step 2: 开发核心组件 (2天)
- 10个基础组件
- Storybook文档
- 使用示例
Step 3: 迁移第一个应用 (2天)
- MBE Education
- 验证可行性
- 总结经验
Step 4: 全面推广 (3天)
- 其他3个应用
- 文档完善
- 培训分享
您想要立即开始实施吗?我建议从创建设计系统包开始! 🎨✨
预计时间: 7-10天
效果: 统一、现代、高效的UI体系
ROI: 开发效率提升 3-5倍,维护成本降低 50%