<template>
  <van-swipe-cell>
    <div class="relative group flex space-x-10 p-10 mb-10 bg-[#fff] rounded-xl">
      <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="">
          <div class="mt-15 line-clamp-2 break-all text-xl font-semibold text-black-3">
            {{ data?.projectTitle || '未命名草稿' }}
          </div>

          <div class="line-clamp-3 text-sm text-red-600">
            审核未通过：{{ data?.reason || '内容可能涉嫌色情淫秽传播，请修改内容' }}
          </div>
        </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>
    <template #right>
      <van-button square text="编辑" @click="handleWrite" type="warning" class="delete-button" />
      <van-button
        square
        text="删除"
        @click="$emit('onDelete')"
        type="danger"
        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: () => ({})
  }
})

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

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