ImageDetailDrawer.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <el-drawer
  3. v-model="showDrawer"
  4. title="图片详细"
  5. @close="handlerDrawerClose"
  6. >
  7. <div class="item">
  8. <div class="header">
  9. <div>图片</div>
  10. <div>
  11. <el-button class="btn" text :icon="Download" />
  12. <el-button class="btn" text :icon="Delete" />
  13. <el-button class="btn" text :icon="More" @click="handlerTaskDetail" />
  14. </div>
  15. </div>
  16. <div class="body">
  17. <ImageTaskCard :image-detail="imageDetail" />
  18. </div>
  19. </div>
  20. <div class="item">
  21. <div class="tip">提示词</div>
  22. <div class="body">
  23. {{imageDetail.prompt}}
  24. </div>
  25. </div>
  26. </el-drawer>
  27. </template>
  28. <script setup lang="ts">
  29. import {ImageApi, ImageDetailVO} from '@/api/ai/image';
  30. import ImageTaskCard from './ImageTaskCard.vue';
  31. import {Delete, Download, More} from "@element-plus/icons-vue";
  32. const showDrawer = ref<boolean>(false) // 是否显示
  33. const imageDetail = ref<ImageDetailVO>({} as ImageDetailVO) // 图片详细信息
  34. const props = defineProps({
  35. show: {
  36. type: Boolean,
  37. require: true,
  38. default: false
  39. }
  40. })
  41. /**
  42. * 抽屉 - close
  43. */
  44. const handlerDrawerClose = async () => {
  45. emits('handlerDrawerClose')
  46. }
  47. /**
  48. * 获取 - 图片 detail
  49. */
  50. const getImageDetail = async (id) => {
  51. // 获取图片详细
  52. imageDetail.value = await ImageApi.getImageDetail(id)
  53. }
  54. /**
  55. * 任务 - detail
  56. */
  57. const handlerTaskDetail = async () => {
  58. showDrawer.value = true
  59. }
  60. // watch
  61. const { show } = toRefs(props)
  62. watch(show, async (newValue, oldValue) => {
  63. showDrawer.value = newValue as boolean
  64. })
  65. //
  66. const emits = defineEmits(['handlerDrawerClose'])
  67. //
  68. onMounted(async () => {
  69. await getImageDetail(1)
  70. })
  71. </script>
  72. <style scoped lang="scss">
  73. .item {
  74. margin-bottom: 20px;
  75. .header {
  76. display: flex;
  77. flex-direction: row;
  78. justify-content: space-between;
  79. font-size: 16px;
  80. font-weight: bold;
  81. }
  82. .body {
  83. margin-top: 10px;
  84. color: #616161;
  85. }
  86. }
  87. .taskImage {
  88. border-radius: 10px;
  89. }
  90. </style>