diff --git a/src/api/DesignForm/types.ts b/src/api/DesignForm/types.ts index 9ffa2ed06..9868ed09a 100644 --- a/src/api/DesignForm/types.ts +++ b/src/api/DesignForm/types.ts @@ -154,3 +154,32 @@ export interface PublicAtrr{ inputStyle?:string; vIf?:any; } +//低代码视频单个属性对象 +export interface VideoMsg { + CreatedAt: string + UpdatedAt: string + fileSize: number + id: number + 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//是否循环播放 +} +//低代码轮播图单个属性对象 +export interface CarsuselConfig { + uploadFlag:boolean, + imgId:string, + imgSort:number, + imgUrl:string, + link:string +} diff --git a/src/assets/404_images/untilUploadImg.png b/src/assets/404_images/untilUploadImg.png new file mode 100644 index 000000000..0557f939e Binary files /dev/null and b/src/assets/404_images/untilUploadImg.png differ diff --git a/src/assets/paintboard.png b/src/assets/paintboard.png new file mode 100644 index 000000000..252b4631e Binary files /dev/null and b/src/assets/paintboard.png differ diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index d2775cc1a..f344bb310 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -248,6 +248,7 @@ const selectOption: any = [ config: {} }, { +<<<<<<< HEAD type: 'colorPicker', label: '取色器', icon: 'color', @@ -256,6 +257,24 @@ const selectOption: any = [ modelValue: '' }, config: {} +======= + type: 'orgCentent', + label: '行政组织', + icon: 'sliders', + iconFont: 'fa-sliders', + control: { + }, + config: {} + }, + { + type: 'signaturemap', + label: '签名板', + icon: 'faedit', + iconFont: 'fa-edit', + control: { + }, + config: {} +>>>>>>> liwenxuan_v4 } ] }, @@ -307,8 +326,60 @@ const selectOption: any = [ modelValue: '' }, config: {} + }, + { + type: 'videoUpAndPlay', + label: '视频', + icon: '', + iconFont: 'fa-play-circle', + control: { + modelValue: '', + videoMsg:[{ + CreatedAt: '', + UpdatedAt: '', + fileSize: "0n", + id: "0n", + key: '', + name: '', + physicspath: '', + size: '', + tag: '', + type: 0, + url: '', + videoReady: false, + videoHeight:400, + videoWidth:700, + videoAutoPlay: false, + attrId: '', + poster:'', + loop: false + }] + }, + config: {} + }, + { + type: 'lowcodeCarsusel', + label: '轮播图', + icon: '', + iconFont: 'fa-window-restore', + control: { + modelValue: '', + carsuselConfigArr:[{ + uploadFlag:false, + imgId:'', + imgSort:1, + imgUrl: '', + link: '' + }], + config: { + carsuselWidth:448, + carsuselHeight:252, + interval:2000, + } + }, + config: {} } - ] + ] }, { title: '布局字段', diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index 0868c292b..2114f7965 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -14,8 +14,14 @@ import { PublicAtrr } from '@/api/DesignForm/types' import { chineseToPinyin } from '@/api/DesignForm/requestapi' +<<<<<<< HEAD //数学计算公式编辑器 import MathFormula from '@/components/DesignForm/math/mathFormula.vue' +======= +import { uploadUrl } from '@/api/DesignForm' +import { UploadFilled } from '@element-plus/icons-vue' +import { UploadFile, UploadFiles } from 'element-plus/es/components/upload/src/upload'; +>>>>>>> liwenxuan_v4 const props = withDefaults( //接收父级参数 defineProps<{ @@ -40,6 +46,7 @@ const mathBoxShow = ref(false) const emits = defineEmits<{ (e: 'openDialog', data: any): void (e: 'update:formOtherData', data: any): void + (e: 'videoMsgChange', data: VideoMsg): void //(e: 'update:formData', data: any): void //(e: 'update:formConfig', data: any): void }>() @@ -196,6 +203,7 @@ const attrList = computed(() => { columnIndex = list[0].type === 'index' } } + const temp =reactive([ { label: '自定义Class', @@ -596,6 +604,64 @@ 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.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_url', + vIf: state.isSearch, + vShow: ['videoUpAndPlay'] + }, + /* { + label: '上传视频封面', + value: config.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_poster', + vIf: state.isSearch, + vShow: ['videoUpAndPlay'] + }, */ + { + label: '视频宽度(像素)', + value: config.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_width', + 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_autoPlay', + vIf: state.isSearch, + vShow: ['videoUpAndPlay'] + }, + { + label: '视频循环播放', + value: config.uploadvideo, + path: 'config.uploadvideo', + type: 'uploadvideo_loopPlay', + vIf: state.isSearch, + vShow: ['videoUpAndPlay'] + }, + + { label: '上传地址', value: control.action, @@ -796,6 +862,7 @@ watch( } } ) + const fileSignAry = reactive([]) const controlChange = (obj: any, val: any) => { // console.log("字段编辑--1--》",obj) @@ -1234,6 +1301,7 @@ const isNotWrite = (val:any) =>{ } return false } +<<<<<<< HEAD const unitInfo = ref() const formListmap = ref() const subUnit = ref() @@ -1288,6 +1356,159 @@ const updataDigit = (key:sring,val:any) => { }) // console.log("默认值处理-5-->",props.formConfig) } +======= + +//liwenxuan 20240108 vidioupload start + +import { VideoMsg } from '@/api/DesignForm/types' +import { genFileId } from 'element-plus' +import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus' + +//更改已上传的视频:el-upload中设置 limit 和 on-exceed 可以在选中时自动替换上一个文件。 +const upload = ref() + +const handleExceed: UploadProps['onExceed'] = (files) => { + upload.value!.clearFiles() + const file = files[0] as UploadRawFile + file.uid = genFileId() + upload.value!.handleStart(file) +} +//每个视频上传控件对应一个videoMsg[videoIndex] +const videoIndex = ref(0); + +//上传成功钩子 +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; +} + +//删除钩子 禁止删除 +function beforeRemove(){ + return false; +} + +//上传失败钩子 +function videoUploadErr(error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles){ + alert("上传失败,请重试") + console.log("上传失败"+error); +} + +//liwenxuan 20240108 vidioupload end + + + + +//liwenxuan 20240111 carousel start + +import { Delete,Plus } from '@element-plus/icons-vue' +import { CarsuselConfig } from '@/api/DesignForm/types' +import errimg from '@/assets/404_images/untilUploadImg.png' +import { v4 as uuidv4 } from "uuid"; + +//轮播图设置弹窗显示控制 +const dialogTableVisible = ref(false) + +//图片展示显示控制 +const showImagePreview = ref(false) + +//最近点击的上传按钮对应的imgId +let currentUploadImgid = ""; + +//刚拖拽视频组件时,初始化imgid监听designForm.activeKey,变化时,如果controlData.value.type=='lowcodeCarsusel',就遍历轮播图数组把imgid=''的都生成uuid +watch(()=>store.activeKey, () => { + if(controlData.value.type==='lowcodeCarsusel'){ + const carsuselConfigData:CarsuselConfig[] = controlData.value.control.carsuselConfigArr + carsuselConfigData.forEach(element => { + //console.log(element) + if(element.imgId==''){ + //console.log("初始化imgid") + let onlyNumber = uuidv4().replaceAll('-','').toString(); //获取唯一编码 + element.imgId = onlyNumber; + } + }); + } +}) +//轮播图图片上传成功钩子 +function carouselImgUploadSuccess(response: any, uploadFile: UploadFile, uploadFiles: UploadFiles){ + const carsuselConfigData:CarsuselConfig[] = controlData.value.control.carsuselConfigArr + carsuselConfigData.forEach(element => { + if(element.imgId==currentUploadImgid){ + element.imgUrl=response.data.url + element.uploadFlag=true + } + }); + +} + +//轮播图所有已上传的图片的url,点击略缩图展示大图用 +const carouselImgUrlList = computed(() => { + const list:string[] = []; + const carsuselConfigData:CarsuselConfig[] = store.controlAttr.control.carsuselConfigArr + carsuselConfigData.forEach(element => { + if(element.uploadFlag===true){ + list.push(element.imgUrl) + } + }); + return list; +}) + +//轮播图设置table +function createRow(clickedRow:any){ + const newRow:CarsuselConfig = { + uploadFlag:false, + imgId:'', + imgSort:1, + imgUrl: '', + link: '' + } + let onlyNumber = uuidv4().replaceAll('-','').toString(); //获取唯一编码 + newRow.imgId = onlyNumber; + const nextSort:number = clickedRow.sort+1; + newRow.imgSort = nextSort; + controlData.value.control.carsuselConfigArr.push(newRow) +} + +function deleteRow(clickedRow:any){ + //alert('删除一行') + const carsuselConfigData:CarsuselConfig[] = controlData.value.control.carsuselConfigArr + for (var i = 0; i < carsuselConfigData.length; i++) { + if(carsuselConfigData[i].imgId===clickedRow.imgId){ + carsuselConfigData.splice(i, 1); + i--; // 如果不减,将漏掉一个元素 + } + } +} + +//关闭大图展示 +const closePreview = () => { + showImagePreview.value = false +} + +//开启大图展示 +const handlePreview = (index: number, row: any) => { + showImagePreview.value = true +} + +const changeCurrentUploadImgid = (clickedRow:any) => { + currentUploadImgid = clickedRow.imgId +} + +//liwenxuan 20240111 carousel end + + + +>>>>>>> liwenxuan_v4