5 changed files with 7148 additions and 6410 deletions
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,56 +1,153 @@ |
|||||
<template> |
<template> |
||||
<!-- <p>{{ videoHeight }}</p> |
<!-- <p>{{ videoHeight }}</p>--> |
||||
<p>{{ videoWidth }}</p> --> |
<!-- <p>{{ props.pageType }}</p> --> |
||||
<video |
<video |
||||
:src="data?.control.videoMsg[0].url" |
:src="imgUrl" |
||||
:loop="data?.control.videoMsg[0].loop" |
:loop="data?.control.videoMsg[0].loop" |
||||
:autoplay="data?.control.videoMsg[0].videoAutoPlay" |
:autoplay="data?.control.videoMsg[0].videoAutoPlay" |
||||
|
:style="getFormItemInputStyle(configStyle, 2)" |
||||
:style="getFormItemInputStyle(configStyle,2)" |
|
||||
controls |
controls |
||||
|
></video> |
||||
|
<el-upload |
||||
|
v-if="props.pageType == 1 || props.pageType == 2" |
||||
|
class="avatar-uploader" |
||||
|
:action="uploadUrl" |
||||
|
:before-remove="beforeRemove" |
||||
|
:on-success="videoUploadOk" |
||||
|
:show-file-list="false" |
||||
|
:on-error="videoUploadErr" |
||||
|
:on-exceed="handleExceed" |
||||
|
accept=".mp4,.MOV,.WMV,.FLV,.AVI,.AVCHD,.WebM,.MKV,.rmvb" |
||||
> |
> |
||||
</video> |
<el-icon class="avatar-uploader-icon"><Plus /></el-icon> |
||||
|
</el-upload> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script setup lang="ts"> |
||||
import { AnalysisCss,AnalysisInputCss } from '@/components/DesignForm/public/form/calculate/cssInfo.ts' |
import { |
||||
|
AnalysisCss, |
||||
|
AnalysisInputCss, |
||||
|
} from "@/components/DesignForm/public/form/calculate/cssInfo.ts"; |
||||
|
import { uploadUrl } from "@/api/DesignForm"; |
||||
|
import { useDesignFormStore } from "@/store/DesignForm/designForm"; |
||||
|
import type { UploadInstance, UploadProps, UploadRawFile, genFileId } from "element-plus"; |
||||
|
|
||||
const props = defineProps({ |
const props = defineProps({ |
||||
// eslint-disable-next-line vue/require-default-prop |
// eslint-disable-next-line vue/require-default-prop |
||||
data: { |
data: { |
||||
type: Object, |
type: Object, |
||||
|
}, |
||||
|
pageType: { |
||||
|
type: Number, |
||||
|
}, |
||||
|
valInfo: { |
||||
|
type: String, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
const emits = defineEmits(["update:valInfo", "upDateInfo"]); |
||||
|
|
||||
|
const imgUrl = computed({ |
||||
|
get() { |
||||
|
if (props.valInfo != "") { |
||||
|
return props.valInfo; |
||||
|
} else { |
||||
|
return props.data?.control.videoMsg[0].url; |
||||
} |
} |
||||
}) |
}, |
||||
|
set(val: any) { |
||||
|
emits("update:valInfo", val); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
const configStyle = computed(() => { |
const configStyle = computed(() => { |
||||
console.log("视频宽度",props.data) |
console.log("视频宽度", props.data); |
||||
return props.data.styles || {} |
return props.data.styles || {}; |
||||
}) |
}); |
||||
const videoHeight = props.data?.control.videoMsg[0].videoHeight+'px' |
const videoHeight = props.data?.control.videoMsg[0].videoHeight + "px"; |
||||
|
|
||||
const videoWidth = props.data?.control.videoMsg[0].videoWidth+'px' |
const videoWidth = props.data?.control.videoMsg[0].videoWidth + "px"; |
||||
|
|
||||
const heightVal = ref("0px") |
const heightVal = ref("0px"); |
||||
const widthtVal = ref("0px") |
const widthtVal = ref("0px"); |
||||
|
const beforeRemove = () => { |
||||
|
return false; |
||||
|
}; |
||||
|
|
||||
onMounted(()=>{ |
onMounted(() => { |
||||
heightVal.value = props.data?.control.videoMsg[0].videoHeight+'px' |
heightVal.value = props.data?.control.videoMsg[0].videoHeight + "px"; |
||||
widthtVal.value = props.data?.control.videoMsg[0].videoWidth+'px' |
widthtVal.value = props.data?.control.videoMsg[0].videoWidth + "px"; |
||||
// console.log("视频得长款",heightVal.value, widthtVal.value,props.data?.control) |
// console.log("视频得长款",heightVal.value, widthtVal.value,props.data?.control) |
||||
}); |
}); |
||||
watch(()=>props.data?.control.videoMsg[0], (val:any) => { |
watch( |
||||
|
() => props.data?.control.videoMsg[0], |
||||
|
(val: any) => { |
||||
// console.log("视频得长款--》",val); |
// console.log("视频得长款--》",val); |
||||
heightVal.value = val.videoHeight+'px' |
heightVal.value = val.videoHeight + "px"; |
||||
widthtVal.value = val.videoWidth+'px' |
widthtVal.value = val.videoWidth + "px"; |
||||
},{ |
}, |
||||
|
{ |
||||
deep: true, |
deep: true, |
||||
}) |
} |
||||
|
); |
||||
|
|
||||
const getFormItemInputStyle = (ele: any,sty:number) => { |
const getFormItemInputStyle = (ele: any, sty: number) => { |
||||
if(ele?.inputStyle){ |
if (ele?.inputStyle) { |
||||
console.log("返回栅格宽度4",AnalysisInputCss(ele?.inputStyle,sty)) |
console.log("返回栅格宽度4", AnalysisInputCss(ele?.inputStyle, sty)); |
||||
return AnalysisInputCss(ele?.inputStyle,sty) |
return AnalysisInputCss(ele?.inputStyle, sty); |
||||
} |
} |
||||
} |
}; |
||||
|
const store = useDesignFormStore() as any; |
||||
|
const controlData = computed(() => { |
||||
|
// console.log("注册自定义事件----------------->",props.formInfo) |
||||
|
// console.log("注册自定义事件--------1--------->", store.controlAttr); |
||||
|
// console.log("注册自定义事件---------3-------->", controlData.value.customRules); |
||||
|
return store.controlAttr; |
||||
|
}); |
||||
|
const upload = ref<UploadInstance>(); |
||||
|
const videoIndex = ref(0); |
||||
|
//上传成功钩子 |
||||
|
const videoUploadOk = ( |
||||
|
response: any, |
||||
|
uploadFile: UploadFile, |
||||
|
uploadFiles: UploadFiles |
||||
|
) => { |
||||
|
const { control = {} }: { control: any } = controlData.value; |
||||
|
|
||||
|
console.log("上传成功钩子", controlData.value); |
||||
|
|
||||
|
console.log("上传成功钩子--------->", props.data?.control.videoMsg); |
||||
|
imgUrl.value = response.data.url; |
||||
|
console.log("上传成功钩子----1----->", imgUrl.value, response.data.url); |
||||
|
emits("upDateInfo", response.data.url); |
||||
|
props.data.control.videoMsg[videoIndex.value].url = response.data.url; |
||||
|
props.data.control.videoMsg[videoIndex.value].videoReady = true; |
||||
|
props.data.control.videoMsg[videoIndex.value].CreatedAt = response.data.CreatedAt; |
||||
|
props.data.control.videoMsg[videoIndex.value].UpdatedAt = response.data.UpdatedAt; |
||||
|
props.data.control.videoMsg[videoIndex.value].fileSize = response.data.fileSize; |
||||
|
props.data.control.videoMsg[videoIndex.value].id = response.data.id; |
||||
|
props.data.control.videoMsg[videoIndex.value].key = response.data.key; |
||||
|
props.data.control.videoMsg[videoIndex.value].name = response.data.name; |
||||
|
props.data.control.videoMsg[videoIndex.value].physicspath = response.data.physicspath; |
||||
|
props.data.control.videoMsg[videoIndex.value].size = response.data.size; |
||||
|
props.data.control.videoMsg[videoIndex.value].tag = response.data.tag; |
||||
|
props.data.control.videoMsg[videoIndex.value].type = response.data.type; |
||||
|
}; |
||||
|
const handleExceed: UploadProps["onExceed"] = (files) => { |
||||
|
upload.value!.clearFiles(); |
||||
|
const file = files[0] as UploadRawFile; |
||||
|
file.uid = genFileId(); |
||||
|
upload.value!.handleStart(file); |
||||
|
}; |
||||
|
//上传失败钩子 |
||||
|
const videoUploadErr = ( |
||||
|
error: Error, |
||||
|
uploadFile: UploadFile, |
||||
|
uploadFiles: UploadFiles |
||||
|
) => { |
||||
|
alert("上传失败,请重试"); |
||||
|
// console.log("上传失败"+error); |
||||
|
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style scoped></style> |
<style scoped></style> |
||||
|
|||||
Loading…
Reference in new issue