<template>
  <section class="py-10">
    <a-typography-title :level="1" class="!mb-2">站内搜索</a-typography-title>
    <a-typography-paragraph class="!text-gray-600 !mb-6">
      支持按栏目 / 时间 / 关键词筛选（待接入全文检索与权限控制）。
    </a-typography-paragraph>

    <a-input-search
      v-model:value="q"
      placeholder="请输入关键词"
      :allow-clear="true"
      :maxlength="50"
      enter-button="搜索"
      @search="onSearch"
    />

    <a-card class="mt-6" size="small">
      <div class="text-sm text-gray-600">
        当前关键词：<span class="font-mono">{{ q || '-' }}</span>
      </div>
    </a-card>

    <a-result class="mt-6" status="info" title="搜索结果建设中" sub-title="接入全文检索后将在此展示结构化结果列表。" />
  </section>
</template>

<script setup lang="ts">
import { usePageSeo } from '@/composables/usePageSeo'

const route = useRoute()
const q = ref(String(route.query.q || '').trim())

usePageSeo({ title: '站内搜索', description: '站内搜索与筛选入口。', path: '/search' })

function onSearch(value: string) {
  const next = String(value || '').trim()
  q.value = next
  navigateTo({ path: '/search', query: next ? { q: next } : {} })
}
</script>

