diff --git a/src/api/DesignForm/types.ts b/src/api/DesignForm/types.ts index 9ffa2ed06..0d5a359f1 100644 --- a/src/api/DesignForm/types.ts +++ b/src/api/DesignForm/types.ts @@ -154,3 +154,24 @@ export interface PublicAtrr{ inputStyle?:string; vIf?:any; } +//低代码视频单个属性对象 +export interface VideoMsg { + CreatedAt: string + UpdatedAt: string + fileSize: bigint + id: bigint + key: string + name: string + physicspath: string + size: string + tag: string + type: number + url: string//视频地址 + videoReady:boolean//当前视频是否成功上传 + videoHeight?:number//视频高 + videoWidth?:number//视频宽 + videoAutoPlay:boolean//是否自动播放 + attrId:string//字段标识 e.g : videoUpAndPlay1705024134559 + poster?:string//海报帧url + loop:boolean//是否循环播放 + } diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index 18b72abbe..f6cd8d7f2 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -316,6 +316,16 @@ const selectOption: any = [ modelValue: '' }, config: {} + }, + { + type: 'lowcodeCarsusel', + label: '轮播图', + icon: '', + iconFont: 'fa-window-restore', + control: { + modelValue: '' + }, + config: {} } ] }, diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index e185c890e..cb103066a 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -588,13 +588,45 @@ const attrList = computed(() => { path: 'config.componentName', vShow: ['component'] }, + { + label: '轮播图设置', + value: config.carousel, + path: 'config.carousel', + type: 'carousel', + vIf: state.isSearch, + vShow: ['lowcodeCarsusel'] + }, { label: '上传视频', - value: config.disabledAdd, - path: 'config.disabledAdd', - type: 'uploadvideo', + value: config.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_url', vIf: state.isSearch, - vHide: ['uploadvideo'] + vShow: ['videoUpAndPlay'] + }, + { + label: '视频自动播放', + value: config.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_autoPlay', + vIf: state.isSearch, + vShow: ['videoUpAndPlay'] + }, + { + label: '视频高度', + value: config.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_height', + vIf: state.isSearch, + vShow: ['videoUpAndPlay'] + }, + { + label: '视频宽度', + value: config.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_width', + vIf: state.isSearch, + vShow: ['videoUpAndPlay'] }, { label: '上传地址', @@ -1221,28 +1253,72 @@ const isNotWrite = (val:any) =>{ //liwenxuan 20240108 vidioupload start import uselowcodevideoStore from '@/store/modules/lowcodevideo' +import { VideoMsg } from '@/api/DesignForm/types' const lowcodevideoStore = uselowcodevideoStore(); - +const videoAutoPlay = ref(false); +const videoHeight = ref(400); +const videoWidth = ref(700); //const emits = defineEmits(["addedVideo"]); //上传成功钩子 function videoUploadOk(response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) { - //更新pinia中的视频上传信息 - lowcodevideoStore.videoResource = response.data.url; - lowcodevideoStore.videoReady = true; + //当上传成功时,封装一个videoMsg对象 + const videoMsg:VideoMsg = { + CreatedAt: '', + UpdatedAt: '', + fileSize: 0n, + id: 0n, + key: '', + name: '', + physicspath: '', + size: '', + tag: '', + type: 0, + url: '', + videoAutoPlay: false, + videoReady: false, + attrId: '', + loop: false + } + videoMsg.url = response.data.url; + videoMsg.videoReady = true; console.log(response) console.log(lowcodevideoStore); - lowcodevideoStore.videoMsg.CreatedAt = response.data.CreatedAt; - lowcodevideoStore.videoMsg.UpdatedAt = response.data.UpdatedAt; - lowcodevideoStore.videoMsg.fileSize = response.data.fileSize; - lowcodevideoStore.videoMsg.id = response.data.id; - lowcodevideoStore.videoMsg.key = response.data.key; - lowcodevideoStore.videoMsg.name = response.data.name; - lowcodevideoStore.videoMsg.physicspath = response.data.physicspath; - lowcodevideoStore.videoMsg.size = response.data.size; - lowcodevideoStore.videoMsg.tag = response.data.tag; - lowcodevideoStore.videoMsg.type = response.data.type; - lowcodevideoStore.videoMsg.url = response.data.url; - //emits("addedVideo",videoArr) + videoMsg.CreatedAt = response.data.CreatedAt; + videoMsg.UpdatedAt = response.data.UpdatedAt; + videoMsg.fileSize = response.data.fileSize; + videoMsg.id = response.data.id; + videoMsg.key = response.data.key; + videoMsg.name = response.data.name; + videoMsg.physicspath = response.data.physicspath; + videoMsg.size = response.data.size; + videoMsg.tag = response.data.tag; + videoMsg.type = response.data.type; + + //emits("addedVideo",videoArr)'' + console.log("response.data.url----2------>",response.data.url) + //formConfig.value["hjk"] = 250 + console.log("formConfig----3------>",formConfig.value) + console.log("attrList----1------>",attrList.value) + + if(attrList.value.length > 0){ + attrList.value.forEach((item:any)=>{ + // console.log("attrList---item-1------>",item.type) + console.log("attrList---item-1------>",item) + if(item.type === "uploadvideo_url"){ + item.config={ + videoConfig:[ + { + videoUrl:response.data.url, + videoAutoPlay:videoAutoPlay, + videoHeight:videoHeight, + videoWidth:videoWidth + } + ] + } + } + }); + } + console.log("attrList---item-2------>",attrList.value) } //删除钩子 禁止删除 @@ -1265,6 +1341,23 @@ function videoUploadErr(error: Error, uploadFile: UploadFile, uploadFiles: Uploa lowcodevideoStore.videoResource = resdurl; } */ //liwenxuan 20240108 vidioupload end + +//liwenxuan 20240111 carousel start +const direction = ref('ltr') +const drawer = ref(false) +const handleClose = (done: () => void) => { + ElMessageBox.confirm('Are you sure you want to close this?') + .then(() => { + done() + }) + .catch(() => { + // catch error + }) +} +//liwenxuan 20240111 carousel end + + +