mirror of
https://github.com/yudaocode/yudao-ui-admin-vue3.git
synced 2026-05-10 00:53:28 +00:00
【代码优化】AI:增加枚举类
This commit is contained in:
@@ -2,9 +2,20 @@
|
||||
<el-card body-class="" class="image-card">
|
||||
<div class="image-operation">
|
||||
<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>
|
||||
<!-- TODO @fan:1)按钮要不调整成详情、下载、再次生成、删除?;2)如果是再次生成,就把当前的参数填写到左侧的框框里? -->
|
||||
<div>
|
||||
@@ -26,7 +37,9 @@
|
||||
<div class="image-wrapper" ref="cardImageRef">
|
||||
<!-- TODO @fan:要不加个点击,大图预览? -->
|
||||
<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>
|
||||
<!-- TODO @fan:style 使用 unocss 替代下 -->
|
||||
<div class="image-mj-btns">
|
||||
@@ -46,7 +59,8 @@
|
||||
import { Delete, Download, More } from '@element-plus/icons-vue'
|
||||
import { ImageVO, ImageMjButtonsVO } from '@/api/ai/image'
|
||||
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 cardImageLoadingInstance = ref<any>() // 卡片 image ref
|
||||
@@ -65,7 +79,7 @@ const handlerBtnClick = async (type, imageDetail: ImageVO) => {
|
||||
|
||||
const handlerLoading = async (status: number) => {
|
||||
// TODO @fan:这个搞成 Loading 组件,然后通过数据驱动,这样搞可以哇?
|
||||
if (status === 10) {
|
||||
if (status === AiImageStatusEnum.IN_PROGRESS) {
|
||||
cardImageLoadingInstance.value = ElLoading.service({
|
||||
target: cardImageRef.value,
|
||||
text: '生成中...'
|
||||
|
||||
Reference in New Issue
Block a user