Skip to content

Commit 5cd0190

Browse files
committed
code review:商品评论
1 parent d09366b commit 5cd0190

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

src/views/mall/product/comment/ReplyForm.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
4848
4949
/** 提交表单 */
5050
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
51-
5251
const submitReplyForm = async () => {
52+
// 校验表单
5353
const valid = await formRef?.value?.validate()
5454
if (!valid) return
55-
55+
// 提交请求
5656
formLoading.value = true
5757
try {
5858
await CommentApi.replyComment(formData.value)
5959
message.success(t('common.createSuccess'))
60-
6160
dialogVisible.value = false
6261
// 发送操作成功的事件
6362
emit('success')

src/views/mall/product/comment/index.vue

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,24 @@
6161
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="false">
6262
<el-table-column label="评论编号" align="center" prop="id" min-width="60" />
6363
<el-table-column label="用户名称" align="center" prop="userNickname" width="80" />
64-
<el-table-column label="商品信息" align="center" min-width="210">
64+
<el-table-column label="商品信息" align="center" min-width="300">
6565
<template #default="scope">
6666
<div class="flex row items-center gap-x-4px">
6767
<el-image
6868
v-if="scope.row.skuPicUrl"
6969
:src="scope.row.skuPicUrl"
7070
:preview-src-list="[scope.row.skuPicUrl]"
71-
class="w-30px h-30px shrink-0"
71+
class="w-40px h-40px shrink-0"
7272
preview-teleported
7373
/>
7474
<div>{{ scope.row.spuName }}</div>
75+
<el-tag
76+
v-for="property in scope.row.skuProperties"
77+
:key="property.propertyId"
78+
class="mr-10px"
79+
>
80+
{{ property.propertyName }}: {{ property.valueName }}
81+
</el-tag>
7582
</div>
7683
</template>
7784
</el-table-column>
@@ -88,7 +95,7 @@
8895
:src="picUrl"
8996
:preview-src-list="scope.row.picUrls"
9097
:initial-index="index"
91-
class="w-30px h-30px"
98+
class="w-40px h-40px"
9299
preview-teleported
93100
/>
94101
</div>
@@ -151,7 +158,7 @@
151158
import { dateFormatter } from '@/utils/formatTime'
152159
import * as CommentApi from '@/api/mall/product/comment'
153160
import CommentForm from './CommentForm.vue'
154-
import ReplyForm from '@/views/mall/product/comment/ReplyForm.vue'
161+
import ReplyForm from './ReplyForm.vue'
155162
156163
defineOptions({ name: 'ProductComment' })
157164
@@ -164,25 +171,10 @@ const list = ref([]) // 列表的数据
164171
const queryParams = reactive({
165172
pageNo: 1,
166173
pageSize: 10,
167-
userId: null,
174+
replyStatus: null,
175+
spuName: null,
168176
userNickname: null,
169-
userAvatar: null,
170-
anonymous: null,
171177
orderId: null,
172-
orderItemId: null,
173-
spuId: null,
174-
spuName: null,
175-
skuId: null,
176-
visible: null,
177-
scores: null,
178-
descriptionScores: null,
179-
benefitScores: null,
180-
content: null,
181-
picUrls: null,
182-
replyStatus: null,
183-
replyUserId: null,
184-
replyContent: null,
185-
replyTime: [],
186178
createTime: []
187179
})
188180
const queryFormRef = ref() // 搜索的表单

0 commit comments

Comments
 (0)