<template>
  <div v-loading="loading" class="policy-container flx-center">
    <div class="container">
      <img
        :src="baseURL + '/' + policyData?.HbData?.[0].FPOSTERPICTURE"
        height="560"
        style="width: 100%"
      />
      <el-input v-model="searchValue" placeholder="搜索关键词" @change="search">
        <template #suffix>
          <el-icon size="24" style="cursor: pointer" @click="search"><i-ep-Search /></el-icon>
        </template>
      </el-input>
      <div class="flx-justify-between" style="margin-bottom: 64px">
        <policy
          title="南山就业政策公告"
          :list="policyData?.GgData"
          is-more
          :min-height="401"
          @change="handleChange"
        />
        <policy
          title="南山就业活动"
          :list="policyData?.HdData"
          is-more
          :min-height="401"
          @change="handleChange"
        />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { baseURL } from '@/services'
import { getPolicy } from '@/services/api/policy'
import policy from '@/components/policy.vue'

const router = useRouter()

const searchValue = ref()
const loading = ref(true)
const queryList = ref({ pageIndex: 1, pageSize: 10 })
const policyData: any = ref()

const search = () => {
  console.log(searchValue.value)
}
const handleChange = (row: any) => {
  router.push({ path: '/commonDetail', query: { FID: row.FID, FormType: 'B', FTITLE: row.FTITLE } })
}

const init = async () => {
  const res: any = await getPolicy(queryList.value)
  if (res.code === 200) {
    console.log(res)
    policyData.value = res.data
    loading.value = false
  }
}

init()
</script>

<style lang="scss" scoped>
@import url(./index.scss);
</style>
