diff --git a/index.html b/index.html
index b305d69..66b024c 100644
--- a/index.html
+++ b/index.html
@@ -1,13 +1,17 @@
-
-
-
-
- Hucky
-
-
-
-
-
+
+
+
+
+ Hucky
+
+
+
+
+
+
diff --git a/src/apis/product.ts b/src/apis/product.ts
index 8937d69..62fdb2a 100644
--- a/src/apis/product.ts
+++ b/src/apis/product.ts
@@ -3,6 +3,7 @@ import type {
// ProductListItem,
ProductCategory,
ProductDetail,
+ ProductDTO,
ProductPageParams,
ProductPageResponse,
} from "@/types/product";
@@ -39,3 +40,29 @@ export const getProductDetail = (id: number) => {
method: "get",
});
};
+
+// 新增商品
+export const saveProduct = (data: ProductDTO) => {
+ return http({
+ url: "/product",
+ method: "post",
+ data,
+ });
+};
+
+// 更新商品
+export const updateProduct = (data: ProductDTO) => {
+ return http({
+ url: "/product",
+ method: "put",
+ data,
+ });
+};
+
+// 更新商品状态(上下架)
+export const updateProductStatus = (id: number, status: number) => {
+ return http({
+ url: `/product/status/${id}/${status}`,
+ method: "put",
+ });
+};
diff --git a/src/apis/user.ts b/src/apis/user.ts
index 98e69bd..539eca5 100644
--- a/src/apis/user.ts
+++ b/src/apis/user.ts
@@ -4,6 +4,7 @@ import {
LoginResponse,
RegisterRequest,
UserInfo,
+ UserDTO,
} from "@/types/user.ts";
import { UserAddress, UserAddressForm } from "@/types/address.ts";
@@ -51,6 +52,14 @@ export const getUserProfile = (id: number) => {
});
};
+// 获取用户列表(管理员)
+export const getUserList = () => {
+ return http({
+ url: "/user/admin",
+ method: "get",
+ });
+};
+
// 更新用户信息
export const updateUserProfile = (data: Partial) => {
return http({
diff --git a/src/layouts/AuthLayout.vue b/src/layouts/AuthLayout.vue
index d0869d0..e1527c1 100644
--- a/src/layouts/AuthLayout.vue
+++ b/src/layouts/AuthLayout.vue
@@ -1,4 +1,3 @@
-NEW_FILE_CODE
+
+
diff --git a/src/pages/admin/ProductPage.vue b/src/pages/admin/ProductPage.vue
new file mode 100644
index 0000000..963cd1a
--- /dev/null
+++ b/src/pages/admin/ProductPage.vue
@@ -0,0 +1,470 @@
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+
+ 添加商品
+
+
+
+
+
+
+
+
+
+ ¥{{ row.price }}
+
+
+
+
+
+ {{ row.userId }}
+
+
+
+
+ {{ getUserById(row.userId || 0)?.username || "未知商家" }}
+
+
+
+
+
+ {{ row.status === 1 ? "上架" : "下架" }}
+
+
+
+
+
+ 编辑
+
+ {{ row.status === 1 ? "下架" : "上架" }}
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/admin/UserPage.vue b/src/pages/admin/UserPage.vue
new file mode 100644
index 0000000..02be6f6
--- /dev/null
+++ b/src/pages/admin/UserPage.vue
@@ -0,0 +1,471 @@
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+
+ 添加用户
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.gender === 1 ? "男" : row.gender === 0 ? "女" : "未知" }}
+
+
+
+
+
+ {{ row.status === 1 ? "启用" : "禁用" }}
+
+
+
+
+
+
+ {{ row.isAdmin === 1 ? "是" : "否" }}
+
+
+
+
+
+ 编辑
+
+ {{ row.status === 1 ? "禁用" : "启用" }}
+
+
+ {{ row.isAdmin === 1 ? "取消管理员" : "设为管理员" }}
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 男
+ 女
+ 未知
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/user/AddressPage.vue b/src/pages/user/AddressPage.vue
index de79b51..60ff1ef 100644
--- a/src/pages/user/AddressPage.vue
+++ b/src/pages/user/AddressPage.vue
@@ -24,6 +24,7 @@ import {
setDefaultAddress,
} from "@/apis/user";
import type { UserAddress, UserAddressForm } from "@/types/address";
+import MainLayout from "@/layouts/MainLayout.vue";
const userStore = useUserStore();
const addressList = ref([]);
@@ -203,136 +204,138 @@ onMounted(() => {
-
-
-
-
-
-
地址管理
-
-
- 新增收货地址
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatAddress(row) }}
+
+
+
+
+ 默认
+ -
+
+
+
+
+
+
+
+ 编辑
+
+
+
+
+
+ 删除
+
+
+
+
+
+ 设为默认
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
- {{ formatAddress(row) }}
-
-
-
-
- 默认
- -
-
-
-
-
-
-
-
- 编辑
-
-
-
-
-
- 删除
-
-
-
-
-
- 设为默认
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+