【解决todo】调整接口命名、和接口返回值
							parent
							
								
									ecc924301d
								
							
						
					
					
						commit
						b82391da0a
					
				| 
						 | 
				
			
			@ -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}`})
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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: '生成中...'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue