Browse Source

图片

qin_26
liwenxuan 5 months ago
parent
commit
6c5ab4debb
  1. 73
      src/components/DesignForm/public/expand/lowcodeImage.vue

73
src/components/DesignForm/public/expand/lowcodeImage.vue

@ -67,6 +67,7 @@ const value = computed({
get: () => {
if (props.data.control.imgUrl == "") {
return props.modelValue ? props.modelValue : errimg;
//return props.modelValue ? props.modelValue : '';
} else {
return props.data.control.imgUrl;
}
@ -99,22 +100,28 @@ onMounted(()=>{
} */
}else{
if(props.type==2&&hasELCard(ancestors)){
props.data.control.uploadedImgs = completionImageDetails(value.value)
if(props.data.control.useDefaultImg==false&&props.data.control.onSiteShot==""){
toShow.value = true
if(value.value=="/src/assets/404_images/imgNotFound.png"){
}else{
props.data.control.uploadedImgs = completionImageDetails(value.value)
if(props.data.control.useDefaultImg==false&&props.data.control.onSiteShot==""){
toShow.value = true
}
}
}
}
},1000)
},100)
})
function completionImageDetails(urlString:string) {
// URL
const urls = urlString.split(',').map(url => url.trim()).filter(url => url);
//console.log(urls)
if (urls.length === 0) {
/* throw new Error('未提供有效的图片URL'); */
return {}
return {}
}
return urls.map(url => {
@ -131,26 +138,32 @@ function completionImageDetails(urlString:string) {
// 18ID
const randomId = Math.floor(Math.random() * 9e17) + 1e17;
if(url=="/src/assets/404_images/imgNotFound.png"){
return {}
}else{
return {
name: fileName,
percentage: 100,
status: "success",
uid: timestamp,
url: url,
response: {
code: 0,
data: {
id: randomId,
key: "",
name: fileName,
tag: fileExtension,
url: url,
type: 1
},
msg: "成功!"
}
};
}
return {
name: fileName,
percentage: 100,
status: "success",
uid: timestamp,
url: url,
response: {
code: 0,
data: {
id: randomId,
key: "",
name: fileName,
tag: fileExtension,
url: url,
type: 1
},
msg: "成功!"
}
};
});
}
@ -287,7 +300,15 @@ function selectFile(){
</script>
<template>
<img
v-if="props.data.control.useDefaultImg&&props.type==4"
:src="props.modelValue"
class="avatar"
:style="getFormItemInputStyle(configStyle, 2)"
/>
<el-upload
v-if="props.type!=4"
v-bind="$props"
class="upload-demo"
:action="uploadUrl"
@ -403,7 +424,7 @@ function selectFile(){
<el-dialog v-model="dialogVisible">
<el-dialog v-model="dialogVisible" style="width:90%">
<img w-full :src="dialogImageUrl" alt="Preview Image" />
</el-dialog>
</template>

Loading…
Cancel
Save