【解决todo】handle命名
parent
bb34c2b75c
commit
b6ff9ede11
|
@ -2,7 +2,7 @@
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="showDrawer"
|
v-model="showDrawer"
|
||||||
title="图片详细"
|
title="图片详细"
|
||||||
@close="handlerDrawerClose"
|
@close="handleDrawerClose"
|
||||||
custom-class="drawer-class"
|
custom-class="drawer-class"
|
||||||
>
|
>
|
||||||
<!-- 图片 -->
|
<!-- 图片 -->
|
||||||
|
@ -79,8 +79,8 @@ const props = defineProps({
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 抽屉 - close */
|
/** 抽屉 - close */
|
||||||
const handlerDrawerClose = async () => {
|
const handleDrawerClose = async () => {
|
||||||
emits('handlerDrawerClose')
|
emits('handleDrawerClose')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取 - 图片 detail */
|
/** 获取 - 图片 detail */
|
||||||
|
@ -90,7 +90,7 @@ const getImageDetail = async (id) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 任务 - detail */
|
/** 任务 - detail */
|
||||||
const handlerTaskDetail = async () => {
|
const handleTaskDetail = async () => {
|
||||||
showDrawer.value = true
|
showDrawer.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ watch(id, async (newVal, oldVal) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//
|
//
|
||||||
const emits = defineEmits(['handlerDrawerClose'])
|
const emits = defineEmits(['handleDrawerClose'])
|
||||||
//
|
//
|
||||||
onMounted(async () => {})
|
onMounted(async () => {})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
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="handleImageBtnClick"
|
||||||
@on-mj-btn-click="handlerImageMjBtnClick"
|
@on-mj-btn-click="handleImageMjBtnClick"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="task-image-pagination">
|
<div class="task-image-pagination">
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
layout="prev, pager, next"
|
layout="prev, pager, next"
|
||||||
:default-page-size="pageSize"
|
:default-page-size="pageSize"
|
||||||
:total="pageTotal"
|
:total="pageTotal"
|
||||||
@change="handlerPageChange"
|
@change="handlePageChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<ImageDetailDrawer
|
<ImageDetailDrawer
|
||||||
:show="isShowImageDetail"
|
:show="isShowImageDetail"
|
||||||
:id="showImageDetailId"
|
:id="showImageDetailId"
|
||||||
@handler-drawer-close="handlerDrawerClose"
|
@handle-drawer-close="handleDrawerClose"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -49,12 +49,12 @@ const pageSize = ref<number>(10) // page size
|
||||||
const pageTotal = ref<number>(0) // page size
|
const pageTotal = ref<number>(0) // page size
|
||||||
|
|
||||||
/** 抽屉 - close */
|
/** 抽屉 - close */
|
||||||
const handlerDrawerClose = async () => {
|
const handleDrawerClose = async () => {
|
||||||
isShowImageDetail.value = false
|
isShowImageDetail.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 任务 - detail */
|
/** 任务 - detail */
|
||||||
const handlerDrawerOpen = async () => {
|
const handleDrawerOpen = async () => {
|
||||||
isShowImageDetail.value = true
|
isShowImageDetail.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,12 +117,12 @@ const refreshWatchImages = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 图片 - btn click */
|
/** 图片 - btn click */
|
||||||
const handlerImageBtnClick = async (type: string, imageDetail: ImageVO) => {
|
const handleImageBtnClick = async (type: string, imageDetail: ImageVO) => {
|
||||||
// 获取 image detail id
|
// 获取 image detail id
|
||||||
showImageDetailId.value = imageDetail.id
|
showImageDetailId.value = imageDetail.id
|
||||||
// 处理不用 btn
|
// 处理不用 btn
|
||||||
if (type === 'more') {
|
if (type === 'more') {
|
||||||
await handlerDrawerOpen()
|
await handleDrawerOpen()
|
||||||
} else if (type === 'delete') {
|
} else if (type === 'delete') {
|
||||||
await message.confirm(`是否删除照片?`)
|
await message.confirm(`是否删除照片?`)
|
||||||
await ImageApi.deleteImageMy(imageDetail.id)
|
await ImageApi.deleteImageMy(imageDetail.id)
|
||||||
|
@ -138,7 +138,7 @@ const handlerImageBtnClick = async (type: string, imageDetail: ImageVO) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 图片 - mj btn click */
|
/** 图片 - mj btn click */
|
||||||
const handlerImageMjBtnClick = async (button: ImageMjButtonsVO, imageDetail: ImageVO) => {
|
const handleImageMjBtnClick = async (button: ImageMjButtonsVO, imageDetail: ImageVO) => {
|
||||||
// 1、构建 params 参数
|
// 1、构建 params 参数
|
||||||
const data = {
|
const data = {
|
||||||
id: imageDetail.id,
|
id: imageDetail.id,
|
||||||
|
@ -171,7 +171,7 @@ const downloadImage = async (imageUrl) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// page change
|
// page change
|
||||||
const handlerPageChange = async (page) => {
|
const handlePageChange = async (page) => {
|
||||||
pageNo.value = page
|
pageNo.value = page
|
||||||
await getImageList(false)
|
await getImageList(false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,21 +23,21 @@
|
||||||
class="btn"
|
class="btn"
|
||||||
text
|
text
|
||||||
:icon="Download"
|
:icon="Download"
|
||||||
@click="handlerBtnClick('download', imageDetail)"
|
@click="handleBtnClick('download', imageDetail)"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
class="btn"
|
class="btn"
|
||||||
text
|
text
|
||||||
:icon="RefreshRight"
|
:icon="RefreshRight"
|
||||||
@click="handlerBtnClick('regeneration', imageDetail)"
|
@click="handleBtnClick('regeneration', imageDetail)"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
class="btn"
|
class="btn"
|
||||||
text
|
text
|
||||||
:icon="Delete"
|
:icon="Delete"
|
||||||
@click="handlerBtnClick('delete', imageDetail)"
|
@click="handleBtnClick('delete', imageDetail)"
|
||||||
/>
|
/>
|
||||||
<el-button class="btn" text :icon="More" @click="handlerBtnClick('more', imageDetail)" />
|
<el-button class="btn" text :icon="More" @click="handleBtnClick('more', imageDetail)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="image-wrapper" ref="cardImageRef">
|
<div class="image-wrapper" ref="cardImageRef">
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
v-for="button in imageDetail?.buttons"
|
v-for="button in imageDetail?.buttons"
|
||||||
:key="button"
|
:key="button"
|
||||||
style="min-width: 40px; margin-left: 0; margin-right: 10px; margin-top: 5px"
|
style="min-width: 40px; margin-left: 0; margin-right: 10px; margin-top: 5px"
|
||||||
@click="handlerMjBtnClick(button)"
|
@click="handleMjBtnClick(button)"
|
||||||
>
|
>
|
||||||
{{ button.label }}{{ button.emoji }}
|
{{ button.label }}{{ button.emoji }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -79,11 +79,11 @@ const props = defineProps({
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 按钮 - 点击事件 */
|
/** 按钮 - 点击事件 */
|
||||||
const handlerBtnClick = async (type, imageDetail: ImageVO) => {
|
const handleBtnClick = async (type, imageDetail: ImageVO) => {
|
||||||
emits('onBtnClick', type, imageDetail)
|
emits('onBtnClick', type, imageDetail)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlerLoading = async (status: number) => {
|
const handleLoading = async (status: number) => {
|
||||||
// TODO @fan:这个搞成 Loading 组件,然后通过数据驱动,这样搞可以哇?
|
// TODO @fan:这个搞成 Loading 组件,然后通过数据驱动,这样搞可以哇?
|
||||||
if (status === AiImageStatusEnum.IN_PROGRESS) {
|
if (status === AiImageStatusEnum.IN_PROGRESS) {
|
||||||
cardImageLoadingInstance.value = ElLoading.service({
|
cardImageLoadingInstance.value = ElLoading.service({
|
||||||
|
@ -99,7 +99,7 @@ const handlerLoading = async (status: number) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** mj 按钮 click */
|
/** mj 按钮 click */
|
||||||
const handlerMjBtnClick = async (button: ImageMjButtonsVO) => {
|
const handleMjBtnClick = async (button: ImageMjButtonsVO) => {
|
||||||
// 确认窗体
|
// 确认窗体
|
||||||
await message.confirm(`确认操作 "${button.label} ${button.emoji}" ?`)
|
await message.confirm(`确认操作 "${button.label} ${button.emoji}" ?`)
|
||||||
emits('onMjBtnClick', button, props.imageDetail)
|
emits('onMjBtnClick', button, props.imageDetail)
|
||||||
|
@ -108,7 +108,7 @@ const handlerMjBtnClick = async (button: ImageMjButtonsVO) => {
|
||||||
// watch
|
// watch
|
||||||
const { imageDetail } = toRefs(props)
|
const { imageDetail } = toRefs(props)
|
||||||
watch(imageDetail, async (newVal, oldVal) => {
|
watch(imageDetail, async (newVal, oldVal) => {
|
||||||
await handlerLoading(newVal.status as string)
|
await handleLoading(newVal.status as string)
|
||||||
})
|
})
|
||||||
|
|
||||||
// emits
|
// emits
|
||||||
|
@ -116,7 +116,7 @@ const emits = defineEmits(['onBtnClick', 'onMjBtnClick'])
|
||||||
|
|
||||||
//
|
//
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await handlerLoading(props.imageDetail.status as string)
|
await handleLoading(props.imageDetail.status as string)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
:type="(selectHotWord === hotWord ? 'primary' : 'default')"
|
:type="(selectHotWord === hotWord ? 'primary' : 'default')"
|
||||||
v-for="hotWord in hotWords"
|
v-for="hotWord in hotWords"
|
||||||
:key="hotWord"
|
:key="hotWord"
|
||||||
@click="handlerHotWordClick(hotWord)"
|
@click="handleHotWordClick(hotWord)"
|
||||||
>
|
>
|
||||||
{{ hotWord }}
|
{{ hotWord }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<el-image
|
<el-image
|
||||||
:src="model.image"
|
:src="model.image"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
@click="handlerModelClick(model)"
|
@click="handleModelClick(model)"
|
||||||
/>
|
/>
|
||||||
<div class="model-font">{{model.name}}</div>
|
<div class="model-font">{{model.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
<el-image
|
<el-image
|
||||||
:src="imageStyle.image"
|
:src="imageStyle.image"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
@click="handlerStyleClick(imageStyle)"
|
@click="handleStyleClick(imageStyle)"
|
||||||
/>
|
/>
|
||||||
<div class="style-font">{{imageStyle.name}}</div>
|
<div class="style-font">{{imageStyle.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
<div class="size-item"
|
<div class="size-item"
|
||||||
v-for="imageSize in imageSizeList"
|
v-for="imageSize in imageSizeList"
|
||||||
:key="imageSize.key"
|
:key="imageSize.key"
|
||||||
@click="handlerSizeClick(imageSize)">
|
@click="handleSizeClick(imageSize)">
|
||||||
<div :class="selectImageSize === imageSize.key ? 'size-wrapper selectImageSize' : 'size-wrapper'">
|
<div :class="selectImageSize === imageSize.key ? 'size-wrapper selectImageSize' : 'size-wrapper'">
|
||||||
<div :style="imageSize.style"></div>
|
<div :style="imageSize.style"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
size="large"
|
size="large"
|
||||||
round
|
round
|
||||||
:loading="drawIn"
|
:loading="drawIn"
|
||||||
@click="handlerGenerateImage">
|
@click="handleGenerateImage">
|
||||||
{{drawIn ? '生成中' : '生成内容'}}
|
{{drawIn ? '生成中' : '生成内容'}}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -183,10 +183,8 @@ const props = defineProps({})
|
||||||
// 定义 emits
|
// 定义 emits
|
||||||
const emits = defineEmits(['onDrawStart', 'onDrawComplete'])
|
const emits = defineEmits(['onDrawStart', 'onDrawComplete'])
|
||||||
|
|
||||||
// TODO @fan:如果是简单注释,建议用 /** */,主要是现在项目里是这种风格哈,保持一致好点~
|
|
||||||
// TODO @fan:handler 应该改成 handle 哈
|
|
||||||
/** 热词 - click */
|
/** 热词 - click */
|
||||||
const handlerHotWordClick = async (hotWord: string) => {
|
const handleHotWordClick = async (hotWord: string) => {
|
||||||
// 取消选中
|
// 取消选中
|
||||||
if (selectHotWord.value == hotWord) {
|
if (selectHotWord.value == hotWord) {
|
||||||
selectHotWord.value = ''
|
selectHotWord.value = ''
|
||||||
|
@ -199,22 +197,22 @@ const handlerHotWordClick = async (hotWord: string) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 模型 - click */
|
/** 模型 - click */
|
||||||
const handlerModelClick = async (model: ImageModelVO) => {
|
const handleModelClick = async (model: ImageModelVO) => {
|
||||||
selectModel.value = model.key
|
selectModel.value = model.key
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 样式 - click */
|
/** 样式 - click */
|
||||||
const handlerStyleClick = async (imageStyle: ImageModelVO) => {
|
const handleStyleClick = async (imageStyle: ImageModelVO) => {
|
||||||
selectImageStyle.value = imageStyle.key
|
selectImageStyle.value = imageStyle.key
|
||||||
}
|
}
|
||||||
|
|
||||||
/** size - click */
|
/** size - click */
|
||||||
const handlerSizeClick = async (imageSize: ImageSizeVO) => {
|
const handleSizeClick = async (imageSize: ImageSizeVO) => {
|
||||||
selectImageSize.value = imageSize.key
|
selectImageSize.value = imageSize.key
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 图片生产 */
|
/** 图片生产 */
|
||||||
const handlerGenerateImage = async () => {
|
const handleGenerateImage = async () => {
|
||||||
// 二次确认
|
// 二次确认
|
||||||
await message.confirm(`确认生成内容?`)
|
await message.confirm(`确认生成内容?`)
|
||||||
try {
|
try {
|
||||||
|
@ -251,15 +249,14 @@ const settingValues = async (imageDetail: ImageVO) => {
|
||||||
selectImageStyle.value = imageDetail.options?.style
|
selectImageStyle.value = imageDetail.options?.style
|
||||||
//
|
//
|
||||||
const imageSize = imageSizeList.value.find(item => item.key === `${imageDetail.width}x${imageDetail.height}`) as ImageSizeVO
|
const imageSize = imageSizeList.value.find(item => item.key === `${imageDetail.width}x${imageDetail.height}`) as ImageSizeVO
|
||||||
console.log('imageSize', imageSize)
|
await handleSizeClick(imageSize)
|
||||||
await handlerSizeClick(imageSize)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 暴露组件方法 */
|
/** 暴露组件方法 */
|
||||||
defineExpose({ settingValues })
|
defineExpose({ settingValues })
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
||||||
// 提示词
|
// 提示词
|
||||||
.prompt {
|
.prompt {
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
<Dall3
|
<Dall3
|
||||||
v-if="selectPlatform === AiPlatformEnum.OPENAI"
|
v-if="selectPlatform === AiPlatformEnum.OPENAI"
|
||||||
ref="dall3Ref"
|
ref="dall3Ref"
|
||||||
@on-draw-start="handlerDrawStart"
|
@on-draw-start="handleDrawStart"
|
||||||
@on-draw-complete="handlerDrawComplete"
|
@on-draw-complete="handleDrawComplete"
|
||||||
/>
|
/>
|
||||||
<Midjourney
|
<Midjourney
|
||||||
v-if="selectPlatform === AiPlatformEnum.MIDJOURNEY"
|
v-if="selectPlatform === AiPlatformEnum.MIDJOURNEY"
|
||||||
|
@ -19,12 +19,12 @@
|
||||||
<StableDiffusion
|
<StableDiffusion
|
||||||
v-if="selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
|
v-if="selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
|
||||||
ref="stableDiffusionRef"
|
ref="stableDiffusionRef"
|
||||||
@on-draw-complete="handlerDrawComplete"
|
@on-draw-complete="handleDrawComplete"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<ImageTask ref="imageTaskRef" @on-regeneration="handlerRegeneration" />
|
<ImageTask ref="imageTaskRef" @on-regeneration="handleRegeneration" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -63,20 +63,20 @@ const platformOptions = [
|
||||||
const drawIn = ref<boolean>(false) // 生成中
|
const drawIn = ref<boolean>(false) // 生成中
|
||||||
|
|
||||||
/** 绘画 - start */
|
/** 绘画 - start */
|
||||||
const handlerDrawStart = async (type) => {
|
const handleDrawStart = async (type) => {
|
||||||
// todo @fan:这个是不是没用啦?
|
// todo @fan:这个是不是没用啦?
|
||||||
drawIn.value = true
|
drawIn.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 绘画 - complete */
|
/** 绘画 - complete */
|
||||||
const handlerDrawComplete = async (type) => {
|
const handleDrawComplete = async (type) => {
|
||||||
drawIn.value = false
|
drawIn.value = false
|
||||||
// todo
|
// todo
|
||||||
await imageTaskRef.value.getImageList()
|
await imageTaskRef.value.getImageList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 绘画 - 重新生成 */
|
/** 绘画 - 重新生成 */
|
||||||
const handlerRegeneration = async (imageDetail: ImageVO) => {
|
const handleRegeneration = async (imageDetail: ImageVO) => {
|
||||||
// 切换平台
|
// 切换平台
|
||||||
selectPlatform.value = imageDetail.platform
|
selectPlatform.value = imageDetail.platform
|
||||||
console.log('切换平台', imageDetail.platform)
|
console.log('切换平台', imageDetail.platform)
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
:type="(selectHotWord === hotWord ? 'primary' : 'default')"
|
:type="(selectHotWord === hotWord ? 'primary' : 'default')"
|
||||||
v-for="hotWord in hotWords"
|
v-for="hotWord in hotWords"
|
||||||
:key="hotWord"
|
:key="hotWord"
|
||||||
@click="handlerHotWordClick(hotWord)"
|
@click="handleHotWordClick(hotWord)"
|
||||||
>
|
>
|
||||||
{{ hotWord }}
|
{{ hotWord }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<div class="size-item"
|
<div class="size-item"
|
||||||
v-for="imageSize in imageSizeList"
|
v-for="imageSize in imageSizeList"
|
||||||
:key="imageSize.key"
|
:key="imageSize.key"
|
||||||
@click="handlerSizeClick(imageSize)">
|
@click="handleSizeClick(imageSize)">
|
||||||
<div :class="selectImageSize === imageSize.key ? 'size-wrapper selectImageSize' : 'size-wrapper'">
|
<div :class="selectImageSize === imageSize.key ? 'size-wrapper selectImageSize' : 'size-wrapper'">
|
||||||
<div :style="imageSize.style"></div>
|
<div :style="imageSize.style"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择版本"
|
placeholder="请选择版本"
|
||||||
style="width: 350px"
|
style="width: 350px"
|
||||||
@change="handlerChangeVersion"
|
@change="handleChangeVersion"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in versionList"
|
v-for="item in versionList"
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
<el-image
|
<el-image
|
||||||
:src="model.image"
|
:src="model.image"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
@click="handlerModelClick(model)"
|
@click="handleModelClick(model)"
|
||||||
/>
|
/>
|
||||||
<div class="model-font">{{model.name}}</div>
|
<div class="model-font">{{model.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="btns">
|
<div class="btns">
|
||||||
<!-- <el-button size="large" round>重置内容</el-button>-->
|
<!-- <el-button size="large" round>重置内容</el-button>-->
|
||||||
<el-button type="primary" size="large" round @click="handlerGenerateImage">生成内容</el-button>
|
<el-button type="primary" size="large" round @click="handleGenerateImage">生成内容</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -211,7 +211,7 @@ let versionList = ref<any>([]) // version 列表
|
||||||
versionList.value = midjourneyVersionList.value // 默认选择 midjourney
|
versionList.value = midjourneyVersionList.value // 默认选择 midjourney
|
||||||
|
|
||||||
/** 热词 - click */
|
/** 热词 - click */
|
||||||
const handlerHotWordClick = async (hotWord: string) => {
|
const handleHotWordClick = async (hotWord: string) => {
|
||||||
// 取消
|
// 取消
|
||||||
if (selectHotWord.value == hotWord) {
|
if (selectHotWord.value == hotWord) {
|
||||||
selectHotWord.value = ''
|
selectHotWord.value = ''
|
||||||
|
@ -224,12 +224,12 @@ const handlerHotWordClick = async (hotWord: string) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** size - click */
|
/** size - click */
|
||||||
const handlerSizeClick = async (imageSize: ImageSizeVO) => {
|
const handleSizeClick = async (imageSize: ImageSizeVO) => {
|
||||||
selectImageSize.value = imageSize.key
|
selectImageSize.value = imageSize.key
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 模型 - click */
|
/** 模型 - click */
|
||||||
const handlerModelClick = async (model: ImageModelVO) => {
|
const handleModelClick = async (model: ImageModelVO) => {
|
||||||
selectModel.value = model.key
|
selectModel.value = model.key
|
||||||
if (model.key === 'niji') {
|
if (model.key === 'niji') {
|
||||||
versionList.value = nijiVersionList.value // 默认选择 niji
|
versionList.value = nijiVersionList.value // 默认选择 niji
|
||||||
|
@ -240,21 +240,20 @@ const handlerModelClick = async (model: ImageModelVO) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** version - click */
|
/** version - click */
|
||||||
const handlerChangeVersion = async (version) => {
|
const handleChangeVersion = async (version) => {
|
||||||
console.log('version', version)
|
console.log('version', version)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 图片生产 */
|
/** 图片生产 */
|
||||||
const handlerGenerateImage = async () => {
|
const handleGenerateImage = async () => {
|
||||||
// 二次确认
|
// 二次确认
|
||||||
await message.confirm(`确认生成内容?`)
|
await message.confirm(`确认生成内容?`)
|
||||||
// todo @范 图片生产逻辑
|
// todo @范 图片生产逻辑
|
||||||
try {
|
try {
|
||||||
console.log('referImage.value', referImage.value)
|
|
||||||
// 回调
|
// 回调
|
||||||
emits('onDrawStart', selectModel.value)
|
emits('onDrawStart', selectModel.value)
|
||||||
// 发送请求
|
// 发送请求
|
||||||
const imageSize = imageSizeList.value.find(item => selectImageSize === item.key) as ImageSizeVO
|
const imageSize = imageSizeList.value.find(item => selectImageSize.value === item.key) as ImageSizeVO
|
||||||
const req = {
|
const req = {
|
||||||
prompt: prompt.value,
|
prompt: prompt.value,
|
||||||
model: selectModel.value,
|
model: selectModel.value,
|
||||||
|
@ -279,7 +278,7 @@ const settingValues = async (imageDetail: ImageVO) => {
|
||||||
selectImageSize.value = imageSize.key
|
selectImageSize.value = imageSize.key
|
||||||
// 选中模型
|
// 选中模型
|
||||||
const model = models.value.find(item => item.key === imageDetail.options?.model) as ImageModelVO
|
const model = models.value.find(item => item.key === imageDetail.options?.model) as ImageModelVO
|
||||||
await handlerModelClick(model)
|
await handleModelClick(model)
|
||||||
// 版本
|
// 版本
|
||||||
selectVersion.value = versionList.value.find(item => item.value === imageDetail.options?.version).value
|
selectVersion.value = versionList.value.find(item => item.value === imageDetail.options?.version).value
|
||||||
// image
|
// image
|
||||||
|
|
|
@ -351,7 +351,7 @@ const handleGenerateImage = async () => {
|
||||||
steps: steps.value, // 图片生成步数
|
steps: steps.value, // 图片生成步数
|
||||||
scale: scale.value, // 引导系数
|
scale: scale.value, // 引导系数
|
||||||
sampler: selectSampler.value, // 采样算法
|
sampler: selectSampler.value, // 采样算法
|
||||||
clipGuidancePreset: selectClipGuidancePreset.value.key, // 文本提示相匹配的图像 CLIP
|
clipGuidancePreset: selectClipGuidancePreset.value, // 文本提示相匹配的图像 CLIP
|
||||||
stylePreset: selectStylePreset.value, // 风格
|
stylePreset: selectStylePreset.value, // 风格
|
||||||
}
|
}
|
||||||
} as ImageDrawReqVO
|
} as ImageDrawReqVO
|
||||||
|
|
Loading…
Reference in New Issue