ImageDetailDrawer.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <el-drawer
  3. v-model="showDrawer"
  4. title="图片详细"
  5. @close="handleDrawerClose"
  6. custom-class="drawer-class"
  7. >
  8. <!-- 图片 -->
  9. <div class="item">
  10. <!-- <div class="header">-->
  11. <!-- <div>图片</div>-->
  12. <!-- <div>-->
  13. <!-- </div>-->
  14. <!-- </div>-->
  15. <div class="body">
  16. <!-- TODO @fan: 要不,这里只展示图片???不用 ImageTaskCard -->
  17. <ImageTaskCard :image-detail="imageDetail" />
  18. </div>
  19. </div>
  20. <!-- 时间 -->
  21. <div class="item">
  22. <div class="tip">时间</div>
  23. <div class="body">
  24. <div>提交时间:{{ imageDetail.createTime }}</div>
  25. <div>生成时间:{{ imageDetail.finishTime }}</div>
  26. </div>
  27. </div>
  28. <!-- 模型 -->
  29. <div class="item">
  30. <div class="tip">模型</div>
  31. <div class="body">
  32. {{ imageDetail.model }}({{ imageDetail.height }}x{{ imageDetail.width }})
  33. </div>
  34. </div>
  35. <!-- 提示词 -->
  36. <div class="item">
  37. <div class="tip">提示词</div>
  38. <div class="body">
  39. {{ imageDetail.prompt }}
  40. </div>
  41. </div>
  42. <!-- 地址 -->
  43. <div class="item">
  44. <div class="tip">图片地址</div>
  45. <div class="body">
  46. {{ imageDetail.picUrl }}
  47. </div>
  48. </div>
  49. <!-- 风格 -->
  50. <div class="item" v-if="imageDetail?.options?.style">
  51. <div class="tip">风格</div>
  52. <div class="body">
  53. <!-- TODO @fan:貌似需要把 imageStyleList 搞到 api/image/index.ts 枚举起来? -->
  54. <!-- TODO @fan:这里的展示,可能需要按照平台做区分 -->
  55. {{ imageDetail?.options?.style }}
  56. </div>
  57. </div>
  58. </el-drawer>
  59. </template>
  60. <script setup lang="ts">
  61. import { ImageApi, ImageVO } from '@/api/ai/image'
  62. import ImageTaskCard from './ImageTaskCard.vue'
  63. const showDrawer = ref<boolean>(false) // 是否显示
  64. const imageDetail = ref<ImageVO>({} as ImageVO) // 图片详细信息
  65. const props = defineProps({
  66. show: {
  67. type: Boolean,
  68. require: true,
  69. default: false
  70. },
  71. id: {
  72. type: Number,
  73. required: true
  74. }
  75. })
  76. /** 抽屉 - close */
  77. const handleDrawerClose = async () => {
  78. emits('handleDrawerClose')
  79. }
  80. /** 获取 - 图片 detail */
  81. const getImageDetail = async (id) => {
  82. // 获取图片详细
  83. imageDetail.value = await ImageApi.getImageMy(id)
  84. }
  85. /** 任务 - detail */
  86. const handleTaskDetail = async () => {
  87. showDrawer.value = true
  88. }
  89. // watch show
  90. const { show } = toRefs(props)
  91. watch(show, async (newValue, oldValue) => {
  92. showDrawer.value = newValue as boolean
  93. })
  94. // watch id
  95. const { id } = toRefs(props)
  96. watch(id, async (newVal, oldVal) => {
  97. if (newVal) {
  98. await getImageDetail(newVal)
  99. }
  100. })
  101. //
  102. const emits = defineEmits(['handleDrawerClose'])
  103. //
  104. onMounted(async () => {})
  105. </script>
  106. <style scoped lang="scss">
  107. .item {
  108. margin-bottom: 20px;
  109. width: 100%;
  110. overflow: hidden;
  111. word-wrap: break-word;
  112. .header {
  113. display: flex;
  114. flex-direction: row;
  115. justify-content: space-between;
  116. }
  117. .tip {
  118. font-weight: bold;
  119. font-size: 16px;
  120. }
  121. .body {
  122. margin-top: 10px;
  123. color: #616161;
  124. .taskImage {
  125. border-radius: 10px;
  126. }
  127. }
  128. }
  129. </style>