<script setup lang="ts">
import { formatTime } from '@/utils/formatTime'
import { getDick, getNews, type NewsData } from '@/api/home'
import { queryFieldMethod } from '@/utils/queryFieldMethod'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const financialData = ref<NewsData[]>([])
const financingLoans = ref<NewsData[]>([])

let router = useRouter()

const toDetail = (id:number|undefined)=>{
  if(!id){
    return
  }
  router.push({
    path:'/newsDetail',
    query:{
      id
    }
  })
}
const dickMapAll = ref<Map<string,string>>(new Map());
const knowMore = (dickMapKey:string|undefined,dickMapValue:string|undefined)=>{
  console.log(dickMapKey)
  router.push({
    path:'/creditDynamicsDetail',
    query:{
      dickMapKey,
      dickMapValue
    }
  });
}
const init =async ()=>{
  const {data} = await getDick()
  const dickMap = data.reduce((acc:Map<string,string>, cur:{dictLabel:string,dictValue:string}) => {
    const key = cur.dictLabel;
    acc.set(key, cur.dictValue);
    return acc;
  },new Map())
  dickMapAll.value = dickMap
  console.log(dickMap)
  //获取政府项目资金需求 数据
  const res1 = await getNews(queryFieldMethod('special_column',dickMap.get('政府项目资金需求')))
  if(res1.code == 200){
    financialData.value = res1.data.slice(0,5);
  }
  //获取园区企业融资贷款 数据
  const res2 = await getNews(queryFieldMethod('special_column',dickMap.get('园区企业融资贷款')))
  if(res2.code == 200){
    financingLoans.value = res2.data.slice(0,5);
  }
}
const toLink = (index:number)=>{
  if(index == 1){
    window.open("http://hntzxm.fgw.hunan.gov.cn/home")
  }else if(index == 2){
    window.open("http://220.168.30.70:28889/portal_v2.jsp")
  }else if(index == 3){
    window.open("https://222.244.103.250:8181/pmp/a/login;jsessionid=fa168d5f90a3ed7b76a9bd5f2442#")
  }
}
const toOrtherLink = (index:number)=>{
  if(index == 1){
    window.open("https://credit.fgw.hunan.gov.cn/xyd/feature")
  }else if(index == 2){
    window.open("https://smecmd.hunanfae.com/main/cms/static/html/loan.html")
  }else if(index == 3){
    window.open("https://credit.fgw.hunan.gov.cn/xyd/financeMarketDetail?id=414&isShow=ck")
  }else if(index == 4){
    window.open('https://credit.fgw.hunan.gov.cn/xyd/financeMarketDetail?id=26&isShow=ck')
  }
}
const toLink1 = ()=>{
  window.open("https://www.hhjrfw.com/")
}
const toLink2 = ()=>{
  window.open("https://credit.fgw.hunan.gov.cn/xyd/provincialIndex")
}
init();
</script>

<template>
  <div class="wiseEnterpriseContainer">
    <div class="w-912px ml-auto mr-auto pt-20px mb-20px text-14px">
      你所在的位置：<span class="cursor-pointer" @click="$router.push('/')">首页</span> > <span class="color-#006eff">信用惠企</span>
    </div>
