提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
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="body"> |
|
11 |
<el-image |
|
12 |
class="image" |
|
13 |
:src="detail?.picUrl" |
|
14 |
:preview-src-list="[detail.picUrl]" |
|
15 |
preview-teleported |
|
16 |
/> |
|
17 |
</div> |
|
18 |
</div> |
|
19 |
<!-- 时间 --> |
|
20 |
<div class="item"> |
|
21 |
<div class="tip">时间</div> |
|
22 |
<div class="body"> |
|
23 |
<div>提交时间:{{ formatTime(detail.createTime, 'yyyy-MM-dd HH:mm:ss') }}</div> |
|
24 |
<div>生成时间:{{ formatTime(detail.finishTime, 'yyyy-MM-dd HH:mm:ss') }}</div> |
|
25 |
</div> |
|
26 |
</div> |
|
27 |
<!-- 模型 --> |
|
28 |
<div class="item"> |
|
29 |
<div class="tip">模型</div> |
|
30 |
<div class="body"> {{ detail.model }}({{ detail.height }}x{{ detail.width }}) </div> |
|
31 |
</div> |
|
32 |
<!-- 提示词 --> |
|
33 |
<div class="item"> |
|
34 |
<div class="tip">提示词</div> |
|
35 |
<div class="body"> |
|
36 |
{{ detail.prompt }} |
|
37 |
</div> |
|
38 |
</div> |
|
39 |
<!-- 地址 --> |
|
40 |
<div class="item"> |
|
41 |
<div class="tip">图片地址</div> |
|
42 |
<div class="body"> |
|
43 |
{{ detail.picUrl }} |
|
44 |
</div> |
|
45 |
</div> |
|
46 |
<!-- StableDiffusion 专属区域 --> |
|
47 |
<div |
|
48 |
class="item" |
|
49 |
v-if="detail.platform === AiPlatformEnum.STABLE_DIFFUSION && detail?.options?.sampler" |
|
50 |
> |
|
51 |
<div class="tip">采样方法</div> |
|
52 |
<div class="body"> |
|
53 |
{{ |
|
54 |
StableDiffusionSamplers.find( |
|
55 |
(item: ImageModelVO) => item.key === detail?.options?.sampler |
|
56 |
)?.name |
|
57 |
}} |
|
58 |
</div> |
|
59 |
</div> |
|
60 |
<div |
|
61 |
class="item" |
|
62 |
v-if=" |
|
63 |
detail.platform === AiPlatformEnum.STABLE_DIFFUSION && detail?.options?.clipGuidancePreset |
|
64 |
" |
|
65 |
> |
|
66 |
<div class="tip">CLIP</div> |
|
67 |
<div class="body"> |
|
68 |
{{ |
|
69 |
StableDiffusionClipGuidancePresets.find( |
|
70 |
(item: ImageModelVO) => item.key === detail?.options?.clipGuidancePreset |
|
71 |
)?.name |
|
72 |
}} |
|
73 |
</div> |
|
74 |
</div> |
|
75 |
<div |
|
76 |
class="item" |
|
77 |
v-if="detail.platform === AiPlatformEnum.STABLE_DIFFUSION && detail?.options?.stylePreset" |
|
78 |
> |
|
79 |
<div class="tip">风格</div> |
|
80 |
<div class="body"> |
|
81 |
{{ |
|
82 |
StableDiffusionStylePresets.find( |
|
83 |
(item: ImageModelVO) => item.key === detail?.options?.stylePreset |
|
84 |
)?.name |
|
85 |
}} |
|
86 |
</div> |
|
87 |
</div> |
|
88 |
<div |
|
89 |
class="item" |
|
90 |
v-if="detail.platform === AiPlatformEnum.STABLE_DIFFUSION && detail?.options?.steps" |
|
91 |
> |
|
92 |
<div class="tip">迭代步数</div> |
|
93 |
<div class="body"> |
|
94 |
{{ detail?.options?.steps }} |
|
95 |
</div> |
|
96 |
</div> |
|
97 |
<div |
|
98 |
class="item" |
|
99 |
v-if="detail.platform === AiPlatformEnum.STABLE_DIFFUSION && detail?.options?.scale" |
|
100 |
> |
|
101 |
<div class="tip">引导系数</div> |
|
102 |
<div class="body"> |
|
103 |
{{ detail?.options?.scale }} |
|
104 |
</div> |
|
105 |
</div> |
|
106 |
<div |
|
107 |
class="item" |
|
108 |
v-if="detail.platform === AiPlatformEnum.STABLE_DIFFUSION && detail?.options?.seed" |
|
109 |
> |
|
110 |
<div class="tip">随机因子</div> |
|
111 |
<div class="body"> |
|
112 |
{{ detail?.options?.seed }} |
|
113 |
</div> |
|
114 |
</div> |
|
115 |
<!-- Dall3 专属区域 --> |
|
116 |
<div class="item" v-if="detail.platform === AiPlatformEnum.OPENAI && detail?.options?.style"> |
|
117 |
<div class="tip">风格选择</div> |
|
118 |
<div class="body"> |
|
119 |
{{ Dall3StyleList.find((item: ImageModelVO) => item.key === detail?.options?.style)?.name }} |
|
120 |
</div> |
|
121 |
</div> |
|
122 |
<!-- Midjourney 专属区域 --> |
|
123 |
<div |
|
124 |
class="item" |
|
125 |
v-if="detail.platform === AiPlatformEnum.MIDJOURNEY && detail?.options?.version" |
|
126 |
> |
|
127 |
<div class="tip">模型版本</div> |
|
128 |
<div class="body"> |
|
129 |
{{ detail?.options?.version }} |
|
130 |
</div> |
|
131 |
</div> |
|
132 |
<div |
|
133 |
class="item" |
|
134 |
v-if="detail.platform === AiPlatformEnum.MIDJOURNEY && detail?.options?.referImageUrl" |
|
135 |
> |
|
136 |
<div class="tip">参考图</div> |
|
137 |
<div class="body"> |
|
138 |
<el-image :src="detail.options.referImageUrl" /> |
|
139 |
</div> |
|
140 |
</div> |
|
141 |
</el-drawer> |
|
142 |
</template> |
|
143 |
|
|
144 |
<script setup lang="ts"> |
|
145 |
import { ImageApi, ImageVO } from '@/api/ai/image' |
|
146 |
import { |
|
147 |
AiPlatformEnum, |
|
148 |
Dall3StyleList, |
|
149 |
ImageModelVO, |
|
150 |
StableDiffusionClipGuidancePresets, |
|
151 |
StableDiffusionSamplers, |
|
152 |
StableDiffusionStylePresets |
|
153 |
} from '@/views/ai/utils/constants' |
|
154 |
import { formatTime } from '@/utils' |
|
155 |
|
|
156 |
const showDrawer = ref<boolean>(false) // 是否显示 |
|
157 |
const detail = ref<ImageVO>({} as ImageVO) // 图片详细信息 |
|
158 |
|
|
159 |
const props = defineProps({ |
|
160 |
show: { |
|
161 |
type: Boolean, |
|
162 |
require: true, |
|
163 |
default: false |
|
164 |
}, |
|
165 |
id: { |
|
166 |
type: Number, |
|
167 |
required: true |
|
168 |
} |
|
169 |
}) |
|
170 |
|
|
171 |
/** 关闭抽屉 */ |
|
172 |
const handleDrawerClose = async () => { |
|
173 |
emits('handleDrawerClose') |
|
174 |
} |
|
175 |
|
|
176 |
/** 监听 drawer 是否打开 */ |
|
177 |
const { show } = toRefs(props) |
|
178 |
watch(show, async (newValue, oldValue) => { |
|
179 |
showDrawer.value = newValue as boolean |
|
180 |
}) |
|
181 |
|
|
182 |
/** 获取图片详情 */ |
|
183 |
const getImageDetail = async (id: number) => { |
|
184 |
detail.value = await ImageApi.getImageMy(id) |
|
185 |
} |
|
186 |
|
|
187 |
/** 监听 id 变化,加载最新图片详情 */ |
|
188 |
const { id } = toRefs(props) |
|
189 |
watch(id, async (newVal, oldVal) => { |
|
190 |
if (newVal) { |
|
191 |
await getImageDetail(newVal) |
|
192 |
} |
|
193 |
}) |
|
194 |
|
|
195 |
const emits = defineEmits(['handleDrawerClose']) |
|
196 |
</script> |
|
197 |
<style scoped lang="scss"> |
|
198 |
.item { |
|
199 |
margin-bottom: 20px; |
|
200 |
width: 100%; |
|
201 |
overflow: hidden; |
|
202 |
word-wrap: break-word; |
|
203 |
|
|
204 |
.header { |
|
205 |
display: flex; |
|
206 |
flex-direction: row; |
|
207 |
justify-content: space-between; |
|
208 |
} |
|
209 |
|
|
210 |
.tip { |
|
211 |
font-weight: bold; |
|
212 |
font-size: 16px; |
|
213 |
} |
|
214 |
|
|
215 |
.body { |
|
216 |
margin-top: 10px; |
|
217 |
color: #616161; |
|
218 |
|
|
219 |
.taskImage { |
|
220 |
border-radius: 10px; |
|
221 |
} |
|
222 |
} |
|
223 |
} |
|
224 |
</style> |