|
|
@ -39,6 +39,7 @@ const props = withDefaults( //接收父级参数 |
|
|
const emits = defineEmits<{ |
|
|
const emits = defineEmits<{ |
|
|
(e: 'openDialog', data: any): void |
|
|
(e: 'openDialog', data: any): void |
|
|
(e: 'update:formOtherData', data: any): void |
|
|
(e: 'update:formOtherData', data: any): void |
|
|
|
|
|
(e: 'videoMsgChange', data: VideoMsg): void |
|
|
//(e: 'update:formData', data: any): void |
|
|
//(e: 'update:formData', data: any): void |
|
|
//(e: 'update:formConfig', data: any): void |
|
|
//(e: 'update:formConfig', data: any): void |
|
|
}>() |
|
|
}>() |
|
|
@ -188,6 +189,7 @@ const attrList = computed(() => { |
|
|
columnIndex = list[0].type === 'index' |
|
|
columnIndex = list[0].type === 'index' |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const temp =reactive<PublicAtrr[]>([ |
|
|
const temp =reactive<PublicAtrr[]>([ |
|
|
{ |
|
|
{ |
|
|
label: '自定义Class', |
|
|
label: '自定义Class', |
|
|
@ -604,16 +606,24 @@ const attrList = computed(() => { |
|
|
vIf: state.isSearch, |
|
|
vIf: state.isSearch, |
|
|
vShow: ['videoUpAndPlay'] |
|
|
vShow: ['videoUpAndPlay'] |
|
|
}, |
|
|
}, |
|
|
|
|
|
/* { |
|
|
|
|
|
label: '上传视频封面', |
|
|
|
|
|
value: config.uploadvideo, |
|
|
|
|
|
path: 'config.uploadvideo', |
|
|
|
|
|
type: 'uploadvideo_poster', |
|
|
|
|
|
vIf: state.isSearch, |
|
|
|
|
|
vShow: ['videoUpAndPlay'] |
|
|
|
|
|
}, */ |
|
|
{ |
|
|
{ |
|
|
label: '视频自动播放', |
|
|
label: '视频宽度(像素)', |
|
|
value: config.uploadvideo, |
|
|
value: config.uploadvideo, |
|
|
path: 'config.uploadvideo', |
|
|
path: 'config.uploadvideo', |
|
|
type: 'uploadvideo_autoPlay', |
|
|
type: 'uploadvideo_width', |
|
|
vIf: state.isSearch, |
|
|
vIf: state.isSearch, |
|
|
vShow: ['videoUpAndPlay'] |
|
|
vShow: ['videoUpAndPlay'] |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: '视频高度', |
|
|
label: '视频高度(像素)', |
|
|
value: config.uploadvideo, |
|
|
value: config.uploadvideo, |
|
|
path: 'config.uploadvideo', |
|
|
path: 'config.uploadvideo', |
|
|
type: 'uploadvideo_height', |
|
|
type: 'uploadvideo_height', |
|
|
@ -621,13 +631,23 @@ const attrList = computed(() => { |
|
|
vShow: ['videoUpAndPlay'] |
|
|
vShow: ['videoUpAndPlay'] |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: '视频宽度', |
|
|
label: '视频自动播放', |
|
|
value: config.uploadvideo, |
|
|
value: config.uploadvideo, |
|
|
path: 'config.uploadvideo', |
|
|
path: 'config.uploadvideo', |
|
|
type: 'uploadvideo_width', |
|
|
type: 'uploadvideo_autoPlay', |
|
|
|
|
|
vIf: state.isSearch, |
|
|
|
|
|
vShow: ['videoUpAndPlay'] |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
label: '视频循环播放', |
|
|
|
|
|
value: config.uploadvideo, |
|
|
|
|
|
path: 'config.uploadvideo', |
|
|
|
|
|
type: 'uploadvideo_loopPlay', |
|
|
vIf: state.isSearch, |
|
|
vIf: state.isSearch, |
|
|
vShow: ['videoUpAndPlay'] |
|
|
vShow: ['videoUpAndPlay'] |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
label: '上传地址', |
|
|
label: '上传地址', |
|
|
value: control.action, |
|
|
value: control.action, |
|
|
@ -817,6 +837,7 @@ watch( |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
const fileSignAry = reactive<any>([]) |
|
|
const fileSignAry = reactive<any>([]) |
|
|
const controlChange = (obj: any, val: any) => { |
|
|
const controlChange = (obj: any, val: any) => { |
|
|
console.log("字段编辑----》",obj,val,controlData.value) |
|
|
console.log("字段编辑----》",obj,val,controlData.value) |
|
|
@ -1252,17 +1273,10 @@ const isNotWrite = (val:any) =>{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//liwenxuan 20240108 vidioupload start |
|
|
//liwenxuan 20240108 vidioupload start |
|
|
import uselowcodevideoStore from '@/store/modules/lowcodevideo' |
|
|
|
|
|
import { VideoMsg } from '@/api/DesignForm/types' |
|
|
import { VideoMsg } from '@/api/DesignForm/types' |
|
|
const lowcodevideoStore = uselowcodevideoStore(); |
|
|
const videoIndex = ref(0); |
|
|
const videoAutoPlay = ref(false); |
|
|
const videoMsgArr:VideoMsg[] = reactive<VideoMsg[]>([{ |
|
|
const videoHeight = ref(400); |
|
|
|
|
|
const videoWidth = ref(700); |
|
|
|
|
|
//const emits = defineEmits(["addedVideo"]); |
|
|
|
|
|
//上传成功钩子 |
|
|
|
|
|
function videoUploadOk(response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) { |
|
|
|
|
|
//当上传成功时,封装一个videoMsg对象 |
|
|
|
|
|
const videoMsg:VideoMsg = { |
|
|
|
|
|
CreatedAt: '', |
|
|
CreatedAt: '', |
|
|
UpdatedAt: '', |
|
|
UpdatedAt: '', |
|
|
fileSize: 0n, |
|
|
fileSize: 0n, |
|
|
@ -1274,51 +1288,104 @@ function videoUploadOk(response: any, uploadFile: UploadFile, uploadFiles: Uploa |
|
|
tag: '', |
|
|
tag: '', |
|
|
type: 0, |
|
|
type: 0, |
|
|
url: '', |
|
|
url: '', |
|
|
videoAutoPlay: false, |
|
|
|
|
|
videoReady: false, |
|
|
videoReady: false, |
|
|
|
|
|
videoHeight:400, |
|
|
|
|
|
videoWidth:700, |
|
|
|
|
|
videoAutoPlay: false, |
|
|
attrId: '', |
|
|
attrId: '', |
|
|
|
|
|
poster:'', |
|
|
loop: false |
|
|
loop: false |
|
|
|
|
|
}]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* //监听当前操作视频的变化 |
|
|
|
|
|
watch(videoMsgArr[videoIndex.value], () => { |
|
|
|
|
|
// 在嵌套的属性变更时触发 |
|
|
|
|
|
// 注意:`newValue` 此处和 `oldValue` 是相等的 |
|
|
|
|
|
// 因为它们是同一个对象! |
|
|
|
|
|
emits('videoMsgChange',videoMsgArr[videoIndex.value]); |
|
|
|
|
|
|
|
|
|
|
|
},{deep:true}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setVideoIndex(newValue:any,oldValue:any){ |
|
|
|
|
|
//alert(videoIndex.value) |
|
|
|
|
|
|
|
|
|
|
|
const result = videoMsgArr.findIndex(function(item) { |
|
|
|
|
|
item.attrId === newValue.activeKey; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
if(result!=-1){ |
|
|
|
|
|
videoIndex.value = result; |
|
|
} |
|
|
} |
|
|
videoMsg.url = response.data.url; |
|
|
//alert(videoIndex.value) |
|
|
videoMsg.videoReady = true; |
|
|
} |
|
|
console.log(response) |
|
|
|
|
|
console.log(lowcodevideoStore); |
|
|
|
|
|
videoMsg.CreatedAt = response.data.CreatedAt; |
|
|
*/ |
|
|
videoMsg.UpdatedAt = response.data.UpdatedAt; |
|
|
|
|
|
videoMsg.fileSize = response.data.fileSize; |
|
|
/* const LastEdit = { |
|
|
videoMsg.id = response.data.id; |
|
|
oldKey:'', |
|
|
videoMsg.key = response.data.key; |
|
|
oldType:'', |
|
|
videoMsg.name = response.data.name; |
|
|
} |
|
|
videoMsg.physicspath = response.data.physicspath; |
|
|
//监听当前操作组件的变化,当新点击的组件是视频组件时,更新videoIndex |
|
|
videoMsg.size = response.data.size; |
|
|
watch( |
|
|
videoMsg.tag = response.data.tag; |
|
|
() => store, (newValue, oldValue) => { |
|
|
videoMsg.type = response.data.type; |
|
|
//alert("newValue:"+newValue+",oldValue:"+oldValue) |
|
|
|
|
|
let newKey = newValue.activeKey; |
|
|
//emits("addedVideo",videoArr)'' |
|
|
//alert("newKey==="+newKey+"|||oldKey==="+LastEdit.oldKey) |
|
|
console.log("response.data.url----2------>",response.data.url) |
|
|
|
|
|
//formConfig.value["hjk"] = 250 |
|
|
if(oldValue==undefined){ |
|
|
console.log("formConfig----3------>",formConfig.value) |
|
|
//alert('刚进入编辑页面') |
|
|
console.log("attrList----1------>",attrList.value) |
|
|
|
|
|
|
|
|
}else{ |
|
|
if(attrList.value.length > 0){ |
|
|
|
|
|
attrList.value.forEach((item:any)=>{ |
|
|
// if(LastEdit.oldKey===''){ |
|
|
// console.log("attrList---item-1------>",item.type) |
|
|
// alert("首次选择控件") |
|
|
console.log("attrList---item-1------>",item) |
|
|
//}else{ |
|
|
if(item.type === "uploadvideo_url"){ |
|
|
// if(newKey===''){ |
|
|
item.config={ |
|
|
// alert('离开编辑页面') |
|
|
videoConfig:[ |
|
|
// }else{ |
|
|
{ |
|
|
// alert("非首次选择控件") |
|
|
videoUrl:response.data.url, |
|
|
// } |
|
|
videoAutoPlay:videoAutoPlay, |
|
|
//} |
|
|
videoHeight:videoHeight, |
|
|
//以下两行必须在本else的最后 |
|
|
videoWidth:videoWidth |
|
|
LastEdit.oldKey = newKey |
|
|
} |
|
|
LastEdit.oldType = newValue.controlAttr.type |
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
if(newValue.controlAttr.type==='videoUpAndPlay'){ |
|
|
|
|
|
console.log('是视频') |
|
|
} |
|
|
} |
|
|
console.log("attrList---item-2------>",attrList.value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},{deep:true} |
|
|
|
|
|
) */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传成功钩子 |
|
|
|
|
|
function videoUploadOk(response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) { |
|
|
|
|
|
const { control = {} } : { control: any } = controlData.value |
|
|
|
|
|
|
|
|
|
|
|
control.videoMsg[videoIndex.value].url = response.data.url; |
|
|
|
|
|
control.videoMsg[videoIndex.value].videoReady = true; |
|
|
|
|
|
control.videoMsg[videoIndex.value].CreatedAt = response.data.CreatedAt; |
|
|
|
|
|
control.videoMsg[videoIndex.value].UpdatedAt = response.data.UpdatedAt; |
|
|
|
|
|
control.videoMsg[videoIndex.value].fileSize = response.data.fileSize; |
|
|
|
|
|
control.videoMsg[videoIndex.value].id = response.data.id; |
|
|
|
|
|
control.videoMsg[videoIndex.value].key = response.data.key; |
|
|
|
|
|
control.videoMsg[videoIndex.value].name = response.data.name; |
|
|
|
|
|
control.videoMsg[videoIndex.value].physicspath = response.data.physicspath; |
|
|
|
|
|
control.videoMsg[videoIndex.value].size = response.data.size; |
|
|
|
|
|
control.videoMsg[videoIndex.value].tag = response.data.tag; |
|
|
|
|
|
control.videoMsg[videoIndex.value].type = response.data.type; |
|
|
|
|
|
|
|
|
|
|
|
// controlData.value.control.videoMsg = [videoMsgArr] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//删除钩子 禁止删除 |
|
|
//删除钩子 禁止删除 |
|
|
@ -1330,18 +1397,13 @@ function beforeRemove(){ |
|
|
function videoUploadErr(error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles){ |
|
|
function videoUploadErr(error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles){ |
|
|
alert("上传失败,请重试") |
|
|
alert("上传失败,请重试") |
|
|
console.log("上传失败"+error); |
|
|
console.log("上传失败"+error); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
//点击文件列表中已上传的文件时的钩子,点击即替换video标签的src |
|
|
|
|
|
/* function selectVideo(uploadFile: UploadFile){ |
|
|
|
|
|
|
|
|
|
|
|
const res:any = uploadFile.response; |
|
|
|
|
|
const resd = res.data; |
|
|
|
|
|
const resdurl = resd.url; |
|
|
|
|
|
lowcodevideoStore.videoResource = resdurl; |
|
|
|
|
|
} */ |
|
|
|
|
|
//liwenxuan 20240108 vidioupload end |
|
|
//liwenxuan 20240108 vidioupload end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//liwenxuan 20240111 carousel start |
|
|
//liwenxuan 20240111 carousel start |
|
|
const direction = ref('ltr') |
|
|
const direction = ref('ltr') |
|
|
const drawer = ref(false) |
|
|
const drawer = ref(false) |
|
|
@ -1393,8 +1455,9 @@ const handleClose = (done: () => void) => { |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<el-row v-else-if="item.type === 'uploadvideo_url'"> |
|
|
<el-row v-else-if="item.type === 'uploadvideo_url'"> |
|
|
|
|
|
<!-- {{ controlData.control }} --> |
|
|
<el-upload |
|
|
<el-upload |
|
|
v-if="!lowcodevideoStore.videoReady" |
|
|
v-if="!controlData.control.videoMsg[videoIndex].videoReady" |
|
|
:action="uploadUrl" :before-remove="beforeRemove" |
|
|
:action="uploadUrl" :before-remove="beforeRemove" |
|
|
:on-success="videoUploadOk" :show-file-list="true" |
|
|
:on-success="videoUploadOk" :show-file-list="true" |
|
|
:on-error="videoUploadErr" |
|
|
:on-error="videoUploadErr" |
|
|
@ -1402,16 +1465,39 @@ const handleClose = (done: () => void) => { |
|
|
accept=".mp4,.MOV,.WMV,.FLV,.AVI,.AVCHD,.WebM,.MKV,.rmvb"> |
|
|
accept=".mp4,.MOV,.WMV,.FLV,.AVI,.AVCHD,.WebM,.MKV,.rmvb"> |
|
|
<el-button type="primary">点此上传</el-button> |
|
|
<el-button type="primary">点此上传</el-button> |
|
|
</el-upload> |
|
|
</el-upload> |
|
|
<el-button v-if="lowcodevideoStore.videoReady" type="primary">已上传,点击修改</el-button> |
|
|
<el-button v-if="controlData.control.videoMsg[videoIndex].videoReady" type="primary">已上传<!-- ,点击修改 --></el-button> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
<!-- <el-row v-else-if="item.type === 'uploadvideo_poster'"> |
|
|
|
|
|
<el-upload |
|
|
|
|
|
v-if="controlData.control.videoMsg[videoIndex].videoReady&&controlData.control.videoMsg[videoIndex].poster===''" |
|
|
|
|
|
:action="uploadUrl" :before-remove="beforeRemove" |
|
|
|
|
|
:on-success="videoUploadOk" :show-file-list="true" |
|
|
|
|
|
:on-error="videoUploadErr" |
|
|
|
|
|
|
|
|
|
|
|
accept=".mp4,.MOV,.WMV,.FLV,.AVI,.AVCHD,.WebM,.MKV,.rmvb"> |
|
|
|
|
|
|
|
|
|
|
|
<el-tooltip |
|
|
|
|
|
class="box-item" |
|
|
|
|
|
content="不上传则视频封面默认为视频第一帧" |
|
|
|
|
|
placement="top-end" |
|
|
|
|
|
> |
|
|
|
|
|
<el-button type="primary">点此上传</el-button> |
|
|
|
|
|
</el-tooltip> |
|
|
|
|
|
</el-upload> |
|
|
|
|
|
<el-button v-if="!controlData.control[videoIndex].videoReady" type="warning">请先上传视频</el-button> |
|
|
|
|
|
<el-button v-if="controlData.control.videoMsg[videoIndex].videoReady&&controlData.control.videoMsg[videoIndex].poster!=''" type="primary">已上传,点击修改</el-button> |
|
|
|
|
|
</el-row> --> |
|
|
<el-row v-else-if="item.type === 'uploadvideo_autoPlay'"> |
|
|
<el-row v-else-if="item.type === 'uploadvideo_autoPlay'"> |
|
|
<el-switch v-model="videoAutoPlay" /> |
|
|
<el-switch v-model="controlData.control.videoMsg[videoIndex].videoAutoPlay" /> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
<el-row v-else-if="item.type === 'uploadvideo_loopPlay'"> |
|
|
|
|
|
<el-switch v-model="controlData.control.videoMsg[videoIndex].loop" /> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row v-else-if="item.type === 'uploadvideo_width'"> |
|
|
<el-row v-else-if="item.type === 'uploadvideo_width'"> |
|
|
<el-input-number v-model="videoWidth" :step="50" :max="4096"/> |
|
|
<el-input-number v-model="controlData.control.videoMsg[videoIndex].videoWidth" :step="50" :max="4096"/> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row v-else-if="item.type === 'uploadvideo_height'"> |
|
|
<el-row v-else-if="item.type === 'uploadvideo_height'"> |
|
|
<el-input-number v-model="videoHeight" :step="50" :max="2160"/> |
|
|
<el-input-number v-model="controlData.control.videoMsg[videoIndex].videoHeight" :step="50" :max="2160"/> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<el-row v-else-if="item.type === 'carousel'"> |
|
|
<el-row v-else-if="item.type === 'carousel'"> |
|
|
|