fix: 以图搜图查看详情优先用 spec_model 跳转物料页面自动搜索

This commit is contained in:
DXC
2026-05-26 08:34:03 +08:00
parent 92e1f7275e
commit 9406669f1c

View File

@ -203,14 +203,13 @@ const handleUse = (item: ImageSearchItem) => {
}
const handleView = (item: ImageSearchItem) => {
// 从 business_data 获取跳转 URL
const url = item.business_data?.url
if (url) {
router.push(url)
const biz = item.business_data
if (biz?.spec_model) {
router.push({ path: '/material/index', query: { keyword: biz.spec_model } })
} else if (biz?.url) {
router.push(biz.url)
} else {
// 兜底:使用 product_name 作为 keyword 搜索
ElMessage.info(`未找到详情页链接,已将 "${item.product_name}" 作为关键词搜索`)
emit('view', item)
ElMessage.warning('无法定位目标页面')
}
handleClose()
}