<template>
    <div v-if="!loading">
        <div class="wrap-box">
            <Introduce :homeData="homeData"></Introduce>
            <IndustrialPark :projectItem="registrationPackage"></IndustrialPark>
            <IndustrialCluster :industrialAllocation="industrialAllocation"></IndustrialCluster>
        </div>
        <div class="wrap-box">
            <div class="title">政策优势</div>
            <Policy v-for="(item, index) in policy" :key="index" :policyItem="item"></Policy>
            <PicturePolicy
                :policySupportKeyIndustries="homeData.policySupportKeyIndustries"
                :domesticTalentIntroduction="homeData.domesticTalentIntroduction"
            ></PicturePolicy>
            <DetailPolicy
                v-for="(item, index) in detailPolicy"
                :key="index"
                :detailPolicyItem="item"
            ></DetailPolicy>
            <OtherPolicy></OtherPolicy>
        </div>
    </div>
</template>
<script setup>
import Introduce from "./project/Introduce.vue";
import IndustrialPark from "./project/IndustrialPark.vue";
import IndustrialCluster from "./project/IndustrialCluster.vue";
import Policy from "./policy/Policy.vue";
import PicturePolicy from "./policy/PicturePolicy.vue";
import DetailPolicy from "./policy/DetailPolicy.vue";
import OtherPolicy from "./policy/OtherPolicy.vue";
import { getHomeData } from "@/views/pc/home/home";
import { onBeforeMount } from "vue";
const {
    getAreaIndustrialAllocation,
    setDetailPolicy,
    setPolicy,
    updatePageView,
    getRegistrationPackage,
} = getHomeData();
let homeData = ref({});
let industrialAllocation = ref([]);
let policy = ref([]);
let detailPolicy = ref([]);
let registrationPackage = ref({});

const loading = ref(true);
import useHomeStore from "@/store/module/home";
const homeStore = useHomeStore();
onBeforeMount(async () => {
    loading.value = true;
    homeData.value = homeStore.homeData.value;
    policy = setPolicy(homeData.value);
    detailPolicy = setDetailPolicy(homeData.value);
    industrialAllocation.value = await getAreaIndustrialAllocation();
    registrationPackage.value = await getRegistrationPackage();
    loading.value = false;
    updatePageView(homeData.value.areaInfoManagementId);
});
</script>

<style lang="scss" scoped>
.wrap-box {
    padding: 10px 15px;
    background: #fff;
    @include border-box;
}
.title {
    @include font(16px, $color-black);
    font-weight: bold;
    margin-bottom: 10px;
}
</style>
