From ecdc51057ba5d0e16ea2b27d32d24540b6bbcf48 Mon Sep 17 00:00:00 2001 From: Flex <q1406482700@163.com> Date: 星期四, 27 三月 2025 14:10:57 +0800 Subject: [PATCH] 修改模型人物视频上传 --- easegen-front/src/views/digitalcourse/digitalhumans/DigitalHumansForm.vue | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 53 insertions(+), 4 deletions(-) diff --git a/easegen-front/src/views/digitalcourse/digitalhumans/DigitalHumansForm.vue b/easegen-front/src/views/digitalcourse/digitalhumans/DigitalHumansForm.vue index 278db5a..366bb20 100644 --- a/easegen-front/src/views/digitalcourse/digitalhumans/DigitalHumansForm.vue +++ b/easegen-front/src/views/digitalcourse/digitalhumans/DigitalHumansForm.vue @@ -10,7 +10,7 @@ <el-form-item :label="t('digitalhumans.name')" prop="name"> <el-input v-model="formData.name" :placeholder="t('common.inputText') + t('digitalhumans.name')" /> </el-form-item> - <el-form-item :label="t('digitalhumans.code')" prop="code"> + <el-form-item :label="t('digitalhumans.code')" prop="code" v-if="false" > // 褰撳墠鏁板瓧浜鸿棰戠殑缂栫爜绫诲瀷 <el-input v-model="formData.code" :placeholder="t('common.inputText') + t('digitalhumans.code')" /> </el-form-item> <el-form-item :label="t('digitalhumans.gender')" prop="gender"> @@ -23,7 +23,7 @@ /> </el-select> </el-form-item> - <el-form-item :label="t('digitalhumans.useModel')" prop="useModel"> + <el-form-item :label="t('digitalhumans.useModel')" prop="useModel" v-if="false" > //鏁板瓧浜烘ā寮忛�夋嫨妗� <el-select v-model="formData.useModel" :placeholder="t('common.selectText')+t('digitalhumans.useModel')"> <el-option v-for="dict in getIntDictOptions(DICT_TYPE.USE_MODEL)" @@ -38,7 +38,15 @@ <UploadImg v-else v-model="formData.pictureUrl" /> </el-form-item> <el-form-item v-if="formData.useModel == 2" :label="t('digitalhumans.video')" prop="videoUrl"> - <UploadFile v-if="!(formData.videoUrl || formData.fixVideoUrl)" v-model="formData.videoUrl" :fileType="['mp4']" :limit="1" @on-success="handleFileSuccess('videoUrl', $event)"/> + <!-- 鍘熸湰鑷甫鐨勮棰戜笂浼� --> + <!-- <UploadFile v-if="!(formData.videoUrl || formData.fixVideoUrl)" v-model="formData.videoUrl" :fileType="['mp4']" :limit="1" @on-success="handleFileSuccess('videoUrl', $event)"/> --> + <!-- 鍚庢湡娣诲姞鐨勫幓闄ょ豢骞曠殑 --> + <div v-if="!(formData.videoUrl || formData.fixVideoUrl)" > + <CES2 @start="StartCes" @Thnd="End" /> + <div style="color: red;" v-show="isUploading" > + 褰撳墠姝e湪澶勭悊骞朵笂浼犱腑锛岃鑰愬績绛夊緟... + </div> + </div> <video-player v-if="formData.videoUrl || formData.fixVideoUrl" :property="videoProperty"/> </el-form-item> <!-- <el-form-item :label="鎶犲浘鏍囪瘑" prop="matting"> @@ -73,7 +81,7 @@ </el-form-item> </el-form> <template #footer> - <el-button @click="submitForm" type="primary" :disabled="formLoading">{{t('common.ok')}}</el-button> + <el-button @click="submitForm" type="primary" :disabled="formLoading" :loading="isUploading" >{{t('common.ok')}}</el-button> <el-button @click="dialogVisible = false">{{t('common.cancel')}}</el-button> </template> </Dialog> @@ -84,10 +92,15 @@ import VideoPlayer from "@/components/DiyEditor/components/mobile/VideoPlayer/index.vue"; import {DiyComponent} from "@/components/DiyEditor/util"; import {VideoPlayerProperty} from "@/components/DiyEditor/components/mobile/VideoPlayer/config"; +import { useUpload } from '@/components/UploadFile/src/useUpload' +import { el } from 'element-plus/es/locale'; +import CES2 from './CES2.vue' +import { any } from 'vue-types'; const { t } = useI18n() // 鍥介檯鍖� const message = useMessage() // 娑堟伅寮圭獥 +const { uploadUrl, httpRequest } = useUpload() //涓婁紶鏂规硶 const dialogVisible = ref(false) // 寮圭獥鐨勬槸鍚﹀睍绀� const dialogTitle = ref('') // 寮圭獥鐨勬爣棰� const formLoading = ref(false) // 琛ㄥ崟鐨勫姞杞戒腑锛�1锛変慨鏀规椂鐨勬暟鎹姞杞斤紱2锛夋彁浜ょ殑鎸夐挳绂佺敤 @@ -110,6 +123,9 @@ useModel: undefined, status: undefined, }) + +// 褰撳墠鏄惁姝e湪涓婁紶瑙嗛 +const isUploading = ref(false) const videoProperty = { videoUrl: '', @@ -142,6 +158,24 @@ }) const formRef = ref() // 琛ㄥ崟 Ref +const StartCes = () => { + console.log( " ----- 寮�濮� ----- " ) + isUploading.value = true +} + +const End = (res)=>{ + const FileObject = { + file:res + } + httpRequest( FileObject ).then( response =>{ + console.log(response) + formData.value.videoUrl = response.data; + } ).finally( res => { + isUploading.value = false + } ) + +} + /** 鎵撳紑寮圭獥 */ const open = async (type: string, id?: number) => { dialogVisible.value = true @@ -156,6 +190,8 @@ } finally { formLoading.value = false } + }else{ + InitHumMODEL() } } defineExpose({ open }) // 鎻愪緵 open 鏂规硶锛岀敤浜庢墦寮�寮圭獥 @@ -211,4 +247,17 @@ formData.value.videoUrl = response.data; } }; + +// 淇敼榛樿鐨勬暟瀛椾汉瑙嗛妯″紡涓鸿棰� + +const InitHumMODEL = ()=>{ + let ModelList = getIntDictOptions( DICT_TYPE.USE_MODEL ) + for (let index = 0; index < ModelList.length; index++) { + const element = ModelList[index]; + if( element.label === "瑙嗛" ){ + formData.value.useModel = Number( element.value ) + } + } +} + </script> -- Gitblit v1.9.3