2025-06-22 23:08:40 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="web-search-result">
|
|
|
|
|
<div class="search-header">
|
|
|
|
|
<h4><GlobalOutlined /> 网页搜索结果</h4>
|
|
|
|
|
<div class="search-meta">
|
|
|
|
|
<span class="query-text">查询: {{ data.query }}</span>
|
|
|
|
|
<span class="response-time">响应时间: {{ data.response_time }}s</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="search-results">
|
|
|
|
|
<div
|
|
|
|
|
v-for="(result, index) in data.results"
|
|
|
|
|
:key="index"
|
|
|
|
|
class="search-result-item"
|
|
|
|
|
>
|
|
|
|
|
<div class="result-header">
|
|
|
|
|
<h5 class="result-title">
|
|
|
|
|
<a :href="result.url" target="_blank" rel="noopener noreferrer">
|
|
|
|
|
{{ result.title }}
|
|
|
|
|
</a>
|
|
|
|
|
</h5>
|
|
|
|
|
<span class="result-score">相关度: {{ (result.score * 100).toFixed(1) }}%</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="result-meta">
|
|
|
|
|
<!-- <span class="result-url">{{ result.url }}</span> -->
|
|
|
|
|
<span v-if="result.published_date" class="result-date">
|
|
|
|
|
{{ formatDate(result.published_date) }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="result-content">
|
|
|
|
|
{{ result.content }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-if="data.results.length === 0" class="no-results">
|
|
|
|
|
<p>未找到相关搜索结果</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { GlobalOutlined } from '@ant-design/icons-vue'
|
2025-10-13 15:08:54 +08:00
|
|
|
import { parseToShanghai } from '@/utils/time'
|
2025-06-22 23:08:40 +08:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
data: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const formatDate = (dateString) => {
|
|
|
|
|
if (!dateString) return ''
|
2025-10-13 15:08:54 +08:00
|
|
|
const parsed = parseToShanghai(dateString)
|
|
|
|
|
if (!parsed) return ''
|
|
|
|
|
return parsed.format('YYYY年MM月DD日')
|
2025-06-22 23:08:40 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.web-search-result {
|
|
|
|
|
background: var(--gray-0);
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
|
|
.search-header {
|
|
|
|
|
padding: 12px 16px;
|
2025-08-27 09:57:29 +08:00
|
|
|
background: var(--gray-25);
|
2025-06-22 23:08:40 +08:00
|
|
|
|
|
|
|
|
h4 {
|
|
|
|
|
margin: 0 0 6px 0;
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 6px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-meta {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 16px;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
|
|
|
|
|
.query-text {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: var(--gray-800);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-results {
|
|
|
|
|
padding: 8px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-result-item {
|
|
|
|
|
padding: 12px;
|
2025-11-05 02:05:23 +08:00
|
|
|
border-bottom: 1px solid var(--gray-200);
|
2025-06-22 23:08:40 +08:00
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
2025-11-05 02:05:23 +08:00
|
|
|
&:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-22 23:08:40 +08:00
|
|
|
.result-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
2025-11-05 02:05:23 +08:00
|
|
|
align-items: center;
|
2025-06-22 23:08:40 +08:00
|
|
|
|
|
|
|
|
.result-title {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
a {
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
2025-07-26 03:36:54 +08:00
|
|
|
color: var(--main-color);
|
2025-06-22 23:08:40 +08:00
|
|
|
text-decoration: underline;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.result-score {
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
color: var(--gray-600);
|
2025-08-27 09:57:29 +08:00
|
|
|
background: var(--gray-50);
|
2025-11-05 02:05:23 +08:00
|
|
|
padding: 0px 6px;
|
2025-06-22 23:08:40 +08:00
|
|
|
border-radius: 10px;
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.result-meta {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
|
|
|
|
.result-url {
|
|
|
|
|
color: var(--main-400);
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.result-date {
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.result-content {
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
display: -webkit-box;
|
2025-11-05 02:05:23 +08:00
|
|
|
line-clamp: 2;
|
|
|
|
|
-webkit-line-clamp: 2;
|
2025-06-22 23:08:40 +08:00
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.no-results {
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
padding: 20px;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-13 15:08:54 +08:00
|
|
|
</style>
|