From 00c2003f8ad2d763543a92a9da3e32f669a29fd2 Mon Sep 17 00:00:00 2001 From: van Date: Sat, 14 Nov 2026 16:32:28 +0800 Subject: [PATCH] 1 --- src/views/system/comment/index.vue | 103 ++++++++--------------------- 1 file changed, 27 insertions(+), 76 deletions(-) diff --git a/src/views/system/comment/index.vue b/src/views/system/comment/index.vue index b750336..b41ea2c 100644 --- a/src/views/system/comment/index.vue +++ b/src/views/system/comment/index.vue @@ -55,7 +55,6 @@ 搜索 重置 - 获取评论 导出 @@ -72,7 +71,6 @@
- 获取评论 导出
@@ -186,7 +184,6 @@ 搜索 重置 - 获取评论 导出 @@ -203,7 +200,6 @@
- 获取评论 导出
@@ -314,19 +310,6 @@ /> - - - @@ -360,8 +343,15 @@ - + @@ -459,12 +449,9 @@ export default { // 图片查看 imageDialogVisible: false, imageList: [], - // 获取评论 loading - jdFetchLoading: false, - tbFetchLoading: false, - statFetchLoading: false, // 商品ID映射 mapSource: 'jd', + mapFetchKey: '', mapKeyword: '', mapDialogVisible: false, mapDialogTitle: '新增商品ID', @@ -489,13 +476,11 @@ export default { }, jdActionButtons() { return [ - { key: 'fetchComments', label: '获取评论', type: 'warning', icon: 'el-icon-upload2', handler: () => this.handleJdFetchComments(), disabled: this.jdFetchLoading }, { key: 'export', label: '导出', type: 'success', icon: 'el-icon-download', handler: () => this.handleJdExport(), disabled: false } ] }, tbActionButtons() { return [ - { key: 'fetchComments', label: '获取评论', type: 'warning', icon: 'el-icon-upload2', handler: () => this.handleTbFetchComments(), disabled: this.tbFetchLoading }, { key: 'export', label: '导出', type: 'success', icon: 'el-icon-download', handler: () => this.handleTbExport(), disabled: false } ] }, @@ -571,41 +556,6 @@ export default { ...this.jdQueryParams }, `jd_comment_${new Date().getTime()}.xlsx`) }, - /** 统计信息表格:仅京东商品可点击,用该行商品ID 调用获取评论 */ - handleStatFetchComments(row) { - if (row.source !== '京东评论') return - const productId = (row.productId || '').toString().trim() - if (!productId) { - this.$modal.msgWarning('商品ID为空') - return - } - this.statFetchLoading = true - fetchComments(productId).then(() => { - this.$modal.msgSuccess('获取评论请求已发送') - this.getStatistics() - }).catch(e => { - this.$modal.msgError(e && (e.message || e.msg) || '获取评论失败') - }).finally(() => { - this.statFetchLoading = false - }) - }, - /** 京东:调用获取评论接口,使用商品ID(SKU) 作为 product_id */ - handleJdFetchComments() { - const productId = (this.jdQueryParams.productId || '').toString().trim() - if (!productId) { - this.$modal.msgWarning('请先输入商品ID(SKU)') - return - } - this.jdFetchLoading = true - fetchComments(productId).then(() => { - this.$modal.msgSuccess('获取评论请求已发送') - this.getJdList() - }).catch(e => { - this.$modal.msgError(e && (e.message || e.msg) || '获取评论失败') - }).finally(() => { - this.jdFetchLoading = false - }) - }, // 淘宝评论相关 getTbList() { this.tbLoading = true @@ -647,23 +597,6 @@ export default { ...this.tbQueryParams }, `tb_comment_${new Date().getTime()}.xlsx`) }, - /** 淘宝:调用获取评论接口,使用商品ID(SKU) 作为 product_id */ - handleTbFetchComments() { - const productId = (this.tbQueryParams.productId || '').toString().trim() - if (!productId) { - this.$modal.msgWarning('请先输入商品ID(SKU)') - return - } - this.tbFetchLoading = true - fetchComments(productId).then(() => { - this.$modal.msgSuccess('获取评论请求已发送') - this.getTbList() - }).catch(e => { - this.$modal.msgError(e && (e.message || e.msg) || '获取评论失败') - }).finally(() => { - this.tbFetchLoading = false - }) - }, // 统计信息相关 getStatistics() { this.statLoading = true @@ -736,6 +669,24 @@ export default { }) }) }, + handleMapFetchComments(row) { + const productId = (row.value || '').toString().trim() + if (!productId) { + this.$modal.msgWarning(this.mapValueLabel + '为空') + return + } + const loadingKey = this.mapSource + ':' + row.key + this.mapFetchKey = loadingKey + fetchComments(productId).then(() => { + this.$modal.msgSuccess('获取评论请求已发送') + }).catch(e => { + this.$modal.msgError(e && (e.message || e.msg) || '获取评论失败') + }).finally(() => { + if (this.mapFetchKey === loadingKey) { + this.mapFetchKey = '' + } + }) + }, handleMapDelete(row) { const label = this.mapKeyLabel + '「' + row.key + '」' this.$modal.confirm('是否确认删除' + label + '?').then(() => {