1
This commit is contained in:
@@ -118,6 +118,17 @@ export function getTbProductTypeMap() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取评论(调用外部接口,按商品ID/SKU拉取评论)
|
||||||
|
const FETCH_COMMENTS_BASE = 'http://192.168.8.60:5008'
|
||||||
|
export function fetchComments(productId) {
|
||||||
|
return request({
|
||||||
|
url: FETCH_COMMENTS_BASE + '/fetch_comments',
|
||||||
|
method: 'get',
|
||||||
|
params: { product_id: productId },
|
||||||
|
headers: { isToken: false }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前IP地址(公开接口)
|
// 获取当前IP地址(公开接口)
|
||||||
export function getCurrentIP() {
|
export function getCurrentIP() {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
<el-form-item v-if="!expanded">
|
<el-form-item v-if="!expanded">
|
||||||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleJdQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="small" @click="handleJdQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="small" @click="resetJdQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="small" @click="resetJdQuery">重置</el-button>
|
||||||
|
<el-button type="warning" icon="el-icon-upload2" size="small" :loading="jdFetchLoading" @click="handleJdFetchComments">获取评论</el-button>
|
||||||
<el-button type="success" icon="el-icon-download" size="small" @click="handleJdExport">导出</el-button>
|
<el-button type="success" icon="el-icon-download" size="small" @click="handleJdExport">导出</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -71,6 +72,7 @@
|
|||||||
|
|
||||||
<!-- 桌面端按钮组 -->
|
<!-- 桌面端按钮组 -->
|
||||||
<div class="desktop-action-buttons desktop-only">
|
<div class="desktop-action-buttons desktop-only">
|
||||||
|
<el-button type="warning" icon="el-icon-upload2" size="small" :loading="jdFetchLoading" @click="handleJdFetchComments">获取评论</el-button>
|
||||||
<el-button type="success" icon="el-icon-download" size="small" @click="handleJdExport">导出</el-button>
|
<el-button type="success" icon="el-icon-download" size="small" @click="handleJdExport">导出</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -184,6 +186,7 @@
|
|||||||
<el-form-item v-if="!expanded">
|
<el-form-item v-if="!expanded">
|
||||||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleTbQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="small" @click="handleTbQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="small" @click="resetTbQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="small" @click="resetTbQuery">重置</el-button>
|
||||||
|
<el-button type="warning" icon="el-icon-upload2" size="small" :loading="tbFetchLoading" @click="handleTbFetchComments">获取评论</el-button>
|
||||||
<el-button type="success" icon="el-icon-download" size="small" @click="handleTbExport">导出</el-button>
|
<el-button type="success" icon="el-icon-download" size="small" @click="handleTbExport">导出</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -200,6 +203,7 @@
|
|||||||
|
|
||||||
<!-- 桌面端按钮组 -->
|
<!-- 桌面端按钮组 -->
|
||||||
<div class="desktop-action-buttons desktop-only">
|
<div class="desktop-action-buttons desktop-only">
|
||||||
|
<el-button type="warning" icon="el-icon-upload2" size="small" :loading="tbFetchLoading" @click="handleTbFetchComments">获取评论</el-button>
|
||||||
<el-button type="success" icon="el-icon-download" size="small" @click="handleTbExport">导出</el-button>
|
<el-button type="success" icon="el-icon-download" size="small" @click="handleTbExport">导出</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -335,7 +339,7 @@
|
|||||||
import {
|
import {
|
||||||
listJdComment, getJdComment, updateJdComment, delJdComment, resetJdCommentByProductId,
|
listJdComment, getJdComment, updateJdComment, delJdComment, resetJdCommentByProductId,
|
||||||
listTbComment, getTbComment, updateTbComment, delTbComment, resetTbCommentByProductId,
|
listTbComment, getTbComment, updateTbComment, delTbComment, resetTbCommentByProductId,
|
||||||
getCommentStatistics, getJdProductTypeMap, getTbProductTypeMap
|
getCommentStatistics, getJdProductTypeMap, getTbProductTypeMap, fetchComments
|
||||||
} from '@/api/jarvis/comment'
|
} from '@/api/jarvis/comment'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import MobileSearchForm from '@/components/MobileSearchForm'
|
import MobileSearchForm from '@/components/MobileSearchForm'
|
||||||
@@ -386,7 +390,10 @@ export default {
|
|||||||
},
|
},
|
||||||
// 图片查看
|
// 图片查看
|
||||||
imageDialogVisible: false,
|
imageDialogVisible: false,
|
||||||
imageList: []
|
imageList: [],
|
||||||
|
// 获取评论 loading
|
||||||
|
jdFetchLoading: false,
|
||||||
|
tbFetchLoading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -402,11 +409,13 @@ export default {
|
|||||||
},
|
},
|
||||||
jdActionButtons() {
|
jdActionButtons() {
|
||||||
return [
|
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 }
|
{ key: 'export', label: '导出', type: 'success', icon: 'el-icon-download', handler: () => this.handleJdExport(), disabled: false }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
tbActionButtons() {
|
tbActionButtons() {
|
||||||
return [
|
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 }
|
{ key: 'export', label: '导出', type: 'success', icon: 'el-icon-download', handler: () => this.handleTbExport(), disabled: false }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -458,6 +467,23 @@ export default {
|
|||||||
...this.jdQueryParams
|
...this.jdQueryParams
|
||||||
}, `jd_comment_${new Date().getTime()}.xlsx`)
|
}, `jd_comment_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
|
/** 京东:调用获取评论接口,使用商品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() {
|
getTbList() {
|
||||||
this.tbLoading = true
|
this.tbLoading = true
|
||||||
@@ -499,6 +525,23 @@ export default {
|
|||||||
...this.tbQueryParams
|
...this.tbQueryParams
|
||||||
}, `tb_comment_${new Date().getTime()}.xlsx`)
|
}, `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() {
|
getStatistics() {
|
||||||
this.statLoading = true
|
this.statLoading = true
|
||||||
|
|||||||
Reference in New Issue
Block a user