【增加】AI Image 列表增加删除

This commit is contained in:
cherishsince 2024-05-28 10:37:44 +08:00
parent c87713f040
commit 2211618ada
3 changed files with 19 additions and 2 deletions

View File

@ -52,4 +52,8 @@ export const ImageApi = {
dall: async (data: ImageDallReqVO)=> { dall: async (data: ImageDallReqVO)=> {
return await request.post({ url: `/ai/image/dall`, data }) return await request.post({ url: `/ai/image/dall`, data })
}, },
// 删除
deleteImage: async (id: number)=> {
return await request.delete({ url: `/ai/image/delete?id=${id}`})
},
} }

View File

@ -2,7 +2,11 @@
<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" @on-btn-click="handlerImageBtnClick" /> <ImageTaskCard
v-for="image in imageList"
:key="image"
:image-detail="image"
@on-btn-click="handlerImageBtnClick" />
</el-card> </el-card>
<!-- 图片 detail 抽屉 --> <!-- 图片 detail 抽屉 -->
<ImageDetailDrawer <ImageDetailDrawer
@ -16,6 +20,8 @@ import ImageDetailDrawer from './ImageDetailDrawer.vue'
import ImageTaskCard from './ImageTaskCard.vue' import ImageTaskCard from './ImageTaskCard.vue'
import {bool} from "vue-types"; import {bool} from "vue-types";
const message = useMessage() //
const imageList = ref<ImageDetailVO[]>([]) // image const imageList = ref<ImageDetailVO[]>([]) // image
const imageListInterval = ref<any>() // image const imageListInterval = ref<any>() // image
const showTaskDetail = ref<bool>(false) // task const showTaskDetail = ref<bool>(false) // task
@ -55,6 +61,11 @@ const getImageList = async () => {
const handlerImageBtnClick = async (type, imageDetail: ImageDetailVO) => { const handlerImageBtnClick = async (type, imageDetail: ImageDetailVO) => {
if (type === 'more') { if (type === 'more') {
await handlerDrawerOpen() await handlerDrawerOpen()
} else if (type === 'delete') {
await message.confirm(`是否删除照片?`)
await ImageApi.deleteImage(imageDetail.id)
await getImageList()
await message.success("删除成功!")
} }
} }
// //

View File

@ -6,7 +6,9 @@
<el-segmented v-model="selectModel" :options="modelOptions" /> <el-segmented v-model="selectModel" :options="modelOptions" />
</div> </div>
<div class="modal-switch-container"> <div class="modal-switch-container">
<Dall3 v-if="selectModel === 'DALL3绘画'" @on-draw-start="handlerDrawStart" @on-draw-complete="handlerDrawComplete" /> <Dall3 v-if="selectModel === 'DALL3绘画'"
@on-draw-start="handlerDrawStart"
@on-draw-complete="handlerDrawComplete" />
<Midjourney v-if="selectModel === 'MJ绘画'" /> <Midjourney v-if="selectModel === 'MJ绘画'" />
</div> </div>
</div> </div>