<!--    <div class="w-912px h-100px mr-a ml-a bg-white mt-10px bg-cover text-50px blod text-center line-height-90px cursor-pointer mb-25px" @click="toLink2">湖南省企业融资综合信用服务平台</div>-->
<!--    <div class="w-912px h-100px mr-a ml-a bg-white mt-10px bg-cover text-50px blod text-center line-height-90px cursor-pointer mb-25px" @click="toLink1">怀化市综合金融服务平台</div>-->
    <div>
      <div class="w-912px bg-white ml-a mr-a text-16px pt-12px mb-10px line-height-44px border-dashed border-#e5e5e5 border-b-5px">
        <div class="w-240px border-solid border-#00306e border-b-5px relative">
          <img class="w-21px h-21px m-3px " src="/src/assets/img/信用小图标.png" />
          <span class="color-#003aac text-16px">政府项目资金需求发布及链接</span>
          <span class="absolute right--650px top-10px cursor-pointer text-#959595" @click="knowMore(dickMapAll.get('政府项目资金需求'),'政府项目资金需求')">查看更多 ></span>
        </div>
        <div v-for="(item,index) in financialData" :key="index">
          <div class="flex justify-between">
            <div class="ml-20px cursor-pointer" @click="toDetail(item.id)">{{item.title}}</div>
            <div class="color-gray mr-20px">{{formatTime(item.date)}}</div>
          </div>
          <div class="h-1px bg-gray"></div>
        </div>
      </div>
      <div>
        <div class="w-912px ml-auto mr-auto mt-20px flex flex-wrap justify-between bg-white">
          <div class="w-174px h-116px mr-10px relative cursor-pointer" @click="toLink(1)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">湖南省发改委项目审批</div>
          </div>
          <div class="w-174px h-116px mr-10px relative cursor-pointer" @click="toLink(2)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">湖南省财政厅项目资金管理</div>
          </div>
          <div class="w-174px h-116px mr-10px relative cursor-pointer" @click="toLink(3)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">湖南省工信厅项目管理</div>
          </div>
          <div class="w-174px h-116px mr-10px relative">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">待开发</div>
          </div>
          <div class="w-174px h-116px relative">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">待开发</div>
          </div>
        </div>
      </div>
    </div>
    <div>
      <div class="w-912px bg-white ml-a mr-a text-16px mt-12px mb-10px line-height-44px border-dashed border-#e5e5e5 border-b-5px">
        <div class="w-240px border-solid border-#00306e border-b-5px relative">
          <img class="w-21px h-21px m-3px " src="/src/assets/img/信用小图标.png" />
          <span class="color-#003aac text-16px">园区企业融资贷款</span>
          <span class="absolute right--650px top-10px cursor-pointer text-#959595" @click="knowMore(dickMapAll.get('园区企业融资贷款'),'园区企业融资贷款')">查看更多 ></span>
        </div>
        <div v-for="(item,index) in financingLoans" :key="index">
          <div class="flex justify-between">
            <div class="ml-20px cursor-pointer" @click="toDetail(item.id)">{{item.title}}</div>
            <div class="color-gray mr-20px">{{formatTime(item.date)}}</div>
          </div>
          <div class="h-1px bg-gray"></div>
        </div>
      </div>
      <div>
        <div class="w-912px ml-auto mr-auto mt-20px flex flex-wrap justify-between bg-white">
          <div class="w-174px h-116px mr-10px relative cursor-pointer" @click="toOrtherLink(1)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">制造业中长期贷款</div>
          </div>
          <div class="w-174px h-116px mr-10px relative cursor-pointer" @click="toOrtherLink(2)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">潇湘财银贷</div>
          </div>
          <div class="w-174px h-116px mr-10px relative cursor-pointer" @click="toOrtherLink(3)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">农业银行流水贷</div>
          </div>
          <div class="w-174px h-116px mr-10px relative cursor-pointer" @click="toOrtherLink(4)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">湖南银行流水贷</div>
          </div>
          <div class="w-174px h-116px relative cursor-pointer" @click="toOrtherLink(5)">
            <img class="w-100% h-100%" src="/src/assets/img/首页背景.png" />
            <div class="absolute bottom-0 text-center w-100% h-22px text-white text-14px pt-4px pb-4px bg-#00306e bg-opacity-72">待开发</div>
          </div>
        </div>
      </div>
    </div>
