From c513814c0a40a0da785d96a5e9a6c207e1ff9882 Mon Sep 17 00:00:00 2001 From: hrx <18603305412@163.com> Date: Wed, 1 Apr 2026 18:01:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=94=9F=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +- src/apis/Model.ts | 4 + src/assets/less/Img/ImgBox.css | 4 + src/assets/less/Img/ImgBox.less | 4 + src/assets/less/Video/img/img.css | 206 +++++ src/assets/less/Video/img/img.less | 253 +++++++ src/assets/less/Video/{ => text}/text.css | 36 + src/assets/less/Video/{ => text}/text.less | 43 ++ src/components/video/ImgVideo.vue | 828 ++++++++++++++------- src/components/video/TextVideo.vue | 21 +- src/components/video/VideoLeft.vue | 27 +- src/types/model.ts | 5 + 12 files changed, 1135 insertions(+), 299 deletions(-) create mode 100644 src/assets/less/Video/img/img.css create mode 100644 src/assets/less/Video/img/img.less rename src/assets/less/Video/{ => text}/text.css (83%) rename src/assets/less/Video/{ => text}/text.less (81%) diff --git a/.env.development b/.env.development index 5995f9a..0016544 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,2 @@ -VITE_API_BASE_URL = 'https://opencomputing.ai' \ No newline at end of file +VITE_API_BASE_URL = 'https://opencomputing.ai' +VITE_IMG_BASE_URL = 'https://opencomputing.ai' \ No newline at end of file diff --git a/src/apis/Model.ts b/src/apis/Model.ts index ef069db..8ba5065 100644 --- a/src/apis/Model.ts +++ b/src/apis/Model.ts @@ -2,6 +2,10 @@ import {get, post} from '../utlis/request' // 文生视频 export const textvideo = (data:D):Promise =>post('/api/llmage/vidu_inference.dspy',data) + +// 图生视频 +export const imagetovideo = (data:D):Promise =>post('/api/llmage/vidu_inference.dspy',data) + // 获取所有模型 export const AllModel = (data:D):Promise =>get('/api/llmage/get_type_llms.dspy',data) diff --git a/src/assets/less/Img/ImgBox.css b/src/assets/less/Img/ImgBox.css index 79490d2..9507070 100644 --- a/src/assets/less/Img/ImgBox.css +++ b/src/assets/less/Img/ImgBox.css @@ -142,3 +142,7 @@ background-color: rgba(255, 255, 255, 0.1); color: #fff; } +:deep(.el-upload--picture-card) { + width: 140px !important; + height: 140px !important; +} diff --git a/src/assets/less/Img/ImgBox.less b/src/assets/less/Img/ImgBox.less index 8a5a9a0..cde8fac 100644 --- a/src/assets/less/Img/ImgBox.less +++ b/src/assets/less/Img/ImgBox.less @@ -175,3 +175,7 @@ } } } +:deep(.el-upload--picture-card) { + width: 140px !important; + height: 140px !important; +} \ No newline at end of file diff --git a/src/assets/less/Video/img/img.css b/src/assets/less/Video/img/img.css new file mode 100644 index 0000000..b52b41f --- /dev/null +++ b/src/assets/less/Video/img/img.css @@ -0,0 +1,206 @@ +:deep(.el-select__wrapper) { + width: 100% !important; + border: none !important; + background-color: rgba(0, 0, 0, 0.32) !important; + box-shadow: none !important; + border-radius: 10px !important; + font-size: 14px; + color: #fff !important; + resize: vertical; + outline: none !important; +} +:deep(.el-upload--picture-card) { + width: 140px !important; + height: 140px !important; +} +:deep(.el-select__selected-item) { + color: #fff !important; +} +:deep(.el-textarea) .el-textarea__inner { + border: none !important; + background-color: rgba(0, 0, 0, 0.32) !important; + box-shadow: none !important; + border-radius: 10px !important; + padding: 14px 16px !important; + font-size: 14px; + line-height: 1.5; + color: #fff !important; + resize: none; + outline: none !important; +} +:deep(.el-textarea) .el-textarea__inner:focus { + border: none !important; + box-shadow: none !important; + outline: none !important; +} +:deep(.el-textarea) .el-textarea__inner::placeholder { + color: rgba(255, 255, 255, 0.36) !important; + font-size: 14px; +} +:deep(.el-textarea) .el-input__count { + background: transparent; + color: rgba(255, 255, 255, 0.5); +} +.card { + width: 100%; + height: 100%; + background-color: #1a1c20; + border: none; + flex: 1; + padding: 16px; + border-radius: 12px; +} +.card :deep(.el-card__body) { + padding: 12px 16px; + height: 100%; +} +.reference-container { + display: flex; + flex-direction: column; + gap: 16px; + height: 100%; + color: #fff; +} +.upload-section { + display: flex; + flex-wrap: wrap; + gap: 16px; + flex-shrink: 0; +} +.upload-item { + flex: 1; + min-width: 200px; +} +.upload-item .upload-label { + font-size: 14px; + margin-bottom: 8px; + color: rgba(255, 255, 255, 0.9); +} +.upload-item :deep(.el-upload--picture-card) { + background-color: rgba(0, 0, 0, 0.32); + border: 1px dashed rgba(255, 255, 255, 0.3); + border-radius: 10px; + width: 100%; + height: 100px; + line-height: 100px; +} +.upload-item :deep(.el-upload--picture-card):hover { + border-color: #409eff; +} +.upload-item :deep(.el-upload-list--picture-card) .el-upload-list__item { + width: 100%; + height: 100px; + background-color: rgba(0, 0, 0, 0.32); + border-radius: 10px; +} +.required-star { + color: #ff4d4f; + margin-left: 4px; +} +.input { + width: 100%; + flex: 1; + min-height: 0; +} +.btmcard { + width: 100%; + background-color: #1a1c20; + border: none; + margin-top: 16px; + padding: 16px; + border-radius: 12px; + flex-shrink: 0; +} +.btmcard :deep(.el-card__body) { + padding: 12px 16px; +} +.select { + display: flex; + flex-direction: column; + gap: 16px; +} +.select-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 8px 0; +} +.select-title { + width: 50%; + font-size: 14px; + color: #fff; + padding-right: 12px; +} +.select-content { + width: 50%; + display: flex; + gap: 8px; +} +.select-content :deep(.el-input-number) { + width: 100%; + background-color: rgba(0, 0, 0, 0.32); + border-radius: 10px; +} +.select-content :deep(.el-input-number) .el-input-number__decrease, +.select-content :deep(.el-input-number) .el-input-number__increase { + background-color: transparent; + color: rgba(255, 255, 255, 0.6); +} +.select-content :deep(.el-input-number) .el-input-number__decrease:hover, +.select-content :deep(.el-input-number) .el-input-number__increase:hover { + color: #fff; +} +.select-content :deep(.el-input-number) .el-input__inner { + background-color: transparent; + color: #fff; + border: none; +} +.select-content :deep(.el-input) .el-input__inner { + background-color: rgba(0, 0, 0, 0.32); + border: none; + border-radius: 10px; + color: #fff; +} +.select-content :deep(.el-input) .el-input__inner::placeholder { + color: rgba(255, 255, 255, 0.5); +} +.select-content :deep(.el-textarea) .el-textarea__inner { + border: none !important; + background-color: rgba(0, 0, 0, 0.32) !important; + border-radius: 10px !important; + color: #fff !important; +} +.audio-wrapper { + display: flex; + gap: 8px; + width: 100%; +} +.upload-btn { + flex-shrink: 0; +} +.custom-select-popup { + background-color: #2A2D34 !important; + border-radius: 12px !important; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important; + border: none !important; +} +.custom-select-popup .el-select-dropdown__item { + color: #ffffff !important; + background-color: transparent !important; + font-size: 14px !important; +} +.custom-select-popup .el-select-dropdown__item.selected, +.custom-select-popup .el-select-dropdown__item:hover { + background-color: #3a3d46 !important; +} +.el-select .el-input__inner { + background-color: #35383F !important; + border: none !important; + color: #fff !important; +} +.el-select .el-input__suffix-inner { + color: #fff !important; +} +:deep(.el-upload-list__item) { + transition: none !important; +} diff --git a/src/assets/less/Video/img/img.less b/src/assets/less/Video/img/img.less new file mode 100644 index 0000000..948e533 --- /dev/null +++ b/src/assets/less/Video/img/img.less @@ -0,0 +1,253 @@ +:deep(.el-select__wrapper) { + width: 100% !important; + border: none !important; + background-color: rgba(0, 0, 0, 0.32) !important; + box-shadow: none !important; + border-radius: 10px !important; + font-size: 14px; + color: #fff !important; + resize: vertical; + outline: none !important; +} + +:deep(.el-upload--picture-card) { + width: 140px !important; + height: 140px !important; +} + +:deep(.el-select__selected-item) { + color: #fff !important; +} + +:deep(.el-textarea) { + .el-textarea__inner { + border: none !important; + background-color: rgba(0, 0, 0, 0.32) !important; + box-shadow: none !important; + border-radius: 10px !important; + padding: 14px 16px !important; + font-size: 14px; + line-height: 1.5; + color: #fff !important; + resize: none; + outline: none !important; + + &:focus { + border: none !important; + box-shadow: none !important; + outline: none !important; + } + + &::placeholder { + color: rgba(255, 255, 255, 0.36) !important; + font-size: 14px; + } + } + + .el-input__count { + background: transparent; + color: rgba(255, 255, 255, 0.5); + } +} + +.card { + width: 100%; + height: 100%; + background-color: #1a1c20; + border: none; + flex: 1; + padding: 16px; + border-radius: 12px; + + :deep(.el-card__body) { + padding: 12px 16px; + height: 100%; + } +} + +.reference-container { + display: flex; + flex-direction: column; + gap: 16px; + height: 100%; + color: #fff; +} + +.upload-section { + display: flex; + flex-wrap: wrap; + gap: 16px; + flex-shrink: 0; +} + +.upload-item { + flex: 1; + min-width: 200px; + + .upload-label { + font-size: 14px; + margin-bottom: 8px; + color: rgba(255, 255, 255, 0.9); + } + + :deep(.el-upload--picture-card) { + background-color: rgba(0, 0, 0, 0.32); + border: 1px dashed rgba(255, 255, 255, 0.3); + border-radius: 10px; + width: 100%; + height: 100px; + line-height: 100px; + + &:hover { + border-color: #409eff; + } + } + + :deep(.el-upload-list--picture-card) { + .el-upload-list__item { + width: 100%; + height: 100px; + background-color: rgba(0, 0, 0, 0.32); + border-radius: 10px; + } + } +} + +.required-star { + color: #ff4d4f; + margin-left: 4px; +} + +.input { + width: 100%; + flex: 1; + min-height: 0; +} + +.btmcard { + width: 100%; + background-color: #1a1c20; + border: none; + margin-top: 16px; + padding: 16px; + border-radius: 12px; + flex-shrink: 0; + + :deep(.el-card__body) { + padding: 12px 16px; + } +} + +.select { + display: flex; + flex-direction: column; + gap: 16px; +} + +.select-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 8px 0; +} + +.select-title { + width: 50%; + font-size: 14px; + color: #fff; + padding-right: 12px; +} + +.select-content { + width: 50%; + display: flex; + gap: 8px; + + :deep(.el-input-number) { + width: 100%; + background-color: rgba(0, 0, 0, 0.32); + border-radius: 10px; + + .el-input-number__decrease, + .el-input-number__increase { + background-color: transparent; + color: rgba(255, 255, 255, 0.6); + + &:hover { + color: #fff; + } + } + + .el-input__inner { + background-color: transparent; + color: #fff; + border: none; + } + } + + :deep(.el-input) { + .el-input__inner { + background-color: rgba(0, 0, 0, 0.32); + border: none; + border-radius: 10px; + color: #fff; + + &::placeholder { + color: rgba(255, 255, 255, 0.5); + } + } + } + + :deep(.el-textarea) { + .el-textarea__inner { + border: none !important; + background-color: rgba(0, 0, 0, 0.32) !important; + border-radius: 10px !important; + color: #fff !important; + } + } +} + +.audio-wrapper { + display: flex; + gap: 8px; + width: 100%; +} + +.upload-btn { + flex-shrink: 0; +} + +.custom-select-popup { + background-color: #2A2D34 !important; + border-radius: 12px !important; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important; + border: none !important; + + .el-select-dropdown__item { + color: #ffffff !important; + background-color: transparent !important; + font-size: 14px !important; + } + + .el-select-dropdown__item.selected, + .el-select-dropdown__item:hover { + background-color: #3a3d46 !important; + } +} + +.el-select { + .el-input__inner { + background-color: #35383F !important; + border: none !important; + color: #fff !important; + } + + .el-input__suffix-inner { + color: #fff !important; + } +} + +:deep(.el-upload-list__item) { + transition: none !important; +} \ No newline at end of file diff --git a/src/assets/less/Video/text.css b/src/assets/less/Video/text/text.css similarity index 83% rename from src/assets/less/Video/text.css rename to src/assets/less/Video/text/text.css index 7a4ff43..1932396 100644 --- a/src/assets/less/Video/text.css +++ b/src/assets/less/Video/text/text.css @@ -184,3 +184,39 @@ align-items: center; height: 32px; } +:deep(.el-upload--picture-card) { + width: 140px !important; + height: 140px !important; +} +.upload-section { + display: flex; + flex-wrap: wrap; + gap: 16px; + flex-shrink: 0; +} +.upload-item { + flex: 1; + min-width: 200px; +} +.upload-item .upload-label { + font-size: 14px; + margin-bottom: 8px; + color: rgba(255, 255, 255, 0.9); +} +.upload-item :deep(.el-upload--picture-card) { + background-color: rgba(0, 0, 0, 0.32); + border: 1px dashed rgba(255, 255, 255, 0.3); + border-radius: 10px; + width: 100%; + height: 100px; + line-height: 100px; +} +.upload-item :deep(.el-upload--picture-card):hover { + border-color: #409eff; +} +.upload-item :deep(.el-upload-list--picture-card) .el-upload-list__item { + width: 100%; + height: 100px; + background-color: rgba(0, 0, 0, 0.32); + border-radius: 10px; +} diff --git a/src/assets/less/Video/text.less b/src/assets/less/Video/text/text.less similarity index 81% rename from src/assets/less/Video/text.less rename to src/assets/less/Video/text/text.less index 8834a29..b35b232 100644 --- a/src/assets/less/Video/text.less +++ b/src/assets/less/Video/text/text.less @@ -211,3 +211,46 @@ align-items: center; height: 32px; } +:deep(.el-upload--picture-card) { + width: 140px !important; + height: 140px !important; +} +.upload-section { + display: flex; + flex-wrap: wrap; + gap: 16px; + flex-shrink: 0; +} + +.upload-item { + flex: 1; + min-width: 200px; + + .upload-label { + font-size: 14px; + margin-bottom: 8px; + color: rgba(255, 255, 255, 0.9); + } + + :deep(.el-upload--picture-card) { + background-color: rgba(0, 0, 0, 0.32); + border: 1px dashed rgba(255, 255, 255, 0.3); + border-radius: 10px; + width: 100%; + height: 100px; + line-height: 100px; + + &:hover { + border-color: #409eff; + } + } + + :deep(.el-upload-list--picture-card) { + .el-upload-list__item { + width: 100%; + height: 100px; + background-color: rgba(0, 0, 0, 0.32); + border-radius: 10px; + } + } +} \ No newline at end of file diff --git a/src/components/video/ImgVideo.vue b/src/components/video/ImgVideo.vue index e4ef8a1..de8d9a4 100644 --- a/src/components/video/ImgVideo.vue +++ b/src/components/video/ImgVideo.vue @@ -1,333 +1,593 @@ + + \ No newline at end of file diff --git a/src/components/video/TextVideo.vue b/src/components/video/TextVideo.vue index 8a0181e..70ac5fe 100644 --- a/src/components/video/TextVideo.vue +++ b/src/components/video/TextVideo.vue @@ -128,6 +128,7 @@ import type { PriceQueryResponse, TextVideoParams, TextVideoResponse, + ModelParams, } from '../../types/model'; // ==================== 事件定义 ==================== @@ -264,8 +265,11 @@ const fetchPrice = () => { // ==================== 模型加载 ==================== const loadModels = async () => { - try { - const res = (await AllModel({})) as AllModelResponse; + const Props = { + type:'文生视频' + } + + const res = await AllModel(Props); if (res.status === 'ok' && Array.isArray(res.data)) { models.value = res.data; if (models.value.length > 0) { @@ -277,10 +281,7 @@ const loadModels = async () => { } else { ElMessage.error('获取模型列表失败'); } - } catch (error) { - console.error('加载模型失败:', error); - ElMessage.error('加载模型列表失败,请刷新重试'); - } + }; const handleModelChange = (modelId: string) => { @@ -341,7 +342,7 @@ const buildSubmitParams = (): TextVideoParams => { if (configData.value.size !== undefined && !baseParams.resolution) { baseParams.resolution = String(configData.value.size); } - baseParams.audio = !!configData.value.audio_file; + baseParams.audio = Boolean(configData.value.audio_file); return baseParams; }; @@ -389,7 +390,7 @@ const generate = async (): Promise => { ElMessage.success(`${statusMsg},请稍后在任务列表中查看`); if (taskid) { - console.log('触发 task-created 事件, taskid:', taskid); + console.log('触发 task-created 事件, taskid:', taskid); emit('task-created', taskid); console.log('task-created 事件已发送'); } else { @@ -400,7 +401,7 @@ const generate = async (): Promise => { resetForm(); return true; } else { - ElMessage.error(res.data?.message || '生成失败,请重试'); + ElMessage.error(res.message || '生成失败,请重试'); return false; } } catch (error) { @@ -433,7 +434,7 @@ onMounted(() => {