From 5cd01903e418648f51507df05ca63794e253fa93 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 26 Aug 2023 21:23:10 +0800 Subject: [PATCH] =?UTF-8?q?code=20review=EF=BC=9A=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mall/product/comment/ReplyForm.vue | 5 ++- src/views/mall/product/comment/index.vue | 36 ++++++++------------ 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/views/mall/product/comment/ReplyForm.vue b/src/views/mall/product/comment/ReplyForm.vue index 4ce36781..4c8bd4d5 100644 --- a/src/views/mall/product/comment/ReplyForm.vue +++ b/src/views/mall/product/comment/ReplyForm.vue @@ -48,16 +48,15 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗 /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 - const submitReplyForm = async () => { + // 校验表单 const valid = await formRef?.value?.validate() if (!valid) return - + // 提交请求 formLoading.value = true try { await CommentApi.replyComment(formData.value) message.success(t('common.createSuccess')) - dialogVisible.value = false // 发送操作成功的事件 emit('success') diff --git a/src/views/mall/product/comment/index.vue b/src/views/mall/product/comment/index.vue index 4fe65a86..1b0745ba 100644 --- a/src/views/mall/product/comment/index.vue +++ b/src/views/mall/product/comment/index.vue @@ -61,17 +61,24 @@ - + @@ -88,7 +95,7 @@ :src="picUrl" :preview-src-list="scope.row.picUrls" :initial-index="index" - class="w-30px h-30px" + class="w-40px h-40px" preview-teleported /> @@ -151,7 +158,7 @@ import { dateFormatter } from '@/utils/formatTime' import * as CommentApi from '@/api/mall/product/comment' import CommentForm from './CommentForm.vue' -import ReplyForm from '@/views/mall/product/comment/ReplyForm.vue' +import ReplyForm from './ReplyForm.vue' defineOptions({ name: 'ProductComment' }) @@ -164,25 +171,10 @@ const list = ref([]) // 列表的数据 const queryParams = reactive({ pageNo: 1, pageSize: 10, - userId: null, - userNickname: null, - userAvatar: null, - anonymous: null, - orderId: null, - orderItemId: null, - spuId: null, - spuName: null, - skuId: null, - visible: null, - scores: null, - descriptionScores: null, - benefitScores: null, - content: null, - picUrls: null, replyStatus: null, - replyUserId: null, - replyContent: null, - replyTime: [], + spuName: null, + userNickname: null, + orderId: null, createTime: [] }) const queryFormRef = ref() // 搜索的表单