5
5
@close =" handleDrawerClose"
6
6
custom-class =" drawer-class"
7
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 >
8
+ <!-- 图片预览 -->
9
+ <div class =" mb-5" >
10
+ <el-image
11
+ :src =" detail?.picUrl"
12
+ :preview-src-list =" [detail.picUrl]"
13
+ preview-teleported
14
+ class =" w-full rounded-2"
15
+ fit =" contain"
16
+ />
45
17
</div >
18
+
19
+ <!-- 基础信息 -->
20
+ <el-descriptions title =" 基础信息" :column =" 1" :label-width =" 100" border >
21
+ <el-descriptions-item label =" 提交时间" >
22
+ {{ formatTime(detail.createTime, 'yyyy-MM-dd HH:mm:ss') }}
23
+ </el-descriptions-item >
24
+ <el-descriptions-item label =" 生成时间" >
25
+ {{ formatTime(detail.finishTime, 'yyyy-MM-dd HH:mm:ss') }}
26
+ </el-descriptions-item >
27
+ <el-descriptions-item label =" 模型" >
28
+ {{ detail.model }}({{ detail.height }}x{{ detail.width }})
29
+ </el-descriptions-item >
30
+ <el-descriptions-item label =" 提示词" >
31
+ <div class =" break-words" >{{ detail.prompt }}</div >
32
+ </el-descriptions-item >
33
+ <el-descriptions-item label =" 图片地址" >
34
+ <div class =" break-all text-xs" >{{ detail.picUrl }}</div >
35
+ </el-descriptions-item >
36
+ </el-descriptions >
37
+
46
38
<!-- StableDiffusion 专属区域 -->
47
- <div
48
- class =" item"
49
- v-if =" detail.platform === AiPlatformEnum.STABLE_DIFFUSION && detail?.options?.sampler"
39
+ <el-descriptions
40
+ v-if =" detail.platform === AiPlatformEnum.STABLE_DIFFUSION && hasStableDiffusionOptions"
41
+ title =" StableDiffusion 参数"
42
+ :column =" 1"
43
+ :label-width =" 100"
44
+ border
45
+ class =" mt-5"
50
46
>
51
- <div class =" tip" >采样方法</div >
52
- <div class =" body" >
47
+ <el-descriptions-item v-if =" detail?.options?.sampler" label =" 采样方法" >
53
48
{{
54
49
StableDiffusionSamplers.find(
55
50
(item: ImageModelVO) => item.key === detail?.options?.sampler
56
51
)?.name
57
52
}}
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" >
53
+ </el-descriptions-item >
54
+ <el-descriptions-item v-if =" detail?.options?.clipGuidancePreset" label =" CLIP" >
68
55
{{
69
56
StableDiffusionClipGuidancePresets.find(
70
57
(item: ImageModelVO) => item.key === detail?.options?.clipGuidancePreset
71
58
)?.name
72
59
}}
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" >
60
+ </el-descriptions-item >
61
+ <el-descriptions-item v-if =" detail?.options?.stylePreset" label =" 风格" >
81
62
{{
82
63
StableDiffusionStylePresets.find(
83
64
(item: ImageModelVO) => item.key === detail?.options?.stylePreset
84
65
)?.name
85
66
}}
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" >
67
+ </el-descriptions-item >
68
+ <el-descriptions-item v-if =" detail?.options?.steps" label =" 迭代步数" >
94
69
{{ 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" >
70
+ </el-descriptions-item >
71
+ <el-descriptions-item v-if =" detail?.options?.scale" label =" 引导系数" >
103
72
{{ 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" >
73
+ </el-descriptions-item >
74
+ <el-descriptions-item v-if =" detail?.options?.seed" label =" 随机因子" >
112
75
{{ detail?.options?.seed }}
113
- </div >
114
- </div >
76
+ </el-descriptions-item >
77
+ </el-descriptions >
78
+
115
79
<!-- Dall3 专属区域 -->
116
- <div class =" item" v-if =" detail.platform === AiPlatformEnum.OPENAI && detail?.options?.style" >
117
- <div class =" tip" >风格选择</div >
118
- <div class =" body" >
80
+ <el-descriptions
81
+ v-if =" detail.platform === AiPlatformEnum.OPENAI && detail?.options?.style"
82
+ title =" DALL-E 3 参数"
83
+ :column =" 1"
84
+ :label-width =" 100"
85
+ border
86
+ class =" mt-5"
87
+ >
88
+ <el-descriptions-item label =" 风格选择" >
119
89
{{ Dall3StyleList.find((item: ImageModelVO) => item.key === detail?.options?.style)?.name }}
120
- </div >
121
- </div >
90
+ </el-descriptions-item >
91
+ </el-descriptions >
92
+
122
93
<!-- Midjourney 专属区域 -->
123
- <div
124
- class =" item"
125
- v-if =" detail.platform === AiPlatformEnum.MIDJOURNEY && detail?.options?.version"
94
+ <el-descriptions
95
+ v-if =" detail.platform === AiPlatformEnum.MIDJOURNEY && hasMidjourneyOptions"
96
+ title =" Midjourney 参数"
97
+ :column =" 1"
98
+ :label-width =" 100"
99
+ border
100
+ class =" mt-5"
126
101
>
127
- <div class =" tip" >模型版本</div >
128
- <div class =" body" >
102
+ <el-descriptions-item v-if =" detail?.options?.version" label =" 模型版本" >
129
103
{{ 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 >
104
+ </el-descriptions-item >
105
+ <el-descriptions-item v-if =" detail?.options?.referImageUrl" label =" 参考图" >
106
+ <el-image
107
+ :src =" detail.options.referImageUrl"
108
+ class =" max-w-[200px] rounded-2"
109
+ fit =" contain"
110
+ />
111
+ </el-descriptions-item >
112
+ </el-descriptions >
141
113
</el-drawer >
142
114
</template >
143
115
@@ -156,6 +128,25 @@ import { formatTime } from '@/utils'
156
128
const showDrawer = ref <boolean >(false ) // 是否显示
157
129
const detail = ref <ImageVO >({} as ImageVO ) // 图片详细信息
158
130
131
+ // 计算属性:判断是否有 StableDiffusion 选项
132
+ const hasStableDiffusionOptions = computed (() => {
133
+ const options = detail .value ?.options
134
+ return (
135
+ options ?.sampler ||
136
+ options ?.clipGuidancePreset ||
137
+ options ?.stylePreset ||
138
+ options ?.steps ||
139
+ options ?.scale ||
140
+ options ?.seed
141
+ )
142
+ })
143
+
144
+ // 计算属性:判断是否有 Midjourney 选项
145
+ const hasMidjourneyOptions = computed (() => {
146
+ const options = detail .value ?.options
147
+ return options ?.version || options ?.referImageUrl
148
+ })
149
+
159
150
const props = defineProps ({
160
151
show: {
161
152
type: Boolean ,
@@ -175,7 +166,7 @@ const handleDrawerClose = async () => {
175
166
176
167
/** 监听 drawer 是否打开 */
177
168
const { show } = toRefs (props )
178
- watch (show , async (newValue , oldValue ) => {
169
+ watch (show , async (newValue , _oldValue ) => {
179
170
showDrawer .value = newValue as boolean
180
171
})
181
172
@@ -186,39 +177,11 @@ const getImageDetail = async (id: number) => {
186
177
187
178
/** 监听 id 变化,加载最新图片详情 */
188
179
const { id } = toRefs (props )
189
- watch (id , async (newVal , oldVal ) => {
180
+ watch (id , async (newVal , _oldVal ) => {
190
181
if (newVal ) {
191
182
await getImageDetail (newVal )
192
183
}
193
184
})
194
185
195
186
const emits = defineEmits ([' handleDrawerClose' ])
196
187
</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 >
0 commit comments