1
- /**
2
- * 图片处理工具-基础操作Tab页
3
- */
1
+ /** * 图片处理工具-基础操作Tab页 */
4
2
<script setup lang="ts">
5
- import { ref , watch } from ' vue' ;
6
- import { message } from ' ant-design-vue' ;
7
- import { useI18n } from ' vue-i18n' ;
3
+ import { ref , watch } from " vue" ;
4
+ import { message } from " ant-design-vue" ;
5
+ import { useI18n } from " vue-i18n" ;
8
6
import { cloneDeep } from " lodash-es" ;
9
7
import {
10
8
flipSideToSide ,
@@ -119,117 +117,189 @@ const doTask = (
119
117
}
120
118
};
121
119
122
- watch (imgInfo , () => {
123
- imgStatusInfo .value = cloneDeep (defaultImgStatus );
124
- }, { immediate: true })
120
+ watch (
121
+ imgInfo ,
122
+ () => {
123
+ imgStatusInfo .value = cloneDeep (defaultImgStatus );
124
+ },
125
+ { immediate: true }
126
+ );
125
127
</script >
126
128
127
129
<template >
128
- <FileBox :imgInfo =" imgInfo" :imgDragOver =" imgDragOver" :onDragOver =" onDragOver" :onDragLeave =" onDragLeave"
129
- :onDrop =" onDrop" />
130
+ <FileBox
131
+ :imgInfo =" imgInfo"
132
+ :imgDragOver =" imgDragOver"
133
+ :onDragOver =" onDragOver"
134
+ :onDragLeave =" onDragLeave"
135
+ :onDrop =" onDrop"
136
+ />
130
137
<div class =" operationBtns" >
131
138
<div class =" left" >
132
- <a-button type =" primary" class =" operationBtn" @click =" () =>
133
- doTask(imgStatusInfo.flipSideToSideStatus, flipSideToSide)
134
- " >
135
- {{ t("page.imageProcessingTool.flipSideToSide") }}
136
- </a-button >
137
- <a-button type =" primary" class =" operationBtn" @click =" () =>
138
- doTask(imgStatusInfo.flipUpsideDownStatus, flipUpsideDown)
139
- " >
140
- {{ t("page.imageProcessingTool.flipTopToBottom") }}
141
- </a-button >
142
- <a-button type =" primary" class =" operationBtn" @click =" () =>
143
- doTask(imgStatusInfo.leftRotateStatus, leftRotate)
144
- " >
145
- {{ t("page.imageProcessingTool.rotateLeft") }}
146
- </a-button >
147
- <a-button type =" primary" class =" operationBtn" @click =" () =>
148
- doTask(imgStatusInfo.rightRotateStatus, rightRotate)
149
- " >
150
- {{ t("page.imageProcessingTool.rotateRight") }}
151
- </a-button >
152
- <a-button type =" primary" class =" operationBtn" @click =" () => doTask(imgStatusInfo.toGreyStatus, toGrey)" >
153
- {{ t("page.imageProcessingTool.graying") }}
154
- </a-button >
155
- <a-button type =" primary" class =" operationBtn" @click =" () =>
156
- doTask(
157
- imgStatusInfo.toBlackAndWhiteStatus,
158
- toBlackAndWhite
159
- )
160
- " >
161
- {{ t("page.imageProcessingTool.vampix") }}
162
- </a-button >
163
- <a-button type =" primary" class =" operationBtn" @click =" () => doTask(imgStatusInfo.sharpenStatus, sharpen)" >
139
+ <a-button
140
+ type =" primary"
141
+ class =" operationBtn"
142
+ @click ="
143
+ () => doTask(imgStatusInfo.flipSideToSideStatus, flipSideToSide)
144
+ "
145
+ >
146
+ {{ t("common.flipSideToSide") }}
147
+ </a-button >
148
+ <a-button
149
+ type =" primary"
150
+ class =" operationBtn"
151
+ @click ="
152
+ () => doTask(imgStatusInfo.flipUpsideDownStatus, flipUpsideDown)
153
+ "
154
+ >
155
+ {{ t("common.flipTopToBottom") }}
156
+ </a-button >
157
+ <a-button
158
+ type =" primary"
159
+ class =" operationBtn"
160
+ @click =" () => doTask(imgStatusInfo.leftRotateStatus, leftRotate)"
161
+ >
162
+ {{ t("common.rotateLeft") }}
163
+ </a-button >
164
+ <a-button
165
+ type =" primary"
166
+ class =" operationBtn"
167
+ @click =" () => doTask(imgStatusInfo.rightRotateStatus, rightRotate)"
168
+ >
169
+ {{ t("common.rotateRight") }}
170
+ </a-button >
171
+ <a-button
172
+ type =" primary"
173
+ class =" operationBtn"
174
+ @click =" () => doTask(imgStatusInfo.toGreyStatus, toGrey)"
175
+ >
176
+ {{ t("common.graying") }}
177
+ </a-button >
178
+ <a-button
179
+ type =" primary"
180
+ class =" operationBtn"
181
+ @click ="
182
+ () => doTask(imgStatusInfo.toBlackAndWhiteStatus, toBlackAndWhite)
183
+ "
184
+ >
185
+ {{ t("common.vampix") }}
186
+ </a-button >
187
+ <a-button
188
+ type =" primary"
189
+ class =" operationBtn"
190
+ @click =" () => doTask(imgStatusInfo.sharpenStatus, sharpen)"
191
+ >
164
192
{{ t("page.imageProcessingTool.shmpch") }}
165
193
</a-button >
166
- <a-button type =" primary" class =" operationBtn" @click =" () =>
167
- doTask(imgStatusInfo.marginSharpenStatus, marginSharpen)
168
- " >
194
+ <a-button
195
+ type =" primary"
196
+ class =" operationBtn"
197
+ @click =" () => doTask(imgStatusInfo.marginSharpenStatus, marginSharpen)"
198
+ >
169
199
{{ t("page.imageProcessingTool.edgeSharpening") }}
170
200
</a-button >
171
- <a-button type =" primary" class =" operationBtn" @click =" () =>
172
- doTask(imgStatusInfo.toOppositeStatus, toOpposite)
173
- " >
201
+ <a-button
202
+ type =" primary"
203
+ class =" operationBtn"
204
+ @click =" () => doTask(imgStatusInfo.toOppositeStatus, toOpposite)"
205
+ >
174
206
{{ t("page.imageProcessingTool.filterContrast") }}
175
207
</a-button >
176
- <a-button type =" primary" class =" operationBtn" @click =" () => doTask(imgStatusInfo.toRedStatus, toRed)" >
208
+ <a-button
209
+ type =" primary"
210
+ class =" operationBtn"
211
+ @click =" () => doTask(imgStatusInfo.toRedStatus, toRed)"
212
+ >
177
213
{{ t("page.imageProcessingTool.redFilter") }}
178
214
</a-button >
179
- <a-button type =" primary" class =" operationBtn" @click =" () => doTask(imgStatusInfo.toGreenStatus, toGreen)" >
215
+ <a-button
216
+ type =" primary"
217
+ class =" operationBtn"
218
+ @click =" () => doTask(imgStatusInfo.toGreenStatus, toGreen)"
219
+ >
180
220
{{ t("page.imageProcessingTool.greenFilter") }}
181
221
</a-button >
182
- <a-button type =" primary" class =" operationBtn" @click =" () => doTask(imgStatusInfo.toBlueStatus, toBlue)" >
222
+ <a-button
223
+ type =" primary"
224
+ class =" operationBtn"
225
+ @click =" () => doTask(imgStatusInfo.toBlueStatus, toBlue)"
226
+ >
183
227
{{ t("page.imageProcessingTool.blueFilter") }}
184
228
</a-button >
185
- <a-button type =" primary" class =" operationBtn" @click =" () =>
186
- doTask(imgStatusInfo.toRedAndGreenStatus, toRedAndGreen)
187
- " >
229
+ <a-button
230
+ type =" primary"
231
+ class =" operationBtn"
232
+ @click =" () => doTask(imgStatusInfo.toRedAndGreenStatus, toRedAndGreen)"
233
+ >
188
234
{{ t("page.imageProcessingTool.redGreenFilter") }}
189
235
</a-button >
190
- <a-button type =" primary" class =" operationBtn" @click =" () =>
191
- doTask(imgStatusInfo.toRedAndBlueStatus, toRedAndBlue)
192
- " >
236
+ <a-button
237
+ type =" primary"
238
+ class =" operationBtn"
239
+ @click =" () => doTask(imgStatusInfo.toRedAndBlueStatus, toRedAndBlue)"
240
+ >
193
241
{{ t("page.imageProcessingTool.redBlueFilter") }}
194
242
</a-button >
195
- <a-button type =" primary" class =" operationBtn" @click =" () =>
196
- doTask(imgStatusInfo.toBlueAndGreenStatus, toBlueAndGreen)
197
- " >
243
+ <a-button
244
+ type =" primary"
245
+ class =" operationBtn"
246
+ @click ="
247
+ () => doTask(imgStatusInfo.toBlueAndGreenStatus, toBlueAndGreen)
248
+ "
249
+ >
198
250
{{ t("page.imageProcessingTool.blueGreenFilter") }}
199
251
</a-button >
200
- <a-button type =" primary" class =" operationBtn" @click =" () =>
201
- doTask(imgStatusInfo.toRedAndGreyStatus, toRedAndGrey)
202
- " >
252
+ <a-button
253
+ type =" primary"
254
+ class =" operationBtn"
255
+ @click =" () => doTask(imgStatusInfo.toRedAndGreyStatus, toRedAndGrey)"
256
+ >
203
257
{{ t("page.imageProcessingTool.redGreyFilter") }}
204
258
</a-button >
205
- <a-button type =" primary" class =" operationBtn" @click =" () =>
206
- doTask(imgStatusInfo.toGreenAndGreyStatus, toGreenAndGrey)
207
- " >
259
+ <a-button
260
+ type =" primary"
261
+ class =" operationBtn"
262
+ @click ="
263
+ () => doTask(imgStatusInfo.toGreenAndGreyStatus, toGreenAndGrey)
264
+ "
265
+ >
208
266
{{ t("page.imageProcessingTool.greenGreyFilter") }}
209
267
</a-button >
210
- <a-button type =" primary" class =" operationBtn" @click =" () =>
211
- doTask(imgStatusInfo.toBlueAndGreyStatus, toBlueAndGrey)
212
- " >
268
+ <a-button
269
+ type =" primary"
270
+ class =" operationBtn"
271
+ @click =" () => doTask(imgStatusInfo.toBlueAndGreyStatus, toBlueAndGrey)"
272
+ >
213
273
{{ t("page.imageProcessingTool.blueGreyFilter") }}
214
274
</a-button >
215
- <a-button type =" primary" class =" operationBtn" @click =" () =>
216
- doTask(imgStatusInfo.toGaussianBlurStatus, toGaussianBlur)
217
- " >
275
+ <a-button
276
+ type =" primary"
277
+ class =" operationBtn"
278
+ @click ="
279
+ () => doTask(imgStatusInfo.toGaussianBlurStatus, toGaussianBlur)
280
+ "
281
+ >
218
282
{{ t("page.imageProcessingTool.gaussianBlur") }}
219
283
</a-button >
220
- <a-button type =" primary" class =" operationBtn" @click =" () =>
221
- doTask(imgStatusInfo.jpgToPngStatus, jpgToPng, 'PNG')" v-if =" ['JPG',
222
- 'JPEG'].includes(imgInfo.fileType)" >
284
+ <a-button
285
+ type =" primary"
286
+ class =" operationBtn"
287
+ @click =" () => doTask(imgStatusInfo.jpgToPngStatus, jpgToPng, 'PNG')"
288
+ v-if =" ['JPG', 'JPEG'].includes(imgInfo.fileType)"
289
+ >
223
290
{{ t("page.imageProcessingTool.jpgToPng") }}
224
291
</a-button >
225
- <a-button type =" primary" class =" operationBtn" @click =" () =>
226
- doTask(imgStatusInfo.pngToJpgStatus, pngToJpg, 'JPEG')" v-if =" imgInfo.fileType
227
- === 'PNG'" >
292
+ <a-button
293
+ type =" primary"
294
+ class =" operationBtn"
295
+ @click =" () => doTask(imgStatusInfo.pngToJpgStatus, pngToJpg, 'JPEG')"
296
+ v-if =" imgInfo.fileType === 'PNG'"
297
+ >
228
298
{{ t("page.imageProcessingTool.pngToJpg") }}
229
299
</a-button >
230
300
</div >
231
301
<a-button class =" right" ghost type =" primary" @click =" onClear" >
232
302
{{ t("common.clear") }}
233
303
</a-button >
234
304
</div >
235
- </template >
305
+ </template >
0 commit comments