<!--    <div class="flex justify-between w-912px mr-a ml-a">-->
<!--      <div class="w-603px pl-24px pr-24px pt-30px text-black bg-white">-->
<!--        <div>-->
<!--          <div class="text-16px">文本政策</div>-->
<!--          <div class="text-13px line-height-23x text-#464646 line-clamp-4 mt-8px">-->
<!--            文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策-->
<!--          </div>-->
<!--          <div class="flex justify-between">-->
<!--            <div class="flex mt-15px">-->
<!--              <div class="text-13px rounded-5 p-3px border-solid border-1px border-#ff9900 color-#ff9900 ">文本服务-->
<!--              </div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--            </div>-->
<!--            <div class="mt-15px text-#858585 text-13px">-->
<!--              <div class="text-13px">文本|9999/99/99</div>-->
<!--            </div>-->
<!--          </div>-->
<!--          <div class="h-1px bg-#e9e9e9 mt-24px mb-24px"></div>-->
<!--        </div>-->
<!--        <div>-->
<!--          <div class="text-16px">文本政策</div>-->
<!--          <div class="text-13px line-height-23x text-#464646 line-clamp-4 mt-8px">-->
<!--            文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策-->
<!--          </div>-->
<!--          <div class="flex justify-between">-->
<!--            <div class="flex mt-15px">-->
<!--              <div class="text-13px rounded-5 p-3px border-solid border-1px border-#ff9900 color-#ff9900 ">文本服务-->
<!--              </div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--            </div>-->
<!--            <div class="mt-15px text-#858585 text-13px">-->
<!--              <div class="text-13px">文本|9999/99/99</div>-->
<!--            </div>-->
<!--          </div>-->
<!--          <div class="h-1px bg-#e9e9e9 mt-24px mb-24px"></div>-->
<!--        </div>-->
<!--        <div>-->
<!--          <div class="text-16px">文本政策</div>-->
<!--          <div class="text-13px line-height-23x text-#464646 line-clamp-4 mt-8px">-->
<!--            文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策-->
<!--          </div>-->
<!--          <div class="flex justify-between">-->
<!--            <div class="flex mt-15px">-->
<!--              <div class="text-13px rounded-5 p-3px border-solid border-1px border-#ff9900 color-#ff9900 ">文本服务-->
<!--              </div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--            </div>-->
<!--            <div class="mt-15px text-#858585 text-13px">-->
<!--              <div class="text-13px">文本|9999/99/99</div>-->
<!--            </div>-->
<!--          </div>-->
<!--          <div class="h-1px bg-#e9e9e9 mt-24px mb-24px"></div>-->
<!--        </div>-->
<!--        <div>-->
<!--          <div class="text-16px">文本政策</div>-->
<!--          <div class="text-13px line-height-23x text-#464646 line-clamp-4 mt-8px">-->
<!--            文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策文本政策-->
<!--          </div>-->
<!--          <div class="flex justify-between">-->
<!--            <div class="flex mt-15px">-->
<!--              <div class="text-13px rounded-5 p-3px border-solid border-1px border-#ff9900 color-#ff9900 ">文本服务-->
<!--              </div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--              <div class="text-13px rounded-5 p-3px ">文本服务</div>-->
<!--            </div>-->
<!--            <div class="mt-15px text-#858585 text-13px">-->
<!--              <div class="text-13px">文本|9999/99/99</div>-->
<!--            </div>-->
<!--          </div>-->
<!--          <div class="h-1px bg-#e9e9e9 mt-24px mb-24px"></div>-->
<!--        </div>-->
<!--      </div>-->
<!--      <div class="w-294px">-->
<!--        <div class="bg-white">-->
<!--          <div class="w-117px border-solid border-#003aac border-b-3px h-32px">-->
<!--            <img src="/src/assets/img/小图标1.png" />-->
<!--            <span class="text-#003aac text-16px font-bold ">省内文本</span>-->
<!--          </div>-->
<!--          <div class="relative mb-15px">-->
<!--            <input class="w-266px h-31px bg-#f3f3f3 m-14px mt-30px mb-30px" placeholder="请输入关键字" />-->
<!--            <button class="absolute right-13px top-31px">-->
<!--              <svg t="1718242035057" class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="19" height="19">-->
<!--                <path-->
<!--                  d="M469.333333 85.333333a384 384 0 0 1 300.032 623.658667l139.306667 139.349333a42.666667 42.666667 0 1 1-60.330667 60.330667l-139.349333-139.306667A384 384 0 1 1 469.333333 85.333333z m0 85.333334a298.666667 298.666667 0 1 0 0 597.333333 298.666667 298.666667 0 0 0 0-597.333333z"-->
<!--                  fill="#000000" p-id="1555"></path>-->
<!--              </svg>-->
<!--            </button>-->
<!--          </div>-->
<!--        </div>-->
<!--        <div class="bg-white">-->
<!--          <div class="w-117px border-solid border-#003aac border-b-3px h-32px">-->
<!--            <img src="/src/assets/img/小图标1.png" />-->
<!--            <span class="text-#003aac text-16px font-bold ">绿色文本</span>-->
<!--          </div>-->
<!--          <div class="mt-20px ml-10px flex flex-wrap w-100%">-->
<!--            <div class="m-10px text-12px color-#030303 w-118px h-52px line-height-52px bg-#cce2ff text-center">文本</div>-->
<!--            <div class="m-10px text-12px color-#030303 w-118px h-52px line-height-52px bg-#ecf4ff text-center">文本</div>-->
<!--            <div class="m-10px text-12px color-#030303 w-118px h-52px line-height-52px bg-#cce2ff text-center">文本</div>-->
<!--            <div class="m-10px text-12px color-#030303 w-118px h-52px line-height-52px bg-#ecf4ff text-center">文本</div>-->
<!--          </div>-->
<!--        </div>-->
<!--        <div class="bg-white mt-15px">-->
<!--          <div class="w-117px border-solid border-#003aac border-b-3px h-32px">-->
<!--            <img src="/src/assets/img/小图标1.png" />-->
<!--            <span class="text-#003aac text-16px font-bold ">最新文本</span>-->
<!--          </div>-->
<!--          <div>-->
<!--            <div class="mt-20px mb-20px">-->
<!--              <div class="w-266px mr-auto ml-auto line-clamp-2 bold text-13px">文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本</div>-->
<!--              <div class="text-#ff9900 text-13px cursor-pointer text-right mt-5px">查看更多></div>-->
<!--            </div>-->
<!--            <div class="h-1px bg-gray"></div>-->
<!--          </div>-->
<!--          <div>-->
<!--            <div class="mt-20px mb-20px">-->
<!--              <div class="w-266px mr-auto ml-auto line-clamp-2 bold text-13px">文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本</div>-->
<!--              <div class="text-#ff9900 text-13px cursor-pointer text-right mt-5px">查看更多></div>-->
<!--            </div>-->
<!--            <div class="h-1px bg-gray"></div>-->
<!--          </div>-->
<!--          <div>-->
<!--            <div class="mt-20px mb-20px">-->
<!--              <div class="w-266px mr-auto ml-auto line-clamp-2 bold text-13px">文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本</div>-->
<!--              <div class="text-#ff9900 text-13px cursor-pointer text-right mt-5px">查看更多></div>-->
<!--            </div>-->
<!--            <div class="h-1px bg-gray"></div>-->
<!--          </div>-->
<!--          <div>-->
<!--            <div class="mt-20px mb-20px">-->
<!--              <div class="w-266px mr-auto ml-auto line-clamp-2 bold text-13px">文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本</div>-->
<!--              <div class="text-#ff9900 text-13px cursor-pointer text-right mt-5px">查看更多></div>-->
<!--            </div>-->
<!--            <div class="h-1px bg-gray"></div>-->
<!--          </div>-->
<!--          <div>-->
<!--            <div class="mt-20px mb-20px">-->
<!--              <div class="w-266px mr-auto ml-auto line-clamp-2 bold text-13px">文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本</div>-->
<!--              <div class="text-#ff9900 text-13px cursor-pointer text-right mt-5px">查看更多></div>-->
<!--            </div>-->
<!--            <div class="h-1px bg-gray"></div>-->
<!--          </div>-->
<!--        </div>-->
<!--      </div>-->
<!--    </div>-->
  </div>
</template>

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