Skip to content

Commit 9a209a8

Browse files
committed
feat:【AI 大模型】image/index/ImageCard 重构成 unocss
1 parent f63ac7b commit 9a209a8

File tree

2 files changed

+17
-51
lines changed

2 files changed

+17
-51
lines changed

src/views/ai/image/index/components/ImageCard.vue

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
2-
<el-card body-class="" style="width: 320px; height: auto; border-radius: 10px; position: relative; display: flex; flex-direction: column;">
3-
<div style="display: flex; flex-direction: row; justify-content: space-between;">
2+
<el-card
3+
body-class=""
4+
class="!w-80 !h-auto !rounded-10px !relative !flex !flex-col"
5+
>
6+
<div class="!flex !flex-row !justify-between">
47
<div>
58
<el-button type="primary" text bg v-if="detail?.status === AiImageStatusEnum.IN_PROGRESS">
69
生成中
@@ -15,34 +18,34 @@
1518
<!-- 操作区 -->
1619
<div>
1720
<el-button
18-
style="padding: 10px; margin: 0;"
21+
class="!p-10px !m-0"
1922
text
2023
:icon="Download"
2124
@click="handleButtonClick('download', detail)"
2225
/>
2326
<el-button
24-
style="padding: 10px; margin: 0;"
27+
class="!p-10px !m-0"
2528
text
2629
:icon="RefreshRight"
2730
@click="handleButtonClick('regeneration', detail)"
2831
/>
2932
<el-button
30-
style="padding: 10px; margin: 0;"
33+
class="!p-10px !m-0"
3134
text
3235
:icon="Delete"
3336
@click="handleButtonClick('delete', detail)"
3437
/>
3538
<el-button
36-
style="padding: 10px; margin: 0;"
39+
class="!p-10px !m-0"
3740
text
3841
:icon="More"
3942
@click="handleButtonClick('more', detail)"
4043
/>
4144
</div>
4245
</div>
43-
<div style="overflow: hidden; margin-top: 20px; height: 280px; flex: 1;" ref="cardImageRef">
46+
<div class="!overflow-hidden !mt-20px !h-280px !flex-1" ref="cardImageRef">
4447
<el-image
45-
style="width: 100%; border-radius: 10px;"
48+
class="!w-full !rounded-10px"
4649
:src="detail?.picUrl"
4750
:preview-src-list="[detail.picUrl]"
4851
preview-teleported
@@ -52,7 +55,7 @@
5255
</div>
5356
</div>
5457
<!-- Midjourney 专属操作 -->
55-
<div style="margin-top: 5px; width: 100%; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-start;">
58+
<div class="!mt-5px !w-full !flex !flex-row !flex-wrap !justify-start">
5659
<el-button
5760
size="small"
5861
v-for="button in detail?.buttons"

src/views/ai/image/square/index.vue

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<template>
2-
<div class="square-container">
2+
<div class="bg-white p-20px">
33
<!-- TODO @fan:style 建议换成 unocss -->
44
<!-- TODO @fan:Search 可以换成 Icon 组件么? -->
55
<el-input
66
v-model="queryParams.prompt"
7-
style="width: 100%; margin-bottom: 20px"
7+
class="!w-full !mb-20px"
88
size="large"
99
placeholder="请输入要搜索的内容"
1010
:suffix-icon="Search"
1111
@keyup.enter="handleQuery"
1212
/>
13-
<div class="gallery">
13+
<div class="grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-10px bg-white shadow-[0_0_10px_rgba(0,0,0,0.1)]">
1414
<!-- TODO @fan:这个图片的风格,要不和 ImageCard.vue 界面一致?(只有卡片,没有操作);因为看着更有相框的感觉~~~ -->
15-
<div v-for="item in list" :key="item.id" class="gallery-item">
16-
<img :src="item.picUrl" class="img" />
15+
<div v-for="item in list" :key="item.id" class="relative overflow-hidden bg-gray-100 cursor-pointer transition-transform duration-300 hover:scale-105">
16+
<img :src="item.picUrl" class="w-full h-auto block transition-transform duration-300 hover:scale-110" />
1717
</div>
1818
</div>
1919
<!-- TODO @fan:缺少翻页 -->
@@ -64,41 +64,4 @@ onMounted(async () => {
6464
await getList()
6565
})
6666
</script>
67-
<style scoped lang="scss">
68-
.square-container {
69-
background-color: #fff;
70-
padding: 20px;
7167

72-
.gallery {
73-
display: grid;
74-
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
75-
gap: 10px;
76-
//max-width: 1000px;
77-
background-color: #fff;
78-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
79-
}
80-
81-
.gallery-item {
82-
position: relative;
83-
overflow: hidden;
84-
background: #f0f0f0;
85-
cursor: pointer;
86-
transition: transform 0.3s;
87-
}
88-
89-
.gallery-item img {
90-
width: 100%;
91-
height: auto;
92-
display: block;
93-
transition: transform 0.3s;
94-
}
95-
96-
.gallery-item:hover img {
97-
transform: scale(1.1);
98-
}
99-
100-
.gallery-item:hover {
101-
transform: scale(1.05);
102-
}
103-
}
104-
</style>

0 commit comments

Comments
 (0)