From 60f80c4effa5fcf2f4f67ce5ae38a0d21488382e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Tue, 23 Dec 2025 17:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=B7=BB=E5=8A=A0=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/attribute.ts | 105 +++ src/api/classify.ts | 7 + src/views/admin/classify/classify_item.vue | 61 ++ src/views/admin/product/product_list.vue | 886 +++++++++++++++++++++ 4 files changed, 1059 insertions(+) create mode 100644 src/api/attribute.ts create mode 100644 src/views/admin/product/product_list.vue diff --git a/src/api/attribute.ts b/src/api/attribute.ts new file mode 100644 index 0000000..85f6cb3 --- /dev/null +++ b/src/api/attribute.ts @@ -0,0 +1,105 @@ +import request from '@/utils/http' + +export class attributeService { + //属性列表 + static getattributeList(params: Api.Common.PaginatingParams) { + return request.get({ + url: '/admin/sku/attribute/list', + params + }) + } + //属性添加 + static addattribute(params: any) { + return request.post({ + url: '/admin/sku/attribute/store', + params + }) + } + //属性编辑 + static editattribute(params: any) { + return request.post({ + url: '/admin/sku/attribute/update', + params + }) + } + //属性删除 + static deleteattribute(params: any) { + return request.post({ + url: '/admin/sku/attribute/destroy', + params + }) + } + //属性详情 + static attributedetail(params: any) { + return request.get({ + url: '/admin/sku/attribute/show', + params + }) + } + //sku列表 + static getskuList(params: Api.Common.PaginatingParams) { + return request.get({ + url: '/admin/sku/list', + params + }) + } + //sku添加 + static addsku(params: any) { + return request.post({ + url: '/admin/sku/store', + params + }) + } + //sku编辑 + static editsku(params: any) { + return request.post({ + url: '/admin/sku/update', + params + }) + } + //sku删除 + static deletesku(params: any) { + return request.post({ + url: '/admin/sku/destroy', + params + }) + } + //sku详情 + static skudetail(params: any) { + return request.get({ + url: '/admin/sku/show', + params + }) + } + //分类下拉 + static getcategoryOptions() { + return request.get({ + url: '/admin/post/category/preset' + }) + } + //属性下拉 + static getattributeOptions(params?: any) { + return request.get({ + url: '/admin/sku/attribute/preset', + params + }) + } + //产品导入 + static importSku(formData: FormData) { + return request.request({ + url: '/admin/sku/import', + method: 'POST', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) + } + //下载导入模板 + static downloadTemplate() { + return request.get({ + url: '/admin/sku/template', + responseType: 'blob' + }) + } +} diff --git a/src/api/classify.ts b/src/api/classify.ts index 67e7a25..e1ca3c6 100644 --- a/src/api/classify.ts +++ b/src/api/classify.ts @@ -85,4 +85,11 @@ export class classifyService { params }) } + //评论删除 /admin/post/comment/destroy + static deleteclassifycontentcomment(params: any) { + return request.post({ + url: '/admin/post/comment/destroy', + params + }) + } } diff --git a/src/views/admin/classify/classify_item.vue b/src/views/admin/classify/classify_item.vue index 90d58d3..76a7a26 100644 --- a/src/views/admin/classify/classify_item.vue +++ b/src/views/admin/classify/classify_item.vue @@ -135,6 +135,16 @@
{{ comment.user.nickname }}
{{ formatTime(comment.created_at) }}
+
+ + 删除 + +
{{ comment.content || '-' }}
@@ -148,6 +158,16 @@ formatTime(reply.created_at || reply.timestamp) }} +
+ + 删除 + +
{{ reply.content || '-' }}
@@ -308,6 +328,47 @@ } }) } + //删除评论 + const deleteComment = (row: any) => { + ElMessageBox.confirm('确定删除该评论吗?', '删除确认', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'error' + }).then(async () => { + try { + const { message } = await classifyService.deleteclassifycontentcomment({ id: row.id }) + ElMessage.success(message) + getMonthlyList() + // 从评论列表中移除已删除的评论 + const removeComment = (list: any[]) => { + const index = list.findIndex((item) => item.id === row.id) + if (index > -1) { + list.splice(index, 1) + return true + } + // 检查是否有子回复需要删除 + for (const item of list) { + if (item.child && item.child.length > 0) { + const childIndex = item.child.findIndex((child: any) => child.id === row.id) + if (childIndex > -1) { + item.child.splice(childIndex, 1) + return true + } + } + } + return false + } + const removed = removeComment(commentList.value) + if (removed) { + // 更新详情中的评论总数 + detailData.value.comment = Math.max(0, detailData.value.comment - 1) + } + } catch (error) { + console.error('删除失败:', error) + ElMessage.error('删除失败') + } + }) + }