<template>
  <div class="banner m-auto sm:pt-[60px] pt-[47px] relative sm:flex">
    <template v-if="layout && layout.showBanner">
      <el-image :src="layout?.photo || config.subpageBanner" :class="layout?.style" class="sm:h-auto"></el-image>
      <div class="banner-bar absolute top-0 w-full mt-[60px] sm:flex hidden">
        <div class="banner-text py-12 md:w-screen-xl m-auto opacity-90 flex flex-col justify-center">
          <div class="keywords my-4 text-3xl">{{ layout?.name }}</div>
          <div class="description mb-4 mt-1 text-xl max-w-3xl text-gray-600">{{ layout?.description }}</div>
          <div class="buy-btn">
            <el-button v-if="layout.demoUrl" @click="openSpmUrl(layout.demoUrl)" type="primary">演示地址</el-button>
            <el-button v-if="layout.buyUrl" type="warning" @click="openSpmUrl(layout.buyUrl)">立即购买</el-button>
            <el-button v-if="layout.docUrl" @click="openSpmUrl(layout.docUrl)">产品文档</el-button>
          </div>
          <div class="demo-account mt-3 text-gray-400" v-if="layout?.account">账号密码：{{ layout.account }}</div>
        </div>
      </div>
    </template>
  </div>
</template>

<script setup lang="ts">
import {useConfigInfo} from "~/composables/configState";
import {openSpmUrl} from "~/utils/common";

  withDefaults(
    defineProps<{
      layout?: any;
    }>(),
    {}
);

const config = useConfigInfo();

</script>
