diff --git a/src/apis/product.ts b/src/apis/product.ts index 4e0dc13..613d7fc 100644 --- a/src/apis/product.ts +++ b/src/apis/product.ts @@ -18,6 +18,15 @@ export const getProductList = (params: ProductPageParams) => { }); }; +// 获取商家商品列表 +export const getMerchantProductList = (params: ProductPageParams) => { + return http({ + url: "/product/page/merchant", + method: "get", + params, + }); +}; + // 获取商品分类 export const getProductCategories = () => { return http({ @@ -51,6 +60,15 @@ export const saveProduct = (data: ProductDTO) => { }); }; +// 删除商品 +export const deleteProductAPI = (id: number) => { + return http({ + url: `/product`, + method: "delete", + params: { id }, + }); +}; + // 更新商品 export const updateProduct = (data: ProductDTO) => { return http({ diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 6337076..649ee8f 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -13,6 +13,11 @@ const isLoggedIn = computed(() => { return !!userStore.token; }); +// 计算属性:判断用户是否为管理员 +const isAdmin = computed(() => { + return userStore.userInfo?.isAdmin === 1; +}); + // 计算属性:获取用户昵称 const userNickname = computed(() => { return userStore.userInfo?.nickname || userStore.userInfo?.username || "用户"; @@ -42,6 +47,24 @@ const goToProfile = () => { router.push(`/user/profile/${userStore.userInfo?.id}`); isMobileMenuOpen.value = false; }; + +// 跳转到管理界面 +const goToAdmin = () => { + router.push("/admin"); + isMobileMenuOpen.value = false; +}; + +// 跳转到地址管理 +const goToAddress = () => { + router.push("/user/address"); + isMobileMenuOpen.value = false; +}; + +// 跳转到商品管理界面 +const goToProductManage = () => { + router.push("/user/product"); + isMobileMenuOpen.value = false; +};