【优化】Image Task 使用 card 组件

This commit is contained in:
cherishsince 2024-05-26 21:51:42 +08:00
parent 4542337f4f
commit c06dd8e273

View File

@ -2,22 +2,7 @@
<template> <template>
<el-card class="dr-task" body-class="task-card" shadow="never"> <el-card class="dr-task" body-class="task-card" shadow="never">
<template #header>绘画任务</template> <template #header>绘画任务</template>
<ImageTaskCard v-for="image in imageList" :key="image" :image-detail="image" />
<el-card body-class="" class="image-card" >
<div class="image-operation">
<div>
<el-button type="" text bg >已完成</el-button>
</div>
<div>
<el-button class="btn" text :icon="Download" />
<el-button class="btn" text :icon="Delete" />
<el-button class="btn" text :icon="More" @click="handlerTaskDetail" />
</div>
</div>
<div class="image-wrapper">
<img class="image" src="https://img.bigpt8.com/uploads/thumbnail/20240509/b7802797e5f709f35a451a1591d4d495.png" />
</div>
</el-card>
</el-card> </el-card>
<!-- 图片 detail 抽屉 --> <!-- 图片 detail 抽屉 -->
<ImageDetailDrawer <ImageDetailDrawer
@ -26,10 +11,13 @@
/> />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ImageApi, ImageDetailVO} from '@/api/ai/image';
import ImageDetailDrawer from './ImageDetailDrawer.vue' import ImageDetailDrawer from './ImageDetailDrawer.vue'
import ImageTaskCard from './ImageTaskCard.vue'
import {Delete, Download, More} from "@element-plus/icons-vue"; import {Delete, Download, More} from "@element-plus/icons-vue";
import {bool} from "vue-types"; import {bool} from "vue-types";
const imageList = ref<ImageDetailVO[]>([]) // image
const showTaskDetail = ref<bool>(false) // task const showTaskDetail = ref<bool>(false) // task
/** /**
@ -40,13 +28,30 @@ const handlerTaskDetail = async () => {
} }
/** /**
* 抽屉 - 关闭 * 抽屉 - close
*/ */
const handlerDrawerClose = async () => { const handlerDrawerClose = async () => {
showTaskDetail.value = false showTaskDetail.value = false
} }
/**
* 任务 - detail
*/
const handlerDrawerOpen = async () => {
showTaskDetail.value = true
}
/**
* 获取 - image 列表
*/
const getImageList = async () => {
imageList.value = await ImageApi.getImageList({pageNo: 1, pageSize: 20})
}
//
onMounted(async () => {
await getImageList()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -60,32 +65,5 @@ const handlerDrawerClose = async () => {
} }
} }
.image-card {
width: 360px;
border-radius: 10px;
.image-operation {
display: flex;
flex-direction: row;
justify-content: space-between;
.btn {
//border: 1px solid red;
padding: 10px;
margin: 0;
}
}
.image-wrapper {
overflow: hidden;
margin-top: 20px;
.image {
width: 100%;
border-radius: 10px;
}
}
}
</style> </style>