|
@@ -2,9 +2,20 @@
|
|
<el-card body-class="" class="image-card">
|
|
<el-card body-class="" class="image-card">
|
|
<div class="image-operation">
|
|
<div class="image-operation">
|
|
<div>
|
|
<div>
|
|
- <el-button type="primary" text bg v-if="imageDetail?.status === 10">生成中</el-button>
|
|
|
|
- <el-button text bg v-else-if="imageDetail?.status === 20">已完成</el-button>
|
|
|
|
- <el-button type="danger" text bg v-else-if="imageDetail?.status === 30">异常</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ text
|
|
|
|
+ bg
|
|
|
|
+ v-if="imageDetail?.status === AiImageStatusEnum.IN_PROGRESS"
|
|
|
|
+ >
|
|
|
|
+ 生成中
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button text bg v-else-if="imageDetail?.status === AiImageStatusEnum.SUCCESS">
|
|
|
|
+ 已完成
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="danger" text bg v-else-if="imageDetail?.status === AiImageStatusEnum.FAIL">
|
|
|
|
+ 异常
|
|
|
|
+ </el-button>
|
|
</div>
|
|
</div>
|
|
<!-- TODO @fan:1)按钮要不调整成详情、下载、再次生成、删除?;2)如果是再次生成,就把当前的参数填写到左侧的框框里? -->
|
|
<!-- TODO @fan:1)按钮要不调整成详情、下载、再次生成、删除?;2)如果是再次生成,就把当前的参数填写到左侧的框框里? -->
|
|
<div>
|
|
<div>
|
|
@@ -26,7 +37,9 @@
|
|
<div class="image-wrapper" ref="cardImageRef">
|
|
<div class="image-wrapper" ref="cardImageRef">
|
|
<!-- TODO @fan:要不加个点击,大图预览? -->
|
|
<!-- TODO @fan:要不加个点击,大图预览? -->
|
|
<img class="image" :src="imageDetail?.picUrl" />
|
|
<img class="image" :src="imageDetail?.picUrl" />
|
|
- <div v-if="imageDetail?.status === 30">{{ imageDetail?.errorMessage }}</div>
|
|
|
|
|
|
+ <div v-if="imageDetail?.status === AiImageStatusEnum.FAIL">
|
|
|
|
+ {{ imageDetail?.errorMessage }}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<!-- TODO @fan:style 使用 unocss 替代下 -->
|
|
<!-- TODO @fan:style 使用 unocss 替代下 -->
|
|
<div class="image-mj-btns">
|
|
<div class="image-mj-btns">
|
|
@@ -46,7 +59,8 @@
|
|
import { Delete, Download, More } from '@element-plus/icons-vue'
|
|
import { Delete, Download, More } from '@element-plus/icons-vue'
|
|
import { ImageVO, ImageMjButtonsVO } from '@/api/ai/image'
|
|
import { ImageVO, ImageMjButtonsVO } from '@/api/ai/image'
|
|
import { PropType } from 'vue'
|
|
import { PropType } from 'vue'
|
|
-import { ElLoading, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
+import { ElLoading } from 'element-plus'
|
|
|
|
+import { AiImageStatusEnum } from '@/views/ai/utils/constants'
|
|
|
|
|
|
const cardImageRef = ref<any>() // 卡片 image ref
|
|
const cardImageRef = ref<any>() // 卡片 image ref
|
|
const cardImageLoadingInstance = ref<any>() // 卡片 image ref
|
|
const cardImageLoadingInstance = ref<any>() // 卡片 image ref
|
|
@@ -65,7 +79,7 @@ const handlerBtnClick = async (type, imageDetail: ImageVO) => {
|
|
|
|
|
|
const handlerLoading = async (status: number) => {
|
|
const handlerLoading = async (status: number) => {
|
|
// TODO @fan:这个搞成 Loading 组件,然后通过数据驱动,这样搞可以哇?
|
|
// TODO @fan:这个搞成 Loading 组件,然后通过数据驱动,这样搞可以哇?
|
|
- if (status === 10) {
|
|
|
|
|
|
+ if (status === AiImageStatusEnum.IN_PROGRESS) {
|
|
cardImageLoadingInstance.value = ElLoading.service({
|
|
cardImageLoadingInstance.value = ElLoading.service({
|
|
target: cardImageRef.value,
|
|
target: cardImageRef.value,
|
|
text: '生成中...'
|
|
text: '生成中...'
|