feat: 重构后台路由并使用嵌套路由;添加图片上传功能

- 拆分 AdminView 为多个子页面组件,使用嵌套路由
- 拆分 MerchantView 为多个子页面组件,使用嵌套路由
- 创建 AdminLayout 和 MerchantLayout 布局组件
- 修复编译错误:IconSend 重复导入、IconDatabase 不存在
- 修复 HomeView 缺失 onMounted 导入
- 添加文件上传后端接口和静态资源映射
- 为商品和轮播图添加图片上传功能(支持预览、清除)
This commit is contained in:
wangziqi
2026-02-10 15:14:23 +08:00
parent a7ce0a089e
commit d6451cf188
29 changed files with 4948 additions and 479 deletions

View File

@@ -5,8 +5,30 @@ import CartView from '../views/CartView.vue'
import OrdersView from '../views/OrdersView.vue'
import FavoritesView from '../views/FavoritesView.vue'
import ProfileView from '../views/ProfileView.vue'
import AdminView from '../views/AdminView.vue'
import MerchantView from '../views/MerchantView.vue'
// Admin Layout & Pages
import AdminLayout from '../views/admin/AdminLayout.vue'
import AdminOverview from '../views/admin/AdminOverview.vue'
import AdminOrders from '../views/admin/AdminOrders.vue'
import AdminRisk from '../views/admin/AdminRisk.vue'
import AdminProducts from '../views/admin/AdminProducts.vue'
import AdminAudit from '../views/admin/AdminAudit.vue'
import AdminUsers from '../views/admin/AdminUsers.vue'
import AdminBanners from '../views/admin/AdminBanners.vue'
import AdminReviews from '../views/admin/AdminReviews.vue'
import AdminLogistics from '../views/admin/AdminLogistics.vue'
import AdminInventory from '../views/admin/AdminInventory.vue'
import AdminProfile from '../views/admin/AdminProfile.vue'
// Merchant Layout & Pages
import MerchantLayout from '../views/merchant/MerchantLayout.vue'
import MerchantOverview from '../views/merchant/MerchantOverview.vue'
import MerchantProducts from '../views/merchant/MerchantProducts.vue'
import MerchantOrders from '../views/merchant/MerchantOrders.vue'
import MerchantReviews from '../views/merchant/MerchantReviews.vue'
import MerchantLogistics from '../views/merchant/MerchantLogistics.vue'
import MerchantInventory from '../views/merchant/MerchantInventory.vue'
import MerchantProfile from '../views/merchant/MerchantProfile.vue'
const routes = [
{ path: '/', redirect: '/products' },
@@ -16,9 +38,43 @@ const routes = [
{ path: '/favorites', component: FavoritesView },
{ path: '/profile', component: ProfileView },
{ path: '/login', component: LoginView },
{ path: '/admin', component: AdminView },
{ path: '/merchant', component: MerchantView },
{ path: '/customer', redirect: '/products' }
{ path: '/customer', redirect: '/products' },
// Admin Routes
{
path: '/admin',
component: AdminLayout,
redirect: '/admin/overview',
children: [
{ path: 'overview', name: 'admin-overview', component: AdminOverview },
{ path: 'orders', name: 'admin-orders', component: AdminOrders },
{ path: 'risk', name: 'admin-risk', component: AdminRisk },
{ path: 'products', name: 'admin-products', component: AdminProducts },
{ path: 'audit', name: 'admin-audit', component: AdminAudit },
{ path: 'users', name: 'admin-users', component: AdminUsers },
{ path: 'banners', name: 'admin-banners', component: AdminBanners },
{ path: 'reviews', name: 'admin-reviews', component: AdminReviews },
{ path: 'logistics', name: 'admin-logistics', component: AdminLogistics },
{ path: 'inventory', name: 'admin-inventory', component: AdminInventory },
{ path: 'profile', name: 'admin-profile', component: AdminProfile }
]
},
// Merchant Routes
{
path: '/merchant',
component: MerchantLayout,
redirect: '/merchant/overview',
children: [
{ path: 'overview', name: 'merchant-overview', component: MerchantOverview },
{ path: 'products', name: 'merchant-products', component: MerchantProducts },
{ path: 'orders', name: 'merchant-orders', component: MerchantOrders },
{ path: 'reviews', name: 'merchant-reviews', component: MerchantReviews },
{ path: 'logistics', name: 'merchant-logistics', component: MerchantLogistics },
{ path: 'inventory', name: 'merchant-inventory', component: MerchantInventory },
{ path: 'profile', name: 'merchant-profile', component: MerchantProfile }
]
}
]
const router = createRouter({
@@ -26,4 +82,4 @@ const router = createRouter({
routes
})
export default router
export default router