<route lang="json5" type="page">
{
  style: {
    navigationBarTitleText: '测评结果',
  },
}
</route>

<template>
  <scroll-view scroll-y class="bg-[#f8f8f8] h-screen">
    <view class="px-[32rpx] mt-[32rpx] flex flex-col gap-[16rpx]">
      <view
        v-for="(item, index) in list"
        :key="index"
        class="flex gap-[24rpx] wish-border justify-between p-[32rpx] rounded-[8rpx]"
        @click="useRouterDetail(item)"
      >
        <view class="flex flex-col gap-[14rpx]">
          <text class="text-[#303030] text-[32rpx] font-semibold">
            {{ item.title }}
          </text>
          <text class="text-[22rpx] text-[#303030]">{{ item.createTime || '时间消失了' }}</text>
        </view>
      </view>
      <view class="flex flex-col items-center justify-center mt-[40%]" v-if="list.length === 0">
        <image
          src="data:image/png;base64,[encoded data, 7048 characters]"
          mode="scaleToFill"
          class="w-[240rpx] h-[240rpx]"
        />
        <text class="text-[28rpx] text-[#aaa]">没有数据哦~</text>
      </view>
    </view>
  </scroll-view>
</template>

<script setup lang="ts">
import { getMyBusReports } from '@/service/index/api'
import { useUserStore } from '@/store'
import { useRouterDetail } from './useRouterDetail'

const userStore = useUserStore()

const list = ref([])

onShow(() => {
  getMyBusReports({ CustomId: userStore.userInfo?.estimatedAchievement.wxId }).then((res) => {
    if (res.code === 200) {
      list.value = (res.result as { customReports: any[] }).customReports
    }
  })
})
</script>

<style lang="scss" scoped>
.wish-border {
  background-color: #ffffff;
  border-radius: 8rpx;
}
</style>
