<script setup lang="ts">
import { useRoute, useRouter } from 'vue-router'
import { getCompanyDetailById } from '@/views/companyDetail/type'
import { companyDetailMap } from '@/views/companyDetail/map'
import { ref } from 'vue'

const router = useRouter()
const route = useRoute()
const showCurrentCompanyDetail = ref<Map<string,string>>(new Map());
const init =async ()=>{
  const res = await getCompanyDetailById(route.query.id as string);
  console.log(res.data)
  console.log(companyDetailMap)
  companyDetailMap.forEach((value,key)=>{
    showCurrentCompanyDetail.value.set(value,res.data[key]);
  })
}
init()
</script>

<template>
 <div class="companyDetailContainer">
   <div class="w-912px ml-auto mr-auto pt-20px pb-20px text-14px">
     你所在的位置：<span class="cursor-pointer" @click="router.push('/home')">首页</span> > <span class="color-#006eff">公司详情</span>
   </div>
   <div class="grid grid-cols-2 gap-x-10px w-912px ml-a mr-a bg-white">
    <div v-for="(item,index) in showCurrentCompanyDetail" :key="index" class="flex">
      <div class="w-30% p-20px border-solid border-1px border-#e5e5e5">{{item[0]}}</div>
      <div class="w-70% p-20px border-solid border-1px border-#e5e5e5">{{item[1]}}</div>
    </div>
   </div>
 </div>
</template>

<style scoped>
.companyDetailContainer{
  background-color: #ecf0f9;
}
</style>