30
30
</el-button >
31
31
</el-space >
32
32
</div >
33
+ <div class =" image-size" >
34
+ <div >
35
+ <el-text tag =" b" >尺寸</el-text >
36
+ </div >
37
+ <el-space wrap class =" size-list" >
38
+ <div class =" size-item"
39
+ v-for =" imageSize in imageSizeList"
40
+ :key =" imageSize.key"
41
+ @click =" handlerSizeClick(imageSize)" >
42
+ <div :class =" selectImageSize === imageSize ? 'size-wrapper selectImageSize' : 'size-wrapper'" >
43
+ <div :style =" imageSize.style" ></div >
44
+ </div >
45
+ <div class =" size-font" >{{ imageSize.key }}</div >
46
+ </div >
47
+ </el-space >
48
+ </div >
33
49
<div class =" model" >
34
50
<div >
35
51
<el-text tag =" b" >模型</el-text >
@@ -73,6 +89,8 @@ interface ImageModelVO {
73
89
interface ImageSizeVO {
74
90
key: string
75
91
style: string ,
92
+ width: string ,
93
+ height: string ,
76
94
}
77
95
78
96
// 定义属性
@@ -94,6 +112,41 @@ const models = ref<ImageModelVO[]>([
94
112
]) // 模型
95
113
selectModel .value = models .value [0 ] // 默认选中
96
114
115
+ const selectImageSize = ref <ImageSizeVO >({} as ImageSizeVO ) // 选中 size
116
+ const imageSizeList = ref <ImageSizeVO []>([
117
+ {
118
+ key: ' 1:1' ,
119
+ width: " 1" ,
120
+ height: " 1" ,
121
+ style: ' width: 30px; height: 30px;background-color: #dcdcdc;' ,
122
+ },
123
+ {
124
+ key: ' 3:4' ,
125
+ width: " 3" ,
126
+ height: " 4" ,
127
+ style: ' width: 30px; height: 40px;background-color: #dcdcdc;' ,
128
+ },
129
+ {
130
+ key: ' 4:3' ,
131
+ width: " 4" ,
132
+ height: " 3" ,
133
+ style: ' width: 40px; height: 30px;background-color: #dcdcdc;' ,
134
+ },
135
+ {
136
+ key: ' 9:16' ,
137
+ width: " 9" ,
138
+ height: " 16" ,
139
+ style: ' width: 30px; height: 50px;background-color: #dcdcdc;' ,
140
+ },
141
+ {
142
+ key: ' 16:9' ,
143
+ width: " 16" ,
144
+ height: " 9" ,
145
+ style: ' width: 50px; height: 30px;background-color: #dcdcdc;' ,
146
+ },
147
+ ]) // size
148
+ selectImageSize .value = imageSizeList .value [0 ]
149
+
97
150
// 定义 Props
98
151
const props = defineProps ({})
99
152
@@ -112,6 +165,17 @@ const handlerHotWordClick = async (hotWord: string) => {
112
165
prompt .value = hotWord
113
166
}
114
167
168
+ /**
169
+ * size - click
170
+ */
171
+ const handlerSizeClick = async (imageSize : ImageSizeVO ) => {
172
+ if (selectImageSize .value === imageSize ) {
173
+ selectImageSize .value = {} as ImageSizeVO
174
+ return
175
+ }
176
+ selectImageSize .value = imageSize
177
+ }
178
+
115
179
/**
116
180
* 模型 - click
117
181
*/
@@ -131,6 +195,8 @@ const handlerGenerateImage = async () => {
131
195
const req = {
132
196
prompt: prompt .value ,
133
197
model: selectModel .value .key ,
198
+ width: selectImageSize .value .width ,
199
+ height: selectImageSize .value .height ,
134
200
base64Array: [],
135
201
} as ImageMidjourneyImagineReqVO
136
202
await ImageApi .midjourneyImagine (req )
0 commit comments