feat: 以图搜图返回 business_data 包含 name/spec_model/url,支持详情页跳转
This commit is contained in:
@ -99,10 +99,13 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Camera, Loading, Picture, WarningFilled } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { imageSearch, type ImageSearchItem } from '@/api/common/upload'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
}
|
||||
@ -200,7 +203,16 @@ const handleUse = (item: ImageSearchItem) => {
|
||||
}
|
||||
|
||||
const handleView = (item: ImageSearchItem) => {
|
||||
emit('view', item)
|
||||
// 从 business_data 获取跳转 URL
|
||||
const url = item.business_data?.url
|
||||
if (url) {
|
||||
router.push(url)
|
||||
} else {
|
||||
// 兜底:使用 product_name 作为 keyword 搜索
|
||||
ElMessage.info(`未找到详情页链接,已将 "${item.product_name}" 作为关键词搜索`)
|
||||
emit('view', item)
|
||||
}
|
||||
handleClose()
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
|
||||
Reference in New Issue
Block a user