# UHaven **Repository Path**: zhself214/uhaven ## Basic Information - **Project Name**: UHaven - **Description**: 小学期blazor - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-16 - **Last Updated**: 2026-07-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # UHaven 奢侈家具定制平台 — 电影级前端体验 + ASP.NET Core 后端。 ## 项目结构 ``` UHaven/ ├── uhaven-frontend/ # React + TypeScript + TailwindCSS ├── uhaven-backend/ # ASP.NET Core (.NET 10) Web API └── README.md ``` --- ## 一、启动方式 Set-ExecutionPolicy -Scope CurrentUser RemoteSigned ### 前端 **环境要求:** Node.js 18+ ```bash cd uhaven-frontend npm install npm run dev ``` 开发服务器默认运行在 `http://localhost:5173`。 如果该端口被占用,Vite 会自动选择下一个可用端口(5174、5175…), 终端输出会显示实际地址。 > API 地址由 `.env` 文件中的 `VITE_API_BASE_URL` 控制, > 默认值为 `http://localhost:5000/api`。 生产构建: ```bash npm run build npm run preview ``` ### 后端 **环境要求:** .NET SDK 10.0+ ```bash cd uhaven-backend dotnet restore dotnet run ``` 后端固定运行在 `http://localhost:5000`(由 `Properties/launchSettings.json` 配置)。 首次运行自动创建 SQLite 数据库并填充示例数据。 后续启动不会清空数据 — 所有管理操作会持久保留。 Swagger 文档:`http://localhost:5000/swagger` ### 管理员登录 | 邮箱 | 密码 | |---|---| | `admin@uhaven.com` | `admin123` | 管理端地址:`/admin/login` --- ## 二、技术栈 **前端** | 类别 | 技术 | |---|---| | 框架 | React 19 · TypeScript 6 | | 构建 | Vite 8 | | 样式 | TailwindCSS 4 | | 路由 | React Router 7 | | 动画 | Motion (Framer Motion) | | 图标 | Lucide React | | 全景 | Pannellum | **后端** | 类别 | 技术 | |---|---| | 框架 | ASP.NET Core 9 (.NET 10) | | ORM | Entity Framework Core 10 | | 数据库 | SQLite | | 加密 | BCrypt.Net | | API 文档 | Swashbuckle (Swagger) | **工程化** | 类别 | 技术 | |---|---| | 代码检查 | ESLint 10 · TypeScript-ESLint 8 | --- ## 三、目录结构 ``` UHaven/ ├── README.md ├── .gitignore │ ├── uhaven-backend/ # ASP.NET Core 9 Web API │ ├── Program.cs # 入口:配置、CORS、Swagger、自动建库+种子数据 │ ├── uhaven-backend.csproj │ ├── appsettings.json │ ├── appsettings.Development.json │ │ │ ├── Controllers/ │ │ ├── AuthController.cs # POST /api/auth/login, /verify │ │ ├── CategoriesController.cs # CRUD + PATCH active + ?activeOnly 筛选 │ │ ├── ProductsController.cs # CRUD + PATCH active/featured + 图片子资源 │ │ ├── InquiriesController.cs # CRUD + PATCH status + PATCH notes │ │ ├── OrdersController.cs # CRUD + PATCH status │ │ └── DashboardController.cs # GET /stats, /activity │ │ │ ├── Models/ │ │ ├── Entities/ │ │ │ ├── Admin.cs # 管理员 │ │ │ ├── Category.cs # 分类(Name, Slug, CoverImage, SortOrder, IsActive) │ │ │ ├── Product.cs # 产品(Name, Slug, Price, LeadTime, IsFeatured, IsActive...) │ │ │ ├── ProductImage.cs # 产品图片(ImageUrl, IsCover, SortOrder) │ │ │ ├── Inquiry.cs # 咨询(5 种状态 + AdminNotes) │ │ │ └── Order.cs # 订单(5 种状态) │ │ │ │ │ └── Dtos/ │ │ ├── AuthDtos.cs │ │ ├── CategoryDtos.cs │ │ ├── ProductDtos.cs │ │ ├── ProductImageDtos.cs │ │ ├── InquiryDtos.cs │ │ └── OrderDtos.cs │ │ │ ├── Services/ │ │ ├── AuthService.cs │ │ ├── CategoryService.cs │ │ ├── ProductService.cs │ │ ├── InquiryService.cs │ │ └── OrderService.cs │ │ │ ├── Data/ │ │ ├── AppDbContext.cs # EF Core DbContext │ │ └── DbSeeder.cs # 首次运行自动导入所有示例数据 │ │ │ └── wwwroot/ │ └── images/ │ └── products/ # 产品图片存储(运行时自动创建) │ ├── uhaven-frontend/ # React 19 + TypeScript + TailwindCSS 4 │ ├── index.html │ ├── package.json │ ├── vite.config.ts │ ├── tsconfig.json │ ├── eslint.config.js │ │ │ ├── public/ │ │ ├── favicon.svg │ │ ├── spaces.html # 独立 3D 空间页面 │ │ └── images/ # 静态资源图片 │ │ │ └── src/ │ ├── main.tsx # 入口:StrictMode > ThemeProvider > AuthProvider > ToastProvider > Router │ ├── App.tsx │ ├── index.css # Tailwind + Admin 主题变量 + 字体定义 │ │ │ ├── types/ │ │ ├── index.ts # 前端 UI 类型(ProductDetail, NavItem...) │ │ └── api.ts # API 响应类型(匹配后端 DTO) │ │ │ ├── services/ │ │ └── api/ │ │ ├── client.ts # Axios 实例 + 拦截器 + Token 管理 + ApiError │ │ ├── auth.ts # POST /auth/login, /verify │ │ ├── products.ts # CRUD + toggle active/featured + 图片子资源 │ │ ├── categories.ts # CRUD + toggle active │ │ ├── inquiries.ts # CRUD + PATCH status + PATCH notes │ │ ├── orders.ts # CRUD + PATCH status │ │ ├── dashboard.ts # GET /stats, /activity │ │ ├── adapters.ts # API 类型 → 前端 UI 类型转换 + 定制化数据 │ │ └── index.ts # 聚合导出 │ │ │ ├── hooks/ │ │ ├── useApi.ts # useApi(fetcher, key?) — 数据获取 + refetch │ │ └── index.ts # useMutation — 手动变更(POST/PUT/PATCH/DELETE) │ │ │ ├── contexts/ │ │ ├── ThemeContext.tsx # Dark / Light 主题切换 │ │ ├── AuthContext.tsx # 登录/登出/Token 管理 │ │ └── ToastContext.tsx # 成功/错误/信息 提示通知 │ │ │ ├── router/ │ │ └── index.tsx # React Router 路由定义(3 组布局 + 管理端) │ │ │ ├── layouts/ │ │ ├── SiteLayout.tsx # 无导航栏(首页、Spaces) │ │ ├── AppLayout.tsx # 带 GlobalNavbar(Collection、Product、Contact...) │ │ └── AdminLayout.tsx # 管理端侧边栏 + 顶部导航 │ │ │ ├── components/ │ │ ├── admin/ │ │ │ └── ProtectedRoute.tsx # 登录鉴权守卫 │ │ ├── GlobalNavbar.tsx │ │ ├── Navbar.tsx │ │ ├── AnimatedButton.tsx │ │ ├── FloatingBadge.tsx │ │ ├── FloatingPanel.tsx │ │ ├── GlassCard.tsx │ │ ├── MetricCard.tsx │ │ └── SectionTitle.tsx │ │ │ ├── pages/ │ │ ├── Home/ # 首页:开场动画 + Hero + 产品精选 + 生态 │ │ ├── Collection/ # 分类展示页 /collection │ │ ├── Category/ # 分类产品页 /collection/:category │ │ ├── Product/ # 产品详情页 /product/:slug │ │ ├── Spaces/ # 3D 空间页(跳转到独立 HTML) │ │ ├── Ecosystem/ # 智能家居生态页 │ │ ├── About/ # 品牌理念页 │ │ ├── Contact/ # 咨询表单页(POST /api/inquiries) │ │ ├── Account/ # 用户面板页 │ │ └── admin/ │ │ ├── Login.tsx # 管理员登录 │ │ ├── Dashboard.tsx # 仪表盘(统计 + 最近咨询 + 活动) │ │ ├── Inquiries.tsx # 咨询管理(5 种状态流转) │ │ ├── Orders.tsx # 订单管理(5 种状态流转) │ │ ├── Products.tsx # 产品管理(CRUD + 上下架 + 精选 + 图片管理) │ │ ├── Categories.tsx # 分类管理(CRUD + 启用/禁用 + 排序) │ │ └── Settings.tsx # 系统设置 │ │ │ ├── sections/ # 页面内区块组件(按需懒加载) │ │ ├── OpeningSequence/ │ │ ├── HeroSection/ │ │ ├── LivingSpaceExperience/ │ │ ├── ProductCollection/ │ │ ├── SmartHomeEcosystem/ │ │ ├── Footer/ │ │ ├── collection/ │ │ │ ├── CategoryShowcase.tsx │ │ │ ├── CollectionHero.tsx │ │ │ ├── CollectionCTA.tsx │ │ │ └── MaterialPhilosophy.tsx │ │ └── category/ │ │ ├── CategoryHero.tsx │ │ ├── FilterBar.tsx │ │ ├── ProductGallery.tsx │ │ ├── FeaturedDesigner.tsx │ │ └── BottomCTA.tsx │ │ │ ├── mocks/ # 前端展示用静态数据(类型定义 + API 不可用时的降级回退) │ │ ├── admin.ts │ │ ├── products.ts │ │ ├── category.ts │ │ ├── collection.ts │ │ ├── rooms.ts │ │ ├── ecosystem.ts │ │ ├── stats.ts │ │ ├── footer.ts │ │ ├── navigation.ts │ │ └── index.ts │ │ │ ├── assets/ │ └── utils/ │ └── uhaven-admin-design/ # 管理端静态设计稿(独立 HTML) ```