<template>
  <!-- Banner -->
  <Banner :data="form" />

  <!-- 容器 -->
  <div class="container md:w-3/4 m-auto">
    <div class="flex flex-col">
      <Breadcrumb :title="`站内搜索`" />
    </div>
  </div>

  <div v-if="!form">
    <el-empty description="404 页面不存在"></el-empty>
  </div>
</template>
<script setup lang="ts">
import type {Design} from "~/api/cms/design/model";
import type {ApiResult} from "~/api";
import {useServerRequest} from "~/composables/useServerRequest";
import {useConfigInfo, useToken} from "~/composables/configState";
import Breadcrumb from "~/components/Breadcrumb.vue";
import type {BreadcrumbItem} from "~/types/global";
import type {Navigation} from "~/api/cms/navigation/model";

const route = useRoute();
const { params } = route;
const { custom: path } = params;

// 网站配置信息
const config = useConfigInfo();
const token = useToken();
// 页面信息
const form = ref<Navigation | any>();
const breadcrumb = ref<BreadcrumbItem>();

// 请求数据
const { data: nav } = await useServerRequest<ApiResult<Navigation>>('/cms/navigation/getNavigationByPath',{
  query: {
    path: '/' + path
  }
})

if (nav.value) {
  // seo
  form.value = nav.value.data
  if(form.value){
    useHead({
      title: `${form.value.title} - 网宿软件`,
      meta: [{ name: form.value.design.keywords, content: form.value.design.description }],
      bodyAttrs: {
        class: "page-container",
      },
      script: [
        {
          children: "console.log('Hello World')",
        },
      ],
    });
    // 面包屑
    breadcrumb.value = form.value.breadcrumb
  }
}
</script>

<style scoped lang="scss">

</style>
