|
@@ -6,15 +6,17 @@
|
|
v-for="image in imageList"
|
|
v-for="image in imageList"
|
|
:key="image"
|
|
:key="image"
|
|
:image-detail="image"
|
|
:image-detail="image"
|
|
-
|
|
|
|
@on-btn-click="handlerImageBtnClick"
|
|
@on-btn-click="handlerImageBtnClick"
|
|
- @on-mj-btn-click="handlerImageMjBtnClick"/>
|
|
|
|
|
|
+ @on-mj-btn-click="handlerImageMjBtnClick"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
<div class="task-image-pagination">
|
|
<div class="task-image-pagination">
|
|
- <el-pagination background layout="prev, pager, next"
|
|
|
|
- :default-page-size="pageSize"
|
|
|
|
- :total="pageTotal"
|
|
|
|
- @change="handlerPageChange"
|
|
|
|
|
|
+ <el-pagination
|
|
|
|
+ background
|
|
|
|
+ layout="prev, pager, next"
|
|
|
|
+ :default-page-size="pageSize"
|
|
|
|
+ :total="pageTotal"
|
|
|
|
+ @change="handlerPageChange"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</el-card>
|
|
@@ -26,14 +28,14 @@
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import {ImageApi, ImageRespVO, ImageMjActionVO, ImageMjButtonsVO} from '@/api/ai/image';
|
|
|
|
|
|
+import { ImageApi, ImageVO, ImageMjActionVO, ImageMjButtonsVO } from '@/api/ai/image'
|
|
import ImageDetailDrawer from './ImageDetailDrawer.vue'
|
|
import ImageDetailDrawer from './ImageDetailDrawer.vue'
|
|
import ImageTaskCard from './ImageTaskCard.vue'
|
|
import ImageTaskCard from './ImageTaskCard.vue'
|
|
-import {ElLoading, LoadingOptionsResolved} from "element-plus";
|
|
|
|
|
|
+import { ElLoading, LoadingOptionsResolved } from 'element-plus'
|
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
|
-const imageList = ref<ImageRespVO[]>([]) // image 列表
|
|
|
|
|
|
+const imageList = ref<ImageVO[]>([]) // image 列表
|
|
const imageListInterval = ref<any>() // image 列表定时器,刷新列表
|
|
const imageListInterval = ref<any>() // image 列表定时器,刷新列表
|
|
const isShowImageDetail = ref<boolean>(false) // 是否显示 task 详情
|
|
const isShowImageDetail = ref<boolean>(false) // 是否显示 task 详情
|
|
const showImageDetailId = ref<number>(0) // 是否显示 task 详情
|
|
const showImageDetailId = ref<number>(0) // 是否显示 task 详情
|
|
@@ -57,14 +59,17 @@ const handlerDrawerOpen = async () => {
|
|
/**
|
|
/**
|
|
* 获取 - image 列表
|
|
* 获取 - image 列表
|
|
*/
|
|
*/
|
|
-const getImageList = async (apply:boolean = false) => {
|
|
|
|
|
|
+const getImageList = async (apply: boolean = false) => {
|
|
imageTaskLoading.value = true
|
|
imageTaskLoading.value = true
|
|
try {
|
|
try {
|
|
imageTaskLoadingInstance.value = ElLoading.service({
|
|
imageTaskLoadingInstance.value = ElLoading.service({
|
|
target: imageTaskRef.value,
|
|
target: imageTaskRef.value,
|
|
text: '加载中...'
|
|
text: '加载中...'
|
|
} as LoadingOptionsResolved)
|
|
} as LoadingOptionsResolved)
|
|
- const { list, total } = await ImageApi.getImagePageMy({pageNo: pageNo.value, pageSize: pageSize.value})
|
|
|
|
|
|
+ const { list, total } = await ImageApi.getImagePageMy({
|
|
|
|
+ pageNo: pageNo.value,
|
|
|
|
+ pageSize: pageSize.value
|
|
|
|
+ })
|
|
if (apply) {
|
|
if (apply) {
|
|
imageList.value = [...imageList.value, ...list]
|
|
imageList.value = [...imageList.value, ...list]
|
|
} else {
|
|
} else {
|
|
@@ -73,14 +78,14 @@ const getImageList = async (apply:boolean = false) => {
|
|
pageTotal.value = total
|
|
pageTotal.value = total
|
|
} finally {
|
|
} finally {
|
|
if (imageTaskLoadingInstance.value) {
|
|
if (imageTaskLoadingInstance.value) {
|
|
- imageTaskLoadingInstance.value.close();
|
|
|
|
- imageTaskLoadingInstance.value = null;
|
|
|
|
|
|
+ imageTaskLoadingInstance.value.close()
|
|
|
|
+ imageTaskLoadingInstance.value = null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/** 图片 - btn click */
|
|
/** 图片 - btn click */
|
|
-const handlerImageBtnClick = async (type, imageDetail: ImageRespVO) => {
|
|
|
|
|
|
+const handlerImageBtnClick = async (type, imageDetail: ImageVO) => {
|
|
// 获取 image detail id
|
|
// 获取 image detail id
|
|
showImageDetailId.value = imageDetail.id
|
|
showImageDetailId.value = imageDetail.id
|
|
console.log('type', imageDetail.id)
|
|
console.log('type', imageDetail.id)
|
|
@@ -91,18 +96,18 @@ const handlerImageBtnClick = async (type, imageDetail: ImageRespVO) => {
|
|
await message.confirm(`是否删除照片?`)
|
|
await message.confirm(`是否删除照片?`)
|
|
await ImageApi.deleteImageMy(imageDetail.id)
|
|
await ImageApi.deleteImageMy(imageDetail.id)
|
|
await getImageList()
|
|
await getImageList()
|
|
- await message.success("删除成功!")
|
|
|
|
|
|
+ await message.success('删除成功!')
|
|
} else if (type === 'download') {
|
|
} else if (type === 'download') {
|
|
await downloadImage(imageDetail.picUrl)
|
|
await downloadImage(imageDetail.picUrl)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/** 图片 - mj btn click */
|
|
/** 图片 - mj btn click */
|
|
-const handlerImageMjBtnClick = async (button: ImageMjButtonsVO, imageDetail: ImageRespVO) => {
|
|
|
|
|
|
+const handlerImageMjBtnClick = async (button: ImageMjButtonsVO, imageDetail: ImageVO) => {
|
|
// 1、构建 params 参数
|
|
// 1、构建 params 参数
|
|
const data = {
|
|
const data = {
|
|
id: imageDetail.id,
|
|
id: imageDetail.id,
|
|
- customId: button.customId,
|
|
|
|
|
|
+ customId: button.customId
|
|
} as ImageMjActionVO
|
|
} as ImageMjActionVO
|
|
// 2、发送 action
|
|
// 2、发送 action
|
|
await ImageApi.midjourneyAction(data)
|
|
await ImageApi.midjourneyAction(data)
|
|
@@ -137,7 +142,7 @@ const handlerPageChange = async (page) => {
|
|
}
|
|
}
|
|
|
|
|
|
/** 暴露组件方法 */
|
|
/** 暴露组件方法 */
|
|
-defineExpose({getImageList})
|
|
|
|
|
|
+defineExpose({ getImageList })
|
|
|
|
|
|
/** 组件挂在的时候 */
|
|
/** 组件挂在的时候 */
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
@@ -177,11 +182,11 @@ onUnmounted(async () => {
|
|
padding-bottom: 140px;
|
|
padding-bottom: 140px;
|
|
box-sizing: border-box; /* 确保内边距不会增加高度 */
|
|
box-sizing: border-box; /* 确保内边距不会增加高度 */
|
|
|
|
|
|
- >div {
|
|
|
|
|
|
+ > div {
|
|
margin-right: 20px;
|
|
margin-right: 20px;
|
|
margin-bottom: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
}
|
|
- >div:last-of-type {
|
|
|
|
|
|
+ > div:last-of-type {
|
|
//margin-bottom: 100px;
|
|
//margin-bottom: 100px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -199,7 +204,6 @@ onUnmounted(async () => {
|
|
justify-content: center;
|
|
justify-content: center;
|
|
align-items: center;
|
|
align-items: center;
|
|
}
|
|
}
|
|
-
|
|
|
|
</style>
|
|
</style>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|