【解决todo】调整接口命名、和接口返回值

This commit is contained in:
cherishsince 2024-05-29 18:07:54 +08:00
parent ecc924301d
commit b82391da0a
3 changed files with 17 additions and 8 deletions

View File

@ -34,11 +34,11 @@ export interface ImageDallReqVO {
export const ImageApi = {
// 获取 image 列表
getImageList: async (params: ImagePageReqVO) => {
return await request.get({ url: `/ai/image/list`, params })
return await request.get({ url: `/ai/image/my-page`, params })
},
// 获取 image 详细信息
getImageDetail: async (id: number) => {
return await request.get({ url: `/ai/image/get?id=${id}`})
return await request.get({ url: `/ai/image/get-my?id=${id}`})
},
// dall2、dall3 调用
dall: async (data: ImageDallReqVO)=> {
@ -46,6 +46,6 @@ export const ImageApi = {
},
// 删除
deleteImage: async (id: number)=> {
return await request.delete({ url: `/ai/image/delete?id=${id}`})
return await request.delete({ url: `/ai/image/delete-my?id=${id}`})
},
}

View File

@ -2,9 +2,9 @@
<el-card body-class="" class="image-card">
<div class="image-operation">
<div>
<el-button type="" text bg v-if="imageDetail.status === 'in_progress'">生成中</el-button>
<el-button type="" text bg v-else-if="imageDetail.status === 'fail'">已完成</el-button>
<el-button type="" text bg v-else-if="imageDetail.status === 'complete'">已完成</el-button>
<el-button type="" text bg v-if="imageDetail.status === '10'">生成中</el-button>
<el-button type="" text bg v-else-if="imageDetail.status === '20'">已完成</el-button>
<el-button type="" text bg v-else-if="imageDetail.status === '30'">已完成</el-button>
</div>
<div>
<el-button class="btn" text :icon="Download"
@ -42,7 +42,7 @@ const handlerBtnClick = async (type, imageDetail: ImageDetailVO) => {
}
const handlerLoading = async (status: string) => {
if (status === 'in_progress') {
if (status === '10') {
cardImageLoadingInstance.value = ElLoading.service({
target: cardImageRef.value,
text: '生成中...'

View File

@ -110,6 +110,8 @@ interface ImageModelVO {
interface ImageSizeVO {
key: string
style: string,
width: string,
height: string,
}
//
@ -152,16 +154,22 @@ const imageSizeList = ref<ImageSizeVO[]>([
{
key: '1024x1024',
name: '1:1',
width: '1024',
height: '1024',
style: 'width: 30px; height: 30px;background-color: #dcdcdc;',
},
{
key: '1024x1792',
name: '3:5',
width: '1024',
height: '1792',
style: 'width: 30px; height: 50px;background-color: #dcdcdc;',
},
{
key: '1792x1024',
name: '5:3',
width: '1792',
height: '1024',
style: 'width: 50px; height: 30px;background-color: #dcdcdc;',
}
]) // size
@ -233,7 +241,8 @@ const handlerGenerateImage = async () => {
prompt: prompt.value, //
model: selectModel.value.key, //
style: selectImageStyle.value.key, //
size: selectImageSize.value.key, // size
width: selectImageSize.value.width, // size
height: selectImageSize.value.height, // size
} as ImageDallReqVO
//
await ImageApi.dall(form)