<template>
  <van-swipe-cell>
    <div class="relative flex mb-10 border-[#fff] space-x-10 p-10 rounded-xl bg-[#FFF]">
      <img
        :src="formatImgSrc(data?.tourismUrlsAfterConvert) || noteDraftCoverBg"
        class="aspect-[4/3] h-109 shrink-0 object-cover"
      />

      <div class="flex w-0 flex-1 flex-col justify-between">
        <div class="mt-15">
          <div class="line-clamp-1 break-all text-base font-semibold text-black-3">
            {{ data?.projectTitle || '未命名草稿' }}
          </div>
          <div class="mt-2 text-sm text-black-3">
            {{ $dayjs(data?.updateTime).format('YYYY/MM/DD') }}
          </div>
        </div>

        <div class="absolute top-1/2 right-0 -translate-y-1/2 z-1 w-11 h-10">
          <img class="w-full h-full" :src="left_arrow" alt="" />
        </div>
      </div>
    </div>

    <template #right>
      <van-button
        square
        text="撤销审核"
        @click="$emit('onRevoke')"
        type="warning"
        class="delete-button"
      />
    </template>
  </van-swipe-cell>
</template>

<script setup>
import noteDraftCoverBg from '~/assets/img/note-create/note_draft_cover_bg.jpg'
import left_arrow from '~/assets/img/note-create/left.svg'
const props = defineProps({
  data: {
    type: Object,
    default: () => ({})
  }
})

defineEmits(['onRevoke'])

function handleWrite() {
  navigateTo({
    path: '/note-create',
    query: {
      id: props.data.id
    }
  })
}
</script>

<style lang="scss" scoped>
.delete-button {
  height: 100%;
}
</style>
