From 39c1dd34b1f0a73942496a2a9137c647671209fd Mon Sep 17 00:00:00 2001
From: puzvv <1@>
Date: Mon, 29 Dec 2025 17:09:04 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BA=86=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E5=91=98=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E6=A0=A1=E9=AA=8C?=
=?UTF-8?q?=EF=BC=8C=E5=AE=8C=E6=88=90=E4=BA=86=E7=94=A8=E6=88=B7=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E7=95=8C=E9=9D=A2=E5=92=8C=E5=95=86=E5=93=81=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 24 +-
src/apis/product.ts | 27 ++
src/apis/user.ts | 9 +
src/layouts/AuthLayout.vue | 1 -
src/layouts/ManageLayout.vue | 135 +++++++++
src/pages/admin/ProductPage.vue | 470 +++++++++++++++++++++++++++++++
src/pages/admin/UserPage.vue | 471 ++++++++++++++++++++++++++++++++
src/pages/user/AddressPage.vue | 257 ++++++++---------
src/pages/user/LoginPage.vue | 1 +
src/router/index.ts | 60 +++-
src/types/product.ts | 21 ++
src/types/user.ts | 20 ++
12 files changed, 1357 insertions(+), 139 deletions(-)
create mode 100644 src/layouts/ManageLayout.vue
create mode 100644 src/pages/admin/ProductPage.vue
create mode 100644 src/pages/admin/UserPage.vue
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) }}
-
-
-
-
- 默认
- -
-
-
-
-
-
-
-
- 编辑
-
-
-
-
-
- 删除
-
-
-
-
-
- 设为默认
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+